Boost logo

Boost :

From: Joerg Walter (jhr.walter_at_[hidden])
Date: 2002-08-23 06:15:41


Gabriel Dos Reis wrote:

> Some days ago, someone was wondering on this list (sorry, I can't find
> the message off hand)

I believe you mean Peter Schmitteckert, who wrote:

<cite>
Dear all,

ibm xlC visual age 6.0 complains on following typedefs in ublas:

        typedef reverse_iterator1<iterator1> reverse_iterator1;
        typedef reverse_iterator2<const_iterator2> const_reverse_iterator2;

"/.../boost/numeric/ublas/hermitian.hpp", line 364.46: 1540-0416 (S)
 "reverse_iterator1" cannot be declared because its name has already been
used.

Is xlC v6.0 correct, or are these typedefs allowed?

Thanks in advance,
best wishes,
Peter
</cite>

> whether the following construct
>
> typedef reverse_iterator<T> reverse_iterator;
>
> were valid or not and reported that one of his compiler rejected it.
>
> His compiler was right; somewhere, the standard says
>
> 3.3/4
> Given a set of declarations in a single declarative region, each of
> which specifies the same unqualified name,
>
> --- they shall all refer to the same entity, or all refer to
> functions and function templates; or
>
> --- exactly one declaration shall declare a class name or
> enumeration name that is not a typedef name and the other
> declarations shall all refer to the same object or
> enumerator, or all refer to functions and func-tion
> templates; in this case the class name or enumeration name is
> hidden (3.3.7). [Note: a namespace name or a class template
> name must be unique in its declarative region (7.3.2, clause
> 14). ]
>
> Hope that helps,

Yes. If I understand that correctly, than we'll either have to change the
typedefs from

        typedef reverse_iterator1<iterator1> reverse_iterator1;

to

        typedef boost::numeric::ublas::reverse_iterator1<iterator1>
reverse_iterator1;

(ugly) or to rename the referenced reverse_iterator1 class to get something
like

        typedef reverse_iterator1_base<iterator1> reverse_iterator1;

(also ugly ;-)

BTW, the IBM compiler is the first of a couple of compilers to complain
about this.

Thanks for your help

Joerg


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