From 3c5579ccbceb12299b2747304839868516cc2a8a Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Thu, 25 Oct 2001 20:56:14 +0000 Subject: [PATCH] Removed function_cast() and .target_type() [SVN r11443] --- include/boost/function/function_template.hpp | 134 ------------------- 1 file changed, 134 deletions(-) diff --git a/include/boost/function/function_template.hpp b/include/boost/function/function_template.hpp index 5de0be6..14f050e 100644 --- a/include/boost/function/function_template.hpp +++ b/include/boost/function/function_template.hpp @@ -46,8 +46,6 @@ namespace boost { virtual R call(BOOST_FUNCTION_PARMS) const = 0; virtual BOOST_FUNCTION_INVOKER_BASE* clone() const = 0; virtual void destroy(BOOST_FUNCTION_INVOKER_BASE*) = 0; - virtual const std::type_info& type() const = 0; - virtual any_pointer pointer() const = 0; }; #endif // BOOST_FUNCTION_USE_VIRTUAL_FUNCTIONS @@ -115,16 +113,6 @@ namespace boost { # endif // BOOST_NO_STD_ALLOCATOR } - virtual const std::type_info& type() const - { - return typeid(FunctionPtr); - } - - virtual any_pointer pointer() const - { - return any_pointer(reinterpret_cast(function_ptr)); - } - private: mutable FunctionPtr function_ptr; #else @@ -202,16 +190,6 @@ namespace boost { # endif // BOOST_NO_STD_ALLOCATOR } - virtual const std::type_info& type() const - { - return typeid(FunctionPtr); - } - - virtual any_pointer pointer() const - { - return any_pointer(reinterpret_cast(function_ptr)); - } - private: mutable FunctionPtr function_ptr; # else @@ -290,16 +268,6 @@ namespace boost { #endif // BOOST_NO_STD_ALLOCATOR } - virtual const std::type_info& type() const - { - return typeid(FunctionObj); - } - - virtual any_pointer pointer() const - { - return any_pointer(&function_obj); - } - private: mutable FunctionObj function_obj; #else @@ -378,16 +346,6 @@ namespace boost { # endif // BOOST_NO_STD_ALLOCATOR } - virtual const std::type_info& type() const - { - return typeid(FunctionObj); - } - - virtual any_pointer pointer() const - { - return any_pointer(&function_obj); - } - private: mutable FunctionObj function_obj; # else @@ -643,69 +601,7 @@ namespace boost { #endif // BOOST_FUNCTION_USE_VIRTUAL_FUNCTIONS } - const std::type_info& target_type() const - { - if (this->empty()) - return typeid(void); - else { -#ifdef BOOST_FUNCTION_USE_VIRTUAL_FUNCTIONS - impl_type* i = reinterpret_cast(impl); - return i->type(); -#else - detail::function::any_pointer p = - manager(functor, detail::function::retrieve_type_info); - return *static_cast(p.const_obj_ptr); -#endif // BOOST_FUNCTION_USE_VIRTUAL_FUNCTIONS - } - } - - template - To& cast(To* dummy = 0) - { - assert(typeid(To) != typeid(void)); - assert(typeid(To) == this->target_type()); - typedef typename detail::function::get_function_tag::type tag; - -#ifdef BOOST_FUNCTION_USE_VIRTUAL_FUNCTIONS - impl_type* i = reinterpret_cast(impl); - return cast_helper(i->pointer(), tag(), dummy); -#else - return cast_helper(functor, tag(), dummy); -#endif // BOOST_FUNCTION_USE_VIRTUAL_FUNCTIONS - } - - template - const To& cast(To* dummy = 0) const - { - assert(typeid(To) != typeid(void)); - assert(typeid(To) == this->target_type()); - typedef typename detail::function::get_function_tag::type tag; - -#ifdef BOOST_FUNCTION_USE_VIRTUAL_FUNCTIONS - impl_type* i = reinterpret_cast(impl); - return cast_helper(i->pointer(), tag(), dummy); -#else - return cast_helper(functor, tag(), dummy); -#endif // BOOST_FUNCTION_USE_VIRTUAL_FUNCTIONS - } - private: - template - To& cast_helper(detail::function::any_pointer p, - detail::function::function_ptr_tag, - To* = 0) const - { - return reinterpret_cast(p.func_ptr); - } - - template - To& cast_helper(detail::function::any_pointer p, - detail::function::function_obj_tag, - To* = 0) const - { - return *static_cast(p.obj_ptr); - } - void assign_to_own(const BOOST_FUNCTION_FUNCTION& f) { if (!f.empty()) { @@ -838,36 +734,6 @@ namespace boost { >& f2) { f1.swap(f2); - } - - template - inline To& function_cast(BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS , - Policy, - Mixin, - Allocator - >& f, - To* dummy = 0) - { - return f.cast(dummy); - } - - template - inline const To& function_cast(const BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS , - Policy, - Mixin, - Allocator - >& f, - To* dummy = 0) - { - return f.cast(dummy); } }