From fe653d0a9ae5f27fb8eca77d944aa44a5cc637b0 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sat, 20 Aug 2011 16:03:58 +0000 Subject: [PATCH] Change call_traits to pass enum's by value. Fixes #5790. [SVN r73953] --- call_traits_test.cpp | 8 +++++++- include/boost/detail/call_traits.hpp | 20 ++++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/call_traits_test.cpp b/call_traits_test.cpp index 72852c4..9e49b68 100644 --- a/call_traits_test.cpp +++ b/call_traits_test.cpp @@ -210,8 +210,10 @@ int main() comparible_UDT u; c1(u); call_traits_checker c2; + call_traits_checker 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::reference); BOOST_CHECK_TYPE(const incomplete_type&, boost::call_traits::const_reference); BOOST_CHECK_TYPE(const incomplete_type&, boost::call_traits::param_type); - + // test enum: + BOOST_CHECK_TYPE(enum_UDT, boost::call_traits::value_type); + BOOST_CHECK_TYPE(enum_UDT&, boost::call_traits::reference); + BOOST_CHECK_TYPE(const enum_UDT&, boost::call_traits::const_reference); + BOOST_CHECK_TYPE(const enum_UDT, boost::call_traits::param_type); return 0; } diff --git a/include/boost/detail/call_traits.hpp b/include/boost/detail/call_traits.hpp index 6ad646e..36dea00 100644 --- a/include/boost/detail/call_traits.hpp +++ b/include/boost/detail/call_traits.hpp @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -43,20 +44,26 @@ struct ct_imp2 typedef const T param_type; }; -template +template struct ct_imp { typedef const T& param_type; }; -template -struct ct_imp +template +struct ct_imp { typedef typename ct_imp2::param_type param_type; }; -template -struct ct_imp +template +struct ct_imp +{ + typedef typename ct_imp2::param_type param_type; +}; + +template +struct ct_imp { typedef const T param_type; }; @@ -79,7 +86,8 @@ public: typedef typename boost::detail::ct_imp< T, ::boost::is_pointer::value, - ::boost::is_arithmetic::value + ::boost::is_arithmetic::value, + ::boost::is_enum::value >::param_type param_type; };