
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: #if !defined(BOOST_NO_SFINAE_EXPR) || BOOST_WORKAROUND(BOOST_MSVC, >= 1500) If you can decipher it you might notice some apparently superfluous code which is required to use SFINAE expressions with Visual C++. I'll write some more when I get a chance. I'll have a look at your trait implementation as it might be better for other compilers.