Boost logo

Boost :

From: Gabriel Dos Reis (Gabriel.Dos-Reis_at_[hidden])
Date: 2001-10-30 11:11:32


"Peter Dimov" <pdimov_at_[hidden]> writes:

| From: "Gabriel Dos Reis" <Gabriel.Dos-Reis_at_[hidden]>
| > "Peter Dimov" <pdimov_at_[hidden]> writes:
| >
| > | This state of affairs makes sense to me, since if we adopt the other
| > | alternative, that f<int> is allowed, parsing the construct:
| > |
| > | identifier '<' expression
| > |
| > | would be much more complicated. Exactly how complicated I don't know.
| :-)
| >
| > Exactly in *which ways* do you think it will make parsing much more
| > complicated?
|
| Sorry, I'm not a compiler expert.
|
| My line of thought was:
|
| namespace N1
| {
| struct A {};
| template<class T> void f(T t);
| }
|
| namespace N2
| {
| struct A {};
| template<int I> void f(A);
| }
|
| namespace N3
| {
| struct A {};
| template<void * p> void f(A);
| }
|
| int main()
| {
| using ?::A;
| f<expression>(A());

This instance of "parsing problem" is a already present in codes like

  namespace N
  {
     template<typename T, typename U> void f(T, U);

     struct X { };
  }

  namespace M
  {
    struct A { };
    
    template<typename> sruct Y;

    template<typename T> void f(Y<T>*, A);

    void f(int, double);
    template<typename T>
    struct Y {
       void g()
       {
          using N::f;
          T t;
          f(this, t);
          f< Y<T>*, T >(this, t);
       }
    }
  }

I don't think requiring Koenig lookup for tempate-id will make parsing
of C++ programs much more complicated. What is required is just the
*syntactic* form of a function call.

-- Gaby
CodeSourcery, LLC http://www.codesourcery.com


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