mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-19 23:32:17 +02:00
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.
This commit is contained in:
@ -21,7 +21,6 @@
|
|||||||
#include <boost/preprocessor/tuple/elem.hpp>
|
#include <boost/preprocessor/tuple/elem.hpp>
|
||||||
#include <boost/mpl/if.hpp>
|
#include <boost/mpl/if.hpp>
|
||||||
#include <boost/type_traits/is_const.hpp>
|
#include <boost/type_traits/is_const.hpp>
|
||||||
#include <boost/type_traits/add_const.hpp>
|
|
||||||
#include <boost/type_traits/remove_const.hpp>
|
#include <boost/type_traits/remove_const.hpp>
|
||||||
#include <boost/type_traits/remove_reference.hpp>
|
#include <boost/type_traits/remove_reference.hpp>
|
||||||
|
|
||||||
@ -84,20 +83,8 @@
|
|||||||
typedef \
|
typedef \
|
||||||
BOOST_PP_EXPR_IF(BOOST_FUSION_ADAPT_IS_TPL(TEMPLATE_PARAMS_SEQ), \
|
BOOST_PP_EXPR_IF(BOOST_FUSION_ADAPT_IS_TPL(TEMPLATE_PARAMS_SEQ), \
|
||||||
typename) \
|
typename) \
|
||||||
boost::remove_const< \
|
deduced_attr_type::type type; \
|
||||||
BOOST_PP_EXPR_IF(BOOST_FUSION_ADAPT_IS_TPL(TEMPLATE_PARAMS_SEQ), \
|
typedef type const_type;
|
||||||
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;
|
|
||||||
|
|
||||||
#define BOOST_FUSION_ADT_ATTRIBUTE_GIVENTYPE( \
|
#define BOOST_FUSION_ADT_ATTRIBUTE_GIVENTYPE( \
|
||||||
NAME_SEQ, ATTRIBUTE, ATTRIBUTE_TUPLE_SIZE, PREFIX, TEMPLATE_PARAMS_SEQ) \
|
NAME_SEQ, ATTRIBUTE, ATTRIBUTE_TUPLE_SIZE, PREFIX, TEMPLATE_PARAMS_SEQ) \
|
||||||
|
@ -300,7 +300,7 @@ main()
|
|||||||
BOOST_MPL_ASSERT((
|
BOOST_MPL_ASSERT((
|
||||||
boost::is_same<
|
boost::is_same<
|
||||||
boost::fusion::result_of::back<ns::point const>::type::type,
|
boost::fusion::result_of::back<ns::point const>::type::type,
|
||||||
const int
|
int
|
||||||
>));
|
>));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user