
El 16/09/2011 1:32, Daniel James escribió:
2011/9/15 Ion Gaztañaga<igaztanaga@gmail.com>:
Hi to all,
Trying to port C++11 code (allocator_traits) to C++03 (without decltype support), I needed to check at compile time if a member function can be called with some given parameters.
Take a look at:
http://svn.boost.org/svn/boost/trunk/boost/unordered/detail/allocator_helper...
It contains an incomplete implementation of allocator_traits. I just used sizeof instead of decltype for compilers which support SFINAE expressions - gcc 4.4+, clang, and visual studio 2008+ (sort of). Look for the line:
Thanks for the info, I didn't know about the existence of SFINAE expressions with sizeof. One of the shortcomings of my proposal is supporting 0 argument functions, I haven't found yet a way to reliably detect them. Best, Ion