Any interest in type_traits workaround macros for ill conforming compilers?
Something along theese lines #include <boost\type_traits.hpp> #define BOOST_REMOVE_POINTER(arg) \ namespace boost \ { \ template <> \ struct remove_pointer<arg*> \ { \ typedef arg type; \ }; \ } // end namespace boost user file struct abc { object x; object b; }; BOOST_REMOVE_POINTER(abc) boosts remove_pointer<T> will now work as expected for abc types Do such macros already exist in boost? Such macros can also be used on good compilers* to describe traits that it can't figure out, such as has_nothrow_assign<T> * compilers supporting partial template specialization
Ray Hilton wrote:
Something along theese lines #include <boost\type_traits.hpp>
#define BOOST_REMOVE_POINTER(arg) \ namespace boost \ { \ template <> \ struct remove_pointer<arg*> \ { \ typedef arg type; \ }; \ } // end namespace boost
user file
struct abc { object x; object b; }; BOOST_REMOVE_POINTER(abc)
boosts remove_pointer<T> will now work as expected for abc types
Do such macros already exist in boost?
BOOST_TT_BROKEN_COMPILER_SPEC(abc) will do that for remove_pointer and a whole bunch of other traits. See boost/type_traits/broken_compiler_spec.hpp -- Dave Abrahams Boost Consulting http://www.boost-consulting.com
Ray Hilton wrote:
Something along theese lines #include <boost\type_traits.hpp>
#define BOOST_REMOVE_POINTER(arg) \ namespace boost \ { \ template <> \ struct remove_pointer<arg*> \ { \ typedef arg type; \ }; \ } // end namespace boost
user file
struct abc { object x; object b; }; BOOST_REMOVE_POINTER(abc)
boosts remove_pointer<T> will now work as expected for abc types
Do such macros already exist in boost?
Yes. Use BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION, as described in the docs below this table: http://www.boost.org/libs/type_traits/index.html#transformations Jonathan
participants (3)
-
David Abrahams
-
Jonathan Turkanis
-
Ray Hilton