// boost_bug.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include "boost/foreach.hpp" class Item { }; class TestClass { public: typedef std::vector ItemContainer; long getIndex (const Item* searchItem) const { long index = 0; BOOST_FOREACH (Item* n, *mCollection) { if (searchItem == n) return index; ++index; } return -1; } private: ItemContainer* mCollection; }; int _tmain(int argc, _TCHAR* argv[]) { return 0; }