휴...ㅠㅠ 너무 어렵네요 STL

assa의 이미지

map<char *, vector<char *>> tmap;

이러면 왜 에러가 나는지...ㅠㅠ

잘 모르겠습니다.

에러로는 ';'이게 미싱됐다고, 자꾸 머라고 하네요..

고수님 부탁드립니다. ㅠㅠ

까막의 이미지

map<char *, vector<char *> > tmap;

이 맞으리라 생각됩니다.
>>는 >> 연산자로 처리되기 때문에...

[/code]

Crow's Maniacal World.
http://crowmania.cafe24.com

Let's be engineers!

assa의 이미지

대단하십니다..

까막의 이미지

템플릿 관련해서 많이 나오는 실수중에 하나랍니다..

typedef std::vector<char*> CharPtrVector;
std::map<char*, CharPtrVector> kk;

이런식으로 typedef을 활용하면 미리 방지할 수 있는 장점이 있지요. :)

Crow's Maniacal World.
http://crowmania.cafe24.com

Let's be engineers!

doldori의 이미지

누구나 한 번쯤은 할 법한 실수입니다. 물론 저도 그랬습니다.

The Design of C++0x

이 아티클에서 BS가 드는 예 중 하나인데, C++ 표준에 대한 그의 영향력을 고려한다면
차기 C++ 표준에서는 >>가 허용될지도 모르겠습니다.

Quote:
To sum up: C++0x must support novices of all backgrounds much
better than does current C++—both through less error-prone language
features and through more supportive libraries.
까막의 이미지

오옷 Lambda에 대한 부분이 눈에 더 들어오네요. ㅎㅎ

Crow's Maniacal World.
http://crowmania.cafe24.com

Let's be engineers!

happyjun의 이미지

까막 wrote:
오옷 Lambda에 대한 부분이 눈에 더 들어오네요. ㅎㅎ

이미 boost.lambda 에 구현된 사항입니다.

다음과 같은 코드가 실행됩니다.

vector<int> v(10);
for_each(v.begin(), v.end(), _1 = 1); // v[0] = 1; v[1] = 1; ....

vector<int*> vp(10); 
transform(v.begin(), v.end(), vp.begin(), &_1); // vp[0]=&(v[0]); vp[1]=&(v[1]); ...

// int foo(int);
for_each(v.begin(), v.end(), _1 = bind(foo, _1)); // v[0] = foo( v[0] ); v[1] = foo( v[1] ); ....

sort(vp.begin(), vp.end(), *_1 > *_2);  // >를 사용한 order functor

for_each(vp.begin(), vp.end(), cout << *_1 << '\n'); // cout << *(vp[0]) << '\n'; ....

_1 은 functor의 첫번째 인자, _2는 두번째 인자를 뜻합니다.

boost.lambda를 사용하지 않으면 다음과 같이 functor를 만들어야 합니다.

for_each(v.begin(), v.end(), _1 = 1);

// lambda를 사용하지 않으면 다음과 같이 작성해야 합니다.

struct MyAssign {
    int c_;
    MyAssign( int c ) : c_(c) {}
    void operator() ( int& v ) { v = c_; }
};

for_each( v.begin(), v.end(), MyAssign(1) );

----------------------------------------
http://moim.at
http://mkhq.co.kr

까막의 이미지

boost.lambda와 boost.bind를 같이쓰다보면 헷갈리지 않나요?
전 이미 boost.bind를 즐겨쓰고 있는 터라... OTL

예제는 잘 보았습니다. 한눈에 쏘옥 들어오네요. 헤헷. :)

ps. boost 한국 사용자 모임 같은게 있으면 참 좋을텐데.. 라는 생각을 해봅니다.

Crow's Maniacal World.
http://crowmania.cafe24.com

Let's be engineers!

jongwooh의 이미지

STL 이 Standard Template Library 이라면
OTL 은 Object Template Library 였던 것인가.. OTL

you must know the power of dark side.

까막의 이미지

Quote:

STL 이 Standard Template Library 이라면
OTL 은 Object Template Library 였던 것인가.. OTL

OTL은 http://otl.sourceforge.net/ 에 실제 존재하는 라이브러리 입니다. :)

OCI/ODBC/DB2 래핑인듯 합니다. :)

Crow's Maniacal World.
http://crowmania.cafe24.com

Let's be engineers!