The standard (1998) states what std::back_insert_iteratoris required Container::const_reference. In "24.4.2.1 Template class back_insert_iterator", [lib.back.insert.iterator], he says:
back_insert_iterator<Container>&
operator=(typename Container::const_reference value);
Standard, 2011 only wants Container::value_type,
back_insert_iterator<Container>&
operator=(const typename Container::value_type& value);
back_insert_iterator<Container>&
operator=(typename Container::value_type&& value);
So, to be compatible with both versions of the C ++ standard, define both value_typeand const_reference_type.
In both GCC 4.4.6 and 4.5.1, the definition is operator=identical to ( libstdc++-v3/include/bits/stl_iterator.h):
back_insert_iterator&
operator=(typename _Container::const_reference __value)
{
container->push_back(__value);
return *this;
}
and I get the same error with both compilers, you might need to double check if you are using the correct version of the compiler.
chill source
share