Visual Studio 2008 SP1的错误?

时间:2012-08-28 06:41:07

标签: c++ boost visual-studio-2008 compiler-construction

我的代码段如下:

#include <boost/bind.hpp>
#include <boost/lambda/bind.hpp>
......................
...................
size_t MyCalass::MyFunction() const
{
   using boost::lambda::_1;
   using boost::lambda::_2;
   using boost::lambda::bind;

   return std::accumulate(m_memberObj.begin(), m_memberObj.end(),
      size(), (_1 += bind(&MyCalass::GetLength, _2)));
}

这里,当然,boost :: lambda :: bind调用是在函数的最后一行写的。但我得到编译错误。它看起来像这样:

Error   70  error C2784: 'const boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::arithmetic_assignment_action<Action>,boost::tuples::tuple<boost::lambda::lambda_functor<T>,boost::lambda::lambda_functor<Arg>>>> boost::lambda::operator +=(const boost::lambda::lambda_functor<T> &,const boost::lambda::lambda_functor<Arg> &)' : could not deduce template argument for 'const boost::lambda::lambda_functor<T> &' from 'stlp_std::basic_string<_CharT,_Traits,_Alloc>::size_type'   z:\3rdParty\boost_1_41_0_patched\boost\lambda\detail\operator_lambda_func_base.hpp  225

当我改变我的代码时:

#include <boost/bind.hpp>
#include <boost/lambda/bind.hpp>
......................
...................
size_t MyCalass::MyFunction() const
{
   using boost::lambda::_1;
   using boost::lambda::_2;
   using boost::lambda::bind;

   return std::accumulate(m_memberObj.begin(), m_memberObj.end(),
      size(), (_1 += boost::lambda::bind(&MyCalass::GetLength, _2)));
}

它正确编译。

这是编译器错误吗?是否有补丁?

0 个答案:

没有答案