Boost logo

Boost :

From: rogeeff (rogeeff_at_[hidden])
Date: 2002-02-11 20:33:48


--- In boost_at_y..., "David Abrahams" <david.abrahams_at_r...> wrote:
> Support requests 101: always include a description of the problem
you're
> experiencing.
> "It doesn't work" is not sufficiently specific to allow anyone to
help you.
>

I intentionally did not include compilation error, since it could be
misdirecting. Well here an error prodused by MSVC with STLPort:

....\stlport-4.5\stlport\stl\_algobase.h(111) : error C2679:
binary '=' : no operator defined which takes a right-hand operand of
type 'const class _STL::basic_string<char,class
_STL::char_traits<char>,class _STL::allocator<char> > *' (or
there is no acceptable conversion)
.....\stlport-4.5\stlport\stl\_algobase.h(210) : see reference to
function template instantiation 'class _STL::ostream_iterator<class
_STL::basic_string<char,class _STL::char_traits<char>,class
_STL::allocator<char> >,char,class _ST
L::char_traits<char> > __cdecl _STL::__copy(struct
boost::iterator_adaptor<struct _STL::_List_iterator<struct
personnel_record,struct _STL::_Nonconst_traits<struct
personnel_record> >,struct boost::projection_iterator_policies<class
_STL::pointer_to
_unary_function<struct personnel_record const &,class
_STL::basic_string<char,class _STL::char_traits<char>,class
_STL::allocator<char> > const &> >,class
_STL::basic_string<char,class _STL::char_traits<char>,class
_STL::allocator<char> > const &,cl
ass _STL::basic_string<char,class _STL::char_traits<char>,class
_STL::allocator<char> > const * &,class _STL::basic_string<char,class
_STL::char_traits<char>,class _STL::allocator<char> > const *
*,struct boost::detail::default_argument,struct boost
::detail::default_argument>,struct boost::iterator_adaptor<struct
_STL::_List_iterator<struct personnel_record,struct
_STL::_Nonconst_traits<struct personnel_record> >,struct
boost::projection_iterator_policies<class
_STL::pointer_to_unary_function<
struct personnel_record const &,class _STL::basic_string<char,class
_STL::char_traits<char>,class _STL::allocator<char> > const &>
>,class _STL::basic_string<char,class _STL::char_traits<char>,class
_STL::allocator<char> > const &,class _STL::basic_
string<char,class _STL::char_traits<char>,class _STL::allocator<char>
> const * &,class _STL::basic_string<char,class
_STL::char_traits<char>,class _STL::allocator<char> > const *
*,struct boost::detail::default_argument,struct boost::detail::defaul
t_argument>,class _STL::ostream_iterator<class
_STL::basic_string<char,class _STL::char_traits<char>,class
_STL::allocator<char> >,char,class _STL::char_traits<char> >,const
struct _STL::input_iterator_tag &,int *)' being compiled

///////////////////////////////////////////////////////////////////
// From STL Port implementation:

template <class _InputIter, class _OutputIter, class _Distance>
inline _OutputIter __copy(_InputIter __first, _InputIter __last,
                          _OutputIter __result,
                          const input_iterator_tag &, _Distance*) {
  for ( ; __first != __last; ++__result, ++__first)
error is here -> *__result = *__first;
  return __result;
}

//////////////////////////////////////////////////////////////////

This error basicly means that iterator_aadaptor for some (magic)
resons deduced that resulting value type is std::string const* while
it should be std::string const.
  Other compilers give me other errors. It seems that the root
problem is that pointer_to_unary function incorrectly define
result_type. While all others functors that returns reference (like
identity, select1st,select2nd ) define result_type as T if operator()
returns T const&, pointer_to_unary_function automatically propogate
result type inherited from its argument, i.e. result_type is defined
like T const&. Could we use transforming type_traits here and define
more smart ptr_fun or I just missing something?

Gennadiy.


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