mirror of
https://github.com/boostorg/function.git
synced 2026-01-29 07:32:15 +00:00
Compare commits
20 Commits
svn-branch
...
svn-branch
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f33837c22 | ||
|
|
35e2ff56a0 | ||
|
|
b5b12295c2 | ||
|
|
eea010ef80 | ||
|
|
b8ef34c043 | ||
|
|
8b816138bc | ||
|
|
24ce3091d0 | ||
|
|
354b8b802e | ||
|
|
db089615a2 | ||
|
|
3b269d5de7 | ||
|
|
795964f63d | ||
|
|
0f15ba9450 | ||
|
|
bb669b4fb5 | ||
|
|
dc61dc6dc8 | ||
|
|
d0fe22e9bf | ||
|
|
e2a7fea741 | ||
|
|
e14e57a678 | ||
|
|
c9d7858ff0 | ||
|
|
fdbbc2b3ff | ||
|
|
520ee97c82 |
@@ -1,6 +1,6 @@
|
||||
// Boost.Function library
|
||||
|
||||
// Copyright Doug Gregor 2001-2003. Use, modification and
|
||||
// Copyright Douglas Gregor 2001-2003. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <boost/function/detail/prologue.hpp>
|
||||
|
||||
// Visual Age C++ doesn't handle the file iteration well
|
||||
#if BOOST_WORKAROUND(__IBMCPP__, <= 600)
|
||||
#if BOOST_WORKAROUND(__IBMCPP__, >= 500)
|
||||
# if BOOST_FUNCTION_MAX_ARGS >= 0
|
||||
# include <boost/function/function0.hpp>
|
||||
# endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Boost.Function library
|
||||
|
||||
// Copyright Doug Gregor 2003. Use, modification and
|
||||
// Copyright Douglas Gregor 2003. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# Boost.Function library
|
||||
#
|
||||
# Copyright (C) 2001-2003 Doug Gregor (gregod@cs.rpi.edu)
|
||||
# Copyright (C) 2001-2003 Douglas Gregor (gregod@cs.rpi.edu)
|
||||
#
|
||||
# Permission to copy, use, sell and distribute this software is granted
|
||||
# provided this copyright notice appears in all copies.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Boost.Function library
|
||||
|
||||
// Copyright Doug Gregor 2003. Use, modification and
|
||||
// Copyright Douglas Gregor 2003. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Boost.Function library
|
||||
|
||||
// Copyright Doug Gregor 2002-2003. Use, modification and
|
||||
// Copyright Douglas Gregor 2002-2003. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Boost.Function library
|
||||
|
||||
// Copyright Doug Gregor 2002-2003. Use, modification and
|
||||
// Copyright Douglas Gregor 2002-2003. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Boost.Function library
|
||||
|
||||
// Copyright Doug Gregor 2002-2003. Use, modification and
|
||||
// Copyright Douglas Gregor 2002-2003. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Boost.Function library
|
||||
|
||||
// Copyright Doug Gregor 2002-2003. Use, modification and
|
||||
// Copyright Douglas Gregor 2002-2003. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Boost.Function library
|
||||
|
||||
// Copyright Doug Gregor 2002-2003. Use, modification and
|
||||
// Copyright Douglas Gregor 2002-2003. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Boost.Function library
|
||||
|
||||
// Copyright Doug Gregor 2002-2003. Use, modification and
|
||||
// Copyright Douglas Gregor 2002-2003. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Boost.Function library
|
||||
|
||||
// Copyright Doug Gregor 2002-2003. Use, modification and
|
||||
// Copyright Douglas Gregor 2002-2003. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Boost.Function library
|
||||
|
||||
// Copyright Doug Gregor 2002-2003. Use, modification and
|
||||
// Copyright Douglas Gregor 2002-2003. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Boost.Function library
|
||||
|
||||
// Copyright Doug Gregor 2002-2003. Use, modification and
|
||||
// Copyright Douglas Gregor 2002-2003. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Boost.Function library
|
||||
|
||||
// Copyright Doug Gregor 2002-2003. Use, modification and
|
||||
// Copyright Douglas Gregor 2002-2003. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Boost.Function library
|
||||
|
||||
// Copyright Doug Gregor 2002-2003. Use, modification and
|
||||
// Copyright Douglas Gregor 2002-2003. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Boost.Function library
|
||||
|
||||
// Copyright Doug Gregor 2002-2003. Use, modification and
|
||||
// Copyright Douglas Gregor 2002-2003. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Boost.Function library
|
||||
|
||||
// Copyright Doug Gregor 2001-2004. Use, modification and
|
||||
// Copyright Douglas Gregor 2001-2004. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -63,11 +63,19 @@ namespace boost { namespace python { namespace objects {
|
||||
# define BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX
|
||||
#endif
|
||||
|
||||
#define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor,Type) \
|
||||
typename ::boost::enable_if_c<(::boost::type_traits::ice_not< \
|
||||
(::boost::is_integral<Functor>::value)>::value), \
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600)
|
||||
# define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor,Type) \
|
||||
typename ::boost::enable_if_c<(::boost::type_traits::ice_not< \
|
||||
(::boost::is_integral<Functor>::value)>::value), \
|
||||
Type>::type
|
||||
#else
|
||||
// BCC doesn't recognize this depends on a template argument and complains
|
||||
// about the use of 'typename'
|
||||
# define BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor,Type) \
|
||||
::boost::enable_if_c<(::boost::type_traits::ice_not< \
|
||||
(::boost::is_integral<Functor>::value)>::value), \
|
||||
Type>::type
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX)
|
||||
namespace boost {
|
||||
@@ -414,7 +422,12 @@ public:
|
||||
}
|
||||
|
||||
template<typename Functor>
|
||||
|
||||
#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
const Functor* target( Functor * = 0 ) const
|
||||
#else
|
||||
const Functor* target() const
|
||||
#endif
|
||||
{
|
||||
if (!manager) return 0;
|
||||
|
||||
@@ -424,14 +437,23 @@ public:
|
||||
if (!result.obj_ptr) return 0;
|
||||
else {
|
||||
typedef typename detail::function::get_function_tag<Functor>::type tag;
|
||||
|
||||
#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
return get_functor_pointer(tag(), 0, (Functor*)0);
|
||||
#else
|
||||
return get_functor_pointer<Functor>(tag(), 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
template<typename F>
|
||||
bool contains(const F& f) const
|
||||
{
|
||||
#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
if (const F* fp = this->target( (F*)0 )) {
|
||||
#else
|
||||
if (const F* fp = this->template target<F>()) {
|
||||
#endif
|
||||
return function_equal(*fp, f);
|
||||
} else {
|
||||
return false;
|
||||
@@ -447,7 +469,7 @@ public:
|
||||
operator==(Functor g) const
|
||||
{
|
||||
if (const Functor* fp = target<Functor>())
|
||||
return function_equal(*fp, g);
|
||||
return function_equal(*fp, g);
|
||||
else return false;
|
||||
}
|
||||
|
||||
@@ -456,7 +478,7 @@ public:
|
||||
operator!=(Functor g) const
|
||||
{
|
||||
if (const Functor* fp = target<Functor>())
|
||||
return !function_equal(*fp, g);
|
||||
return !function_equal(*fp, g);
|
||||
else return true;
|
||||
}
|
||||
#endif
|
||||
@@ -469,20 +491,36 @@ public: // should be protected, but GCC 2.95.3 will fail to allow access
|
||||
|
||||
private:
|
||||
template<typename Functor>
|
||||
#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
Functor* get_functor_pointer(detail::function::function_ptr_tag, int, Functor * = 0)
|
||||
#else
|
||||
Functor* get_functor_pointer(detail::function::function_ptr_tag, int)
|
||||
#endif
|
||||
{ return reinterpret_cast<Functor*>(&functor.func_ptr); }
|
||||
|
||||
template<typename Functor, typename Tag>
|
||||
#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
Functor* get_functor_pointer(Tag, long, Functor * = 0)
|
||||
#else
|
||||
Functor* get_functor_pointer(Tag, long)
|
||||
#endif
|
||||
{ return static_cast<Functor*>(functor.obj_ptr); }
|
||||
|
||||
template<typename Functor>
|
||||
const Functor*
|
||||
#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
get_functor_pointer(detail::function::function_ptr_tag, int, Functor * = 0) const
|
||||
#else
|
||||
get_functor_pointer(detail::function::function_ptr_tag, int) const
|
||||
#endif
|
||||
{ return reinterpret_cast<const Functor*>(&functor.func_ptr); }
|
||||
|
||||
template<typename Functor, typename Tag>
|
||||
#if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
const Functor* get_functor_pointer(Tag, long, Functor * = 0) const
|
||||
#else
|
||||
const Functor* get_functor_pointer(Tag, long) const
|
||||
#endif
|
||||
{ return static_cast<const Functor*>(functor.const_obj_ptr); }
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Boost.Function library
|
||||
|
||||
// Copyright Doug Gregor 2001-2003. Use, modification and
|
||||
// Copyright Douglas Gregor 2001-2003. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -61,6 +61,14 @@
|
||||
#define BOOST_FUNCTION_GET_STATELESS_FUNCTION_OBJ_INVOKER \
|
||||
BOOST_JOIN(get_stateless_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS)
|
||||
|
||||
#ifndef BOOST_NO_VOID_RETURNS
|
||||
# define BOOST_FUNCTION_VOID_RETURN_TYPE void
|
||||
# define BOOST_FUNCTION_RETURN(X) X
|
||||
#else
|
||||
# define BOOST_FUNCTION_VOID_RETURN_TYPE boost::detail::function::unusable
|
||||
# define BOOST_FUNCTION_RETURN(X) X; return BOOST_FUNCTION_VOID_RETURN_TYPE ()
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace function {
|
||||
@@ -86,13 +94,13 @@ namespace boost {
|
||||
>
|
||||
struct BOOST_FUNCTION_VOID_FUNCTION_INVOKER
|
||||
{
|
||||
static unusable invoke(any_pointer function_ptr BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_PARMS)
|
||||
static BOOST_FUNCTION_VOID_RETURN_TYPE
|
||||
invoke(any_pointer function_ptr BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_PARMS)
|
||||
|
||||
{
|
||||
FunctionPtr f = reinterpret_cast<FunctionPtr>(function_ptr.func_ptr);
|
||||
f(BOOST_FUNCTION_ARGS);
|
||||
return unusable();
|
||||
BOOST_FUNCTION_RETURN(f(BOOST_FUNCTION_ARGS));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -119,14 +127,13 @@ namespace boost {
|
||||
>
|
||||
struct BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER
|
||||
{
|
||||
static unusable invoke(any_pointer function_obj_ptr
|
||||
BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_PARMS)
|
||||
static BOOST_FUNCTION_VOID_RETURN_TYPE
|
||||
invoke(any_pointer function_obj_ptr BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_PARMS)
|
||||
|
||||
{
|
||||
FunctionObj* f = (FunctionObj*)(function_obj_ptr.obj_ptr);
|
||||
(*f)(BOOST_FUNCTION_ARGS);
|
||||
return unusable();
|
||||
BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -151,13 +158,12 @@ namespace boost {
|
||||
>
|
||||
struct BOOST_FUNCTION_STATELESS_VOID_FUNCTION_OBJ_INVOKER
|
||||
{
|
||||
static unusable invoke(any_pointer BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_PARMS)
|
||||
static BOOST_FUNCTION_VOID_RETURN_TYPE
|
||||
invoke(any_pointer BOOST_FUNCTION_COMMA BOOST_FUNCTION_PARMS)
|
||||
|
||||
{
|
||||
FunctionObj f = FunctionObj();
|
||||
f(BOOST_FUNCTION_ARGS);
|
||||
return unusable();
|
||||
BOOST_FUNCTION_RETURN(f(BOOST_FUNCTION_ARGS));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -235,8 +241,12 @@ namespace boost {
|
||||
class BOOST_FUNCTION_FUNCTION : public function_base
|
||||
{
|
||||
public:
|
||||
typedef typename detail::function::function_return_type<R>::type
|
||||
internal_result_type;
|
||||
#ifndef BOOST_NO_VOID_RETURNS
|
||||
typedef R result_type;
|
||||
#else
|
||||
typedef typename boost::detail::function::function_return_type<R>::type
|
||||
result_type;
|
||||
#endif // BOOST_NO_VOID_RETURNS
|
||||
|
||||
private:
|
||||
struct clear_type {};
|
||||
@@ -248,7 +258,7 @@ namespace boost {
|
||||
template<typename Args>
|
||||
struct sig
|
||||
{
|
||||
typedef internal_result_type type;
|
||||
typedef result_type type;
|
||||
};
|
||||
|
||||
#if BOOST_FUNCTION_NUM_ARGS == 1
|
||||
@@ -261,11 +271,6 @@ namespace boost {
|
||||
BOOST_STATIC_CONSTANT(int, arity = BOOST_FUNCTION_NUM_ARGS);
|
||||
BOOST_FUNCTION_ARG_TYPES
|
||||
|
||||
#ifndef BOOST_NO_VOID_RETURNS
|
||||
typedef R result_type;
|
||||
#else
|
||||
typedef internal_result_type result_type;
|
||||
#endif // BOOST_NO_VOID_RETURNS
|
||||
typedef Allocator allocator_type;
|
||||
typedef BOOST_FUNCTION_FUNCTION self_type;
|
||||
|
||||
@@ -278,7 +283,7 @@ namespace boost {
|
||||
BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f
|
||||
#ifndef BOOST_NO_SFINAE
|
||||
,typename enable_if_c<
|
||||
(::boost::type_traits::ice_not<
|
||||
(boost::type_traits::ice_not<
|
||||
(is_integral<Functor>::value)>::value),
|
||||
int>::type = 0
|
||||
#endif // BOOST_NO_SFINAE
|
||||
@@ -307,7 +312,7 @@ namespace boost {
|
||||
|
||||
~BOOST_FUNCTION_FUNCTION() { clear(); }
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
// MSVC 6.0 and prior require all definitions to be inline, but
|
||||
// these definitions can become very costly.
|
||||
result_type operator()(BOOST_FUNCTION_PARMS) const
|
||||
@@ -315,15 +320,7 @@ namespace boost {
|
||||
if (this->empty())
|
||||
boost::throw_exception(bad_function_call());
|
||||
|
||||
internal_result_type result = invoker(this->functor
|
||||
BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_ARGS);
|
||||
|
||||
#ifndef BOOST_NO_VOID_RETURNS
|
||||
return static_cast<result_type>(result);
|
||||
#else
|
||||
return result;
|
||||
#endif // BOOST_NO_VOID_RETURNS
|
||||
return invoker(this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS);
|
||||
}
|
||||
#else
|
||||
result_type operator()(BOOST_FUNCTION_PARMS) const;
|
||||
@@ -337,7 +334,7 @@ namespace boost {
|
||||
template<typename Functor>
|
||||
#ifndef BOOST_NO_SFINAE
|
||||
typename enable_if_c<
|
||||
(::boost::type_traits::ice_not<
|
||||
(boost::type_traits::ice_not<
|
||||
(is_integral<Functor>::value)>::value),
|
||||
BOOST_FUNCTION_FUNCTION&>::type
|
||||
#else
|
||||
@@ -389,7 +386,8 @@ namespace boost {
|
||||
{
|
||||
if (this->manager) {
|
||||
function_base::functor =
|
||||
this->manager(this->functor, detail::function::destroy_functor_tag);
|
||||
this->manager(this->functor,
|
||||
boost::detail::function::destroy_functor_tag);
|
||||
}
|
||||
|
||||
this->manager = 0;
|
||||
@@ -422,24 +420,24 @@ namespace boost {
|
||||
invoker = f.invoker;
|
||||
this->manager = f.manager;
|
||||
this->functor =
|
||||
f.manager(f.functor, detail::function::clone_functor_tag);
|
||||
f.manager(f.functor, boost::detail::function::clone_functor_tag);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Functor>
|
||||
void assign_to(Functor f)
|
||||
{
|
||||
typedef typename detail::function::get_function_tag<Functor>::type tag;
|
||||
typedef typename boost::detail::function::get_function_tag<Functor>::type tag;
|
||||
this->assign_to(f, tag());
|
||||
}
|
||||
|
||||
template<typename FunctionPtr>
|
||||
void assign_to(FunctionPtr f, detail::function::function_ptr_tag)
|
||||
void assign_to(FunctionPtr f, boost::detail::function::function_ptr_tag)
|
||||
{
|
||||
clear();
|
||||
|
||||
if (f) {
|
||||
typedef typename detail::function::BOOST_FUNCTION_GET_FUNCTION_INVOKER<
|
||||
typedef typename boost::detail::function::BOOST_FUNCTION_GET_FUNCTION_INVOKER<
|
||||
FunctionPtr,
|
||||
R BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_TEMPLATE_ARGS
|
||||
@@ -448,31 +446,31 @@ namespace boost {
|
||||
|
||||
invoker = &actual_invoker_type::invoke;
|
||||
this->manager =
|
||||
&detail::function::functor_manager<FunctionPtr, Allocator>::manage;
|
||||
&boost::detail::function::functor_manager<FunctionPtr, Allocator>::manage;
|
||||
this->functor =
|
||||
this->manager(detail::function::make_any_pointer(
|
||||
this->manager(boost::detail::function::make_any_pointer(
|
||||
// should be a reinterpret cast, but some compilers
|
||||
// insist on giving cv-qualifiers to free functions
|
||||
(void (*)())(f)
|
||||
),
|
||||
detail::function::clone_functor_tag);
|
||||
boost::detail::function::clone_functor_tag);
|
||||
}
|
||||
}
|
||||
|
||||
#if BOOST_FUNCTION_NUM_ARGS > 0
|
||||
template<typename MemberPtr>
|
||||
void assign_to(MemberPtr f, detail::function::member_ptr_tag)
|
||||
void assign_to(MemberPtr f, boost::detail::function::member_ptr_tag)
|
||||
{
|
||||
this->assign_to(mem_fn(f));
|
||||
}
|
||||
#endif // BOOST_FUNCTION_NUM_ARGS > 0
|
||||
|
||||
template<typename FunctionObj>
|
||||
void assign_to(FunctionObj f, detail::function::function_obj_tag)
|
||||
void assign_to(FunctionObj f, boost::detail::function::function_obj_tag)
|
||||
{
|
||||
if (!detail::function::has_empty_target(addressof(f))) {
|
||||
if (!boost::detail::function::has_empty_target(boost::addressof(f))) {
|
||||
typedef
|
||||
typename detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER<
|
||||
typename boost::detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER<
|
||||
FunctionObj,
|
||||
R BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_TEMPLATE_ARGS
|
||||
@@ -480,7 +478,7 @@ namespace boost {
|
||||
actual_invoker_type;
|
||||
|
||||
invoker = &actual_invoker_type::invoke;
|
||||
this->manager = &detail::function::functor_manager<
|
||||
this->manager = &boost::detail::function::functor_manager<
|
||||
FunctionObj, Allocator>::manage;
|
||||
#ifndef BOOST_NO_STD_ALLOCATOR
|
||||
typedef typename Allocator::template rebind<FunctionObj>::other
|
||||
@@ -496,17 +494,17 @@ namespace boost {
|
||||
FunctionObj* new_f = new FunctionObj(f);
|
||||
#endif // BOOST_NO_STD_ALLOCATOR
|
||||
this->functor =
|
||||
detail::function::make_any_pointer(static_cast<void*>(new_f));
|
||||
boost::detail::function::make_any_pointer(static_cast<void*>(new_f));
|
||||
}
|
||||
}
|
||||
|
||||
template<typename FunctionObj>
|
||||
void assign_to(const reference_wrapper<FunctionObj>& f,
|
||||
detail::function::function_obj_ref_tag)
|
||||
boost::detail::function::function_obj_ref_tag)
|
||||
{
|
||||
if (!detail::function::has_empty_target(f.get_pointer())) {
|
||||
if (!boost::detail::function::has_empty_target(f.get_pointer())) {
|
||||
typedef
|
||||
typename detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER<
|
||||
typename boost::detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER<
|
||||
FunctionObj,
|
||||
R BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_TEMPLATE_ARGS
|
||||
@@ -514,20 +512,20 @@ namespace boost {
|
||||
actual_invoker_type;
|
||||
|
||||
invoker = &actual_invoker_type::invoke;
|
||||
this->manager = &detail::function::trivial_manager<FunctionObj>::get;
|
||||
this->manager = &boost::detail::function::trivial_manager<FunctionObj>::get;
|
||||
this->functor =
|
||||
this->manager(
|
||||
detail::function::make_any_pointer(
|
||||
boost::detail::function::make_any_pointer(
|
||||
const_cast<FunctionObj*>(f.get_pointer())),
|
||||
detail::function::clone_functor_tag);
|
||||
boost::detail::function::clone_functor_tag);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename FunctionObj>
|
||||
void assign_to(FunctionObj, detail::function::stateless_function_obj_tag)
|
||||
void assign_to(FunctionObj, boost::detail::function::stateless_function_obj_tag)
|
||||
{
|
||||
typedef
|
||||
typename detail::function::
|
||||
typename boost::detail::function::
|
||||
BOOST_FUNCTION_GET_STATELESS_FUNCTION_OBJ_INVOKER<
|
||||
FunctionObj,
|
||||
R BOOST_FUNCTION_COMMA
|
||||
@@ -535,13 +533,13 @@ namespace boost {
|
||||
>::type
|
||||
actual_invoker_type;
|
||||
invoker = &actual_invoker_type::invoke;
|
||||
this->manager = &detail::function::trivial_manager<FunctionObj>::get;
|
||||
this->functor = detail::function::make_any_pointer(this);
|
||||
this->manager = &boost::detail::function::trivial_manager<FunctionObj>::get;
|
||||
this->functor = boost::detail::function::make_any_pointer(this);
|
||||
}
|
||||
|
||||
typedef internal_result_type (*invoker_type)(detail::function::any_pointer
|
||||
BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_TEMPLATE_ARGS);
|
||||
typedef result_type (*invoker_type)(boost::detail::function::any_pointer
|
||||
BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_TEMPLATE_ARGS);
|
||||
|
||||
invoker_type invoker;
|
||||
};
|
||||
@@ -562,7 +560,7 @@ namespace boost {
|
||||
f1.swap(f2);
|
||||
}
|
||||
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
template<typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS,
|
||||
typename Allocator>
|
||||
typename BOOST_FUNCTION_FUNCTION<
|
||||
@@ -573,19 +571,11 @@ namespace boost {
|
||||
Allocator>
|
||||
::operator()(BOOST_FUNCTION_PARMS) const
|
||||
{
|
||||
if (this->empty())
|
||||
boost::throw_exception(bad_function_call());
|
||||
|
||||
internal_result_type result = invoker(this->functor
|
||||
BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_ARGS);
|
||||
|
||||
# ifndef BOOST_NO_VOID_RETURNS
|
||||
return static_cast<result_type>(result);
|
||||
# else
|
||||
return result;
|
||||
# endif // BOOST_NO_VOID_RETURNS
|
||||
}
|
||||
if (this->empty())
|
||||
boost::throw_exception(bad_function_call());
|
||||
|
||||
return invoker(this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Poison comparisons between boost::function objects of the same type.
|
||||
@@ -640,7 +630,7 @@ public:
|
||||
function(Functor f
|
||||
#ifndef BOOST_NO_SFINAE
|
||||
,typename enable_if_c<
|
||||
(::boost::type_traits::ice_not<
|
||||
(boost::type_traits::ice_not<
|
||||
(is_integral<Functor>::value)>::value),
|
||||
int>::type = 0
|
||||
#endif
|
||||
@@ -666,7 +656,7 @@ public:
|
||||
template<typename Functor>
|
||||
#ifndef BOOST_NO_SFINAE
|
||||
typename enable_if_c<
|
||||
(::boost::type_traits::ice_not<
|
||||
(boost::type_traits::ice_not<
|
||||
(is_integral<Functor>::value)>::value),
|
||||
self_type&>::type
|
||||
#else
|
||||
@@ -719,3 +709,5 @@ public:
|
||||
#undef BOOST_FUNCTION_ARGS
|
||||
#undef BOOST_FUNCTION_ARG_TYPE
|
||||
#undef BOOST_FUNCTION_ARG_TYPES
|
||||
#undef BOOST_FUNCTION_VOID_RETURN_TYPE
|
||||
#undef BOOST_FUNCTION_RETURN
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# Boost.Function library
|
||||
#
|
||||
# Copyright Doug Gregor 2001-2003. Use, modification and
|
||||
# Copyright Douglas Gregor 2001-2003. Use, modification and
|
||||
# distribution is subject to the Boost Software License, Version
|
||||
# 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
// Copyright Doug Gregor 2004. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// Copyright Douglas Gregor 2004.
|
||||
// Copyright 2005 Peter Dimov
|
||||
|
||||
// Use, modification and distribution is subject to
|
||||
// the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// For more information, see http://www.boost.org
|
||||
@@ -9,15 +12,16 @@
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace detail {
|
||||
template<typename F, typename G>
|
||||
bool function_equal_impl(const F& f, const G& g, long)
|
||||
{ return f == g; }
|
||||
} // end namespace boost::function
|
||||
template<typename F, typename G>
|
||||
bool function_equal_impl(const F& f, const G& g, long)
|
||||
{ return f == g; }
|
||||
|
||||
// function_equal_impl needs to be unqualified to pick
|
||||
// user overloads on two-phase compilers
|
||||
|
||||
template<typename F, typename G>
|
||||
bool function_equal(const F& f, const G& g)
|
||||
{ return ::boost::detail::function_equal_impl(f, g, 0); }
|
||||
{ return function_equal_impl(f, g, 0); }
|
||||
|
||||
} // end namespace boost
|
||||
|
||||
|
||||
Reference in New Issue
Block a user