From 77ebd568e18d99ac2bc8f9e22388db6a5b82ee1f Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Wed, 1 Aug 2018 20:08:24 +0900 Subject: [PATCH] adapt/adt: Don't add/remove const on return type of attributes Boost.TypeOf always deduces the type as un-cv-qualified value type, thus const-ized value type is redundant and inhibiting compiler optimization. --- .../fusion/adapted/adt/detail/adapt_base.hpp | 17 ++--------------- test/sequence/adapt_adt.cpp | 2 +- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/include/boost/fusion/adapted/adt/detail/adapt_base.hpp b/include/boost/fusion/adapted/adt/detail/adapt_base.hpp index c0527f63..6bceb757 100644 --- a/include/boost/fusion/adapted/adt/detail/adapt_base.hpp +++ b/include/boost/fusion/adapted/adt/detail/adapt_base.hpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -84,20 +83,8 @@ typedef \ BOOST_PP_EXPR_IF(BOOST_FUSION_ADAPT_IS_TPL(TEMPLATE_PARAMS_SEQ), \ typename) \ - boost::remove_const< \ - BOOST_PP_EXPR_IF(BOOST_FUSION_ADAPT_IS_TPL(TEMPLATE_PARAMS_SEQ), \ - typename) \ - deduced_attr_type::type \ - >::type type; \ - \ - typedef \ - BOOST_PP_EXPR_IF(BOOST_FUSION_ADAPT_IS_TPL(TEMPLATE_PARAMS_SEQ), \ - typename) \ - boost::add_const< \ - BOOST_PP_EXPR_IF(BOOST_FUSION_ADAPT_IS_TPL(TEMPLATE_PARAMS_SEQ), \ - typename) \ - deduced_attr_type::type \ - >::type const_type; + deduced_attr_type::type type; \ + typedef type const_type; #define BOOST_FUSION_ADT_ATTRIBUTE_GIVENTYPE( \ NAME_SEQ, ATTRIBUTE, ATTRIBUTE_TUPLE_SIZE, PREFIX, TEMPLATE_PARAMS_SEQ) \ diff --git a/test/sequence/adapt_adt.cpp b/test/sequence/adapt_adt.cpp index 98958348..90f2d061 100644 --- a/test/sequence/adapt_adt.cpp +++ b/test/sequence/adapt_adt.cpp @@ -300,7 +300,7 @@ main() BOOST_MPL_ASSERT(( boost::is_same< boost::fusion::result_of::back::type::type, - const int + int >)); }