Boost logo

Boost :

Subject: [boost] Basic boost::mpl::max_element question.
From: Yves Dolce (yves.dolce_at_[hidden])
Date: 2011-09-01 22:40:27


Hi everyone,

 

Once past the basic understanding of C++ metaprogramming (factorial,
vector/typeslist, .), I must confess I have a hard time using max_element in
my particular scenario. And I have not found a lot of samples on the net.

 

Consider this "repro" first:

 

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!

 

An MPL/FUSION beginner. J

 


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk