
On 16/04/2011 12:32, Robert Jones wrote:
On Sat, Apr 16, 2011 at 11:23 AM, Mathias Gaunard< mathias.gaunard@ens-lyon.org> wrote:
They need to be differently sized types so that you can use sizeof to distinguish which function overloads gets picked up.
I didn't understand that at all, quite possibly because I misunderstood the OP. What overloads are we seeking to distinguish? (Sorry if I'm being a bit slow here!)
SFINAE is usually used to define traits like this: template<typename T> struct my_trait { typedef char yes_type; struct no_type { char dummy[2]; }; template<typename X> yes_type test(whatever_you_want_to_test_with_X *); no_type test(...); static const bool value = sizeof(test<T>(0)) == sizeof(yes_type); typedef boost::mpl::bool_<value> type; };