diff options
Diffstat (limited to '3rdParty/Boost/src/boost/function/function_template.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/function/function_template.hpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/3rdParty/Boost/src/boost/function/function_template.hpp b/3rdParty/Boost/src/boost/function/function_template.hpp index f9699d0..72b7fab 100644 --- a/3rdParty/Boost/src/boost/function/function_template.hpp +++ b/3rdParty/Boost/src/boost/function/function_template.hpp @@ -645,71 +645,71 @@ namespace boost { } // end namespace function } // end namespace detail template< typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS > class BOOST_FUNCTION_FUNCTION : public function_base #if BOOST_FUNCTION_NUM_ARGS == 1 , public std::unary_function<T0,R> #elif BOOST_FUNCTION_NUM_ARGS == 2 , public std::binary_function<T0,T1,R> #endif { public: #ifndef BOOST_NO_VOID_RETURNS typedef R result_type; #else typedef typename boost::detail::function::function_return_type<R>::type result_type; #endif // BOOST_NO_VOID_RETURNS private: typedef boost::detail::function::BOOST_FUNCTION_VTABLE< R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS> vtable_type; vtable_type* get_vtable() const { return reinterpret_cast<vtable_type*>( - reinterpret_cast<std::size_t>(vtable) & ~static_cast<size_t>(0x01)); + reinterpret_cast<std::size_t>(vtable) & ~static_cast<std::size_t>(0x01)); } struct clear_type {}; public: BOOST_STATIC_CONSTANT(int, args = BOOST_FUNCTION_NUM_ARGS); // add signature for boost::lambda template<typename Args> struct sig { typedef result_type type; }; #if BOOST_FUNCTION_NUM_ARGS == 1 typedef T0 argument_type; #elif BOOST_FUNCTION_NUM_ARGS == 2 typedef T0 first_argument_type; typedef T1 second_argument_type; #endif BOOST_STATIC_CONSTANT(int, arity = BOOST_FUNCTION_NUM_ARGS); BOOST_FUNCTION_ARG_TYPES typedef BOOST_FUNCTION_FUNCTION self_type; BOOST_FUNCTION_FUNCTION() : function_base() { } // MSVC chokes if the following two constructors are collapsed into // one with a default parameter. template<typename Functor> BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f #ifndef BOOST_NO_SFINAE ,typename enable_if_c< (boost::type_traits::ice_not< @@ -717,71 +717,71 @@ namespace boost { int>::type = 0 #endif // BOOST_NO_SFINAE ) : function_base() { this->assign_to(f); } template<typename Functor,typename Allocator> BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f, Allocator a #ifndef BOOST_NO_SFINAE ,typename enable_if_c< (boost::type_traits::ice_not< (is_integral<Functor>::value)>::value), int>::type = 0 #endif // BOOST_NO_SFINAE ) : function_base() { this->assign_to_a(f,a); } #ifndef BOOST_NO_SFINAE BOOST_FUNCTION_FUNCTION(clear_type*) : function_base() { } #else BOOST_FUNCTION_FUNCTION(int zero) : function_base() { BOOST_ASSERT(zero == 0); } #endif BOOST_FUNCTION_FUNCTION(const BOOST_FUNCTION_FUNCTION& f) : function_base() { this->assign_to_own(f); } -#ifndef BOOST_NO_RVALUE_REFERENCES +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES BOOST_FUNCTION_FUNCTION(BOOST_FUNCTION_FUNCTION&& f) : function_base() { this->move_assign(f); } #endif ~BOOST_FUNCTION_FUNCTION() { clear(); } result_type operator()(BOOST_FUNCTION_PARMS) const { if (this->empty()) boost::throw_exception(bad_function_call()); return get_vtable()->invoker (this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); } // The distinction between when to use BOOST_FUNCTION_FUNCTION and // when to use self_type is obnoxious. MSVC cannot handle self_type as // the return type of these assignment operators, but Borland C++ cannot // handle BOOST_FUNCTION_FUNCTION as the type of the temporary to // construct. template<typename Functor> #ifndef BOOST_NO_SFINAE typename enable_if_c< (boost::type_traits::ice_not< (is_integral<Functor>::value)>::value), BOOST_FUNCTION_FUNCTION&>::type #else BOOST_FUNCTION_FUNCTION& #endif operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) { this->clear(); BOOST_TRY { @@ -806,71 +806,71 @@ namespace boost { BOOST_CATCH_END } #ifndef BOOST_NO_SFINAE BOOST_FUNCTION_FUNCTION& operator=(clear_type*) { this->clear(); return *this; } #else BOOST_FUNCTION_FUNCTION& operator=(int zero) { BOOST_ASSERT(zero == 0); this->clear(); return *this; } #endif // Assignment from another BOOST_FUNCTION_FUNCTION BOOST_FUNCTION_FUNCTION& operator=(const BOOST_FUNCTION_FUNCTION& f) { if (&f == this) return *this; this->clear(); BOOST_TRY { this->assign_to_own(f); } BOOST_CATCH (...) { vtable = 0; BOOST_RETHROW; } BOOST_CATCH_END return *this; } -#ifndef BOOST_NO_RVALUE_REFERENCES +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES // Move assignment from another BOOST_FUNCTION_FUNCTION BOOST_FUNCTION_FUNCTION& operator=(BOOST_FUNCTION_FUNCTION&& f) { if (&f == this) return *this; this->clear(); BOOST_TRY { this->move_assign(f); } BOOST_CATCH (...) { vtable = 0; BOOST_RETHROW; } BOOST_CATCH_END return *this; } #endif void swap(BOOST_FUNCTION_FUNCTION& other) { if (&other == this) return; BOOST_FUNCTION_FUNCTION tmp; tmp.move_assign(*this); this->move_assign(other); other.move_assign(tmp); } // Clear out a target, if there is one void clear() { if (vtable) { if (!this->has_trivial_copy_and_destroy()) @@ -903,104 +903,106 @@ namespace boost { { if (!f.empty()) { this->vtable = f.vtable; if (this->has_trivial_copy_and_destroy()) this->functor = f.functor; else get_vtable()->base.manager(f.functor, this->functor, boost::detail::function::clone_functor_tag); } } template<typename Functor> void assign_to(Functor f) { using detail::function::vtable_base; typedef typename detail::function::get_function_tag<Functor>::type tag; typedef detail::function::BOOST_FUNCTION_GET_INVOKER<tag> get_invoker; typedef typename get_invoker:: template apply<Functor, R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS> handler_type; typedef typename handler_type::invoker_type invoker_type; typedef typename handler_type::manager_type manager_type; // Note: it is extremely important that this initialization use // static initialization. Otherwise, we will have a race // condition here in multi-threaded code. See // http://thread.gmane.org/gmane.comp.lib.boost.devel/164902/. static const vtable_type stored_vtable = { { &manager_type::manage }, &invoker_type::invoke }; if (stored_vtable.assign_to(f, functor)) { std::size_t value = reinterpret_cast<std::size_t>(&stored_vtable.base); + // coverity[pointless_expression]: suppress coverity warnings on apparant if(const). if (boost::has_trivial_copy_constructor<Functor>::value && boost::has_trivial_destructor<Functor>::value && detail::function::function_allows_small_object_optimization<Functor>::value) - value |= static_cast<size_t>(0x01); + value |= static_cast<std::size_t>(0x01); vtable = reinterpret_cast<detail::function::vtable_base *>(value); } else vtable = 0; } template<typename Functor,typename Allocator> void assign_to_a(Functor f,Allocator a) { using detail::function::vtable_base; typedef typename detail::function::get_function_tag<Functor>::type tag; typedef detail::function::BOOST_FUNCTION_GET_INVOKER<tag> get_invoker; typedef typename get_invoker:: template apply_a<Functor, R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS, Allocator> handler_type; typedef typename handler_type::invoker_type invoker_type; typedef typename handler_type::manager_type manager_type; // Note: it is extremely important that this initialization use // static initialization. Otherwise, we will have a race // condition here in multi-threaded code. See // http://thread.gmane.org/gmane.comp.lib.boost.devel/164902/. static const vtable_type stored_vtable = { { &manager_type::manage }, &invoker_type::invoke }; if (stored_vtable.assign_to_a(f, functor, a)) { std::size_t value = reinterpret_cast<std::size_t>(&stored_vtable.base); + // coverity[pointless_expression]: suppress coverity warnings on apparant if(const). if (boost::has_trivial_copy_constructor<Functor>::value && boost::has_trivial_destructor<Functor>::value && detail::function::function_allows_small_object_optimization<Functor>::value) value |= static_cast<std::size_t>(0x01); vtable = reinterpret_cast<detail::function::vtable_base *>(value); } else vtable = 0; } // Moves the value from the specified argument to *this. If the argument // has its function object allocated on the heap, move_assign will pass // its buffer to *this, and set the argument's buffer pointer to NULL. void move_assign(BOOST_FUNCTION_FUNCTION& f) { if (&f == this) return; BOOST_TRY { if (!f.empty()) { this->vtable = f.vtable; if (this->has_trivial_copy_and_destroy()) this->functor = f.functor; else get_vtable()->base.manager(f.functor, this->functor, boost::detail::function::move_functor_tag); f.vtable = 0; } else { clear(); } } BOOST_CATCH (...) { vtable = 0; BOOST_RETHROW; } BOOST_CATCH_END } @@ -1058,120 +1060,120 @@ public: function() : base_type() {} template<typename Functor> function(Functor f #ifndef BOOST_NO_SFINAE ,typename enable_if_c< (boost::type_traits::ice_not< (is_integral<Functor>::value)>::value), int>::type = 0 #endif ) : base_type(f) { } template<typename Functor,typename Allocator> function(Functor f, Allocator a #ifndef BOOST_NO_SFINAE ,typename enable_if_c< (boost::type_traits::ice_not< (is_integral<Functor>::value)>::value), int>::type = 0 #endif ) : base_type(f,a) { } #ifndef BOOST_NO_SFINAE function(clear_type*) : base_type() {} #endif function(const self_type& f) : base_type(static_cast<const base_type&>(f)){} function(const base_type& f) : base_type(static_cast<const base_type&>(f)){} -#ifndef BOOST_NO_RVALUE_REFERENCES +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES // Move constructors function(self_type&& f): base_type(static_cast<base_type&&>(f)){} function(base_type&& f): base_type(static_cast<base_type&&>(f)){} #endif self_type& operator=(const self_type& f) { self_type(f).swap(*this); return *this; } -#ifndef BOOST_NO_RVALUE_REFERENCES +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES self_type& operator=(self_type&& f) { self_type(static_cast<self_type&&>(f)).swap(*this); return *this; } #endif template<typename Functor> #ifndef BOOST_NO_SFINAE typename enable_if_c< (boost::type_traits::ice_not< (is_integral<Functor>::value)>::value), self_type&>::type #else self_type& #endif operator=(Functor f) { self_type(f).swap(*this); return *this; } #ifndef BOOST_NO_SFINAE self_type& operator=(clear_type*) { this->clear(); return *this; } #endif self_type& operator=(const base_type& f) { self_type(f).swap(*this); return *this; } -#ifndef BOOST_NO_RVALUE_REFERENCES +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES self_type& operator=(base_type&& f) { self_type(static_cast<base_type&&>(f)).swap(*this); return *this; } #endif }; #undef BOOST_FUNCTION_PARTIAL_SPEC #endif // have partial specialization } // end namespace boost // Cleanup after ourselves... #undef BOOST_FUNCTION_VTABLE #undef BOOST_FUNCTION_COMMA #undef BOOST_FUNCTION_FUNCTION #undef BOOST_FUNCTION_FUNCTION_INVOKER #undef BOOST_FUNCTION_VOID_FUNCTION_INVOKER #undef BOOST_FUNCTION_FUNCTION_OBJ_INVOKER #undef BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER #undef BOOST_FUNCTION_FUNCTION_REF_INVOKER #undef BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER #undef BOOST_FUNCTION_MEMBER_INVOKER #undef BOOST_FUNCTION_VOID_MEMBER_INVOKER #undef BOOST_FUNCTION_GET_FUNCTION_INVOKER #undef BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER #undef BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER #undef BOOST_FUNCTION_GET_MEM_FUNCTION_INVOKER #undef BOOST_FUNCTION_GET_INVOKER #undef BOOST_FUNCTION_TEMPLATE_PARMS #undef BOOST_FUNCTION_TEMPLATE_ARGS #undef BOOST_FUNCTION_PARMS #undef BOOST_FUNCTION_PARM #undef BOOST_FUNCTION_ARGS |