try push_back<_1, deref > >.
i.e. don't use ::type in an MPL Lambda expression.
That doesn't work either. Below is a full code example as I think it should
be from your feedback (I have tried in GCC and MSVC2010):
#include
#include
#include
#include
#include
#include
#include
#include <iostream>
#include <typeinfo>
using namespace boost::mpl;
using namespace boost::mpl::placeholders;
typedef vector, int_<3>, int_<2> > v1;
// I want to use max_element on a vector I am in the process of
constructing using a fold
typedef fold >, push_back<_1, deref > >
::type v2;
struct print_value
{
template <typename data_tpt>
void operator()(data_tpt p)
{
//Uncommenting this is what I would like but fails to compile
//std::cerr << "value: " << data_tpt::value << std::endl;
std::cerr << "value: " << typeid(p).name() << std::endl;
}
};
int main()
{
for_each(print_value());
return 0;
}
This produces a compile error in MSVC 2010 and compiles on GCC but produces
bad results:
value: N4mpl_4int_ILi0EEE
value:
N5boost3mpl5derefINS0_11max_elementIN4mpl_3argILi1EEENS0_4lessINS4_ILin1EEES7_EEEEEE
value:
N5boost3mpl5derefINS0_11max_elementIN4mpl_3argILi1EEENS0_4lessINS4_ILin1EEES7_EEEEEE
value:
N5boost3mpl5derefINS0_11max_elementIN4mpl_3argILi1EEENS0_4lessINS4_ILin1EEES7_EEEEEE
I expect all to be similar to: N4mpl_4int_ILi0EEE