forked from boostorg/typeof
*** empty log message ***
[SVN r34270]
This commit is contained in:
@ -1,42 +0,0 @@
|
||||
#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&
|
||||
*/
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC,==1310) && defined(BOOST_TYPEOF_EMULATION)
|
||||
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_function.hpp>
|
||||
|
||||
namespace boost { namespace type_of {
|
||||
|
||||
template<class V,class T>
|
||||
sizer<typename encode_type<V, 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>
|
||||
|
||||
namespace boost { namespace type_of {
|
||||
|
||||
template<typename T>
|
||||
char (*encode_start(T*))[encode_type<T*>::value];
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
|
||||
#endif//BOOST_TYPEOF_BINDING_WORKAROUND_HPP_INCLUDED
|
@ -50,6 +50,9 @@ test-suite "typeof"
|
||||
[ compile function.cpp : <define>BOOST_TYPEOF_NATIVE special-requirements : function_native ]
|
||||
[ compile function.cpp : <define>BOOST_TYPEOF_COMPLIANT special-requirements : function_emulation ]
|
||||
|
||||
[ compile function_binding.cpp : <define>BOOST_TYPEOF_NATIVE special-requirements : function_binding_native ]
|
||||
[ compile function_binding.cpp : <define>BOOST_TYPEOF_COMPLIANT special-requirements : function_binding_emulation ]
|
||||
|
||||
[ compile function_ptr.cpp : <define>BOOST_TYPEOF_NATIVE special-requirements : function_ptr_native ]
|
||||
[ compile function_ptr.cpp : <define>BOOST_TYPEOF_COMPLIANT special-requirements : function_ptr_emulation ]
|
||||
|
||||
|
10
test/function_binding.cpp
Executable file
10
test/function_binding.cpp
Executable file
@ -0,0 +1,10 @@
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
int foo(double);
|
||||
typedef int(&FREF)(double);
|
||||
FREF fref = *foo;
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(fref), int(double)>::value));
|
@ -2,11 +2,3 @@
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<void(&)()>::value);
|
||||
BOOST_STATIC_ASSERT(boost::type_of::test<int(&)(int, short)>::value);
|
||||
|
||||
// check that function values/refs can be bound
|
||||
|
||||
int foo(double);
|
||||
typedef int(&FREF)(double);
|
||||
FREF fref = *foo;
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(fref), int(double)>::value));
|
||||
|
Reference in New Issue
Block a user