diff --git a/include/boost/typeof/binding_workaround.hpp b/include/boost/typeof/binding_workaround.hpp new file mode 100755 index 0000000..0620c4b --- /dev/null +++ b/include/boost/typeof/binding_workaround.hpp @@ -0,0 +1,43 @@ +#ifndef BOOST_TYPEOF_BINDING_WORKAROUND_HPP_INCLUDED +#define BOOST_TYPEOF_BINDING_WORKAROUND_HPP_INCLUDED + +// workarounds related to inability to bind to const T& + +/* +MSVC 7.1-, from inside a template, +can't bind a function pointer to const T& +*/ + +#if BOOST_WORKAROUND(BOOST_MSVC,==1310) && defined(BOOST_TYPEOF_EMULATION) + +#include +#include +#include + +namespace boost { namespace type_of { + + template + sizer, T*>::type> encode(T*, + typename enable_if::type>::type* = 0); + +}} + +#elif BOOST_WORKAROUND(BOOST_MSVC,<=1310) && defined(BOOST_TYPEOF_NATIVE) + +#include +#include +#include + +namespace boost { namespace type_of { + + template + char (*encode_start(T*, + typename enable_if::type>::type* = 0))[encode_type::value]; + +}} + +#endif + +// + +#endif//BOOST_TYPEOF_BINDING_WORKAROUND_HPP_INCLUDED diff --git a/include/boost/typeof/typeof.hpp b/include/boost/typeof/typeof.hpp index 435c72a..5cce6e1 100755 --- a/include/boost/typeof/typeof.hpp +++ b/include/boost/typeof/typeof.hpp @@ -145,6 +145,7 @@ #endif #include +#include // auto #define BOOST_AUTO(Var, Expr) BOOST_TYPEOF(Expr) Var = Expr diff --git a/test/function_ptr_from_tpl.cpp b/test/function_ptr_from_tpl.cpp index 27aafc5..2f4db2d 100755 --- a/test/function_ptr_from_tpl.cpp +++ b/test/function_ptr_from_tpl.cpp @@ -1,4 +1,6 @@ #include +#include +#include void f() {} @@ -6,5 +8,7 @@ void f() template class x { - typedef BOOST_TYPEOF(&f) type; + BOOST_STATIC_ASSERT(( + boost::is_same::value + )); };