Thanks, I tried it but seems like my compiler (MSVC 7.1) doesn't eat it. The error messages are: c:\boost\boost\mpl\aux_\preprocessed\plain\apply_wrap.hpp(38) : error C2903: 'apply' : symbol is neither a class template nor a function template c:\boost\boost\mpl\aux_\preprocessed\plain\apply.hpp(43) : see reference to class template instantiation 'boost::mpl::apply_wrap1<F,T1>' being compiled with [ F=boost::mpl::lambda<boost::is_same<boost::mpl::at_c<boost::mpl::_1,1>,int>>::type, T1=boost::mpl::deref<boost::mpl::aux::iter_fold_if_null_step<boost::mpl::iter_fold_if<mat,void,boost::mpl::arg<1>,boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::is_same<boost::mpl::at_c<boost::mpl::_1,1>,int>>>>::first_,void>::iterator>::type ] c:\boost\boost\mpl\aux_\iter_apply.hpp(28) : see reference to class template instantiation 'boost::mpl::apply1<F,T1>' being compiled with [ F=boost::is_same<boost::mpl::at_c<boost::mpl::_1,1>,int>, T1=boost::mpl::deref<boost::mpl::aux::iter_fold_if_null_step<boost::mpl::iter_fold_if<mat,void,boost::mpl::arg<1>,boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::is_same<boost::mpl::at_c<boost::mpl::_1,1>,int>>>>::first_,void>::iterator>::type ] c:\boost\boost\mpl\not.hpp(41) : see reference to class template instantiation 'boost::mpl::aux::iter_apply1<F,Iterator>' being compiled with [ F=boost::is_same<boost::mpl::at_c<boost::mpl::_1,1>,int>, Iterator=boost::mpl::aux::iter_fold_if_null_step<boost::mpl::iter_fold_if<mat,void,boost::mpl::arg<1>,boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::is_same<boost::mpl::at_c<boost::mpl::_1,1>,int>>>>::first_,void>::iterator ] c:\boost\boost\mpl\aux_\preprocessed\plain\and.hpp(25) : see reference to class template instantiation 'boost::mpl::not_<T>' being compiled with [ T=boost::mpl::aux::iter_apply1<boost::is_same<boost::mpl::at_c<boost::mpl::_1,1>,int>,boost::mpl::aux::iter_fold_if_null_step<boost::mpl::iter_fold_if<mat,void,boost::mpl::arg<1>,boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::is_same<boost::mpl::at_c<boost::mpl::_1,1>,int>>>>::first_,void>::iterator> ] c:\boost\boost\mpl\aux_\preprocessed\plain\and.hpp(55) : see reference to class template instantiation 'boost::mpl::aux::and_impl<C_,T1,T2,T3,T4>' being compiled with [ C_=true, T1=boost::mpl::apply1<boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::is_same<boost::mpl::at_c<boost::mpl::_1,1>,int>>>,boost::mpl::aux::iter_fold_if_null_step<boost::mpl::iter_fold_if<mat,void,boost::mpl::arg<1>,boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::is_same<boost::mpl::at_c<boost::mpl::_1,1>,int>>>>::first_,void>::iterator>, T2=boost::mpl::true_, T3=boost::mpl::true_, T4=boost::mpl::true_ ] [snip] The code looks like this: #include "boost/mpl/vector.hpp" #include <boost/mpl/find_if.hpp> #include <boost/mpl/at.hpp> using namespace std; using namespace boost; typedef mpl::vector<char, char> vec_1; typedef mpl::vector<char, int> vec_2; typedef mpl::vector<vec_1, vec_2> mat; //typedef mpl::find_if<mat, is_same<mpl::_1, int> >::type iter; typedef mpl::find_if<mat, is_same<mpl::at_c<mpl::_1,1>, int> >::type iter; int _tmain(int argc, _TCHAR* argv[]) { BOOST_STATIC_ASSERT(( is_same< mpl::deref<iter>::type, vec_2 >::value )); return 0; } Regards, Christian On 3/22/07, Chris Weed <chrisweed@gmail.com> wrote:
On 3/22/07, Christian Henning <chhenning@gmail.com> wrote:
Thanks Chris for the quick response. I was trying find_if but I don't think it provides the whole solution. Below is the minimal example, that doesn't compile since the static assertion fires.
#include "boost/mpl/vector.hpp" #include <boost/mpl/find_if.hpp>
using namespace std; using namespace boost;
typedef mpl::vector<char, char> vec_1; typedef mpl::vector<char, int> vec_2;
typedef mpl::vector<vec_1, vec_2> mat;
I would think you need to use mpl::at_c here. I haven't test this, but how about:
typedef mpl::find_if<mat, is_same<mpl::at_c<mpl::_1,1>, int> >::type iter;
int _tmain(int argc, _TCHAR* argv[]) { BOOST_STATIC_ASSERT(( is_same< mpl::deref<iter>::type, vec_2 >::value ));
return 0; }
Do you know what I'm missing here?
Christian _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users