BRIEF에서 bitset 사용

cpp 2011. 4. 5. 16:24


BRIEF descriptor에서 bitset을 쓰고 있길래, 이걸 숫자로 바꾸는 작업을 했다.


class bitset::reference {
  friend class bitset;
  reference();                                 // no public constructor
public:
  ~reference();
  operator bool () const;                      // convert to bool
  reference& operator= ( bool x );             // assign from bool
  reference& operator= ( const reference& x ); // assign from bit
  reference& flip();                           // flip bit value
  bool operator~() const;                      // return inverse value
}


http://neodreamer.tistory.com/326

bool bFlag = bit.test(3) 
;

 


Posted by 언제나19
l

cpp class variable

cpp 2011. 2. 13. 21:26

cpp에서는 class variable을 쓸 때,
어떤 cpp 파일에
12 int Something::s_nIDGenerator = 1;
를 한 번 더 정의해줘야 하네.


01 class Something
02 {
03 private:
04     static int s_nIDGenerator;
05     int m_nID;
06 public:
07     Something() { m_nID = s_nIDGenerator++; }
08  
09     int GetID() const { return m_nID; }
10 };
11  
12 int Something::s_nIDGenerator = 1;
13  
14 int main()
15 {
16     Something cFirst;
17     Something cSecond;
18     Something cThird;
19  
20     using namespace std;
21     cout << cFirst.GetID() << endl;
22     cout << cSecond.GetID() << endl;
23     cout << cThird.GetID() << endl;
24     return 0;
25 }


http://www.learncpp.com/cpp-tutorial/811-static-member-variables/
Posted by 언제나19
l

mac nm instead of readelf

mac 2010. 10. 3. 21:53

library 안에 어떤 함수가 있는지 알고 싶을 때
nm이나 otools를 쓰면 된단다.

My mistake. OS X doesn't use ELF. You might check this article: 0xfe.blogspot.com/2006/03/how-os-x-executes-applications.html I didn't read it yet, but it may have useful information. – Gilad Naor Mar 5 '09 at 12:58
FYI: On the Mac, you can use nm or otool, as epatel outlines in another answer here. – Craig S Mar 5 '09 at 19:40

http://0xfe.blogspot.com/2006/03/how-os-x-executes-applications.html
Posted by 언제나19
l