[ create a new paste ] login | about

Link: http://codepad.org/qIiKsw4l    [ raw code | output | fork ]

C++, pasted on Nov 28:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <vector>


template<typename A>
struct AClass {};

#define specialize_AClass(X)\
template<> struct AClass<X> { X a; };


specialize_AClass(int) //ok

specialize_AClass(std::vector<int,std::allocator<int> >) //error

int main()
{
   return 0;
}


Output:
1
2
3
Line 55: error: macro "specialize_AClass" passed 2 arguments, but takes just 1
Line 15: error: expected constructor, destructor, or type conversion before 'int'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: