mirror of
https://github.com/boostorg/utility.git
synced 2025-05-08 18:34:02 +00:00
parent
26b39384e3
commit
fe653d0a9a
@ -210,8 +210,10 @@ int main()
|
||||
comparible_UDT u;
|
||||
c1(u);
|
||||
call_traits_checker<int> c2;
|
||||
call_traits_checker<enum_UDT> c2b;
|
||||
int i = 2;
|
||||
c2(i);
|
||||
c2b(one);
|
||||
int* pi = &i;
|
||||
int a[2] = {1,2};
|
||||
#if defined(BOOST_MSVC6_MEMBER_TEMPLATES) && !defined(__ICL)
|
||||
@ -292,7 +294,11 @@ int main()
|
||||
BOOST_CHECK_TYPE(incomplete_type&, boost::call_traits<incomplete_type>::reference);
|
||||
BOOST_CHECK_TYPE(const incomplete_type&, boost::call_traits<incomplete_type>::const_reference);
|
||||
BOOST_CHECK_TYPE(const incomplete_type&, boost::call_traits<incomplete_type>::param_type);
|
||||
|
||||
// test enum:
|
||||
BOOST_CHECK_TYPE(enum_UDT, boost::call_traits<enum_UDT>::value_type);
|
||||
BOOST_CHECK_TYPE(enum_UDT&, boost::call_traits<enum_UDT>::reference);
|
||||
BOOST_CHECK_TYPE(const enum_UDT&, boost::call_traits<enum_UDT>::const_reference);
|
||||
BOOST_CHECK_TYPE(const enum_UDT, boost::call_traits<enum_UDT>::param_type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <cstddef>
|
||||
|
||||
#include <boost/type_traits/is_arithmetic.hpp>
|
||||
#include <boost/type_traits/is_enum.hpp>
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
@ -43,20 +44,26 @@ struct ct_imp2<T, true>
|
||||
typedef const T param_type;
|
||||
};
|
||||
|
||||
template <typename T, bool isp, bool b1>
|
||||
template <typename T, bool isp, bool b1, bool b2>
|
||||
struct ct_imp
|
||||
{
|
||||
typedef const T& param_type;
|
||||
};
|
||||
|
||||
template <typename T, bool isp>
|
||||
struct ct_imp<T, isp, true>
|
||||
template <typename T, bool isp, bool b2>
|
||||
struct ct_imp<T, isp, true, b2>
|
||||
{
|
||||
typedef typename ct_imp2<T, sizeof(T) <= sizeof(void*)>::param_type param_type;
|
||||
};
|
||||
|
||||
template <typename T, bool b1>
|
||||
struct ct_imp<T, true, b1>
|
||||
template <typename T, bool isp, bool b1>
|
||||
struct ct_imp<T, isp, b1, true>
|
||||
{
|
||||
typedef typename ct_imp2<T, sizeof(T) <= sizeof(void*)>::param_type param_type;
|
||||
};
|
||||
|
||||
template <typename T, bool b1, bool b2>
|
||||
struct ct_imp<T, true, b1, b2>
|
||||
{
|
||||
typedef const T param_type;
|
||||
};
|
||||
@ -79,7 +86,8 @@ public:
|
||||
typedef typename boost::detail::ct_imp<
|
||||
T,
|
||||
::boost::is_pointer<T>::value,
|
||||
::boost::is_arithmetic<T>::value
|
||||
::boost::is_arithmetic<T>::value,
|
||||
::boost::is_enum<T>::value
|
||||
>::param_type param_type;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user