Tuesday, September 13, 2011

C++0x extended friend syntax

While reading gcc 4.7 Changes, New Features, and Fixes list

[..]
- G++ now implements C++0x extended friend syntax:
    template
    class Q
    {
      static const int I = 2;
    public:
      friend W;
    };

    struct B
    {
      int ar[Q<B>::I];
    };
 [..]


Yeah, that's possibly cool to skip class key for friend declaration...
But wait... really...

int ar[Q<B>::I];

how is that klingon supposed to be readable in anyway?


int ar[Q<T,M>::I & 255 + X<B<C>>::I << 2];


No comments:

Post a Comment