Daniela Engert wrote: ...
I've implemented a possible solution and created two pull-requests: - https://github.com/boostorg/typeof/pull/7
I think that a more principled solution here would be to check !defined(BOOST_NO_CXX11_DECLTYPE) at the very start of typeof.hpp (if BOOST_TYPEOF_EMULATION is not defined) and then use a generic decltype-based implementation. Something like -#if defined(__COMO__) +#if !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_TYPEOF_EMULATION) +# ifndef BOOST_TYPEOF_NATIVE +# define BOOST_TYPEOF_NATIVE +# endif + +#elif defined(__COMO__) (which would also require the inclusion of <boost/config.hpp>) and then #elif defined(BOOST_TYPEOF_NATIVE) # define BOOST_TYPEOF_TEXT "using native typeof" # include <boost/typeof/message.hpp> -# include <boost/typeof/native.hpp> +# if !defined(BOOST_NO_CXX11_DECLTYPE) +# include <boost/typeof/decltype.hpp> +# else +# include <boost/typeof/native.hpp> +# endif where decltype.hpp is more or less the same as the suggested msvc/typeof_impl_decltype.hpp, but without ensure_obj (shouldn't be needed with decltype) and with remove_cv_ref instead of remove_reference. Except that we don't have remove_cv_ref in TypeTraits, so remove_cv<remove_reference>.