I have one more suggestion, how to deal with such problems. If the code compiles but does not do what you want it is somewhat difficult to understand where the error is. I find the debugging ablity of MSVC extremely useful. Even using the free edition one can instanciate the produced type and see in the watch window of which type the instantiated object is. In this case it woule be obvious that the type is mpl::insert<Constraints, mpl::end<Constraints>, Base> and not the type to which compile time insert<...>::type member would expand. I understand there are other tools and possibilities like static assertions etc. which do the trick, but this one is visual... Best Regards, Ovanes P.S. would be great to have smth. like a C++ Metaprogramm Debugger ;) -----Original Message----- From: Ovanes Markarian [mailto:om_boost@keywallet.com] Sent: Mittwoch, 28. März 2007 23:34 To: boost-users@lists.boost.org Subject: Re: [Boost-users] [mpl] insert not inserting? I think the problem is in the typedef statement below: typedef mpl::insert<Constraints, mpl::end<Constraints>, Base> BaseClasses; mpl::insert is an own type but you need the new sequence type with is accessed via: mpl::insert<...>::type Best Regards, Ovanes -----Original Message----- From: Scott Meyers [mailto:usenet@aristeia.com] Sent: Donnerstag, 29. März 2007 00:28 To: boost-users@lists.boost.org Subject: [Boost-users] [mpl] insert not inserting? In my continuing effort to demonstrate my inability to get much of anything working with the MPL, I'm having trouble inserting a type into an existing set of types. The code compiles and runs, but the revised type sequence is empty. Here's the code: #include <boost/mpl/set.hpp> #include <boost/mpl/for_each.hpp> #include <typeinfo> #include <iostream> namespace mpl = boost::mpl; struct Base { virtual ~Base(){} }; struct A { virtual ~A(){} }; struct B { virtual ~B(){} }; struct Print { template<typename T> void operator()(const T&) { std::cout << typeid(T).name() << ", "; } }; int main() { typedef mpl::set<A, B> Constraints; // print contents of Constraints (should be the equivalent // of "[A, B,]") std::cout << '['; mpl::for_each<Constraints>(Print()); std::cout << "]\n"; // add Base to Constraints, call result BaseClasses typedef mpl::insert<Constraints, mpl::end<Constraints>, Base> BaseClasses; // print contents of BaseClasses (should be the equivalent // of "[A, B, Base, ]") std::cout << '['; mpl::for_each<BaseClasses>(Print()); std::cout << "]\n"; } Can anybody spot what I'm doing wrong? I know that I could use the two-argument form of insert with a set, but I'm trying to write code that will work with a vector, too, and at any rate, I get the same results with the two-argument form of set. Thanks, Scott _______________________________________________ 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