
Hello boost-users, I know, BOOST_FOREACH is not distributed with boost, but I don't know where else should I write about it so I decided to post it here. BOOST_FOREACH is not compiling under VC 7.0 Here I've wrote small example that represents problem: ----------------------- #include <iostream> #include <list> #include <boost/foreach.hpp> using std::list; class BNamespace { public: list<int> contents; int Find(int what) const; }; inline int BNamespace::Find(int what) const { BOOST_FOREACH (int i, this->contents) //BOOST_FOREACH (const int& i, this->contents) // will fail too if (i==what) return i; return 0; } int main() { BNamespace lst; lst.contents.push_back(4); lst.contents.push_back(5); lst.contents.push_back(6); int i=lst.Find(6); std::cout<<i<<std::endl; return 0; } ----------------------- Compilation of this code on VC 7.0 leads to following errors: a.cpp(15) : error C2667: 'boost::for_each::wrap' : none of 2 overloads have a best conversion f:\Libs\boost\boost\foreach.hpp(138): could be 'boost::for_each::container<T,boost::mpl::true_> boost::for_ each::wrap(const T &)' f:\Libs\boost\boost\foreach.hpp(132): or 'boost::for_each::container<T,boost::mpl::false_> boost::for _each::wrap(T &)' while trying to match the argument list '(const std::list<_Ty,_Ax>)' with [ _Ty=int, _Ax=std::allocator<int> ] a.cpp(15) : error C2668: 'boost::for_each::wrap' : ambiguous call to overloaded function f:\Libs\boost\boost\foreach.hpp(138): could be 'boost::for_each::container<T,boost::mpl::true_> boost::for_ each::wrap(const T &)' f:\Libs\boost\boost\foreach.hpp(132): or 'boost::for_each::container<T,boost::mpl::false_> boost::for _each::wrap(T &)' while trying to match the argument list '(const std::list<_Ty,_Ax>)' with [ _Ty=int, _Ax=std::allocator<int> ] ----------------------- I've tried to compile same code with MinGW and it succeded. Can anyone help me with this problem? Thanks! -- Best regards, Yaroslav mailto:yaroslav@enkord.com