diff --git a/include/boost/function.hpp b/include/boost/function.hpp index 62c47b8..d2f4aae 100644 --- a/include/boost/function.hpp +++ b/include/boost/function.hpp @@ -538,7 +538,7 @@ namespace boost { typename InMixin = empty_function_mixin, typename InAllocator = std::allocator > - class get_function_impl + struct get_function_impl { #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION typedef maybe_decode_function_args<(is_function::value), @@ -576,7 +576,7 @@ namespace boost { typedef InMixin Mixin; typedef InAllocator Allocator; #endif // def BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - public: + typedef typename real_get_function_impl< (count_used_args::value) >::template params - void set(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) + BOOST_FUNCTION_DEPRECATED_PRE + void set(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) { - int deprecated; + BOOST_FUNCTION_DEPRECATED_INNER self_type(f).swap(*this); } - void set(const base_type& f) + BOOST_FUNCTION_DEPRECATED_PRE + void set(const base_type& f) { - int deprecated; + BOOST_FUNCTION_DEPRECATED_INNER self_type(f).swap(*this); } + BOOST_FUNCTION_DEPRECATED_PRE void set(const self_type& f) { - int deprecated; + BOOST_FUNCTION_DEPRECATED_INNER self_type(f).swap(*this); } }; diff --git a/include/boost/function/function_base.hpp b/include/boost/function/function_base.hpp index 46d8863..72c1bce 100644 --- a/include/boost/function/function_base.hpp +++ b/include/boost/function/function_base.hpp @@ -31,6 +31,14 @@ # define BOOST_FUNCTION_TARGET_FIX(x) #endif // not MSVC +#if defined (BOOST_MSVC) && (BOOST_MSVC >= 1300) +# define BOOST_FUNCTION_DEPRECATED_PRE __declspec(deprecated) +# define BOOST_FUNCTION_DEPRECATED_INSIDE +#else +# define BOOST_FUNCTION_DEPRECATED_PRE +# define BOOST_FUNCTION_DEPRECATED_INSIDE int deprecated; +#endif + namespace boost { namespace detail { namespace function { diff --git a/include/boost/function/function_template.hpp b/include/boost/function/function_template.hpp index e7b2e6e..3ea16c8 100644 --- a/include/boost/function/function_template.hpp +++ b/include/boost/function/function_template.hpp @@ -322,9 +322,10 @@ namespace boost { } template + BOOST_FUNCTION_DEPRECATED_PRE void set(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) { - int deprecated; + BOOST_FUNCTION_DEPRECATED_INNER self_type(f, static_cast(*this)).swap(*this); } @@ -339,9 +340,10 @@ namespace boost { } // Assignment from another BOOST_FUNCTION_FUNCTION + BOOST_FUNCTION_DEPRECATED_PRE void set(const BOOST_FUNCTION_FUNCTION& f) { - int deprecated; + BOOST_FUNCTION_DEPRECATED_INNER if (&f == this) return;