mirror of
https://github.com/boostorg/typeof.git
synced 2025-05-09 23:14:01 +00:00
Removed use of typeid in typeof implementation for VC7.1, as this caused problems in some uses of BOOST_TYPEOF
[SVN r51681]
This commit is contained in:
parent
4c9b8ba961
commit
c10804f3b0
52
include/boost/typeof/msvc/typeof_impl.hpp
Executable file → Normal file
52
include/boost/typeof/msvc/typeof_impl.hpp
Executable file → Normal file
@ -153,58 +153,7 @@ namespace boost
|
||||
};
|
||||
};
|
||||
# endif
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC,==1310)
|
||||
template<const std::type_info& ref_type_info>
|
||||
struct msvc_typeid_wrapper {
|
||||
typedef typename msvc_extract_type<msvc_typeid_wrapper>::id2type id2type;
|
||||
typedef typename id2type::type wrapped_type;
|
||||
typedef typename wrapped_type::type type;
|
||||
};
|
||||
//This class is used for registering the type T. encode_type<T> is mapped against typeid(encode_type<T>).
|
||||
//msvc_typeid_wrapper<typeid(encode_type<T>)> will now have a type typedef that equals encode_type<T>.
|
||||
template<typename T>
|
||||
struct encode_type
|
||||
{
|
||||
typedef encode_type<T> input_type;
|
||||
//Invoke registration of encode_type<T>. typeid(encode_type<T>) is now mapped to encode_type<T>. Do not use registered_type for anything.
|
||||
//The reason for registering encode_type<T> rather than T, is that VC handles typeid(function reference) poorly. By adding another
|
||||
//level of indirection, we solve this problem.
|
||||
typedef typename msvc_register_type<input_type,msvc_typeid_wrapper<typeid(input_type)> >::id2type registered_type;
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<typename T> typename disable_if<
|
||||
typename is_function<T>::type,
|
||||
typename encode_type<T>::input_type>::type encode_start(T const&);
|
||||
|
||||
template<typename T> typename enable_if<
|
||||
typename is_function<T>::type,
|
||||
typename encode_type<T>::input_type>::type encode_start(T&);
|
||||
|
||||
template<typename Organizer, typename T>
|
||||
msvc_register_type<T,Organizer> typeof_register_type(const T&);
|
||||
|
||||
|
||||
# define BOOST_TYPEOF(expr) \
|
||||
boost::type_of::msvc_typeid_wrapper<typeid(boost::type_of::encode_start(expr))>::type
|
||||
|
||||
# define BOOST_TYPEOF_TPL(expr) typename BOOST_TYPEOF(expr)
|
||||
|
||||
# define BOOST_TYPEOF_NESTED_TYPEDEF_TPL(name,expr) \
|
||||
struct name {\
|
||||
enum {_typeof_register_value=sizeof(typeid(boost::type_of::typeof_register_type<name>(expr)))};\
|
||||
typedef typename boost::type_of::msvc_extract_type<name>::id2type id2type;\
|
||||
typedef typename id2type::type type;\
|
||||
};
|
||||
|
||||
# define BOOST_TYPEOF_NESTED_TYPEDEF(name,expr) \
|
||||
struct name {\
|
||||
enum {_typeof_register_value=sizeof(typeid(boost::type_of::typeof_register_type<name>(expr)))};\
|
||||
typedef boost::type_of::msvc_extract_type<name>::id2type id2type;\
|
||||
typedef id2type::type type;\
|
||||
};
|
||||
|
||||
# else
|
||||
template<int ID>
|
||||
struct msvc_typeid_wrapper {
|
||||
typedef typename msvc_extract_type<mpl::int_<ID> >::id2type id2type;
|
||||
@ -274,7 +223,6 @@ struct name {\
|
||||
typedef id2type::type type;\
|
||||
};
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user