Topic: with or without typename


Author: bill@gibbons.org (Bill Gibbons)
Date: 1997/12/11
Raw View
In article <348D587F.41C67EA6@pratique.fr>, Valentin Bonnard
<bonnardv@pratique.fr> wrote:

> Stefan Kuhlins wrote:
> >
> > I tested this with Borland and KAI, both complained about 'typename'.
> >
> > 24.3.3  Standard iterator tags                 [lib.std.iterator.tags]
> >
> >  template <class BidirectionalIterator>
> >  inline void
> >   evolve(BidirectionalIterator first, BidirectionalIterator last) {
> >    evolve(first, last,
> >     typenameiterator_traits<BidirectionalIterator>::iterator_category());
> >  }  ^^^^^^^^
>
> This grammatical problem is well-known; typename A<T>::B() isn't
> allowed; some people argue that it's an omission, some disagree
> and say that T*() or short int isn't allowed either. I don't
> know (or don't remember) the result of the decision in Morristown.

This was fixed in Morristown (last month).  The FDIS allows typename
in every place where it is needed.  The particular change that covers
this case is:

  postfix-expression:
     ...
     typename ::[opt] nested-name-specifier template[opt] template-id
              ( expression-list[opt] )


-- Bill Gibbons
   bill@gibbons.org
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]





Author: Stefan Kuhlins <kuhlins@wifo.uni-mannheim.de>
Date: 1997/12/09
Raw View
  I tested this with Borland and KAI, both complained about 'typename'.

  24.3.3  Standard iterator tags                 [lib.std.iterator.tags]

    template <class BidirectionalIterator>
    inline void
     evolve(BidirectionalIterator first, BidirectionalIterator last) {
      evolve(first, last,
       typename iterator_traits<BidirectionalIterator>::iterator_category());
    }  ^^^^^^^^
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]





Author: Valentin Bonnard <bonnardv@pratique.fr>
Date: 1997/12/10
Raw View
Stefan Kuhlins wrote:
>
>   I tested this with Borland and KAI, both complained about 'typename'.
>
>   24.3.3  Standard iterator tags                 [lib.std.iterator.tags]
>
>     template <class BidirectionalIterator>
>     inline void
>      evolve(BidirectionalIterator first, BidirectionalIterator last) {
>       evolve(first, last,
>        typename iterator_traits<BidirectionalIterator>::iterator_category());
>     }  ^^^^^^^^

This grammatical problem is well-known; typename A<T>::B() isn't
allowed; some people argue that it's an omission, some disagree
and say that T*() or short int isn't allowed either. I don't
know (or don't remember) the result of the decision in Morristown.

--

Valentin Bonnard                mailto:bonnardv@pratique.fr
info about C++/a propos du C++: http://www.pratique.fr/~bonnardv/
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]





Author: Oleg Zabluda <zabluda@math.psu.edu>
Date: 1997/12/10
Raw View
Stefan Kuhlins <kuhlins@wifo.uni-mannheim.de> wrote:
:   I tested this with Borland and KAI, both complained about 'typename'.

:   24.3.3  Standard iterator tags                 [lib.std.iterator.tags]

:     template <class BidirectionalIterator>
:     inline void
:      evolve(BidirectionalIterator first, BidirectionalIterator last) {
:       evolve(first, last,
:        typename iterator_traits<BidirectionalIterator>::iterator_category());
:     }  ^^^^^^^^
                                                                           ^^

The "()" after the iterator_category is an error.

Oleg.
--
Life is a sexually transmitted, 100% lethal disease.
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]





Author: "Rose, Seb" <srose@spam_free.dundee.ncr.com>
Date: 1997/12/10
Raw View
    template <class BidirectionalIterator>
    inline void
     evolve(BidirectionalIterator first, BidirectionalIterator last) {
      evolve(first, last,
       typename
iterator_traits<BidirectionalIterator>::iterator_category());
    }  ^^^^^^^^

This compiles fine on VC++5.

I don't think the () is an error... it just constructs a temporary object
of the specified type.

Seb.


--
Remove spam_free from address to reply
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]