I have a question about the following code:
typedef void(intArrayParamFunc)(int[]);
typedef void(intPtrParamFunc)(int*);
BOOST_STATIC_ASSERT((boost::is_same<intArrayParamFunc,intPtrParamFunc>::value));
BOOST_STATIC_ASSERT((boost::is_same<int*,int[]>::value));
cout << typeid(intArrayParamFunc).name() << endl;
cout << typeid(intPtrParamFunc).name() << endl;
cout << typeid(int*).name() << endl;
cout << typeid(int[]).name() << endl;
The first assert compiles but the second fails, which means that boost::is_same<> thinks that int* and int[] are different, but void(int[]) and void(int*) are the same. Why is this?
The typeids print out the following:
void __cdecl(int * const)
void __cdecl(int *)
int *
int [0]
I'm using Visual Studio 2008. I notice that typeid tells me that intArrayParamFunc is void(int* const). So why does boost::is_same<> compare them equal? Surely void(int* const) should not be the same type as void(int*). Unless this is just some obscure language subtlety I'm not aware of. So is this a bug in boost::is_same<>, a bug in my compiler, or no bugs at all and everything is working perfectly?