mirror of
https://github.com/boostorg/function.git
synced 2025-07-23 17:37:14 +02:00
function_base.hpp:
- Use <boost/pending/ct_if.hpp> all: - Add BOOST_FUNCTION_NO_DEPRECATED macro hackery to get rid of ALL deprecated features [SVN r14685]
This commit is contained in:
@ -36,6 +36,11 @@
|
||||
#include <boost/function/function9.hpp>
|
||||
#include <boost/function/function10.hpp>
|
||||
|
||||
// Don't compile any of this code if we've asked not to include the deprecated
|
||||
// syntax and we don't have partial specialization, because none of this code
|
||||
// can work.
|
||||
#if !defined (BOOST_FUNCTION_NO_DEPRECATED) || !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace function {
|
||||
@ -57,13 +62,19 @@ namespace boost {
|
||||
typename T8,
|
||||
typename T9,
|
||||
typename T10,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Policy,
|
||||
typename Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Allocator
|
||||
>
|
||||
struct params
|
||||
{
|
||||
typedef function0<R, Policy, Mixin, Allocator> type;
|
||||
typedef function0<R,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Policy, Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Allocator> type;
|
||||
};
|
||||
};
|
||||
|
||||
@ -82,13 +93,19 @@ namespace boost {
|
||||
typename T8,
|
||||
typename T9,
|
||||
typename T10,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Policy,
|
||||
typename Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Allocator
|
||||
>
|
||||
struct params
|
||||
{
|
||||
typedef function1<R, T1, Policy, Mixin, Allocator> type;
|
||||
typedef function1<R, T1,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Policy, Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Allocator> type;
|
||||
};
|
||||
};
|
||||
|
||||
@ -107,13 +124,19 @@ namespace boost {
|
||||
typename T8,
|
||||
typename T9,
|
||||
typename T10,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Policy,
|
||||
typename Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Allocator
|
||||
>
|
||||
struct params
|
||||
{
|
||||
typedef function2<R, T1, T2, Policy, Mixin, Allocator> type;
|
||||
typedef function2<R, T1, T2,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Policy, Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Allocator> type;
|
||||
};
|
||||
};
|
||||
|
||||
@ -132,13 +155,19 @@ namespace boost {
|
||||
typename T8,
|
||||
typename T9,
|
||||
typename T10,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Policy,
|
||||
typename Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Allocator
|
||||
>
|
||||
struct params
|
||||
{
|
||||
typedef function3<R, T1, T2, T3, Policy, Mixin, Allocator> type;
|
||||
typedef function3<R, T1, T2, T3,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Policy, Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Allocator> type;
|
||||
};
|
||||
};
|
||||
|
||||
@ -157,13 +186,19 @@ namespace boost {
|
||||
typename T8,
|
||||
typename T9,
|
||||
typename T10,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Policy,
|
||||
typename Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Allocator
|
||||
>
|
||||
struct params
|
||||
{
|
||||
typedef function4<R, T1, T2, T3, T4, Policy, Mixin, Allocator> type;
|
||||
typedef function4<R, T1, T2, T3, T4,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Policy, Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Allocator> type;
|
||||
};
|
||||
};
|
||||
|
||||
@ -182,13 +217,19 @@ namespace boost {
|
||||
typename T8,
|
||||
typename T9,
|
||||
typename T10,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Policy,
|
||||
typename Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Allocator
|
||||
>
|
||||
struct params
|
||||
{
|
||||
typedef function5<R, T1, T2, T3, T4, T5, Policy, Mixin, Allocator>
|
||||
typedef function5<R, T1, T2, T3, T4, T5,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Policy, Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Allocator>
|
||||
type;
|
||||
};
|
||||
};
|
||||
@ -208,13 +249,19 @@ namespace boost {
|
||||
typename T8,
|
||||
typename T9,
|
||||
typename T10,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Policy,
|
||||
typename Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Allocator
|
||||
>
|
||||
struct params
|
||||
{
|
||||
typedef function6<R, T1, T2, T3, T4, T5, T6, Policy, Mixin, Allocator>
|
||||
typedef function6<R, T1, T2, T3, T4, T5, T6,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Policy, Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Allocator>
|
||||
type;
|
||||
};
|
||||
};
|
||||
@ -234,13 +281,18 @@ namespace boost {
|
||||
typename T8,
|
||||
typename T9,
|
||||
typename T10,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Policy,
|
||||
typename Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Allocator
|
||||
>
|
||||
struct params
|
||||
{
|
||||
typedef function7<R, T1, T2, T3, T4, T5, T6, T7, Policy, Mixin,
|
||||
typedef function7<R, T1, T2, T3, T4, T5, T6, T7,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Policy, Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Allocator> type;
|
||||
};
|
||||
};
|
||||
@ -260,13 +312,18 @@ namespace boost {
|
||||
typename T8,
|
||||
typename T9,
|
||||
typename T10,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Policy,
|
||||
typename Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Allocator
|
||||
>
|
||||
struct params
|
||||
{
|
||||
typedef function8<R, T1, T2, T3, T4, T5, T6, T7, T8, Policy, Mixin,
|
||||
typedef function8<R, T1, T2, T3, T4, T5, T6, T7, T8,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Policy, Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Allocator> type;
|
||||
};
|
||||
};
|
||||
@ -286,14 +343,19 @@ namespace boost {
|
||||
typename T8,
|
||||
typename T9,
|
||||
typename T10,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Policy,
|
||||
typename Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Allocator
|
||||
>
|
||||
struct params
|
||||
{
|
||||
typedef function9<R, T1, T2, T3, T4, T5, T6, T7, T8, T9, Policy,
|
||||
Mixin, Allocator> type;
|
||||
typedef function9<R, T1, T2, T3, T4, T5, T6, T7, T8, T9,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Policy, Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Allocator> type;
|
||||
};
|
||||
};
|
||||
|
||||
@ -312,14 +374,19 @@ namespace boost {
|
||||
typename T8,
|
||||
typename T9,
|
||||
typename T10,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Policy,
|
||||
typename Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Allocator
|
||||
>
|
||||
struct params
|
||||
{
|
||||
typedef function10<R, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
|
||||
Policy, Mixin, Allocator> type;
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Policy, Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Allocator> type;
|
||||
};
|
||||
};
|
||||
|
||||
@ -456,45 +523,12 @@ namespace boost {
|
||||
typename InT8,
|
||||
typename InT9,
|
||||
typename InT10,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename InPolicy,
|
||||
typename InMixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename InAllocator>
|
||||
struct maybe_decode_function_args
|
||||
{
|
||||
// Not a function, so just map the types directly
|
||||
typedef InR R;
|
||||
typedef InT1 T1;
|
||||
typedef InT2 T2;
|
||||
typedef InT3 T3;
|
||||
typedef InT4 T4;
|
||||
typedef InT5 T5;
|
||||
typedef InT6 T6;
|
||||
typedef InT7 T7;
|
||||
typedef InT8 T8;
|
||||
typedef InT9 T9;
|
||||
typedef InT10 T10;
|
||||
typedef InPolicy Policy;
|
||||
typedef InMixin Mixin;
|
||||
typedef InAllocator Allocator;
|
||||
};
|
||||
|
||||
template<typename InR,
|
||||
typename InT1,
|
||||
typename InT2,
|
||||
typename InT3,
|
||||
typename InT4,
|
||||
typename InT5,
|
||||
typename InT6,
|
||||
typename InT7,
|
||||
typename InT8,
|
||||
typename InT9,
|
||||
typename InT10,
|
||||
typename InPolicy,
|
||||
typename InMixin,
|
||||
typename InAllocator>
|
||||
struct maybe_decode_function_args<true, InR, InT1, InT2, InT3, InT4,
|
||||
InT5, InT6, InT7, InT8, InT9, InT10,
|
||||
InPolicy, InMixin, InAllocator>
|
||||
{
|
||||
typedef function_traits<InR> traits;
|
||||
|
||||
@ -509,6 +543,7 @@ namespace boost {
|
||||
typedef typename get_arg8_type<(traits::arity >= 8), traits>::type T8;
|
||||
typedef typename get_arg9_type<(traits::arity >= 9), traits>::type T9;
|
||||
typedef typename get_arg10_type<(traits::arity >= 10), traits>::type T10;
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typedef typename ct_if<(is_same<InT1, unusable>::value),
|
||||
empty_function_policy,
|
||||
InT1>::type Policy;
|
||||
@ -518,8 +553,58 @@ namespace boost {
|
||||
typedef typename ct_if<(is_same<InT3, unusable>::value),
|
||||
std::allocator<function_base>,
|
||||
InT3>::type Allocator;
|
||||
#else
|
||||
typedef typename ct_if<(is_same<InT1, unusable>::value),
|
||||
std::allocator<function_base>,
|
||||
InT1>::type Allocator;
|
||||
#endif // BOOST_FUNCTION_NO_DEPRECATED
|
||||
};
|
||||
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
template<typename InR,
|
||||
typename InT1,
|
||||
typename InT2,
|
||||
typename InT3,
|
||||
typename InT4,
|
||||
typename InT5,
|
||||
typename InT6,
|
||||
typename InT7,
|
||||
typename InT8,
|
||||
typename InT9,
|
||||
typename InT10,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename InPolicy,
|
||||
typename InMixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename InAllocator>
|
||||
struct maybe_decode_function_args<false, InR, InT1, InT2, InT3, InT4,
|
||||
InT5, InT6, InT7, InT8, InT9, InT10,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
InPolicy, InMixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
InAllocator>
|
||||
{
|
||||
// Not a function, so just map the types directly
|
||||
typedef InR R;
|
||||
typedef InT1 T1;
|
||||
typedef InT2 T2;
|
||||
typedef InT3 T3;
|
||||
typedef InT4 T4;
|
||||
typedef InT5 T5;
|
||||
typedef InT6 T6;
|
||||
typedef InT7 T7;
|
||||
typedef InT8 T8;
|
||||
typedef InT9 T9;
|
||||
typedef InT10 T10;
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typedef InPolicy Policy;
|
||||
typedef InMixin Mixin;
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typedef InAllocator Allocator;
|
||||
|
||||
};
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
|
||||
#endif // ndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
template<
|
||||
@ -544,8 +629,10 @@ namespace boost {
|
||||
typedef maybe_decode_function_args<(is_function<InR>::value),
|
||||
InR, InT1, InT2, InT3, InT4, InT5,
|
||||
InT6, InT7, InT8, InT9, InT10,
|
||||
InPolicy, InMixin, InAllocator>
|
||||
decoder;
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
InPolicy, InMixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
InAllocator> decoder;
|
||||
typedef typename decoder::R R;
|
||||
typedef typename decoder::T1 T1;
|
||||
typedef typename decoder::T2 T2;
|
||||
@ -557,8 +644,10 @@ namespace boost {
|
||||
typedef typename decoder::T8 T8;
|
||||
typedef typename decoder::T9 T9;
|
||||
typedef typename decoder::T10 T10;
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typedef typename decoder::Policy Policy;
|
||||
typedef typename decoder::Mixin Mixin;
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typedef typename decoder::Allocator Allocator;
|
||||
#else
|
||||
typedef InR R;
|
||||
@ -580,10 +669,14 @@ namespace boost {
|
||||
typedef typename real_get_function_impl<
|
||||
(count_used_args<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>::value)
|
||||
>::template params<R, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
|
||||
Policy, Mixin, Allocator>::type
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Policy, Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Allocator>::type
|
||||
type;
|
||||
};
|
||||
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
template<
|
||||
typename InR,
|
||||
typename InT1,
|
||||
@ -676,9 +769,9 @@ namespace boost {
|
||||
Allocator>::type
|
||||
type;
|
||||
};
|
||||
#endif
|
||||
#endif // ndef NO_DEPENDENT_NESTED_DERIVATIONS
|
||||
};
|
||||
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
} // end namespace function
|
||||
} // end namespace detail
|
||||
|
||||
@ -697,9 +790,11 @@ namespace boost {
|
||||
>
|
||||
class function :
|
||||
public detail::function::get_function_impl<R, T1, T2, T3, T4, T5, T6, T7,
|
||||
T8, T9, T10>::type,
|
||||
public detail::function::function_traits_builder<R, T1, T2, T3, T4, T5, T6,
|
||||
T7, T8, T9, T10>
|
||||
T8, T9, T10>::type
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
, public detail::function::function_traits_builder<R, T1, T2, T3, T4, T5,
|
||||
T6, T7, T8, T9, T10>
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
{
|
||||
typedef typename detail::function::get_function_impl<R, T1, T2, T3, T4, T5,
|
||||
T6, T7, T8, T9, T10
|
||||
@ -707,8 +802,10 @@ namespace boost {
|
||||
base_type;
|
||||
|
||||
public:
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typedef typename base_type::policy_type policy_type;
|
||||
typedef typename base_type::mixin_type mixin_type;
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typedef typename base_type::allocator_type allocator_type;
|
||||
typedef function self_type;
|
||||
|
||||
@ -738,27 +835,29 @@ namespace boost {
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
template<typename Functor>
|
||||
BOOST_FUNCTION_DEPRECATED_PRE
|
||||
void set(Functor BOOST_FUNCTION_TARGET_FIX(const &) f)
|
||||
void set(Functor BOOST_FUNCTION_TARGET_FIX(const &) f)
|
||||
{
|
||||
BOOST_FUNCTION_DEPRECATED_INNER
|
||||
self_type(f).swap(*this);
|
||||
}
|
||||
|
||||
BOOST_FUNCTION_DEPRECATED_PRE
|
||||
BOOST_FUNCTION_DEPRECATED_PRE
|
||||
void set(const base_type& f)
|
||||
{
|
||||
BOOST_FUNCTION_DEPRECATED_INNER
|
||||
self_type(f).swap(*this);
|
||||
}
|
||||
|
||||
BOOST_FUNCTION_DEPRECATED_PRE
|
||||
BOOST_FUNCTION_DEPRECATED_PRE
|
||||
void set(const self_type& f)
|
||||
{
|
||||
BOOST_FUNCTION_DEPRECATED_INNER
|
||||
self_type(f).swap(*this);
|
||||
}
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
};
|
||||
|
||||
template<typename R,
|
||||
@ -779,4 +878,6 @@ namespace boost {
|
||||
}
|
||||
} // end namespace boost
|
||||
|
||||
#endif // !no deprecated || !no partial specialization
|
||||
|
||||
#endif
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/pending/ct_if.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__ICL) && __ICL <= 600 || defined(__MWERKS__) && __MWERKS__ < 0x2406
|
||||
# define BOOST_FUNCTION_TARGET_FIX(x) x
|
||||
@ -33,58 +34,15 @@
|
||||
|
||||
#if defined (BOOST_MSVC) && (BOOST_MSVC >= 1300)
|
||||
# define BOOST_FUNCTION_DEPRECATED_PRE __declspec(deprecated)
|
||||
# define BOOST_FUNCTION_DEPRECATED_INSIDE
|
||||
# define BOOST_FUNCTION_DEPRECATED_INNER
|
||||
#else
|
||||
# define BOOST_FUNCTION_DEPRECATED_PRE
|
||||
# define BOOST_FUNCTION_DEPRECATED_INSIDE int deprecated;
|
||||
# define BOOST_FUNCTION_DEPRECATED_INNER int deprecated;
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace function {
|
||||
/*
|
||||
* The ct_if implementation is temporary code. When a Boost metaprogramming
|
||||
* library is introduced, Boost.Function will use it instead.
|
||||
*/
|
||||
namespace intimate {
|
||||
struct SelectThen
|
||||
{
|
||||
template<typename Then, typename Else>
|
||||
struct Result
|
||||
{
|
||||
typedef Then type;
|
||||
};
|
||||
};
|
||||
|
||||
struct SelectElse
|
||||
{
|
||||
template<typename Then, typename Else>
|
||||
struct Result
|
||||
{
|
||||
typedef Else type;
|
||||
};
|
||||
};
|
||||
|
||||
template<bool Condition>
|
||||
struct Selector
|
||||
{
|
||||
typedef SelectThen type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Selector<false>
|
||||
{
|
||||
typedef SelectElse type;
|
||||
};
|
||||
} // end namespace intimate
|
||||
|
||||
template<bool Condition, typename Then, typename Else>
|
||||
struct ct_if
|
||||
{
|
||||
typedef typename intimate::Selector<Condition>::type select;
|
||||
typedef typename select::template Result<Then,Else>::type type;
|
||||
};
|
||||
|
||||
/**
|
||||
* A union of a function pointer and a void pointer. This is necessary
|
||||
* because 5.2.10/6 allows reinterpret_cast<> to safely cast between
|
||||
|
@ -229,11 +229,16 @@ namespace boost {
|
||||
template<
|
||||
typename R BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_TEMPLATE_PARMS,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Policy = empty_function_policy,
|
||||
typename Mixin = empty_function_mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Allocator = BOOST_FUNCTION_DEFAULT_ALLOCATOR
|
||||
>
|
||||
class BOOST_FUNCTION_FUNCTION : public function_base, public Mixin
|
||||
class BOOST_FUNCTION_FUNCTION : public function_base
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
, public Mixin
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
{
|
||||
typedef typename detail::function::function_return_type<R>::type
|
||||
internal_result_type;
|
||||
@ -253,36 +258,58 @@ namespace boost {
|
||||
#else
|
||||
typedef internal_result_type result_type;
|
||||
#endif // BOOST_NO_VOID_RETURNS
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typedef Policy policy_type;
|
||||
typedef Mixin mixin_type;
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typedef Allocator allocator_type;
|
||||
typedef BOOST_FUNCTION_FUNCTION self_type;
|
||||
|
||||
BOOST_FUNCTION_FUNCTION() : function_base(), Mixin(), invoker(0) {}
|
||||
BOOST_FUNCTION_FUNCTION() : function_base()
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
, Mixin()
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
, invoker(0) {}
|
||||
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
explicit BOOST_FUNCTION_FUNCTION(const Mixin& m) :
|
||||
function_base(), Mixin(m), invoker(0)
|
||||
function_base(),
|
||||
Mixin(m),
|
||||
invoker(0)
|
||||
{
|
||||
}
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
|
||||
// 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) :
|
||||
function_base(), Mixin(), invoker(0)
|
||||
function_base(),
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Mixin(),
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
invoker(0)
|
||||
{
|
||||
this->assign_to(f);
|
||||
}
|
||||
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
template<typename Functor>
|
||||
BOOST_FUNCTION_FUNCTION(Functor f, const Mixin& m) :
|
||||
function_base(), Mixin(m), invoker(0)
|
||||
function_base(),
|
||||
Mixin(m),
|
||||
invoker(0)
|
||||
{
|
||||
this->assign_to(f);
|
||||
}
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
|
||||
BOOST_FUNCTION_FUNCTION(const BOOST_FUNCTION_FUNCTION& f) :
|
||||
function_base(), Mixin(static_cast<const Mixin&>(f)), invoker(0)
|
||||
function_base(),
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Mixin(static_cast<const Mixin&>(f)),
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
invoker(0)
|
||||
{
|
||||
this->assign_to_own(f);
|
||||
}
|
||||
@ -293,14 +320,19 @@ namespace boost {
|
||||
{
|
||||
assert(!this->empty());
|
||||
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
policy_type policy;
|
||||
policy.precall(this);
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
|
||||
internal_result_type result = invoker(function_base::functor
|
||||
BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_ARGS);
|
||||
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
policy.postcall(this);
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
|
||||
#ifndef BOOST_NO_VOID_RETURNS
|
||||
return static_cast<result_type>(result);
|
||||
#else
|
||||
@ -317,17 +349,23 @@ namespace boost {
|
||||
BOOST_FUNCTION_FUNCTION&
|
||||
operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f)
|
||||
{
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
self_type(f, static_cast<const Mixin&>(*this)).swap(*this);
|
||||
#else
|
||||
self_type(f).swap(*this);
|
||||
#endif // BOOST_FUNCTION_NO_DEPRECATED
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
template<typename Functor>
|
||||
BOOST_FUNCTION_DEPRECATED_PRE
|
||||
BOOST_FUNCTION_DEPRECATED_PRE
|
||||
void set(Functor BOOST_FUNCTION_TARGET_FIX(const &) f)
|
||||
{
|
||||
BOOST_FUNCTION_DEPRECATED_INNER
|
||||
self_type(f, static_cast<const Mixin&>(*this)).swap(*this);
|
||||
}
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
|
||||
// Assignment from another BOOST_FUNCTION_FUNCTION
|
||||
BOOST_FUNCTION_FUNCTION& operator=(const BOOST_FUNCTION_FUNCTION& f)
|
||||
@ -339,8 +377,9 @@ namespace boost {
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
// Assignment from another BOOST_FUNCTION_FUNCTION
|
||||
BOOST_FUNCTION_DEPRECATED_PRE
|
||||
BOOST_FUNCTION_DEPRECATED_PRE
|
||||
void set(const BOOST_FUNCTION_FUNCTION& f)
|
||||
{
|
||||
BOOST_FUNCTION_DEPRECATED_INNER
|
||||
@ -349,6 +388,7 @@ namespace boost {
|
||||
|
||||
self_type(f).swap(*this);
|
||||
}
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
|
||||
void swap(BOOST_FUNCTION_FUNCTION& other)
|
||||
{
|
||||
@ -358,7 +398,9 @@ namespace boost {
|
||||
std::swap(function_base::manager, other.manager);
|
||||
std::swap(function_base::functor, other.functor);
|
||||
std::swap(invoker, other.invoker);
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
std::swap(static_cast<Mixin&>(*this), static_cast<Mixin&>(other));
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
}
|
||||
|
||||
// Clear out a target, if there is one
|
||||
@ -506,19 +548,26 @@ namespace boost {
|
||||
};
|
||||
|
||||
template<typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS ,
|
||||
typename Policy, typename Mixin, typename Allocator>
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Policy, typename Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
typename Allocator>
|
||||
inline void swap(BOOST_FUNCTION_FUNCTION<
|
||||
R BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_TEMPLATE_ARGS ,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Policy,
|
||||
Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Allocator
|
||||
>& f1,
|
||||
BOOST_FUNCTION_FUNCTION<
|
||||
R BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_TEMPLATE_ARGS,
|
||||
#ifndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Policy,
|
||||
Mixin,
|
||||
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
|
||||
Allocator
|
||||
>& f2)
|
||||
{
|
||||
|
Reference in New Issue
Block a user