Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-06-10 22:51:38


----- Original Message -----
From: "Howard Hinnant" <hinnant_at_[hidden]>

> David Abrahams wrote on 6/10/2000 1:07 AM
> >CodeWarrior rejected the test because it seems to instantiate unused
> >operators. I can't tell whether this is a bug in the compiler or in my
code,
> >though.
>
> I'm having trouble accessing www.boost.org this morning so I'm not sure I
> have an up-to-date test. But the first trouble I'm having with your test
> is:
>
> Error : declaration syntax error
> reverse_iterator.hpp line 77 Self& operator+=(difference_type n) {
>
> Don't know if this is the error you're referring to or not (pasting in
> error messages helps immensely).
>
> The error message looks correct to me. difference_type is undefined.
> This error is allowed to be detected even if operator+= is not
> instantiated (14.6/7 and 14.6.3/1). Detecting errors as early as
> possible in templates is a desired quality (we're still trying to improve
> on this ourselves). It is an error because the base class scope is not
> examined during name lookup until the class template is instantiated
> (14.6.2/3).
>
> If this isn't the error you're having trouble with could you please send
> me a complete test and the error message it is causing?

That's funny, I get:

Error : illegal operand
 (instantiating: 'boost::reverse_iterator_policies::advance<std::list<int,
std::allocator<int>>::const_iterator, long>(std::list<int,
std::allocator<int>>::const_iterator &, long)')
reverse_iterator.hpp line 32 { x -= n; }

My current theory about this is that this is that the barton&nackmann trick
employed by operators.hpp causes the global (operator) functions in the base
class to be instantiated regardless of whether they are used or not. Since
these are not template functions or member functions of a class template I
also theorize that the compiler is correct in doing so. I think
wrapped_iterator probably needs to give up on using the operators templates
for that reason.

-Dave

P.S. I've added the relevant files as enclosures, but I think only Howard
will see them because we are blocking them on the mailing list.

[Non-text portions of this message have been removed]


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