|
Boost : |
From: Craigp (craigp_at_[hidden])
Date: 2003-08-25 00:27:54
I tried the following example (taken from
http://boost.org/libs/lambda/doc/ar01s05.html#sect:construction_and_destruction) ,
and it failed to compile:
std::vector<int> x(10);
std::vector<int> y(10);
std::vector<std::pair<int, int> > pairs;
std::transform(x.begin(), x.end(), y.begin(), std::back_inserter(pairs),
boost::bind(boost::lambda::constructor<std::pair<int, int> >(), _1,
_2));
Compiling...
main.cpp
c:\dev\boost-1.30.2\boost\bind.hpp(60) : error C2039: 'result_type' : is not
a member of 'boost::lambda::constructor<T>'
with
[
T=std::pair<int,int>
]
c:\dev\boost-1.30.2\boost\bind\bind_template.hpp(16) : see reference
to class template instantiation 'boost::_bi::result_traits<R,F>' being
compiled
with
[
R=boost::_bi::unspecified,
F=boost::lambda::constructor<std::pair<int,int>>
]
c:\dev\projects\boost\main.cpp(67) : see reference to class template
instantiation 'boost::_bi::bind_t<R,F,L>' being compiled
with
[
R=boost::_bi::unspecified,
F=boost::lambda::constructor<std::pair<int,int>>,
L=boost::_bi::list2<boost::_bi::list_av_2<boost::arg<1>,boost::arg<2>>::B1,b
oost::_bi::list_av_2<boost::arg<1>,boost::arg<2>>::B2>
]
c:\dev\boost-1.30.2\boost\bind.hpp(60) : error C2146: syntax error : missing
';' before identifier 'type'
c:\dev\boost-1.30.2\boost\bind.hpp(60) : error C2955: 'boost::_bi::type' :
use of class template requires template argument list
c:\dev\boost-1.30.2\boost\bind.hpp(92) : see declaration of
'boost::_bi::type'
c:\dev\boost-1.30.2\boost\bind.hpp(60) : fatal error C1903: unable to
recover from previous error(s); stopping compilation
---- In boost/lambda/construct.hpp, I added the following line, and it worked: template<class T> struct constructor { template <class U> struct sig { typedef T type; }; + typedef T result_type; T operator()() const { return T(); } ... HTH, --craig
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk