comparison DEPENDENCIES/generic/include/boost/function/function_template.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
24 24
25 #define BOOST_FUNCTION_PARM(J,I,D) BOOST_PP_CAT(T,I) BOOST_PP_CAT(a,I) 25 #define BOOST_FUNCTION_PARM(J,I,D) BOOST_PP_CAT(T,I) BOOST_PP_CAT(a,I)
26 26
27 #define BOOST_FUNCTION_PARMS BOOST_PP_ENUM(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_PARM,BOOST_PP_EMPTY) 27 #define BOOST_FUNCTION_PARMS BOOST_PP_ENUM(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_PARM,BOOST_PP_EMPTY)
28 28
29 #define BOOST_FUNCTION_ARGS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, a) 29 #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
30 # define BOOST_FUNCTION_ARGS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, a)
31 #else
32 # include <boost/move/utility_core.hpp>
33 # define BOOST_FUNCTION_ARG(J,I,D) ::boost::forward< BOOST_PP_CAT(T,I) >(BOOST_PP_CAT(a,I))
34 # define BOOST_FUNCTION_ARGS BOOST_PP_ENUM(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_ARG,BOOST_PP_EMPTY)
35 #endif
30 36
31 #define BOOST_FUNCTION_ARG_TYPE(J,I,D) \ 37 #define BOOST_FUNCTION_ARG_TYPE(J,I,D) \
32 typedef BOOST_PP_CAT(T,I) BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(I)),_type); 38 typedef BOOST_PP_CAT(T,I) BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(I)),_type);
33 39
34 #define BOOST_FUNCTION_ARG_TYPES BOOST_PP_REPEAT(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_ARG_TYPE,BOOST_PP_EMPTY) 40 #define BOOST_FUNCTION_ARG_TYPES BOOST_PP_REPEAT(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_ARG_TYPE,BOOST_PP_EMPTY)
912 } 918 }
913 919
914 template<typename Functor> 920 template<typename Functor>
915 void assign_to(Functor f) 921 void assign_to(Functor f)
916 { 922 {
917 using detail::function::vtable_base; 923 using boost::detail::function::vtable_base;
918 924
919 typedef typename detail::function::get_function_tag<Functor>::type tag; 925 typedef typename boost::detail::function::get_function_tag<Functor>::type tag;
920 typedef detail::function::BOOST_FUNCTION_GET_INVOKER<tag> get_invoker; 926 typedef boost::detail::function::BOOST_FUNCTION_GET_INVOKER<tag> get_invoker;
921 typedef typename get_invoker:: 927 typedef typename get_invoker::
922 template apply<Functor, R BOOST_FUNCTION_COMMA 928 template apply<Functor, R BOOST_FUNCTION_COMMA
923 BOOST_FUNCTION_TEMPLATE_ARGS> 929 BOOST_FUNCTION_TEMPLATE_ARGS>
924 handler_type; 930 handler_type;
925 931
933 static const vtable_type stored_vtable = 939 static const vtable_type stored_vtable =
934 { { &manager_type::manage }, &invoker_type::invoke }; 940 { { &manager_type::manage }, &invoker_type::invoke };
935 941
936 if (stored_vtable.assign_to(f, functor)) { 942 if (stored_vtable.assign_to(f, functor)) {
937 std::size_t value = reinterpret_cast<std::size_t>(&stored_vtable.base); 943 std::size_t value = reinterpret_cast<std::size_t>(&stored_vtable.base);
944 // coverity[pointless_expression]: suppress coverity warnings on apparant if(const).
938 if (boost::has_trivial_copy_constructor<Functor>::value && 945 if (boost::has_trivial_copy_constructor<Functor>::value &&
939 boost::has_trivial_destructor<Functor>::value && 946 boost::has_trivial_destructor<Functor>::value &&
940 detail::function::function_allows_small_object_optimization<Functor>::value) 947 boost::detail::function::function_allows_small_object_optimization<Functor>::value)
941 value |= static_cast<size_t>(0x01); 948 value |= static_cast<std::size_t>(0x01);
942 vtable = reinterpret_cast<detail::function::vtable_base *>(value); 949 vtable = reinterpret_cast<boost::detail::function::vtable_base *>(value);
943 } else 950 } else
944 vtable = 0; 951 vtable = 0;
945 } 952 }
946 953
947 template<typename Functor,typename Allocator> 954 template<typename Functor,typename Allocator>
948 void assign_to_a(Functor f,Allocator a) 955 void assign_to_a(Functor f,Allocator a)
949 { 956 {
950 using detail::function::vtable_base; 957 using boost::detail::function::vtable_base;
951 958
952 typedef typename detail::function::get_function_tag<Functor>::type tag; 959 typedef typename boost::detail::function::get_function_tag<Functor>::type tag;
953 typedef detail::function::BOOST_FUNCTION_GET_INVOKER<tag> get_invoker; 960 typedef boost::detail::function::BOOST_FUNCTION_GET_INVOKER<tag> get_invoker;
954 typedef typename get_invoker:: 961 typedef typename get_invoker::
955 template apply_a<Functor, R BOOST_FUNCTION_COMMA 962 template apply_a<Functor, R BOOST_FUNCTION_COMMA
956 BOOST_FUNCTION_TEMPLATE_ARGS, 963 BOOST_FUNCTION_TEMPLATE_ARGS,
957 Allocator> 964 Allocator>
958 handler_type; 965 handler_type;
967 static const vtable_type stored_vtable = 974 static const vtable_type stored_vtable =
968 { { &manager_type::manage }, &invoker_type::invoke }; 975 { { &manager_type::manage }, &invoker_type::invoke };
969 976
970 if (stored_vtable.assign_to_a(f, functor, a)) { 977 if (stored_vtable.assign_to_a(f, functor, a)) {
971 std::size_t value = reinterpret_cast<std::size_t>(&stored_vtable.base); 978 std::size_t value = reinterpret_cast<std::size_t>(&stored_vtable.base);
979 // coverity[pointless_expression]: suppress coverity warnings on apparant if(const).
972 if (boost::has_trivial_copy_constructor<Functor>::value && 980 if (boost::has_trivial_copy_constructor<Functor>::value &&
973 boost::has_trivial_destructor<Functor>::value && 981 boost::has_trivial_destructor<Functor>::value &&
974 detail::function::function_allows_small_object_optimization<Functor>::value) 982 boost::detail::function::function_allows_small_object_optimization<Functor>::value)
975 value |= static_cast<std::size_t>(0x01); 983 value |= static_cast<std::size_t>(0x01);
976 vtable = reinterpret_cast<detail::function::vtable_base *>(value); 984 vtable = reinterpret_cast<boost::detail::function::vtable_base *>(value);
977 } else 985 } else
978 vtable = 0; 986 vtable = 0;
979 } 987 }
980 988
981 // Moves the value from the specified argument to *this. If the argument 989 // Moves the value from the specified argument to *this. If the argument
1172 #undef BOOST_FUNCTION_GET_INVOKER 1180 #undef BOOST_FUNCTION_GET_INVOKER
1173 #undef BOOST_FUNCTION_TEMPLATE_PARMS 1181 #undef BOOST_FUNCTION_TEMPLATE_PARMS
1174 #undef BOOST_FUNCTION_TEMPLATE_ARGS 1182 #undef BOOST_FUNCTION_TEMPLATE_ARGS
1175 #undef BOOST_FUNCTION_PARMS 1183 #undef BOOST_FUNCTION_PARMS
1176 #undef BOOST_FUNCTION_PARM 1184 #undef BOOST_FUNCTION_PARM
1185 #ifdef BOOST_FUNCTION_ARG
1186 # undef BOOST_FUNCTION_ARG
1187 #endif
1177 #undef BOOST_FUNCTION_ARGS 1188 #undef BOOST_FUNCTION_ARGS
1178 #undef BOOST_FUNCTION_ARG_TYPE 1189 #undef BOOST_FUNCTION_ARG_TYPE
1179 #undef BOOST_FUNCTION_ARG_TYPES 1190 #undef BOOST_FUNCTION_ARG_TYPES
1180 #undef BOOST_FUNCTION_VOID_RETURN_TYPE 1191 #undef BOOST_FUNCTION_VOID_RETURN_TYPE
1181 #undef BOOST_FUNCTION_RETURN 1192 #undef BOOST_FUNCTION_RETURN