Hello,
The following program does compile fine on a conformant compiler:
#include
#include
#include
#include
using namespace boost;
using namespace boost::mpl;
template<typename T>
struct foo
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,foo,(T))
};
template<typename T>
struct bar
{
typedef T type;
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,bar,(T))
};
typedef apply1,int>::type t1;
typedef apply1,int>::type t2;
BOOST_MPL_ASSERT((is_same));
BOOST_MPL_ASSERT((is_same));
int main(){return 0;}
Note that foo<_1> applied to int resolves to foo<int> whereas bar<_1>
resolves to int, which is correct because the former class does not
have a nested ::type while the latter does. This is documented in the
MPL
reference at:
http://www.boost.org/libs/mpl/doc/refmanual/quote.html
Now, if I compile the same program with a defective compiler (MSVC 6.0)
not supporting PTS, I've got the following:
...\boost\boost\mpl\aux_\preprocessed\msvc60\apply_wrap.hpp(77) :
error C2039: 'type' : is not a member of 'result_<int>'
...\boost\mpl\aux_\preprocessed\msvc60\bind.hpp(184) : see
reference to class
template instantiation 'boost::mpl::apply_wrap1' being
compiled
whereas the code associated with bar<> works OK. So, it seems like
BOOST_MPL_AUX_LAMBDA_SUPPORT does not provide lambda
support for classes without nested ::type:
1. Is this so by design and/or documented somewhere?
2. If not, could it be fixed?
Thank you,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo