AMDG vasyl_y wrote:
I started learn mpl and here we go... I have an mpl::vector of compund types and i want to find an element in vector based on property of compound type and cannot find the way to do it, any suggestions?
Here is an example how i'm trying to do it:
#include
#include #include namespace mpl = boost::mpl;
template
struct Type2IdLink { typedef T value_type; typedef mpl::int_<id> type_id; }; typedef Type2IdLink
v1; typedef Type2IdLink v2; typedef Type2IdLink v3; typedef mpl::vector
types; // This work typedef mpl::find_if >::type iter; // This does not work: // value_type is not a member of mpl_::_1 typedef mpl::find_if >::type iter;
You need to use a metafunction, since mpl::_1 has no member named
value_type.
template<class T>
struct value_type {
typedef typename T::value_type type;
};
typedef mpl::find_if
::type iter;
In Christ, Steven Watanabe