#include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace mpl = boost::mpl; using namespace mpl::placeholders; enum colors { red, blue, green, yellow }; template struct TestClass { typedef COLORTYPES colortypes; }; template struct colortypes { typedef T::colortypes type; }; void func() { // come up with a interface to simplify this like vector_c - only it must be able to handle enums - I would think one would already exist typedef mpl::vector< mpl::integral_c , mpl::integral_c , mpl::integral_c > colorcoll1; typedef mpl::vector< mpl::integral_c , mpl::integral_c > colorcoll2; typedef mpl::vector< mpl::integral_c > colorcoll3; typedef mpl::vector< TestClass , TestClass, TestClass > testvector; std::cout << " SIZE IS " << mpl::size::value << std::endl; // would like to make a new vector from testvector that contains only //those types that have green in their nested vector colortypes. In //other words, go from testvector which has three types to a vector //that only has TestClass and TestClass typedef mpl::copy_if< testvector , mpl::contains< colortypes , integral_c > >::type testvectorwithgreen; // I can do it successfully when operating directly on the //container as below, but am having trouble deterimining the //predicate for the above case typedef mpl::vector_c intColl; std::cout << mpl::size::value << std::endl; typedef mpl::copy_if > >::type newIntColl; std::cout << mpl::size::value << std::endl; } int main() { func(); return 0; }