diff --git a/doc/reference.html b/doc/reference.html
index 51d73e6..4740e4b 100644
--- a/doc/reference.html
+++ b/doc/reference.html
@@ -13,9 +13,8 @@
namespace boost {
- class function_base
+ class function_base // Deprecated
{
- typedef implementation-defined safe_bool;
bool empty() const;
};
@@ -25,14 +24,13 @@
typename Arg2,
...
typename ArgN,
- typename Policy = empty_function_policy, // Deprecated
- typename Mixin = empty_function_mixin, // Deprecated
- typename Allocator = std::allocator<function_base> >
- class functionN : public function_base, public Mixin
+ typename Allocator = std::allocator<void> >
+ class functionN : public function_base
{
+ typedef implementation-defined safe_bool;
+
+ public:
typedef ResultType result_type; // [1]
- typedef Policy policy_type; // Deprecated
- typedef Mixin mixin_type; // Deprecated
typedef Allocator allocator_type;
typedef Arg1 argument_type; // If N == 1
@@ -50,17 +48,15 @@
enum { arity = N };
// Construction
- explicit functionN(const Mixin& = Mixin());
+ explicit functionN();
functionN(const functionN&);
- template<typename F> functionN(F, const Mixin& = Mixin());
+ template<typename F> functionN(F);
template<typename F> functionN(reference_wrapper<F>);
// Assignment
functionN& operator=(const functionN&);
template<typename F> functionN& operator=(F);
template<typename F> functionN& operator=(reference_wrapper<F>);
- void set(const functionN&); // Deprecated
- template<typename F> void set(F); // Deprecated
void swap(functionN&);
void clear();
@@ -77,37 +73,30 @@
typename Arg2,
...
typename ArgN,
- typename Policy, // Deprecated
- typename Mixin, // Deprecated
typename Allocator>
- void swap(functionN<ResultType, Arg1, Arg2, ..., ArgN, Policy, Mixin, Allocator>&,
- functionN<ResultType, Arg1, Arg2, ..., ArgN, Policy, Mixin, Allocator>&);
+ void swap(functionN<ResultType, Arg1, Arg2, ..., ArgN, Allocator>&,
+ functionN<ResultType, Arg1, Arg2, ..., ArgN, Allocator>&);
// For any N in [0, MAX_ARGS]
template<typename Signature, // Function type: ResultType (Arg1, Arg2, ..., ArgN)
- typename Policy = empty_function_policy, // Deprecated
- typename Mixin = empty_function_mixin, // Deprecated
- typename Allocator = std::allocator<function_base> >
- class function : public functionN<ResultType, Arg1, Arg2, ..., ArgN>
+ typename Allocator = std::allocator<void> >
+ class function : public functionN<ResultType, Arg1, Arg2, ..., ArgN, Allocator>
{
// Construction
function();
function(const function&);
- function(const functionN<ResultType, Arg1, Arg2, ..., ArgN>&);
+ function(const functionN<ResultType, Arg1, Arg2, ..., ArgN, Allocator>&);
template<typename F> functionN(F);
// Assignment
function& operator=(const function&);
- function& operator=(const functionN<ResultType, Arg1, Arg2, ..., ArgN>&);
+ function& operator=(const functionN<ResultType, Arg1, Arg2, ..., ArgN, Allocator>&);
template<typename F> function& operator=(F);
- void set(const function&); // Deprecated
- void set(const functionN<ResultType, Arg1, Arg2, ..., ArgN>&); // Deprecated
- template<typename F> void set(F); // Deprecated
};
- template<typename Signature, typename Policy, typename Mixin, typename Allocator>
- void swap(function<Signature, Policy, Mixin, Allocator>&,
- function<Signature, Policy, Mixin, Allocator>&);
+ template<typename Signature, typename Allocator>
+ void swap(function<Signature, Allocator>&,
+ function<Signature, Allocator>&);
}
@@ -141,7 +130,7 @@
Class function_base
is the common base class for all Boost.Function objects. Objects of type function_base
may not be created directly.
-
+
Note: the use of this class by users is deprecated. This class will become an implementation detail in the future.
bool empty() const
- Returns:
true
if the function object has a target, false
otherwise.
@@ -151,40 +140,37 @@
Class template functionN
is actually a family of related classes function0
, function1
, etc., up to some implementation-defined maximum. In this context, N
refers to the number of parameters and f
refers to the implicit object parameter.
-
explicit functionN(const Mixin& = Mixin());
+
explicit functionN();
- - Effects: Constructs the
Mixin
subobject with the given mixin.
- Postconditions:
f.empty()
.
- - Throws: will not throw unless construction of the
Mixin
subobject throws.
+ - Throws: will not throw.
functionN(const functionN& g);
- - Postconditions:
f
contains a copy of the g
's target, if it has one, or is empty if g.empty()
. The mixin for the f
is copy-constructed from the mixin of g
.
- - Throws: will not throw unless copying the target of
g
or construction of the Mixin
subobject throws.
+ - Postconditions:
f
contains a copy of the g
's target, if it has one, or is empty if g.empty()
.
+ - Throws: will not throw unless copying the target of
g
throws.
- template<typename F> functionN(F g, const Mixin& = Mixin());
+
template<typename F> functionN(F g);
- Requires:
g
is a compatible function object.
- - Effects: Constructs the
Mixin
subobject from the given mixin.
- Postconditions:
f
targets a copy of g
if g
is nonempty, or f.empty()
if g
is empty.
- - Throws: will not throw when
g
is a stateless function object unless construction of the Mixin
subobject throws.
+ - Throws: will not throw when
g
is stateless; otherwise, may throw when a copy of g
is made.
template<typename F> functionN(reference_wrapper<F> g);
- Requires:
g.get()
is a compatible function object.
- - Effects: Constructs the
Mixin
subobject from the given mixin.
- Postconditions:
this
object targets g
(not a copy of g.get()
) if g.get()
is nonempty, or this->empty()
if g.get()
is empty.
- - Throws: will not throw unless the construction of the
Mixin
subobject throws.
+ - Throws: will not throw.
functionN& operator=(const functionN& g);
- - Postconditions:
f
targets a copy of g
's target, if it has one, or is empty if g.empty()
. The mixin for f
is assigned the value of the mixin for g
.
+ - Postconditions:
f
targets a copy of g
's target, if it has one, or is empty if g.empty()
.
- Returns:
*this
.
- - Throws: will not throw when the target of
g
is a stateless function object or a reference to the function object, unless the copy of the Mixin
subobject throws.
+ - Throws: will not throw when the target of
g
is a stateless function object or a reference to the function object.
template<typename F> functionN& operator=(F g);
@@ -203,21 +189,9 @@
- Throws: will throw only if the destruction or deallocation of the target of
this
throws.
- void set(const functionN& g);
-
- - Effects:
*this = g
.
- - Note: This function is deprecated and will be removed in future versions of Boost.Function. Please use the assignment operator instead.
-
-
- template<typename F> void set(F g);
-
- - Effects:
*this = g
.
- - Note: This function is deprecated and will be removed in future versions of Boost.Function. Please use the assignment operator instead.
-
-
void swap(functionN& g);
- - Effects: interchanges the targets of
f
and g
and swaps the mixins of f
and g
.
+ - Effects: interchanges the targets of
f
and g
.
- Throws: will not throw.
@@ -267,11 +241,9 @@
typename Arg2,
...
typename ArgN,
- typename Policy, // Deprecated
- typename Mixin, // Deprecated
typename Allocator>
-void swap(functionN<ResultType, Arg1, Arg2, ..., ArgN, Policy, Mixin, Allocator>& f,
- functionN<ResultType, Arg1, Arg2, ..., ArgN, Policy, Mixin, Allocator>& g);
+void swap(functionN<ResultType, Arg1, Arg2, ..., ArgN, Allocator>& f,
+ functionN<ResultType, Arg1, Arg2, ..., ArgN, Allocator>& g);
- Effects:
f.swap(g);
@@ -279,9 +251,9 @@
-template<typename Signature, typename Policy, typename Mixin, typename Allocator>
-void swap(function<Signature, Policy, Mixin, Allocator>& f,
- function<Signature, Policy, Mixin, Allocator>& g);
+template<typename Signature, typename Allocator>
+void swap(function<Signature, Allocator>& f,
+ function<Signature, Allocator>& g);
- Effects:
f.swap(g);
diff --git a/include/boost/function.hpp b/include/boost/function.hpp
index 53cdb1a..fd8a20f 100644
--- a/include/boost/function.hpp
+++ b/include/boost/function.hpp
@@ -16,885 +16,17 @@
// William Kempf, Jesse Jones and Karl Nelson were all very helpful in the
// design of this library.
-#ifndef BOOST_FUNCTION_HPP
-#define BOOST_FUNCTION_HPP
+#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
+#ifndef BOOST_FUNCTION_MAX_ARGS
+# define BOOST_FUNCTION_MAX_ARGS 10
+#endif // BOOST_FUNCTION_MAX_ARGS
-// 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)
+// Include the prologue here so that the use of file-level iteration
+// in anything that may be included by function_template.hpp doesn't break
+#include
-namespace boost {
- namespace detail {
- namespace function {
- // Choose the appropriate underlying implementation
- template struct real_get_function_impl {};
+// What is the '3' for?
+#define BOOST_PP_ITERATION_PARAMS_1 (3,(0,BOOST_FUNCTION_MAX_ARGS,))
+#include BOOST_PP_ITERATE()
- template<>
- struct real_get_function_impl<0>
- {
- template<
- typename R,
- typename T1,
- typename T2,
- typename T3,
- typename T4,
- typename T5,
- typename T6,
- typename T7,
- 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 type;
- };
- };
-
- template<>
- struct real_get_function_impl<1>
- {
- template<
- typename R,
- typename T1,
- typename T2,
- typename T3,
- typename T4,
- typename T5,
- typename T6,
- typename T7,
- 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 type;
- };
- };
-
- template<>
- struct real_get_function_impl<2>
- {
- template<
- typename R,
- typename T1,
- typename T2,
- typename T3,
- typename T4,
- typename T5,
- typename T6,
- typename T7,
- 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 type;
- };
- };
-
- template<>
- struct real_get_function_impl<3>
- {
- template<
- typename R,
- typename T1,
- typename T2,
- typename T3,
- typename T4,
- typename T5,
- typename T6,
- typename T7,
- 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 type;
- };
- };
-
- template<>
- struct real_get_function_impl<4>
- {
- template<
- typename R,
- typename T1,
- typename T2,
- typename T3,
- typename T4,
- typename T5,
- typename T6,
- typename T7,
- 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 type;
- };
- };
-
- template<>
- struct real_get_function_impl<5>
- {
- template<
- typename R,
- typename T1,
- typename T2,
- typename T3,
- typename T4,
- typename T5,
- typename T6,
- typename T7,
- 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
- type;
- };
- };
-
- template<>
- struct real_get_function_impl<6>
- {
- template<
- typename R,
- typename T1,
- typename T2,
- typename T3,
- typename T4,
- typename T5,
- typename T6,
- typename T7,
- 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
- type;
- };
- };
-
- template<>
- struct real_get_function_impl<7>
- {
- template<
- typename R,
- typename T1,
- typename T2,
- typename T3,
- typename T4,
- typename T5,
- typename T6,
- typename T7,
- 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 type;
- };
- };
-
- template<>
- struct real_get_function_impl<8>
- {
- template<
- typename R,
- typename T1,
- typename T2,
- typename T3,
- typename T4,
- typename T5,
- typename T6,
- typename T7,
- 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 type;
- };
- };
-
- template<>
- struct real_get_function_impl<9>
- {
- template<
- typename R,
- typename T1,
- typename T2,
- typename T3,
- typename T4,
- typename T5,
- typename T6,
- typename T7,
- 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 type;
- };
- };
-
- template<>
- struct real_get_function_impl<10>
- {
- template<
- typename R,
- typename T1,
- typename T2,
- typename T3,
- typename T4,
- typename T5,
- typename T6,
- typename T7,
- 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 type;
- };
- };
-
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
- template
- struct get_arg1_type
- {
- typedef unusable type;
- };
-
- template
- struct get_arg1_type
- {
- typedef typename Traits::arg1_type type;
- };
-
- template
- struct get_arg2_type
- {
- typedef unusable type;
- };
-
- template
- struct get_arg2_type
- {
- typedef typename Traits::arg2_type type;
- };
-
- template
- struct get_arg3_type
- {
- typedef unusable type;
- };
-
- template
- struct get_arg3_type
- {
- typedef typename Traits::arg3_type type;
- };
-
- template
- struct get_arg4_type
- {
- typedef unusable type;
- };
-
- template
- struct get_arg4_type
- {
- typedef typename Traits::arg4_type type;
- };
-
- template
- struct get_arg5_type
- {
- typedef unusable type;
- };
-
- template
- struct get_arg5_type
- {
- typedef typename Traits::arg5_type type;
- };
-
- template
- struct get_arg6_type
- {
- typedef unusable type;
- };
-
- template
- struct get_arg6_type
- {
- typedef typename Traits::arg6_type type;
- };
-
- template
- struct get_arg7_type
- {
- typedef unusable type;
- };
-
- template
- struct get_arg7_type
- {
- typedef typename Traits::arg7_type type;
- };
-
- template
- struct get_arg8_type
- {
- typedef unusable type;
- };
-
- template
- struct get_arg8_type
- {
- typedef typename Traits::arg8_type type;
- };
-
- template
- struct get_arg9_type
- {
- typedef unusable type;
- };
-
- template
- struct get_arg9_type
- {
- typedef typename Traits::arg9_type type;
- };
-
- template
- struct get_arg10_type
- {
- typedef unusable type;
- };
-
- template
- struct get_arg10_type
- {
- typedef typename Traits::arg10_type type;
- };
-
- template
- struct gte
- {
- BOOST_STATIC_CONSTANT(bool, value = (X >= Y));
- };
-
- template
- struct maybe_decode_function_args
- {
- typedef function_traits traits;
-
- typedef typename traits::result_type R;
- typedef typename get_arg1_type<(gte<(traits::arity), 1>::value),
- traits>::type T1;
- typedef typename get_arg2_type<(gte<(traits::arity), 2>::value),
- traits>::type T2;
- typedef typename get_arg3_type<(gte<(traits::arity), 3>::value),
- traits>::type T3;
- typedef typename get_arg4_type<(gte<(traits::arity), 4>::value),
- traits>::type T4;
- typedef typename get_arg5_type<(gte<(traits::arity), 5>::value),
- traits>::type T5;
- typedef typename get_arg6_type<(gte<(traits::arity), 6>::value),
- traits>::type T6;
- typedef typename get_arg7_type<(gte<(traits::arity), 7>::value),
- traits>::type T7;
- typedef typename get_arg8_type<(gte<(traits::arity), 8>::value),
- traits>::type T8;
- typedef typename get_arg9_type<(gte<(traits::arity), 9>::value),
- traits>::type T9;
- typedef typename get_arg10_type<(gte<(traits::arity), 10>::value),
- traits>::type T10;
-
-#ifndef BOOST_FUNCTION_NO_DEPRECATED
- typedef typename ct_if<(is_same::value),
- empty_function_policy,
- InT1>::type Policy;
- typedef typename ct_if<(is_same::value),
- empty_function_mixin,
- InT2>::type Mixin;
- typedef typename ct_if<(is_same::value),
- std::allocator,
- InT3>::type Allocator;
-#else
- typedef typename ct_if<(is_same::value),
- std::allocator,
- InT1>::type Allocator;
-#endif // BOOST_FUNCTION_NO_DEPRECATED
- };
-
-#ifndef BOOST_FUNCTION_NO_DEPRECATED
- template
- 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;
-#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<
- typename InR,
- typename InT1,
- typename InT2,
- typename InT3,
- typename InT4,
- typename InT5,
- typename InT6,
- typename InT7,
- typename InT8,
- typename InT9,
- typename InT10,
- typename InPolicy = empty_function_policy,
- typename InMixin = empty_function_mixin,
- typename InAllocator = std::allocator
- >
- struct get_function_impl
- {
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
- typedef maybe_decode_function_args<(is_function::value),
- 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> decoder;
- typedef typename decoder::R R;
- typedef typename decoder::T1 T1;
- typedef typename decoder::T2 T2;
- typedef typename decoder::T3 T3;
- typedef typename decoder::T4 T4;
- typedef typename decoder::T5 T5;
- typedef typename decoder::T6 T6;
- typedef typename decoder::T7 T7;
- 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;
- 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;
-#endif // def BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-
- typedef typename real_get_function_impl<
- (count_used_args::value)
- >::template params::type
- type;
- };
-
-#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,
- typename InMyPolicy = empty_function_policy,
- typename InMyMixin = empty_function_mixin,
- typename InMyAllocator = std::allocator
- >
- class function_traits_builder
- {
- typedef get_function_impl
- impl;
-
- typedef typename impl::R MyR;
- typedef typename impl::T1 MyT1;
- typedef typename impl::T2 MyT2;
- typedef typename impl::T3 MyT3;
- typedef typename impl::T4 MyT4;
- typedef typename impl::T5 MyT5;
- typedef typename impl::T6 MyT6;
- typedef typename impl::T7 MyT7;
- typedef typename impl::T8 MyT8;
- typedef typename impl::T9 MyT9;
- typedef typename impl::T10 MyT10;
- typedef typename impl::Policy MyPolicy;
- typedef typename impl::Mixin MyMixin;
- typedef typename impl::Allocator MyAllocator;
-
- public:
- typedef typename impl::type type;
- typedef MyPolicy policy_type;
- typedef MyMixin mixin_type;
- typedef MyAllocator allocator_type;
-
-#ifndef BOOST_NO_DEPENDENT_NESTED_DERIVATIONS
- template
- struct policy :
- public function_traits_builder {};
-
- template
- struct mixin :
- public function_traits_builder {};
-
- template
- struct allocator :
- public function_traits_builder {};
-#else
- template
- struct policy
- {
- typedef typename function_traits_builder::type
- type;
- };
-
- template
- struct mixin
- {
- typedef typename function_traits_builder::type
- type;
- };
-
- template
- struct allocator
- {
- typedef typename function_traits_builder::type
- type;
- };
-#endif // ndef NO_DEPENDENT_NESTED_DERIVATIONS
- };
-#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
- } // end namespace function
- } // end namespace detail
-
- template<
- typename R,
- typename T1 = detail::function::unusable,
- typename T2 = detail::function::unusable,
- typename T3 = detail::function::unusable,
- typename T4 = detail::function::unusable,
- typename T5 = detail::function::unusable,
- typename T6 = detail::function::unusable,
- typename T7 = detail::function::unusable,
- typename T8 = detail::function::unusable,
- typename T9 = detail::function::unusable,
- typename T10 = detail::function::unusable
- >
- class function :
- public detail::function::get_function_impl::type
-#ifndef BOOST_FUNCTION_NO_DEPRECATED
- , public detail::function::function_traits_builder
-#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
- {
- typedef typename detail::function::get_function_impl::type
- 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;
-
- function() : base_type() {}
-
- template
- function(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) : base_type(f) {}
-
- function(const self_type& f) : base_type(static_cast(f)){}
-
- template
- self_type& operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f)
- {
- self_type(f).swap(*this);
- return *this;
- }
-
- self_type& operator=(const base_type& f)
- {
- self_type(f).swap(*this);
- return *this;
- }
-
- self_type& operator=(const self_type& f)
- {
- self_type(f).swap(*this);
- return *this;
- }
-
-#ifndef BOOST_FUNCTION_NO_DEPRECATED
- template
- BOOST_FUNCTION_DEPRECATED_PRE
- void set(Functor BOOST_FUNCTION_TARGET_FIX(const &) f)
- {
- BOOST_FUNCTION_DEPRECATED_INNER
- self_type(f).swap(*this);
- }
-
- BOOST_FUNCTION_DEPRECATED_PRE
- void set(const base_type& f)
- {
- BOOST_FUNCTION_DEPRECATED_INNER
- self_type(f).swap(*this);
- }
-
- 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
- inline void swap(function& f1,
- function& f2)
- {
- f1.swap(f2);
- }
-} // end namespace boost
-
-#endif // !no deprecated || !no partial specialization
-
-#endif
diff --git a/include/boost/function/detail/function_iterate.hpp b/include/boost/function/detail/function_iterate.hpp
new file mode 100644
index 0000000..d0239d2
--- /dev/null
+++ b/include/boost/function/detail/function_iterate.hpp
@@ -0,0 +1,8 @@
+#if !defined(BOOST_PP_IS_ITERATING)
+# error Boost.Function - do not include this file!
+#endif
+
+#define BOOST_FUNCTION_NUM_ARGS BOOST_PP_ITERATION()
+#include
+#undef BOOST_FUNCTION_NUM_ARGS
+
diff --git a/include/boost/function/detail/gen_maybe_include.pl b/include/boost/function/detail/gen_maybe_include.pl
new file mode 100644
index 0000000..a7d4cfb
--- /dev/null
+++ b/include/boost/function/detail/gen_maybe_include.pl
@@ -0,0 +1,22 @@
+#!/usr/bin/perl -w
+use English;
+
+$max_args = $ARGV[0];
+
+open (OUT, ">maybe_include.hpp") or die("Cannot write to maybe_include.hpp");
+for($on_arg = 0; $on_arg <= $max_args; ++$on_arg) {
+ if ($on_arg == 0) {
+ print OUT "#if";
+ }
+ else {
+ print OUT "#elif";
+ }
+ print OUT " BOOST_FUNCTION_NUM_ARGS == $on_arg\n";
+ print OUT "# ifndef BOOST_FUNCTION_$on_arg\n";
+ print OUT "# define BOOST_FUNCTION_$on_arg\n";
+ print OUT "# include \n";
+ print OUT "# endif\n";
+}
+print OUT "#else\n";
+print OUT "# error Cannot handle Boost.Function objects that accept more than $max_args arguments!\n";
+print OUT "#endif\n";
diff --git a/include/boost/function/detail/maybe_include.hpp b/include/boost/function/detail/maybe_include.hpp
new file mode 100644
index 0000000..c3c4924
--- /dev/null
+++ b/include/boost/function/detail/maybe_include.hpp
@@ -0,0 +1,258 @@
+#if BOOST_FUNCTION_NUM_ARGS == 0
+# ifndef BOOST_FUNCTION_0
+# define BOOST_FUNCTION_0
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 1
+# ifndef BOOST_FUNCTION_1
+# define BOOST_FUNCTION_1
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 2
+# ifndef BOOST_FUNCTION_2
+# define BOOST_FUNCTION_2
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 3
+# ifndef BOOST_FUNCTION_3
+# define BOOST_FUNCTION_3
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 4
+# ifndef BOOST_FUNCTION_4
+# define BOOST_FUNCTION_4
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 5
+# ifndef BOOST_FUNCTION_5
+# define BOOST_FUNCTION_5
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 6
+# ifndef BOOST_FUNCTION_6
+# define BOOST_FUNCTION_6
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 7
+# ifndef BOOST_FUNCTION_7
+# define BOOST_FUNCTION_7
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 8
+# ifndef BOOST_FUNCTION_8
+# define BOOST_FUNCTION_8
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 9
+# ifndef BOOST_FUNCTION_9
+# define BOOST_FUNCTION_9
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 10
+# ifndef BOOST_FUNCTION_10
+# define BOOST_FUNCTION_10
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 11
+# ifndef BOOST_FUNCTION_11
+# define BOOST_FUNCTION_11
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 12
+# ifndef BOOST_FUNCTION_12
+# define BOOST_FUNCTION_12
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 13
+# ifndef BOOST_FUNCTION_13
+# define BOOST_FUNCTION_13
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 14
+# ifndef BOOST_FUNCTION_14
+# define BOOST_FUNCTION_14
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 15
+# ifndef BOOST_FUNCTION_15
+# define BOOST_FUNCTION_15
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 16
+# ifndef BOOST_FUNCTION_16
+# define BOOST_FUNCTION_16
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 17
+# ifndef BOOST_FUNCTION_17
+# define BOOST_FUNCTION_17
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 18
+# ifndef BOOST_FUNCTION_18
+# define BOOST_FUNCTION_18
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 19
+# ifndef BOOST_FUNCTION_19
+# define BOOST_FUNCTION_19
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 20
+# ifndef BOOST_FUNCTION_20
+# define BOOST_FUNCTION_20
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 21
+# ifndef BOOST_FUNCTION_21
+# define BOOST_FUNCTION_21
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 22
+# ifndef BOOST_FUNCTION_22
+# define BOOST_FUNCTION_22
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 23
+# ifndef BOOST_FUNCTION_23
+# define BOOST_FUNCTION_23
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 24
+# ifndef BOOST_FUNCTION_24
+# define BOOST_FUNCTION_24
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 25
+# ifndef BOOST_FUNCTION_25
+# define BOOST_FUNCTION_25
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 26
+# ifndef BOOST_FUNCTION_26
+# define BOOST_FUNCTION_26
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 27
+# ifndef BOOST_FUNCTION_27
+# define BOOST_FUNCTION_27
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 28
+# ifndef BOOST_FUNCTION_28
+# define BOOST_FUNCTION_28
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 29
+# ifndef BOOST_FUNCTION_29
+# define BOOST_FUNCTION_29
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 30
+# ifndef BOOST_FUNCTION_30
+# define BOOST_FUNCTION_30
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 31
+# ifndef BOOST_FUNCTION_31
+# define BOOST_FUNCTION_31
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 32
+# ifndef BOOST_FUNCTION_32
+# define BOOST_FUNCTION_32
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 33
+# ifndef BOOST_FUNCTION_33
+# define BOOST_FUNCTION_33
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 34
+# ifndef BOOST_FUNCTION_34
+# define BOOST_FUNCTION_34
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 35
+# ifndef BOOST_FUNCTION_35
+# define BOOST_FUNCTION_35
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 36
+# ifndef BOOST_FUNCTION_36
+# define BOOST_FUNCTION_36
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 37
+# ifndef BOOST_FUNCTION_37
+# define BOOST_FUNCTION_37
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 38
+# ifndef BOOST_FUNCTION_38
+# define BOOST_FUNCTION_38
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 39
+# ifndef BOOST_FUNCTION_39
+# define BOOST_FUNCTION_39
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 40
+# ifndef BOOST_FUNCTION_40
+# define BOOST_FUNCTION_40
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 41
+# ifndef BOOST_FUNCTION_41
+# define BOOST_FUNCTION_41
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 42
+# ifndef BOOST_FUNCTION_42
+# define BOOST_FUNCTION_42
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 43
+# ifndef BOOST_FUNCTION_43
+# define BOOST_FUNCTION_43
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 44
+# ifndef BOOST_FUNCTION_44
+# define BOOST_FUNCTION_44
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 45
+# ifndef BOOST_FUNCTION_45
+# define BOOST_FUNCTION_45
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 46
+# ifndef BOOST_FUNCTION_46
+# define BOOST_FUNCTION_46
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 47
+# ifndef BOOST_FUNCTION_47
+# define BOOST_FUNCTION_47
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 48
+# ifndef BOOST_FUNCTION_48
+# define BOOST_FUNCTION_48
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 49
+# ifndef BOOST_FUNCTION_49
+# define BOOST_FUNCTION_49
+# include
+# endif
+#elif BOOST_FUNCTION_NUM_ARGS == 50
+# ifndef BOOST_FUNCTION_50
+# define BOOST_FUNCTION_50
+# include
+# endif
+#else
+# error Cannot handle Boost.Function objects that accept more than 50 arguments!
+#endif
diff --git a/include/boost/function/detail/prologue.hpp b/include/boost/function/detail/prologue.hpp
new file mode 100644
index 0000000..84823a8
--- /dev/null
+++ b/include/boost/function/detail/prologue.hpp
@@ -0,0 +1,12 @@
+#ifndef BOOST_FUNCTION_PROLOGUE_HPP
+#define BOOST_FUNCTION_PROLOGUE_HPP
+# include
+# include
+# include
+# include
+# include
+# include
+# include
+# include
+# include
+#endif // BOOST_FUNCTION_PROLOGUE_HPP
diff --git a/include/boost/function/function0.hpp b/include/boost/function/function0.hpp
index 8f37ae6..77baeaf 100644
--- a/include/boost/function/function0.hpp
+++ b/include/boost/function/function0.hpp
@@ -1,39 +1,3 @@
-// Boost.Function library
-//
-// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu)
-//
-// Permission to copy, use, sell and distribute this software is granted
-// provided this copyright notice appears in all copies.
-// Permission to modify the code and to distribute modified code is granted
-// provided this copyright notice appears in all copies, and a notice
-// that the code was modified is included with the copyright notice.
-//
-// This software is provided "as is" without express or implied warranty,
-// and with no claim as to its suitability for any purpose.
-
-// For more information, see http://www.boost.org
-
-#ifndef BOOST_FUNCTION_FUNCTION0_HEADER
-#define BOOST_FUNCTION_FUNCTION0_HEADER
-
#define BOOST_FUNCTION_NUM_ARGS 0
-#define BOOST_FUNCTION_TEMPLATE_PARMS
-#define BOOST_FUNCTION_TEMPLATE_ARGS
-#define BOOST_FUNCTION_PARMS
-#define BOOST_FUNCTION_ARGS
-#define BOOST_FUNCTION_NOT_0_PARMS
-#define BOOST_FUNCTION_NOT_0_ARGS
-#define BOOST_FUNCTION_ARG_TYPES
-
-#include
-
-#undef BOOST_FUNCTION_ARG_TYPES
-#undef BOOST_FUNCTION_NOT_0_ARGS
-#undef BOOST_FUNCTION_NOT_0_PARMS
-#undef BOOST_FUNCTION_ARGS
-#undef BOOST_FUNCTION_PARMS
-#undef BOOST_FUNCTION_TEMPLATE_ARGS
-#undef BOOST_FUNCTION_TEMPLATE_PARMS
+#include
#undef BOOST_FUNCTION_NUM_ARGS
-
-#endif // BOOST_FUNCTION_FUNCTION0_HEADER
diff --git a/include/boost/function/function1.hpp b/include/boost/function/function1.hpp
index 7cf9b23..e09cad3 100644
--- a/include/boost/function/function1.hpp
+++ b/include/boost/function/function1.hpp
@@ -1,39 +1,3 @@
-// Boost.Function library
-//
-// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu)
-//
-// Permission to copy, use, sell and distribute this software is granted
-// provided this copyright notice appears in all copies.
-// Permission to modify the code and to distribute modified code is granted
-// provided this copyright notice appears in all copies, and a notice
-// that the code was modified is included with the copyright notice.
-//
-// This software is provided "as is" without express or implied warranty,
-// and with no claim as to its suitability for any purpose.
-
-// For more information, see http://www.boost.org
-
-#ifndef BOOST_FUNCTION_FUNCTION1_HEADER
-#define BOOST_FUNCTION_FUNCTION1_HEADER
-
#define BOOST_FUNCTION_NUM_ARGS 1
-#define BOOST_FUNCTION_TEMPLATE_PARMS typename T0
-#define BOOST_FUNCTION_TEMPLATE_ARGS T0
-#define BOOST_FUNCTION_PARMS T0 a0
-#define BOOST_FUNCTION_ARGS a0
-#define BOOST_FUNCTION_NOT_0_PARMS
-#define BOOST_FUNCTION_NOT_0_ARGS
-#define BOOST_FUNCTION_ARG_TYPES typedef T0 arg1_type;
-
-#include
-
-#undef BOOST_FUNCTION_ARG_TYPES
-#undef BOOST_FUNCTION_NOT_0_ARGS
-#undef BOOST_FUNCTION_NOT_0_PARMS
-#undef BOOST_FUNCTION_ARGS
-#undef BOOST_FUNCTION_PARMS
-#undef BOOST_FUNCTION_TEMPLATE_ARGS
-#undef BOOST_FUNCTION_TEMPLATE_PARMS
+#include
#undef BOOST_FUNCTION_NUM_ARGS
-
-#endif // BOOST_FUNCTION_FUNCTION1_HEADER
diff --git a/include/boost/function/function10.hpp b/include/boost/function/function10.hpp
index afdb5b1..0970605 100644
--- a/include/boost/function/function10.hpp
+++ b/include/boost/function/function10.hpp
@@ -1,39 +1,3 @@
-// Boost.Function library
-//
-// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu)
-//
-// Permission to copy, use, sell and distribute this software is granted
-// provided this copyright notice appears in all copies.
-// Permission to modify the code and to distribute modified code is granted
-// provided this copyright notice appears in all copies, and a notice
-// that the code was modified is included with the copyright notice.
-//
-// This software is provided "as is" without express or implied warranty,
-// and with no claim as to its suitability for any purpose.
-
-// For more information, see http://www.boost.org
-
-#ifndef BOOST_FUNCTION_FUNCTION10_HEADER
-#define BOOST_FUNCTION_FUNCTION10_HEADER
-
#define BOOST_FUNCTION_NUM_ARGS 10
-#define BOOST_FUNCTION_TEMPLATE_PARMS typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9
-#define BOOST_FUNCTION_TEMPLATE_ARGS T0, T1, T2, T3, T4, T5, T6, T7, T8, T9
-#define BOOST_FUNCTION_PARMS T0 a0, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9
-#define BOOST_FUNCTION_ARGS a0, a1, a2, a3, a4, a5, a6, a7, a8, a9
-#define BOOST_FUNCTION_NOT_0_PARMS T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8, T9 a9
-#define BOOST_FUNCTION_NOT_0_ARGS a1, a2, a3, a4, a5, a6, a7, a8, a9
-#define BOOST_FUNCTION_ARG_TYPES typedef T0 arg1_type; typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type; typedef T4 arg5_type; typedef T5 arg6_type; typedef T6 arg7_type; typedef T7 arg8_type; typedef T8 arg9_type; typedef T9 arg10_type;
-
-#include
-
-#undef BOOST_FUNCTION_ARG_TYPES
-#undef BOOST_FUNCTION_NOT_0_ARGS
-#undef BOOST_FUNCTION_NOT_0_PARMS
-#undef BOOST_FUNCTION_ARGS
-#undef BOOST_FUNCTION_PARMS
-#undef BOOST_FUNCTION_TEMPLATE_ARGS
-#undef BOOST_FUNCTION_TEMPLATE_PARMS
+#include
#undef BOOST_FUNCTION_NUM_ARGS
-
-#endif // BOOST_FUNCTION_FUNCTION10_HEADER
diff --git a/include/boost/function/function2.hpp b/include/boost/function/function2.hpp
index 31a5397..f477186 100644
--- a/include/boost/function/function2.hpp
+++ b/include/boost/function/function2.hpp
@@ -1,39 +1,3 @@
-// Boost.Function library
-//
-// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu)
-//
-// Permission to copy, use, sell and distribute this software is granted
-// provided this copyright notice appears in all copies.
-// Permission to modify the code and to distribute modified code is granted
-// provided this copyright notice appears in all copies, and a notice
-// that the code was modified is included with the copyright notice.
-//
-// This software is provided "as is" without express or implied warranty,
-// and with no claim as to its suitability for any purpose.
-
-// For more information, see http://www.boost.org
-
-#ifndef BOOST_FUNCTION_FUNCTION2_HEADER
-#define BOOST_FUNCTION_FUNCTION2_HEADER
-
#define BOOST_FUNCTION_NUM_ARGS 2
-#define BOOST_FUNCTION_TEMPLATE_PARMS typename T0, typename T1
-#define BOOST_FUNCTION_TEMPLATE_ARGS T0, T1
-#define BOOST_FUNCTION_PARMS T0 a0, T1 a1
-#define BOOST_FUNCTION_ARGS a0, a1
-#define BOOST_FUNCTION_NOT_0_PARMS T1 a1
-#define BOOST_FUNCTION_NOT_0_ARGS a1
-#define BOOST_FUNCTION_ARG_TYPES typedef T0 arg1_type; typedef T1 arg2_type;
-
-#include
-
-#undef BOOST_FUNCTION_ARG_TYPES
-#undef BOOST_FUNCTION_NOT_0_ARGS
-#undef BOOST_FUNCTION_NOT_0_PARMS
-#undef BOOST_FUNCTION_ARGS
-#undef BOOST_FUNCTION_PARMS
-#undef BOOST_FUNCTION_TEMPLATE_ARGS
-#undef BOOST_FUNCTION_TEMPLATE_PARMS
+#include
#undef BOOST_FUNCTION_NUM_ARGS
-
-#endif // BOOST_FUNCTION_FUNCTION2_HEADER
diff --git a/include/boost/function/function3.hpp b/include/boost/function/function3.hpp
index 38c64cb..3a7fe63 100644
--- a/include/boost/function/function3.hpp
+++ b/include/boost/function/function3.hpp
@@ -1,38 +1,3 @@
-// Boost.Function library
-//
-// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu)
-//
-// Permission to copy, use, sell and distribute this software is granted
-// provided this copyright notice appears in all copies.
-// Permission to modify the code and to distribute modified code is granted
-// provided this copyright notice appears in all copies, and a notice
-// that the code was modified is included with the copyright notice.
-//
-// This software is provided "as is" without express or implied warranty,
-// and with no claim as to its suitability for any purpose.
-
-// For more information, see http://www.boost.org
-
-#ifndef BOOST_FUNCTION_FUNCTION3_HEADER
-#define BOOST_FUNCTION_FUNCTION3_HEADER
-
#define BOOST_FUNCTION_NUM_ARGS 3
-#define BOOST_FUNCTION_TEMPLATE_PARMS typename T0, typename T1, typename T2
-#define BOOST_FUNCTION_TEMPLATE_ARGS T0, T1, T2
-#define BOOST_FUNCTION_PARMS T0 a0, T1 a1, T2 a2
-#define BOOST_FUNCTION_ARGS a0, a1, a2
-#define BOOST_FUNCTION_NOT_0_PARMS T1 a1, T2 a2
-#define BOOST_FUNCTION_NOT_0_ARGS a1, a2
-#define BOOST_FUNCTION_ARG_TYPES typedef T0 arg1_type; typedef T1 arg2_type; typedef T2 arg3_type;
-
-#include
-#undef BOOST_FUNCTION_ARG_TYPES
-#undef BOOST_FUNCTION_NOT_0_ARGS
-#undef BOOST_FUNCTION_NOT_0_PARMS
-#undef BOOST_FUNCTION_ARGS
-#undef BOOST_FUNCTION_PARMS
-#undef BOOST_FUNCTION_TEMPLATE_ARGS
-#undef BOOST_FUNCTION_TEMPLATE_PARMS
+#include
#undef BOOST_FUNCTION_NUM_ARGS
-
-#endif // BOOST_FUNCTION_FUNCTION3_HEADER
diff --git a/include/boost/function/function4.hpp b/include/boost/function/function4.hpp
index 7049964..8b55628 100644
--- a/include/boost/function/function4.hpp
+++ b/include/boost/function/function4.hpp
@@ -1,39 +1,3 @@
-// Boost.Function library
-//
-// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu)
-//
-// Permission to copy, use, sell and distribute this software is granted
-// provided this copyright notice appears in all copies.
-// Permission to modify the code and to distribute modified code is granted
-// provided this copyright notice appears in all copies, and a notice
-// that the code was modified is included with the copyright notice.
-//
-// This software is provided "as is" without express or implied warranty,
-// and with no claim as to its suitability for any purpose.
-
-// For more information, see http://www.boost.org
-
-#ifndef BOOST_FUNCTION_FUNCTION4_HEADER
-#define BOOST_FUNCTION_FUNCTION4_HEADER
-
#define BOOST_FUNCTION_NUM_ARGS 4
-#define BOOST_FUNCTION_TEMPLATE_PARMS typename T0, typename T1, typename T2, typename T3
-#define BOOST_FUNCTION_TEMPLATE_ARGS T0, T1, T2, T3
-#define BOOST_FUNCTION_PARMS T0 a0, T1 a1, T2 a2, T3 a3
-#define BOOST_FUNCTION_ARGS a0, a1, a2, a3
-#define BOOST_FUNCTION_NOT_0_PARMS T1 a1, T2 a2, T3 a3
-#define BOOST_FUNCTION_NOT_0_ARGS a1, a2, a3
-#define BOOST_FUNCTION_ARG_TYPES typedef T0 arg1_type; typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type;
-
-#include
-
-#undef BOOST_FUNCTION_ARG_TYPES
-#undef BOOST_FUNCTION_NOT_0_ARGS
-#undef BOOST_FUNCTION_NOT_0_PARMS
-#undef BOOST_FUNCTION_ARGS
-#undef BOOST_FUNCTION_PARMS
-#undef BOOST_FUNCTION_TEMPLATE_ARGS
-#undef BOOST_FUNCTION_TEMPLATE_PARMS
+#include
#undef BOOST_FUNCTION_NUM_ARGS
-
-#endif // BOOST_FUNCTION_FUNCTION4_HEADER
diff --git a/include/boost/function/function5.hpp b/include/boost/function/function5.hpp
index b133426..9c04ba0 100644
--- a/include/boost/function/function5.hpp
+++ b/include/boost/function/function5.hpp
@@ -1,39 +1,3 @@
-// Boost.Function library
-//
-// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu)
-//
-// Permission to copy, use, sell and distribute this software is granted
-// provided this copyright notice appears in all copies.
-// Permission to modify the code and to distribute modified code is granted
-// provided this copyright notice appears in all copies, and a notice
-// that the code was modified is included with the copyright notice.
-//
-// This software is provided "as is" without express or implied warranty,
-// and with no claim as to its suitability for any purpose.
-
-// For more information, see http://www.boost.org
-
-#ifndef BOOST_FUNCTION_FUNCTION5_HEADER
-#define BOOST_FUNCTION_FUNCTION5_HEADER
-
#define BOOST_FUNCTION_NUM_ARGS 5
-#define BOOST_FUNCTION_TEMPLATE_PARMS typename T0, typename T1, typename T2, typename T3, typename T4
-#define BOOST_FUNCTION_TEMPLATE_ARGS T0, T1, T2, T3, T4
-#define BOOST_FUNCTION_PARMS T0 a0, T1 a1, T2 a2, T3 a3, T4 a4
-#define BOOST_FUNCTION_ARGS a0, a1, a2, a3, a4
-#define BOOST_FUNCTION_NOT_0_PARMS T1 a1, T2 a2, T3 a3, T4 a4
-#define BOOST_FUNCTION_NOT_0_ARGS a1, a2, a3, a4
-#define BOOST_FUNCTION_ARG_TYPES typedef T0 arg1_type; typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type; typedef T4 arg5_type;
-
-#include
-
-#undef BOOST_FUNCTION_ARG_TYPES
-#undef BOOST_FUNCTION_NOT_0_ARGS
-#undef BOOST_FUNCTION_NOT_0_PARMS
-#undef BOOST_FUNCTION_ARGS
-#undef BOOST_FUNCTION_PARMS
-#undef BOOST_FUNCTION_TEMPLATE_ARGS
-#undef BOOST_FUNCTION_TEMPLATE_PARMS
+#include
#undef BOOST_FUNCTION_NUM_ARGS
-
-#endif // BOOST_FUNCTION_FUNCTION5_HEADER
diff --git a/include/boost/function/function6.hpp b/include/boost/function/function6.hpp
index 4456334..bee6620 100644
--- a/include/boost/function/function6.hpp
+++ b/include/boost/function/function6.hpp
@@ -1,39 +1,3 @@
-// Boost.Function library
-//
-// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu)
-//
-// Permission to copy, use, sell and distribute this software is granted
-// provided this copyright notice appears in all copies.
-// Permission to modify the code and to distribute modified code is granted
-// provided this copyright notice appears in all copies, and a notice
-// that the code was modified is included with the copyright notice.
-//
-// This software is provided "as is" without express or implied warranty,
-// and with no claim as to its suitability for any purpose.
-
-// For more information, see http://www.boost.org
-
-#ifndef BOOST_FUNCTION_FUNCTION6_HEADER
-#define BOOST_FUNCTION_FUNCTION6_HEADER
-
#define BOOST_FUNCTION_NUM_ARGS 6
-#define BOOST_FUNCTION_TEMPLATE_PARMS typename T0, typename T1, typename T2, typename T3, typename T4, typename T5
-#define BOOST_FUNCTION_TEMPLATE_ARGS T0, T1, T2, T3, T4, T5
-#define BOOST_FUNCTION_PARMS T0 a0, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5
-#define BOOST_FUNCTION_ARGS a0, a1, a2, a3, a4, a5
-#define BOOST_FUNCTION_NOT_0_PARMS T1 a1, T2 a2, T3 a3, T4 a4, T5 a5
-#define BOOST_FUNCTION_NOT_0_ARGS a1, a2, a3, a4, a5
-#define BOOST_FUNCTION_ARG_TYPES typedef T0 arg1_type; typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type; typedef T4 arg5_type; typedef T5 arg6_type;
-
-#include
-
-#undef BOOST_FUNCTION_ARG_TYPES
-#undef BOOST_FUNCTION_NOT_0_ARGS
-#undef BOOST_FUNCTION_NOT_0_PARMS
-#undef BOOST_FUNCTION_ARGS
-#undef BOOST_FUNCTION_PARMS
-#undef BOOST_FUNCTION_TEMPLATE_ARGS
-#undef BOOST_FUNCTION_TEMPLATE_PARMS
+#include
#undef BOOST_FUNCTION_NUM_ARGS
-
-#endif // BOOST_FUNCTION_FUNCTION6_HEADER
diff --git a/include/boost/function/function7.hpp b/include/boost/function/function7.hpp
index 46544fd..eb8befb 100644
--- a/include/boost/function/function7.hpp
+++ b/include/boost/function/function7.hpp
@@ -1,39 +1,3 @@
-// Boost.Function library
-//
-// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu)
-//
-// Permission to copy, use, sell and distribute this software is granted
-// provided this copyright notice appears in all copies.
-// Permission to modify the code and to distribute modified code is granted
-// provided this copyright notice appears in all copies, and a notice
-// that the code was modified is included with the copyright notice.
-//
-// This software is provided "as is" without express or implied warranty,
-// and with no claim as to its suitability for any purpose.
-
-// For more information, see http://www.boost.org
-
-#ifndef BOOST_FUNCTION_FUNCTION7_HEADER
-#define BOOST_FUNCTION_FUNCTION7_HEADER
-
#define BOOST_FUNCTION_NUM_ARGS 7
-#define BOOST_FUNCTION_TEMPLATE_PARMS typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6
-#define BOOST_FUNCTION_TEMPLATE_ARGS T0, T1, T2, T3, T4, T5, T6
-#define BOOST_FUNCTION_PARMS T0 a0, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6
-#define BOOST_FUNCTION_ARGS a0, a1, a2, a3, a4, a5, a6
-#define BOOST_FUNCTION_NOT_0_PARMS T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6
-#define BOOST_FUNCTION_NOT_0_ARGS a1, a2, a3, a4, a5, a6
-#define BOOST_FUNCTION_ARG_TYPES typedef T0 arg1_type; typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type; typedef T4 arg5_type; typedef T5 arg6_type; typedef T6 arg7_type;
-
-#include
-
-#undef BOOST_FUNCTION_ARG_TYPES
-#undef BOOST_FUNCTION_NOT_0_ARGS
-#undef BOOST_FUNCTION_NOT_0_PARMS
-#undef BOOST_FUNCTION_ARGS
-#undef BOOST_FUNCTION_PARMS
-#undef BOOST_FUNCTION_TEMPLATE_ARGS
-#undef BOOST_FUNCTION_TEMPLATE_PARMS
+#include
#undef BOOST_FUNCTION_NUM_ARGS
-
-#endif // BOOST_FUNCTION_FUNCTION7_HEADER
diff --git a/include/boost/function/function8.hpp b/include/boost/function/function8.hpp
index ca08983..c36d155 100644
--- a/include/boost/function/function8.hpp
+++ b/include/boost/function/function8.hpp
@@ -1,39 +1,3 @@
-// Boost.Function library
-//
-// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu)
-//
-// Permission to copy, use, sell and distribute this software is granted
-// provided this copyright notice appears in all copies.
-// Permission to modify the code and to distribute modified code is granted
-// provided this copyright notice appears in all copies, and a notice
-// that the code was modified is included with the copyright notice.
-//
-// This software is provided "as is" without express or implied warranty,
-// and with no claim as to its suitability for any purpose.
-
-// For more information, see http://www.boost.org
-
-#ifndef BOOST_FUNCTION_FUNCTION8_HEADER
-#define BOOST_FUNCTION_FUNCTION8_HEADER
-
#define BOOST_FUNCTION_NUM_ARGS 8
-#define BOOST_FUNCTION_TEMPLATE_PARMS typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7
-#define BOOST_FUNCTION_TEMPLATE_ARGS T0, T1, T2, T3, T4, T5, T6, T7
-#define BOOST_FUNCTION_PARMS T0 a0, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7
-#define BOOST_FUNCTION_ARGS a0, a1, a2, a3, a4, a5, a6, a7
-#define BOOST_FUNCTION_NOT_0_PARMS T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7
-#define BOOST_FUNCTION_NOT_0_ARGS a1, a2, a3, a4, a5, a6, a7
-#define BOOST_FUNCTION_ARG_TYPES typedef T0 arg1_type; typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type; typedef T4 arg5_type; typedef T5 arg6_type; typedef T6 arg7_type; typedef T7 arg8_type;
-
-#include
-
-#undef BOOST_FUNCTION_ARG_TYPES
-#undef BOOST_FUNCTION_NOT_0_ARGS
-#undef BOOST_FUNCTION_NOT_0_PARMS
-#undef BOOST_FUNCTION_ARGS
-#undef BOOST_FUNCTION_PARMS
-#undef BOOST_FUNCTION_TEMPLATE_ARGS
-#undef BOOST_FUNCTION_TEMPLATE_PARMS
+#include
#undef BOOST_FUNCTION_NUM_ARGS
-
-#endif // BOOST_FUNCTION_FUNCTION8_HEADER
diff --git a/include/boost/function/function9.hpp b/include/boost/function/function9.hpp
index db42f66..dc037da 100644
--- a/include/boost/function/function9.hpp
+++ b/include/boost/function/function9.hpp
@@ -1,39 +1,3 @@
-// Boost.Function library
-//
-// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu)
-//
-// Permission to copy, use, sell and distribute this software is granted
-// provided this copyright notice appears in all copies.
-// Permission to modify the code and to distribute modified code is granted
-// provided this copyright notice appears in all copies, and a notice
-// that the code was modified is included with the copyright notice.
-//
-// This software is provided "as is" without express or implied warranty,
-// and with no claim as to its suitability for any purpose.
-
-// For more information, see http://www.boost.org
-
-#ifndef BOOST_FUNCTION_FUNCTION9_HEADER
-#define BOOST_FUNCTION_FUNCTION9_HEADER
-
#define BOOST_FUNCTION_NUM_ARGS 9
-#define BOOST_FUNCTION_TEMPLATE_PARMS typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8
-#define BOOST_FUNCTION_TEMPLATE_ARGS T0, T1, T2, T3, T4, T5, T6, T7, T8
-#define BOOST_FUNCTION_PARMS T0 a0, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8
-#define BOOST_FUNCTION_ARGS a0, a1, a2, a3, a4, a5, a6, a7, a8
-#define BOOST_FUNCTION_NOT_0_PARMS T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7, T8 a8
-#define BOOST_FUNCTION_NOT_0_ARGS a1, a2, a3, a4, a5, a6, a7, a8
-#define BOOST_FUNCTION_ARG_TYPES typedef T0 arg1_type; typedef T1 arg2_type; typedef T2 arg3_type; typedef T3 arg4_type; typedef T4 arg5_type; typedef T5 arg6_type; typedef T6 arg7_type; typedef T7 arg8_type; typedef T8 arg9_type;
-
-#include
-
-#undef BOOST_FUNCTION_ARG_TYPES
-#undef BOOST_FUNCTION_NOT_0_ARGS
-#undef BOOST_FUNCTION_NOT_0_PARMS
-#undef BOOST_FUNCTION_ARGS
-#undef BOOST_FUNCTION_PARMS
-#undef BOOST_FUNCTION_TEMPLATE_ARGS
-#undef BOOST_FUNCTION_TEMPLATE_PARMS
+#include
#undef BOOST_FUNCTION_NUM_ARGS
-
-#endif // BOOST_FUNCTION_FUNCTION9_HEADER
diff --git a/include/boost/function/function_base.hpp b/include/boost/function/function_base.hpp
index 27002c9..6f3647b 100644
--- a/include/boost/function/function_base.hpp
+++ b/include/boost/function/function_base.hpp
@@ -16,13 +16,13 @@
#ifndef BOOST_FUNCTION_BASE_HEADER
#define BOOST_FUNCTION_BASE_HEADER
-#include
#include
#include
#include
-#include
#include
-#include
+#include
+#include
+#include
#include
#include
@@ -32,18 +32,21 @@
# define BOOST_FUNCTION_TARGET_FIX(x)
#endif // not MSVC
-#ifdef BOOST_FUNCTION_SILENT_DEPRECATED
-# define BOOST_FUNCTION_DEPRECATED_PRE
-# define BOOST_FUNCTION_DEPRECATED_INNER
-#else
-# if defined (BOOST_MSVC) && (BOOST_MSVC >= 1300)
-# define BOOST_FUNCTION_DEPRECATED_PRE __declspec(deprecated)
-# define BOOST_FUNCTION_DEPRECATED_INNER
-# else
-# define BOOST_FUNCTION_DEPRECATED_PRE
-# define BOOST_FUNCTION_DEPRECATED_INNER int deprecated;
-# endif
-#endif
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+namespace boost {
+
+template >
+class function;
+
+template
+inline void swap(function& f1,
+ function& f2)
+{
+ f1.swap(f2);
+}
+
+} // end namespace boost
+#endif // have partial specialization
namespace boost {
namespace detail {
@@ -60,12 +63,30 @@ namespace boost {
void* obj_ptr;
const void* const_obj_ptr;
void (*func_ptr)();
-
- explicit any_pointer(void* p) : obj_ptr(p) {}
- explicit any_pointer(const void* p) : const_obj_ptr(p) {}
- explicit any_pointer(void (*p)()) : func_ptr(p) {}
+ char data[1];
};
+ any_pointer make_any_pointer(void* o)
+ {
+ any_pointer p;
+ p.obj_ptr = o;
+ return p;
+ }
+
+ any_pointer make_any_pointer(const void* o)
+ {
+ any_pointer p;
+ p.const_obj_ptr = o;
+ return p;
+ }
+
+ any_pointer make_any_pointer(void (*f)())
+ {
+ any_pointer p;
+ p.obj_ptr = f;
+ return p;
+ }
+
/**
* The unusable class is a placeholder for unused function arguments
* It is also completely unusable except that it constructable from
@@ -132,7 +153,7 @@ namespace boost {
if (op == clone_functor_tag)
return f;
else
- return any_pointer(reinterpret_cast(0));
+ return make_any_pointer(reinterpret_cast(0));
}
/**
@@ -154,7 +175,7 @@ namespace boost {
if (op == clone_functor_tag)
return function_ptr;
else
- return any_pointer(static_cast(0));
+ return make_any_pointer(static_cast(0));
}
// For function object pointers, we clone the pointer to each
@@ -190,7 +211,7 @@ namespace boost {
# else
functor_type* new_f = new functor_type(*f);
# endif // BOOST_NO_STD_ALLOCATOR
- return any_pointer(static_cast(new_f));
+ return make_any_pointer(static_cast(new_f));
}
else {
/* Cast from the void pointer to the functor pointer type */
@@ -209,7 +230,7 @@ namespace boost {
delete f;
# endif // BOOST_NO_STD_ALLOCATOR
- return any_pointer(static_cast(0));
+ return make_any_pointer(static_cast(0));
}
}
public:
@@ -222,40 +243,6 @@ namespace boost {
return manager(functor_ptr, op, tag_type());
}
};
-
- // value=1 if the given type is not "unusable"
- template
- struct count_if_used
- {
- BOOST_STATIC_CONSTANT(int, value = 1);
- };
-
- // value=0 for unusable types
- template<>
- struct count_if_used
- {
- BOOST_STATIC_CONSTANT(int, value = 0);
- };
-
- // Count the number of arguments (from the given set) which are not
- // "unusable" (therefore, count those arguments that are used).
- template
- struct count_used_args
- {
- BOOST_STATIC_CONSTANT(int, value =
- (count_if_used::value +
- count_if_used::value +
- count_if_used::value +
- count_if_used::value +
- count_if_used::value +
- count_if_used::value +
- count_if_used::value +
- count_if_used::value +
- count_if_used::value +
- count_if_used::value));
- };
} // end namespace function
} // end namespace detail
@@ -268,7 +255,10 @@ namespace boost {
class function_base
{
public:
- function_base() : manager(0), functor(static_cast(0)) {}
+ function_base() : manager(0)
+ {
+ functor.obj_ptr = 0;
+ }
// Is this function empty?
bool empty() const { return !manager; }
@@ -302,27 +292,6 @@ namespace boost {
}
} // end namespace function
} // end namespace detail
-
- // The default function policy is to do nothing before and after the call.
- struct empty_function_policy
- {
- inline void precall(const function_base*) {}
- inline void postcall(const function_base*) {}
- };
-
- // The default function mixin does nothing. The assignment and
- // copy-construction operators are all defined because MSVC defines broken
- // versions.
- struct empty_function_mixin
- {
- empty_function_mixin() {}
- empty_function_mixin(const empty_function_mixin&) {}
-
- empty_function_mixin& operator=(const empty_function_mixin&)
- {
- return *this;
- }
- };
}
#endif // BOOST_FUNCTION_BASE_HEADER
diff --git a/include/boost/function/function_template.hpp b/include/boost/function/function_template.hpp
index 488d845..16fd56f 100644
--- a/include/boost/function/function_template.hpp
+++ b/include/boost/function/function_template.hpp
@@ -1,6 +1,6 @@
// Boost.Function library
-// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu)
+// Copyright (C) 2001-2002 Doug Gregor (gregod@cs.rpi.edu)
//
// Permission to copy, use, sell and distribute this software is granted
// provided this copyright notice appears in all copies.
@@ -15,15 +15,23 @@
// Note: this header is a header template and must NOT have multiple-inclusion
// protection.
+#include
-#ifndef BOOST_FUNCTION_FUNCTION_TEMPLATE_HPP
-#define BOOST_FUNCTION_FUNCTION_TEMPLATE_HPP
-# include
-# include
-# include
-# include
-# include
-#endif // BOOST_FUNCTION_FUNCTION_TEMPLATE_HPP
+#define BOOST_FUNCTION_TEMPLATE_PARMS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, typename T)
+
+#define BOOST_FUNCTION_TEMPLATE_ARGS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, T)
+
+
+#define BOOST_FUNCTION_PARM(J,I,D) BOOST_PP_CAT(T,I) BOOST_PP_CAT(a,I)
+
+#define BOOST_FUNCTION_PARMS BOOST_PP_ENUM(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_PARM,)
+
+#define BOOST_FUNCTION_ARGS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, a)
+
+#define BOOST_FUNCTION_ARG_TYPE(J,I,D) \
+ typedef BOOST_PP_CAT(T,I) BOOST_PP_CAT(arg, BOOST_PP_CAT(BOOST_PP_INC(I),_type));
+
+#define BOOST_FUNCTION_ARG_TYPES BOOST_PP_REPEAT(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_ARG_TYPE,)
// Type of the default allocator
#ifndef BOOST_NO_STD_ALLOCATOR
@@ -229,16 +237,9 @@ 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
-#ifndef BOOST_FUNCTION_NO_DEPRECATED
- , public Mixin
-#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
{
typedef typename detail::function::function_return_type::type
internal_result_type;
@@ -261,57 +262,24 @@ 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()
-#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)
- {
- }
-#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
-
// MSVC chokes if the following two constructors are collapsed into
// one with a default parameter.
template
BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) :
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
- BOOST_FUNCTION_FUNCTION(Functor f, const Mixin& m) :
- 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(),
-#ifndef BOOST_FUNCTION_NO_DEPRECATED
- Mixin(static_cast(f)),
-#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
invoker(0)
{
this->assign_to_own(f);
@@ -323,19 +291,10 @@ 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);
#else
@@ -352,24 +311,10 @@ namespace boost {
BOOST_FUNCTION_FUNCTION&
operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f)
{
-#ifndef BOOST_FUNCTION_NO_DEPRECATED
- self_type(f, static_cast(*this)).swap(*this);
-#else
self_type(f).swap(*this);
-#endif // BOOST_FUNCTION_NO_DEPRECATED
return *this;
}
-#ifndef BOOST_FUNCTION_NO_DEPRECATED
- template
- BOOST_FUNCTION_DEPRECATED_PRE
- void set(Functor BOOST_FUNCTION_TARGET_FIX(const &) f)
- {
- BOOST_FUNCTION_DEPRECATED_INNER
- self_type(f, static_cast(*this)).swap(*this);
- }
-#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
-
// Assignment from another BOOST_FUNCTION_FUNCTION
BOOST_FUNCTION_FUNCTION& operator=(const BOOST_FUNCTION_FUNCTION& f)
{
@@ -380,19 +325,6 @@ namespace boost {
return *this;
}
-#ifndef BOOST_FUNCTION_NO_DEPRECATED
- // Assignment from another BOOST_FUNCTION_FUNCTION
- BOOST_FUNCTION_DEPRECATED_PRE
- void set(const BOOST_FUNCTION_FUNCTION& f)
- {
- BOOST_FUNCTION_DEPRECATED_INNER
- if (&f == this)
- return;
-
- self_type(f).swap(*this);
- }
-#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
-
void swap(BOOST_FUNCTION_FUNCTION& other)
{
if (&other == this)
@@ -401,9 +333,6 @@ 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(*this), static_cast(other));
-#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
}
// Clear out a target, if there is one
@@ -473,7 +402,7 @@ namespace boost {
function_base::manager =
&detail::function::functor_manager::manage;
function_base::functor =
- function_base::manager(detail::function::any_pointer(
+ function_base::manager(detail::function::make_any_pointer(
// should be a reinterpret cast, but some compilers
// insist on giving cv-qualifiers to free functions
(void (*)())(f)
@@ -519,7 +448,7 @@ namespace boost {
FunctionObj* new_f = new FunctionObj(f);
#endif // BOOST_NO_STD_ALLOCATOR
function_base::functor =
- detail::function::any_pointer(static_cast(new_f));
+ detail::function::make_any_pointer(static_cast(new_f));
}
}
@@ -540,7 +469,7 @@ namespace boost {
function_base::manager = &detail::function::trivial_manager;
function_base::functor =
function_base::manager(
- detail::function::any_pointer(
+ detail::function::make_any_pointer(
const_cast(f.get_pointer())),
detail::function::clone_functor_tag);
}
@@ -559,7 +488,7 @@ namespace boost {
invoker_type;
invoker = &invoker_type::invoke;
function_base::manager = &detail::function::trivial_manager;
- function_base::functor = detail::function::any_pointer(this);
+ function_base::functor = detail::function::make_any_pointer(this);
}
typedef internal_result_type (*invoker_type)(detail::function::any_pointer
@@ -570,32 +499,74 @@ namespace boost {
};
template
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)
{
f1.swap(f2);
}
-}
+
+#if !defined (BOOST_NO_PARTIAL_SPECIALIZATION)
+
+#if BOOST_FUNCTION_NUM_ARGS == 0
+#define BOOST_FUNCTION_PARTIAL_SPEC R (void)
+#else
+#define BOOST_FUNCTION_PARTIAL_SPEC R (BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS,T))
+#endif
+
+template
+class function
+ : public BOOST_FUNCTION_FUNCTION
+{
+ typedef BOOST_FUNCTION_FUNCTION base_type;
+ typedef function self_type;
+
+public:
+ typedef typename base_type::allocator_type allocator_type;
+
+ function() : base_type() {}
+
+ template
+ function(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) : base_type(f) {}
+
+ function(const self_type& f) : base_type(static_cast(f)){}
+
+ template
+ self_type& operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f)
+ {
+ self_type(f).swap(*this);
+ return *this;
+ }
+
+ self_type& operator=(const base_type& f)
+ {
+ self_type(f).swap(*this);
+ return *this;
+ }
+
+ self_type& operator=(const self_type& f)
+ {
+ self_type(f).swap(*this);
+ return *this;
+ }
+};
+
+#undef BOOST_FUNCTION_PARTIAL_SPEC
+#endif // have partial specialization
+
+} // end namespace boost
// Cleanup after ourselves...
#undef BOOST_FUNCTION_DEFAULT_ALLOCATOR
@@ -611,3 +582,10 @@ namespace boost {
#undef BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER
#undef BOOST_FUNCTION_GET_STATELESS_FUNCTION_OBJ_INVOKER
#undef BOOST_FUNCTION_GET_MEM_FUNCTION_INVOKER
+#undef BOOST_FUNCTION_TEMPLATE_PARMS
+#undef BOOST_FUNCTION_TEMPLATE_ARGS
+#undef BOOST_FUNCTION_PARMS
+#undef BOOST_FUNCTION_PARM
+#undef BOOST_FUNCTION_ARGS
+#undef BOOST_FUNCTION_ARG_TYPE
+#undef BOOST_FUNCTION_ARG_TYPES
diff --git a/include/boost/function/gen_function_N.pl b/include/boost/function/gen_function_N.pl
index a159272..6f5b2f1 100644
--- a/include/boost/function/gen_function_N.pl
+++ b/include/boost/function/gen_function_N.pl
@@ -2,7 +2,7 @@
#
# Boost.Function library
#
-# Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu)
+# Copyright (C) 2001,2002 Doug Gregor (gregod@cs.rpi.edu)
#
# Permission to copy, use, sell and distribute this software is granted
# provided this copyright notice appears in all copies.
@@ -25,87 +25,8 @@ if ($#ARGV < 0) {
$totalNumArgs = $ARGV[0];
for ($numArgs = 0; $numArgs <= $totalNumArgs; ++$numArgs) {
open OUT, ">function$numArgs.hpp";
- print OUT "// Boost.Function library\n";
- print OUT "//\n";
- print OUT "// Copyright (C) 2001 Doug Gregor (gregod\@cs.rpi.edu)\n";
- print OUT "//\n";
- print OUT "// Permission to copy, use, sell and distribute this software is granted\n";
- print OUT "// provided this copyright notice appears in all copies.\n";
- print OUT "// Permission to modify the code and to distribute modified code is granted\n";
- print OUT "// provided this copyright notice appears in all copies, and a notice\n";
- print OUT "// that the code was modified is included with the copyright notice.\n";
- print OUT "//\n";
- print OUT "// This software is provided \"as is\" without express or implied warranty,\n";
- print OUT "// and with no claim as to its suitability for any purpose.\n";
- print OUT " \n";
- print OUT "// For more information, see http://www.boost.org\n";
- print OUT "\n";
- print OUT "#ifndef BOOST_FUNCTION_FUNCTION" . $numArgs . "_HEADER\n";
- print OUT "#define BOOST_FUNCTION_FUNCTION" , $numArgs . "_HEADER\n";
- print OUT "\n";
print OUT "#define BOOST_FUNCTION_NUM_ARGS $numArgs\n";
-
- $templateParms = "";
- for ($i = 0; $i < $numArgs; ++$i) {
- if ($i > 0) {
- $templateParms .= ", ";
- }
- $templateParms .= "typename T$i";
- }
- print OUT "#define BOOST_FUNCTION_TEMPLATE_PARMS $templateParms\n";
-
- $_ = $templateParms;
- s/typename //g;
- $templateArgs = $_;
- print OUT "#define BOOST_FUNCTION_TEMPLATE_ARGS $templateArgs\n";
-
- $parms = "";
- for ($i = 0; $i < $numArgs; ++$i) {
- if ($i > 0) {
- $parms .= ", ";
- }
- $parms .= "T$i a$i";
- }
- print OUT "#define BOOST_FUNCTION_PARMS $parms\n";
-
- $args = "";
- for ($i = 0; $i < $numArgs; ++$i) {
- if ($i > 0) {
- $args .= ", ";
- }
- $args .= "a$i";
- }
- print OUT "#define BOOST_FUNCTION_ARGS $args\n";
-
- $not0Parms = "";
- for ($i = 1; $i < $numArgs; ++$i) {
- if ($i > 1) {
- $not0Parms .= ", ";
- }
- $not0Parms .= "T$i a$i";
- }
- print OUT "#define BOOST_FUNCTION_NOT_0_PARMS $not0Parms\n";
-
- $not0Args = "";
- for ($i = 1; $i < $numArgs; ++$i) {
- if ($i > 1) {
- $not0Args .= ", ";
- }
- $not0Args .= "a$i";
- }
- print OUT "#define BOOST_FUNCTION_NOT_0_ARGS $not0Args\n";
-
- print OUT "\n";
- print OUT "#include \n";
- print OUT "\n";
- print OUT "#undef BOOST_FUNCTION_NOT_0_ARGS\n";
- print OUT "#undef BOOST_FUNCTION_NOT_0_PARMS\n";
- print OUT "#undef BOOST_FUNCTION_ARGS\n";
- print OUT "#undef BOOST_FUNCTION_PARMS\n";
- print OUT "#undef BOOST_FUNCTION_TEMPLATE_ARGS\n";
- print OUT "#undef BOOST_FUNCTION_TEMPLATE_PARMS\n";
+ print OUT "#include \n";
print OUT "#undef BOOST_FUNCTION_NUM_ARGS\n";
- print OUT "\n";
- print OUT "#endif // BOOST_FUNCTION_FUNCTION" . $numArgs . "_HEADER\n";
close OUT;
}
diff --git a/index.html b/index.html
index 1d298bc..1823970 100644
--- a/index.html
+++ b/index.html
@@ -25,7 +25,10 @@
Compatibility Note
- Boost.Function has been partially redesigned to minimize the interface and make it cleaner. Several seldom- or never-used features of the older Boost.Function have been deprecated and will be removed in the near future. Here is a list of features that have been deprecated, the likely impact of the deprecations, and how to adjust your code:
+
Version 1.30.0: All deprecated features have been removed
+from Boost.Function.
+
+
Version 1.29.0: Boost.Function has been partially redesigned to minimize the interface and make it cleaner. Several seldom- or never-used features of the older Boost.Function have been deprecated and will be removed in the near future. Here is a list of features that have been deprecated, the likely impact of the deprecations, and how to adjust your code:
- The
boost::function
class template syntax has
changed. The old syntax, e.g., boost::function<int, float,
diff --git a/test/allocator_test.cpp b/test/allocator_test.cpp
index cab749f..1809db1 100644
--- a/test/allocator_test.cpp
+++ b/test/allocator_test.cpp
@@ -60,7 +60,7 @@ static void do_nothing() {}
int
test_main(int, char*[])
{
- function::allocator< counting_allocator >::type f;
+ function2 > f;
f = plus();
f.clear();
BOOST_TEST(alloc_count == 1);
@@ -71,7 +71,7 @@ test_main(int, char*[])
f = &do_minus;
f.clear();
- function::allocator< counting_allocator >::type fv;
+ function0 > fv;
alloc_count = 0;
dealloc_count = 0;
fv = DoNothing();
diff --git a/test/deprecated_syntax_test.cpp b/test/deprecated_syntax_test.cpp
deleted file mode 100644
index 31c5152..0000000
--- a/test/deprecated_syntax_test.cpp
+++ /dev/null
@@ -1,645 +0,0 @@
-// Boost.Function library
-
-// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu)
-//
-// Permission to copy, use, sell and distribute this software is granted
-// provided this copyright notice appears in all copies.
-// Permission to modify the code and to distribute modified code is granted
-// provided this copyright notice appears in all copies, and a notice
-// that the code was modified is included with the copyright notice.
-//
-// This software is provided "as is" without express or implied warranty,
-// and with no claim as to its suitability for any purpose.
-
-// For more information, see http://www.boost.org
-
-#define BOOST_INCLUDE_MAIN
-#include
-#include
-#include
-#include
-#include
-
-using namespace boost;
-using std::string;
-using std::negate;
-
-int global_int;
-
-struct write_five_obj { void operator()() const { global_int = 5; } };
-struct write_three_obj { int operator()() const { global_int = 3; return 7; }};
-static void write_five() { global_int = 5; }
-static void write_three() { global_int = 3; }
-struct generate_five_obj { int operator()() const { return 5; } };
-struct generate_three_obj { int operator()() const { return 3; } };
-static int generate_five() { return 5; }
-static int generate_three() { return 3; }
-static string identity_str(const string& s) { return s; }
-static string string_cat(const string& s1, const string& s2) { return s1+s2; }
-static int sum_ints(int x, int y) { return x+y; }
-
-struct write_const_1_nonconst_2
-{
- void operator()() { global_int = 2; }
- void operator()() const { global_int = 1; }
-};
-
-struct add_to_obj
-{
- add_to_obj(int v) : value(v) {}
-
- int operator()(int x) const { return value + x; }
-
- int value;
-};
-
-static void
-test_zero_args()
-{
- typedef function func_void_type;
-
- write_five_obj five;
- write_three_obj three;
-
- // Default construction
- func_void_type v1;
- BOOST_TEST(v1.empty());
-
- // Assignment to an empty function
- v1 = five;
- BOOST_TEST(!v1.empty());
-
- // Invocation of a function
- global_int = 0;
- v1();
- BOOST_TEST(global_int == 5);
-
- // clear() method
- v1.clear();
- BOOST_TEST(v1.empty());
-
- // Assignment to an empty function
- v1 = three;
- BOOST_TEST(!v1.empty());
-
- // Invocation and self-assignment
- global_int = 0;
- v1 = v1;
- v1();
- BOOST_TEST(global_int == 3);
-
- // Assignment to a non-empty function
- v1 = five;
-
- // Invocation and self-assignment
- global_int = 0;
- v1 = (v1);
- v1();
- BOOST_TEST(global_int == 5);
-
- // clear()
- v1.clear();
- BOOST_TEST(v1.empty());
-
- // Assignment to an empty function from a free function
- v1 = BOOST_FUNCTION_TARGET_FIX(&) write_five;
- BOOST_TEST(!v1.empty());
-
- // Invocation
- global_int = 0;
- v1();
- BOOST_TEST(global_int == 5);
-
- // Assignment to a non-empty function from a free function
- v1 = BOOST_FUNCTION_TARGET_FIX(&) write_three;
- BOOST_TEST(!v1.empty());
-
- // Invocation
- global_int = 0;
- v1();
- BOOST_TEST(global_int == 3);
-
- // Assignment
- v1 = five;
- BOOST_TEST(!v1.empty());
-
- // Invocation
- global_int = 0;
- v1();
- BOOST_TEST(global_int == 5);
-
- // Assignment to a non-empty function from a free function
- v1 = &write_three;
- BOOST_TEST(!v1.empty());
-
- // Invocation
- global_int = 0;
- v1();
- BOOST_TEST(global_int == 3);
-
- // Construction from another function (that is empty)
- v1.clear();
- func_void_type v2(v1);
- BOOST_TEST(!v2? true : false);
-
- // Assignment to an empty function
- v2 = three;
- BOOST_TEST(!v2.empty());
-
- // Invocation
- global_int = 0;
- v2();
- BOOST_TEST(global_int == 3);
-
- // Assignment to a non-empty function
- v2 = (five);
-
- // Invocation
- global_int = 0;
- v2();
- BOOST_TEST(global_int == 5);
-
- v2.clear();
- BOOST_TEST(v2.empty());
-
- // Assignment to an empty function from a free function
- v2 = (BOOST_FUNCTION_TARGET_FIX(&) write_five);
- BOOST_TEST(v2? true : false);
-
- // Invocation
- global_int = 0;
- v2();
- BOOST_TEST(global_int == 5);
-
- // Assignment to a non-empty function from a free function
- v2 = BOOST_FUNCTION_TARGET_FIX(&) write_three;
- BOOST_TEST(!v2.empty());
-
- // Invocation
- global_int = 0;
- v2();
- BOOST_TEST(global_int == 3);
-
- // Swapping
- v1 = five;
- swap(v1, v2);
- v2();
- BOOST_TEST(global_int == 5);
- v1();
- BOOST_TEST(global_int == 3);
- swap(v1, v2);
- v1.clear();
-
- // Assignment
- v2 = five;
- BOOST_TEST(!v2.empty());
-
- // Invocation
- global_int = 0;
- v2();
- BOOST_TEST(global_int == 5);
-
- // Assignment to a non-empty function from a free function
- v2 = &write_three;
- BOOST_TEST(!v2.empty());
-
- // Invocation
- global_int = 0;
- v2();
- BOOST_TEST(global_int == 3);
-
- // Assignment to a function from an empty function
- v2 = v1;
- BOOST_TEST(v2.empty());
-
- // Assignment to a function from a function with a functor
- v1 = three;
- v2 = v1;
- BOOST_TEST(!v1.empty());
- BOOST_TEST(!v2.empty());
-
- // Invocation
- global_int = 0;
- v1();
- BOOST_TEST(global_int == 3);
- global_int = 0;
- v2();
- BOOST_TEST(global_int == 3);
-
- // Assign to a function from a function with a function
- v2 = BOOST_FUNCTION_TARGET_FIX(&) write_five;
- v1 = v2;
- BOOST_TEST(!v1.empty());
- BOOST_TEST(!v2.empty());
- global_int = 0;
- v1();
- BOOST_TEST(global_int == 5);
- global_int = 0;
- v2();
- BOOST_TEST(global_int == 5);
-
- // Construct a function given another function containing a function
- func_void_type v3(v1);
-
- // Invocation of a function
- global_int = 0;
- v3();
- BOOST_TEST(global_int == 5);
-
- // clear() method
- v3.clear();
- BOOST_TEST(!v3? true : false);
-
- // Assignment to an empty function
- v3 = three;
- BOOST_TEST(!v3.empty());
-
- // Invocation
- global_int = 0;
- v3();
- BOOST_TEST(global_int == 3);
-
- // Assignment to a non-empty function
- v3 = five;
-
- // Invocation
- global_int = 0;
- v3();
- BOOST_TEST(global_int == 5);
-
- // clear()
- v3.clear();
- BOOST_TEST(v3.empty());
-
- // Assignment to an empty function from a free function
- v3 = &write_five;
- BOOST_TEST(!v3.empty());
-
- // Invocation
- global_int = 0;
- v3();
- BOOST_TEST(global_int == 5);
-
- // Assignment to a non-empty function from a free function
- v3 = &write_three;
- BOOST_TEST(!v3.empty());
-
- // Invocation
- global_int = 0;
- v3();
- BOOST_TEST(global_int == 3);
-
- // Assignment
- v3 = five;
- BOOST_TEST(!v3.empty());
-
- // Invocation
- global_int = 0;
- v3();
- BOOST_TEST(global_int == 5);
-
- // Construction of a function from a function containing a functor
- func_void_type v4(v3);
-
- // Invocation of a function
- global_int = 0;
- v4();
- BOOST_TEST(global_int == 5);
-
- // clear() method
- v4.clear();
- BOOST_TEST(v4.empty());
-
- // Assignment to an empty function
- v4 = three;
- BOOST_TEST(!v4.empty());
-
- // Invocation
- global_int = 0;
- v4();
- BOOST_TEST(global_int == 3);
-
- // Assignment to a non-empty function
- v4 = five;
-
- // Invocation
- global_int = 0;
- v4();
- BOOST_TEST(global_int == 5);
-
- // clear()
- v4.clear();
- BOOST_TEST(v4.empty());
-
- // Assignment to an empty function from a free function
- v4 = &write_five;
- BOOST_TEST(!v4.empty());
-
- // Invocation
- global_int = 0;
- v4();
- BOOST_TEST(global_int == 5);
-
- // Assignment to a non-empty function from a free function
- v4 = &write_three;
- BOOST_TEST(!v4.empty());
-
- // Invocation
- global_int = 0;
- v4();
- BOOST_TEST(global_int == 3);
-
- // Assignment
- v4 = five;
- BOOST_TEST(!v4.empty());
-
- // Invocation
- global_int = 0;
- v4();
- BOOST_TEST(global_int == 5);
-
- // Construction of a function from a functor
- func_void_type v5(five);
-
- // Invocation of a function
- global_int = 0;
- v5();
- BOOST_TEST(global_int == 5);
-
- // clear() method
- v5.clear();
- BOOST_TEST(v5.empty());
-
- // Assignment to an empty function
- v5 = three;
- BOOST_TEST(!v5.empty());
-
- // Invocation
- global_int = 0;
- v5();
- BOOST_TEST(global_int == 3);
-
- // Assignment to a non-empty function
- v5 = five;
-
- // Invocation
- global_int = 0;
- v5();
- BOOST_TEST(global_int == 5);
-
- // clear()
- v5.clear();
- BOOST_TEST(v5.empty());
-
- // Assignment to an empty function from a free function
- v5 = &write_five;
- BOOST_TEST(!v5.empty());
-
- // Invocation
- global_int = 0;
- v5();
- BOOST_TEST(global_int == 5);
-
- // Assignment to a non-empty function from a free function
- v5 = &write_three;
- BOOST_TEST(!v5.empty());
-
- // Invocation
- global_int = 0;
- v5();
- BOOST_TEST(global_int == 3);
-
- // Assignment
- v5 = five;
- BOOST_TEST(!v5.empty());
-
- // Invocation
- global_int = 0;
- v5();
- BOOST_TEST(global_int == 5);
-
- // Construction of a function from a function
- func_void_type v6(&write_five);
-
- // Invocation of a function
- global_int = 0;
- v6();
- BOOST_TEST(global_int == 5);
-
- // clear() method
- v6.clear();
- BOOST_TEST(v6.empty());
-
- // Assignment to an empty function
- v6 = three;
- BOOST_TEST(!v6.empty());
-
- // Invocation
- global_int = 0;
- v6();
- BOOST_TEST(global_int == 3);
-
- // Assignment to a non-empty function
- v6 = five;
-
- // Invocation
- global_int = 0;
- v6();
- BOOST_TEST(global_int == 5);
-
- // clear()
- v6.clear();
- BOOST_TEST(v6.empty());
-
- // Assignment to an empty function from a free function
- v6 = &write_five;
- BOOST_TEST(!v6.empty());
-
- // Invocation
- global_int = 0;
- v6();
- BOOST_TEST(global_int == 5);
-
- // Assignment to a non-empty function from a free function
- v6 = &write_three;
- BOOST_TEST(!v6.empty());
-
- // Invocation
- global_int = 0;
- v6();
- BOOST_TEST(global_int == 3);
-
- // Assignment
- v6 = five;
- BOOST_TEST(!v6.empty());
-
- // Invocation
- global_int = 0;
- v6();
- BOOST_TEST(global_int == 5);
-
- // Const vs. non-const
- write_const_1_nonconst_2 one_or_two;
- const function v7(one_or_two);
- function v8(one_or_two);
-
- global_int = 0;
- v7();
- BOOST_TEST(global_int == 2);
-
- global_int = 0;
- v8();
- BOOST_TEST(global_int == 2);
-
- // Test return values
- typedef function func_int_type;
- generate_five_obj gen_five;
- generate_three_obj gen_three;
-
- func_int_type i0(gen_five);
-
- BOOST_TEST(i0() == 5);
- i0 = gen_three;
- BOOST_TEST(i0() == 3);
- i0 = &generate_five;
- BOOST_TEST(i0() == 5);
- i0 = &generate_three;
- BOOST_TEST(i0() == 3);
- BOOST_TEST(i0? true : false);
- i0.clear();
- BOOST_TEST(!i0? true : false);
-
- // Test return values with compatible types
- typedef function func_long_type;
- func_long_type i1(gen_five);
-
- BOOST_TEST(i1() == 5);
- i1 = gen_three;
- BOOST_TEST(i1() == 3);
- i1 = &generate_five;
- BOOST_TEST(i1() == 5);
- i1 = &generate_three;
- BOOST_TEST(i1() == 3);
- BOOST_TEST(i1? true : false);
- i1.clear();
- BOOST_TEST(!i1? true : false);
-}
-
-static void
-test_one_arg()
-{
- negate neg;
-
- function f1(neg);
- BOOST_TEST(f1(5) == -5);
-
- function id(&identity_str);
- BOOST_TEST(id("str") == "str");
-
- function id2(&identity_str);
- BOOST_TEST(id2("foo") == "foo");
-
- add_to_obj add_to(5);
- function f2(add_to);
- BOOST_TEST(f2(3) == 8);
-
- const function cf2(add_to);
- BOOST_TEST(cf2(3) == 8);
-}
-
-static void
-test_two_args()
-{
- function cat(&string_cat);
- BOOST_TEST(cat("str", "ing") == "string");
-
- function sum(&sum_ints);
- BOOST_TEST(sum(2, 3) == 5);
-}
-
-static void
-test_emptiness()
-{
- function f1;
- BOOST_TEST(f1.empty());
-
- function f2;
- f2 = f1;
- BOOST_TEST(f2.empty());
-
- function f3;
- f3 = f2;
- BOOST_TEST(f3.empty());
-}
-
-struct X {
- X(int v) : value(v) {}
-
- int twice() const { return 2*value; }
- int plus(int v) { return value + v; }
-
- int value;
-};
-
-static void
-test_member_functions()
-{
- boost::function f1(&X::twice);
-
- X one(1);
- X five(5);
-
- BOOST_TEST(f1(&one) == 2);
- BOOST_TEST(f1(&five) == 10);
-
- boost::function f1_2;
- f1_2 = &X::twice;
-
- BOOST_TEST(f1_2(&one) == 2);
- BOOST_TEST(f1_2(&five) == 10);
-
- boost::function f2(&X::plus);
- BOOST_TEST(f2(one, 3) == 4);
- BOOST_TEST(f2(five, 4) == 9);
-}
-
-struct add_with_throw_on_copy {
- int operator()(int x, int y) const { return x+y; }
-
- add_with_throw_on_copy() {}
-
- add_with_throw_on_copy(const add_with_throw_on_copy&)
- {
- throw std::runtime_error("But this CAN'T throw");
- }
-
- add_with_throw_on_copy& operator=(const add_with_throw_on_copy&)
- {
- throw std::runtime_error("But this CAN'T throw");
- }
-};
-
-static void
-test_ref()
-{
- add_with_throw_on_copy atc;
- try {
- boost::function f(ref(atc));
- BOOST_TEST(f(1, 3) == 4);
- }
- catch(std::runtime_error e) {
- BOOST_ERROR("Nonthrowing constructor threw an exception");
- }
-}
-
-int test_main(int, char* [])
-{
- test_zero_args();
- test_one_arg();
- test_two_args();
- test_emptiness();
- test_member_functions();
- test_ref();
-
- return 0;
-}
diff --git a/test/function_30.cpp b/test/function_30.cpp
new file mode 100644
index 0000000..d8696d5
--- /dev/null
+++ b/test/function_30.cpp
@@ -0,0 +1,16 @@
+// Make sure we don't try to redefine function2
+#include
+
+// Define all Boost.Function class templates up to 30 arguments
+#define BOOST_FUNCTION_MAX_ARGS 30
+#include
+
+int main()
+{
+ boost::function0 f0;
+
+ boost::function30 f30;
+ return 0;
+}
diff --git a/test/function_n_test.cpp b/test/function_n_test.cpp
index ac01f0e..34817bc 100644
--- a/test/function_n_test.cpp
+++ b/test/function_n_test.cpp
@@ -481,7 +481,7 @@ test_zero_args()
// Const vs. non-const
write_const_1_nonconst_2 one_or_two;
const function0 v7(one_or_two);
- function v8(one_or_two);
+ function0 v8(one_or_two);
global_int = 0;
v7();
diff --git a/test/mixin_test.cpp b/test/mixin_test.cpp
deleted file mode 100644
index 61c7200..0000000
--- a/test/mixin_test.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-// Boost.Function library
-
-// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu)
-//
-// Permission to copy, use, sell and distribute this software is granted
-// provided this copyright notice appears in all copies.
-// Permission to modify the code and to distribute modified code is granted
-// provided this copyright notice appears in all copies, and a notice
-// that the code was modified is included with the copyright notice.
-//
-// This software is provided "as is" without express or implied warranty,
-// and with no claim as to its suitability for any purpose.
-
-// For more information, see http://www.boost.org
-
-#define BOOST_INCLUDE_MAIN
-#include
-#include
-#include
-#include
-
-struct id_mixin
-{
- id_mixin(const id_mixin& rhs) : id(rhs.id) {}
- id_mixin& operator=(const id_mixin& rhs){id = rhs.id; return *this;}
- id_mixin(int i = 0){ id = i;}
- int id;
-};
-
-static int do_plus(int x, int y) { return x+y; }
-
-typedef boost::function::mixin::type func;
-
-int test_main(int, char*[])
-{
- func f(id_mixin(3));
- f = std::plus();
- BOOST_TEST(f.id == 3);
-
- f = &do_plus;
- BOOST_TEST(f.id == 3);
-
- f.clear();
- f.id = 7;
- BOOST_TEST(f.id == 7);
-
- func g(f);
- BOOST_TEST(g.id == 7);
-
- f.id = 21;
- BOOST_TEST(f.id == 21);
-
- boost::swap(f,g);
- BOOST_TEST(f.id == 7);
- BOOST_TEST(g.id == 21);
-
- g = f;
- BOOST_TEST(g.id == 7);
- return 0;
-}
diff --git a/test/policy_test.cpp b/test/policy_test.cpp
deleted file mode 100644
index cee8f93..0000000
--- a/test/policy_test.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-// Boost.Function library
-
-// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu)
-//
-// Permission to copy, use, sell and distribute this software is granted
-// provided this copyright notice appears in all copies.
-// Permission to modify the code and to distribute modified code is granted
-// provided this copyright notice appears in all copies, and a notice
-// that the code was modified is included with the copyright notice.
-//
-// This software is provided "as is" without express or implied warranty,
-// and with no claim as to its suitability for any purpose.
-
-// For more information, see http://www.boost.org
-
-#define BOOST_INCLUDE_MAIN
-#include
-#include
-#include
-#include
-#include
-
-using namespace std;
-using namespace boost;
-
-struct counting_policy
-{
- static int count;
-
- void precall(const function_base*) { count++; }
- void postcall(const function_base*) { count+=2; }
-};
-
-int counting_policy::count = 0;
-
-int
-test_main(int, char*[])
-{
- function::policy::type f;
-
- f = plus();
-
- BOOST_TEST(5 == f(2,3));
- BOOST_TEST(counting_policy::count==3);
-
- return 0;
-}