0

Possible Duplicate:
Is it possible to write c++ template/macros to check whether two functions have the same signatures

Is it possible to write c++ template/macros to check whether two member functions have the same signatures (return type and arguments list) in compile time ?

I want something like this:

CHECK_SIGNATURES(Foo, foo, Bar, bar);

Compilation fails if Foo::foo and Bar::bar functions have deifferent return types or parameters list.

Community
  • 1
  • 1
sergeyz
  • 1,308
  • 2
  • 14
  • 23

1 Answers1

0

Try the following:

template <class T>
bool same(T, T) { return true; }

template <class T, class U>
bool same(T, U) { return false; }

Or maybe you can use std::is_same like in the answer to the duplicate question.

Community
  • 1
  • 1
David G
  • 94,763
  • 41
  • 167
  • 253