On Sat, Feb 23, 2013 at 9:38 PM, Niitsuma Hirotaka <hirotaka.niitsuma@gmail.com> wrote:
> Also: remove the ::type from the fold<> expression. Works for me after that
> (and the fix with adding the ::type on the definition of my_max). I would
> think you would've gotten a compiler error at this point but, meh.

Thank you for your advice.
However with gcc 4.6.3,  that cause compiler error.

Sorry, I think I inadvertently fixed a 3rd error in your original post (accessing ::type on the mpl::max invocation) when I copied your code. The following works for me on MSVC9:

--------
#include <boost/mpl/assert.hpp>
#include <boost/mpl/fold.hpp>
#include <boost/mpl/front.hpp>
#include <boost/mpl/integral_c.hpp>
#include <boost/mpl/lambda.hpp>
#include <boost/mpl/max.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/mpl/vector_c.hpp>
#include <boost/type_traits/is_same.hpp>

namespace mpl = boost::mpl;

typedef mpl::lambda<
  mpl::max< mpl::_1, mpl::_2 > >::type my_max;
typedef mpl::fold<
  mpl::vector_c<int,1,7,0,-2,5,-1>
, mpl::int_<6>
, my_max
>::type r2;
BOOST_MPL_ASSERT(( boost::is_same< r2, mpl::integral_c<int, 7> > ));

typedef mpl::lambda<
  mpl::fold<
    mpl::_1
  , mpl::front< mpl::_1 >
  , my_max
  >
>::type my_max_types;

typedef my_max_types::apply<
  mpl::vector_c<int,1,7,0,-2,5,-1> >::type r3;
BOOST_MPL_ASSERT(( boost::is_same< r3, mpl::integral_c<int, 7> > ));
--------

If you can't figure out the reasons your original posting didn't work and you want to know, holler back.

- Jeff