binding workarounds added

[SVN r33045]
This commit is contained in:
Arkadiy Vertleyb
2006-02-20 21:54:00 +00:00
parent ade1b9c2d1
commit 756a0ff572
3 changed files with 49 additions and 1 deletions

View File

@ -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 <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_function.hpp>
#include <boost/detail/workaround.hpp>
namespace boost { namespace type_of {
template<class T>
sizer<typename encode_type<BOOST_TYPEOF_VECTOR(0)<>, T*>::type> encode(T*,
typename enable_if<typename is_function<T>::type>::type* = 0);
}}
#elif BOOST_WORKAROUND(BOOST_MSVC,<=1310) && defined(BOOST_TYPEOF_NATIVE)
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_function.hpp>
#include <boost/detail/workaround.hpp>
namespace boost { namespace type_of {
template<typename T>
char (*encode_start(T*,
typename enable_if<typename is_function<T>::type>::type* = 0))[encode_type<T*>::value];
}}
#endif
//
#endif//BOOST_TYPEOF_BINDING_WORKAROUND_HPP_INCLUDED

View File

@ -145,6 +145,7 @@
#endif
#include <boost/typeof/message.hpp>
#include <boost/typeof/binding_workaround.hpp>
// auto
#define BOOST_AUTO(Var, Expr) BOOST_TYPEOF(Expr) Var = Expr

View File

@ -1,4 +1,6 @@
#include <boost/typeof/typeof.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/static_assert.hpp>
void f()
{}
@ -6,5 +8,7 @@ void f()
template<class T>
class x
{
typedef BOOST_TYPEOF(&f) type;
BOOST_STATIC_ASSERT((
boost::is_same<BOOST_TYPEOF_TPL(&f), void(*)()>::value
));
};