non-type template args and friend declarations

Discussion in 'C++' started by Wolfgang Meyer, Apr 23, 2004.

  1. template<bool constness>
    class X
    {
    public:
    friend class X<!constness>;
    ...
    };


    Is this legal C++?
    g++ doesn't warn with -ansi -predantic. So I suppose it is?
    Wolfgang Meyer, Apr 23, 2004
    #1
    1. Advertising

  2. Wolfgang Meyer wrote in
    news: in comp.lang.c++:

    > template<bool constness>
    > class X
    > {
    > public:
    > friend class X<!constness>;
    > ...
    > };
    >
    >
    > Is this legal C++?
    > g++ doesn't warn with -ansi -predantic. So I suppose it is?
    >


    The mandatory: "No ... is a syntax error" aside, Yes.

    Rob.
    --
    http://www.victim-prime.dsl.pipex.com/
    Rob Williscroft, Apr 24, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ken Varn
    Replies:
    2
    Views:
    624
    Ken Varn
    Jun 22, 2005
  2. Replies:
    3
    Views:
    491
    David Eppstein
    Sep 17, 2003
  3. Hicham Mouline
    Replies:
    1
    Views:
    352
    Vladyslav Lazarenko
    Mar 27, 2009
  4. A L
    Replies:
    1
    Views:
    510
    Alf P. Steinbach /Usenet
    Aug 25, 2010
  5. er
    Replies:
    2
    Views:
    504
Loading...

Share This Page