Skip to content

Instantly share code, notes, and snippets.

@euler0
Created November 23, 2011 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save euler0/1388021 to your computer and use it in GitHub Desktop.
Save euler0/1388021 to your computer and use it in GitHub Desktop.
N2657: Local and Unnamed Types as Template Arguments (C++11)
template <class T> class X { };
template <class T> void f(T t) { }
struct {} unnamed_obj;
void f()
{
struct A { };
enum { e1 };
typedef struct {} B;
B b;
X<A> x1; // OK
X<A*> x2; // OK
X<B> x3; // OK
f(e1); // OK
f(unnamed_obj); // OK
f(b); // OK
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment