Boost logo

Boost :

From: Eyal Farago (eyal.farago_at_[hidden])
Date: 2004-02-01 08:06:08


hi, I'm trying to use mpl lambda on vc.6.5, it seems that for some reason when applying lambda on the expression the compiler tries to instantiate the wrong specialisation(the one with the boost::mpl::arg<1> as a template parameter.

this is the test program:

#include <boost/mpl/lambda.hpp>
#include <boost/tuple/tuple.hpp>

template< class T_ >
struct head_type
{
        typedef typename T_::head_type type;
        BOOST_MPL_AUX_LAMBDA_SUPPORT( 1, head_type, ( T_ ) );
};

void main()
{
        typedef boost::tuples::tuple< int > int_tuple_t;
        typedef head_type< int_tuple_t >::type head_of_int_tuple_t;

        typedef head_type< boost::mpl::_1 > exp_t;
        typedef boost::mpl::lambda< exp_t >::type exp_lambda_t; //this line causes the compilation error
        typedef boost::mpl::apply1< exp_lambda_t, int_tuple_t >::type int_tuple_head_type;
}

and this is the compiler's output:

--------------------Configuration: boost_tests - Win32 Debug--------------------
Compiling...
main.cpp
C:\c++\boost_tests\main.cpp(7) : error C2039: 'head_type' : is not a member of 'arg<1>'
        c:\c++\boost_1_30_0\boost\mpl\aux_\preprocessed\msvc60\arg.hpp(28) : see declaration of 'arg<1>'
        c:\c++\boost_1_30_0\boost\type_traits\is_convertible.hpp(64) : see reference to class template instantiation 'head_type<struct boost::mpl::arg<1> >' being compiled
        c:\c++\boost_1_30_0\boost\type_traits\is_convertible.hpp(80) : see reference to class template instantiation 'boost::detail::does_conversion_exist<struct head_type<struct boost::mpl::arg<1> > &>::result_<struct boost::detail::int_convertible
>' being compiled
        c:\c++\boost_1_30_0\boost\type_traits\is_convertible.hpp(184) : see reference to class template instantiation 'boost::detail::is_convertible_basic_impl<struct head_type<struct boost::mpl::arg<1> > &,struct boost::detail::int_convertible>' be
ing compiled
        c:\c++\boost_1_30_0\boost\type_traits\is_convertible.hpp(239) : see reference to class template instantiation 'boost::detail::is_convertible_impl<struct head_type<struct boost::mpl::arg<1> > &,struct boost::detail::int_convertible>' being co
mpiled
        c:\c++\boost_1_30_0\boost\type_traits\is_enum.hpp(54) : see reference to class template instantiation 'boost::is_convertible<struct head_type<struct boost::mpl::arg<1> > &,struct boost::detail::int_convertible>' being compiled
        c:\c++\boost_1_30_0\boost\type_traits\is_enum.hpp(91) : see reference to class template instantiation 'boost::detail::is_enum_helper<0>::type<struct head_type<struct boost::mpl::arg<1> > &>' being compiled
        c:\c++\boost_1_30_0\boost\type_traits\is_enum.hpp(108) : see reference to class template instantiation 'boost::detail::is_enum_impl<struct head_type<struct boost::mpl::arg<1> > >' being compiled
        c:\c++\boost_1_30_0\boost\type_traits\is_scalar.hpp(30) : see reference to class template instantiation 'boost::is_enum<struct head_type<struct boost::mpl::arg<1> > >' being compiled
        c:\c++\boost_1_30_0\boost\type_traits\is_scalar.hpp(50) : see reference to class template instantiation 'boost::detail::is_scalar_impl<struct head_type<struct boost::mpl::arg<1> > >' being compiled
        c:\c++\boost_1_30_0\boost\type_traits\is_class.hpp(78) : see reference to class template instantiation 'boost::is_scalar<struct head_type<struct boost::mpl::arg<1> > >' being compiled
        c:\c++\boost_1_30_0\boost\type_traits\is_class.hpp(93) : see reference to class template instantiation 'boost::detail::is_class_impl<struct head_type<struct boost::mpl::arg<1> > >' being compiled
        c:\c++\boost_1_30_0\boost\mpl\aux_\has_rebind.hpp(32) : see reference to class template instantiation 'boost::is_class<struct head_type<struct boost::mpl::arg<1> > >' being compiled
        c:\c++\boost_1_30_0\boost\mpl\aux_\preprocessed\msvc60\template_arity.hpp(27) : see reference to class template instantiation 'boost::mpl::aux::has_rebind<struct head_type<struct boost::mpl::arg<1> > >' being compiled
        c:\c++\boost_1_30_0\boost\mpl\aux_\preprocessed\msvc60\lambda_no_ctps.hpp(150) : see reference to class template instantiation 'boost::mpl::aux::template_arity<struct head_type<struct boost::mpl::arg<1> > >' being compiled
        C:\c++\boost_tests\main.cpp(17) : see reference to class template instantiation 'boost::mpl::lambda<struct head_type<struct boost::mpl::arg<1> >,1>' being compiled
Error executing cl.exe.

boost_tests.exe - 1 error(s), 0 warning(s)

eyal.


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