我的compiler是gcc 4.7。 多谢
$g++ testAny.cpp -o testAny
testAny.cpp: In function ‘void AnyTesting3()’:
testAny.cpp:66:54: error: no match for ‘operator=’ in ‘myPropertySet.std:
:map<_key _alloc="" _compare="" _tp="">::operator[], boost
::any, std::less >, std::allocatorstd::basic_string, boost::any> > >((* & std::basic_string(((
const char*)"BarrType"), (*(const std::allocator*)(& std::allocator<
char>()))))) = (BarrierType)0u’
testAny.cpp:66:54: note: candidates are:
In file included from testAny.cpp:1:0:
/usr/include/boost/any.hpp:69:15: note: template boost::any
& boost::any::operator=(const ValueType&)
testAny.cpp:66:54: error: template argument for ‘template
boost::any& boost::any::operator=(const ValueType&)’ uses local type ‘
AnyTesting3()::BarrierType’
testAny.cpp:66:54: error: trying to instantiate ‘template> boost::any& boost::any::operator=(const ValueType&)’
In file included from testAny.cpp:1:0:
/usr/include/boost/any.hpp:75:15: note: boost::any& boost::any::operator=(
boost::any)
/usr/include/boost/any.hpp:75:15: note: no known conversion for argument 1
from ‘AnyTesting3()::BarrierType’ to ‘boost::any’
程序:
#include
#include
#include
#include