I played with some meta programming of the C ++ template, and I discovered a situation which, in my opinion, is rather strange. Say I have the following class.
template<typename T>
class Foo{
};
Then later I discovered that I was using the foward declaration for the class (I assume this is what it refers to) as an argument to the template as such
Foo<class bar> bar1;
I also found that the following also compiles.
Foo<class bar()> bar2;
Foo<class bar(int a)> bar3;
So my question is: why does this work. What happens in all three cases.
According to the standard, I cannot declare a class at this point, so this fails:
Foo<class bar{}> bar4
, , ( , , ).
. , : ? - , ++ , . , , .
g++