
On Thu, Sep 1, 2011 at 7:40 PM, Yves Dolce <yves.dolce@live.com> wrote: [...]
template <unsigned char L>
struct Level {
static const unsigned char value = L;
};
template <class LEVEL>
struct CTA {
typedef LEVEL Level_t;
};
typedef boost::fusion::vector<CTA1, CTA2, CTA3, CTA4> CTAS;
Now, using max_element, I'd like to pick the one CTAn for which CTn::Level_t::value is the biggest. Can you enlighten me? Thanks!
I presume each CTAn is an instantiation of CTA, in which case *I think* something like template< class T > struct Get_Level_t { typedef typename T::Level_t type; }; // ... boost::mpl::max_element< CTAS, boost::mpl::less< Get_Level_t< boost::mpl::_1 >, Get_Level_t< boost::mpl::_2 > >
::type
would get you an iterator into CTAS pointing to the CTAn the largest Level_t::value. (WARNING: I haven't actually tried this code.) HTH, - Jeff