forked from boostorg/function
Compare commits
1 Commits
svn-branch
...
svn-branch
Author | SHA1 | Date | |
---|---|---|---|
955cf95601 |
@ -1,6 +1,6 @@
|
||||
// Boost.Function library
|
||||
|
||||
// Copyright Douglas Gregor 2001-2003. Use, modification and
|
||||
// Copyright Doug 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__, >= 500)
|
||||
#if BOOST_WORKAROUND(__IBMCPP__, <= 600)
|
||||
# if BOOST_FUNCTION_MAX_ARGS >= 0
|
||||
# include <boost/function/function0.hpp>
|
||||
# endif
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Boost.Function library
|
||||
|
||||
// Copyright Douglas Gregor 2003. Use, modification and
|
||||
// Copyright Doug 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 Douglas Gregor (gregod@cs.rpi.edu)
|
||||
# Copyright (C) 2001-2003 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.
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Boost.Function library
|
||||
|
||||
// Copyright Douglas Gregor 2003. Use, modification and
|
||||
// Copyright Doug 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 Douglas Gregor 2002-2003. Use, modification and
|
||||
// Copyright Doug 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 Douglas Gregor 2002-2003. Use, modification and
|
||||
// Copyright Doug 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 Douglas Gregor 2002-2003. Use, modification and
|
||||
// Copyright Doug 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 Douglas Gregor 2002-2003. Use, modification and
|
||||
// Copyright Doug 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 Douglas Gregor 2002-2003. Use, modification and
|
||||
// Copyright Doug 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 Douglas Gregor 2002-2003. Use, modification and
|
||||
// Copyright Doug 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 Douglas Gregor 2002-2003. Use, modification and
|
||||
// Copyright Doug 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 Douglas Gregor 2002-2003. Use, modification and
|
||||
// Copyright Doug 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 Douglas Gregor 2002-2003. Use, modification and
|
||||
// Copyright Doug 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 Douglas Gregor 2002-2003. Use, modification and
|
||||
// Copyright Doug 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 Douglas Gregor 2002-2003. Use, modification and
|
||||
// Copyright Doug 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 Douglas Gregor 2002-2003. Use, modification and
|
||||
// Copyright Doug 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 Douglas Gregor 2001-2004. Use, modification and
|
||||
// Copyright Doug 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,19 +63,11 @@ namespace boost { namespace python { namespace objects {
|
||||
# define BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX
|
||||
#endif
|
||||
|
||||
#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), \
|
||||
#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
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX)
|
||||
namespace boost {
|
||||
@ -422,12 +414,7 @@ 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;
|
||||
|
||||
@ -437,23 +424,14 @@ 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;
|
||||
@ -469,7 +447,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;
|
||||
}
|
||||
|
||||
@ -478,7 +456,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
|
||||
@ -491,36 +469,20 @@ 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 Douglas Gregor 2001-2003. Use, modification and
|
||||
// Copyright Doug 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,14 +61,6 @@
|
||||
#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 {
|
||||
@ -94,13 +86,13 @@ namespace boost {
|
||||
>
|
||||
struct BOOST_FUNCTION_VOID_FUNCTION_INVOKER
|
||||
{
|
||||
static BOOST_FUNCTION_VOID_RETURN_TYPE
|
||||
invoke(any_pointer function_ptr BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_PARMS)
|
||||
static unusable invoke(any_pointer function_ptr BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_PARMS)
|
||||
|
||||
{
|
||||
FunctionPtr f = reinterpret_cast<FunctionPtr>(function_ptr.func_ptr);
|
||||
BOOST_FUNCTION_RETURN(f(BOOST_FUNCTION_ARGS));
|
||||
f(BOOST_FUNCTION_ARGS);
|
||||
return unusable();
|
||||
}
|
||||
};
|
||||
|
||||
@ -127,13 +119,14 @@ namespace boost {
|
||||
>
|
||||
struct BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER
|
||||
{
|
||||
static BOOST_FUNCTION_VOID_RETURN_TYPE
|
||||
invoke(any_pointer function_obj_ptr BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_PARMS)
|
||||
static unusable invoke(any_pointer function_obj_ptr
|
||||
BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_PARMS)
|
||||
|
||||
{
|
||||
FunctionObj* f = (FunctionObj*)(function_obj_ptr.obj_ptr);
|
||||
BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS));
|
||||
(*f)(BOOST_FUNCTION_ARGS);
|
||||
return unusable();
|
||||
}
|
||||
};
|
||||
|
||||
@ -158,12 +151,13 @@ namespace boost {
|
||||
>
|
||||
struct BOOST_FUNCTION_STATELESS_VOID_FUNCTION_OBJ_INVOKER
|
||||
{
|
||||
static BOOST_FUNCTION_VOID_RETURN_TYPE
|
||||
invoke(any_pointer BOOST_FUNCTION_COMMA BOOST_FUNCTION_PARMS)
|
||||
static unusable invoke(any_pointer BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_PARMS)
|
||||
|
||||
{
|
||||
FunctionObj f = FunctionObj();
|
||||
BOOST_FUNCTION_RETURN(f(BOOST_FUNCTION_ARGS));
|
||||
f(BOOST_FUNCTION_ARGS);
|
||||
return unusable();
|
||||
}
|
||||
};
|
||||
|
||||
@ -241,12 +235,8 @@ namespace boost {
|
||||
class BOOST_FUNCTION_FUNCTION : public function_base
|
||||
{
|
||||
public:
|
||||
#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
|
||||
typedef typename detail::function::function_return_type<R>::type
|
||||
internal_result_type;
|
||||
|
||||
private:
|
||||
struct clear_type {};
|
||||
@ -258,7 +248,7 @@ namespace boost {
|
||||
template<typename Args>
|
||||
struct sig
|
||||
{
|
||||
typedef result_type type;
|
||||
typedef internal_result_type type;
|
||||
};
|
||||
|
||||
#if BOOST_FUNCTION_NUM_ARGS == 1
|
||||
@ -271,6 +261,11 @@ 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;
|
||||
|
||||
@ -283,7 +278,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
|
||||
@ -312,7 +307,7 @@ namespace boost {
|
||||
|
||||
~BOOST_FUNCTION_FUNCTION() { clear(); }
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
|
||||
// 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
|
||||
@ -320,7 +315,15 @@ namespace boost {
|
||||
if (this->empty())
|
||||
boost::throw_exception(bad_function_call());
|
||||
|
||||
return invoker(this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS);
|
||||
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
|
||||
}
|
||||
#else
|
||||
result_type operator()(BOOST_FUNCTION_PARMS) const;
|
||||
@ -334,7 +337,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
|
||||
@ -386,8 +389,7 @@ namespace boost {
|
||||
{
|
||||
if (this->manager) {
|
||||
function_base::functor =
|
||||
this->manager(this->functor,
|
||||
boost::detail::function::destroy_functor_tag);
|
||||
this->manager(this->functor, detail::function::destroy_functor_tag);
|
||||
}
|
||||
|
||||
this->manager = 0;
|
||||
@ -420,24 +422,24 @@ namespace boost {
|
||||
invoker = f.invoker;
|
||||
this->manager = f.manager;
|
||||
this->functor =
|
||||
f.manager(f.functor, boost::detail::function::clone_functor_tag);
|
||||
f.manager(f.functor, detail::function::clone_functor_tag);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Functor>
|
||||
void assign_to(Functor f)
|
||||
{
|
||||
typedef typename boost::detail::function::get_function_tag<Functor>::type tag;
|
||||
typedef typename detail::function::get_function_tag<Functor>::type tag;
|
||||
this->assign_to(f, tag());
|
||||
}
|
||||
|
||||
template<typename FunctionPtr>
|
||||
void assign_to(FunctionPtr f, boost::detail::function::function_ptr_tag)
|
||||
void assign_to(FunctionPtr f, detail::function::function_ptr_tag)
|
||||
{
|
||||
clear();
|
||||
|
||||
if (f) {
|
||||
typedef typename boost::detail::function::BOOST_FUNCTION_GET_FUNCTION_INVOKER<
|
||||
typedef typename detail::function::BOOST_FUNCTION_GET_FUNCTION_INVOKER<
|
||||
FunctionPtr,
|
||||
R BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_TEMPLATE_ARGS
|
||||
@ -446,31 +448,31 @@ namespace boost {
|
||||
|
||||
invoker = &actual_invoker_type::invoke;
|
||||
this->manager =
|
||||
&boost::detail::function::functor_manager<FunctionPtr, Allocator>::manage;
|
||||
&detail::function::functor_manager<FunctionPtr, Allocator>::manage;
|
||||
this->functor =
|
||||
this->manager(boost::detail::function::make_any_pointer(
|
||||
this->manager(detail::function::make_any_pointer(
|
||||
// should be a reinterpret cast, but some compilers
|
||||
// insist on giving cv-qualifiers to free functions
|
||||
(void (*)())(f)
|
||||
),
|
||||
boost::detail::function::clone_functor_tag);
|
||||
detail::function::clone_functor_tag);
|
||||
}
|
||||
}
|
||||
|
||||
#if BOOST_FUNCTION_NUM_ARGS > 0
|
||||
template<typename MemberPtr>
|
||||
void assign_to(MemberPtr f, boost::detail::function::member_ptr_tag)
|
||||
void assign_to(MemberPtr f, 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, boost::detail::function::function_obj_tag)
|
||||
void assign_to(FunctionObj f, detail::function::function_obj_tag)
|
||||
{
|
||||
if (!boost::detail::function::has_empty_target(boost::addressof(f))) {
|
||||
if (!detail::function::has_empty_target(addressof(f))) {
|
||||
typedef
|
||||
typename boost::detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER<
|
||||
typename detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER<
|
||||
FunctionObj,
|
||||
R BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_TEMPLATE_ARGS
|
||||
@ -478,7 +480,7 @@ namespace boost {
|
||||
actual_invoker_type;
|
||||
|
||||
invoker = &actual_invoker_type::invoke;
|
||||
this->manager = &boost::detail::function::functor_manager<
|
||||
this->manager = &detail::function::functor_manager<
|
||||
FunctionObj, Allocator>::manage;
|
||||
#ifndef BOOST_NO_STD_ALLOCATOR
|
||||
typedef typename Allocator::template rebind<FunctionObj>::other
|
||||
@ -494,17 +496,17 @@ namespace boost {
|
||||
FunctionObj* new_f = new FunctionObj(f);
|
||||
#endif // BOOST_NO_STD_ALLOCATOR
|
||||
this->functor =
|
||||
boost::detail::function::make_any_pointer(static_cast<void*>(new_f));
|
||||
detail::function::make_any_pointer(static_cast<void*>(new_f));
|
||||
}
|
||||
}
|
||||
|
||||
template<typename FunctionObj>
|
||||
void assign_to(const reference_wrapper<FunctionObj>& f,
|
||||
boost::detail::function::function_obj_ref_tag)
|
||||
detail::function::function_obj_ref_tag)
|
||||
{
|
||||
if (!boost::detail::function::has_empty_target(f.get_pointer())) {
|
||||
if (!detail::function::has_empty_target(f.get_pointer())) {
|
||||
typedef
|
||||
typename boost::detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER<
|
||||
typename detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER<
|
||||
FunctionObj,
|
||||
R BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_TEMPLATE_ARGS
|
||||
@ -512,20 +514,20 @@ namespace boost {
|
||||
actual_invoker_type;
|
||||
|
||||
invoker = &actual_invoker_type::invoke;
|
||||
this->manager = &boost::detail::function::trivial_manager<FunctionObj>::get;
|
||||
this->manager = &detail::function::trivial_manager<FunctionObj>::get;
|
||||
this->functor =
|
||||
this->manager(
|
||||
boost::detail::function::make_any_pointer(
|
||||
detail::function::make_any_pointer(
|
||||
const_cast<FunctionObj*>(f.get_pointer())),
|
||||
boost::detail::function::clone_functor_tag);
|
||||
detail::function::clone_functor_tag);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename FunctionObj>
|
||||
void assign_to(FunctionObj, boost::detail::function::stateless_function_obj_tag)
|
||||
void assign_to(FunctionObj, detail::function::stateless_function_obj_tag)
|
||||
{
|
||||
typedef
|
||||
typename boost::detail::function::
|
||||
typename detail::function::
|
||||
BOOST_FUNCTION_GET_STATELESS_FUNCTION_OBJ_INVOKER<
|
||||
FunctionObj,
|
||||
R BOOST_FUNCTION_COMMA
|
||||
@ -533,13 +535,13 @@ namespace boost {
|
||||
>::type
|
||||
actual_invoker_type;
|
||||
invoker = &actual_invoker_type::invoke;
|
||||
this->manager = &boost::detail::function::trivial_manager<FunctionObj>::get;
|
||||
this->functor = boost::detail::function::make_any_pointer(this);
|
||||
this->manager = &detail::function::trivial_manager<FunctionObj>::get;
|
||||
this->functor = detail::function::make_any_pointer(this);
|
||||
}
|
||||
|
||||
typedef result_type (*invoker_type)(boost::detail::function::any_pointer
|
||||
BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_TEMPLATE_ARGS);
|
||||
typedef internal_result_type (*invoker_type)(detail::function::any_pointer
|
||||
BOOST_FUNCTION_COMMA
|
||||
BOOST_FUNCTION_TEMPLATE_ARGS);
|
||||
|
||||
invoker_type invoker;
|
||||
};
|
||||
@ -560,7 +562,7 @@ namespace boost {
|
||||
f1.swap(f2);
|
||||
}
|
||||
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
|
||||
template<typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS,
|
||||
typename Allocator>
|
||||
typename BOOST_FUNCTION_FUNCTION<
|
||||
@ -571,11 +573,19 @@ namespace boost {
|
||||
Allocator>
|
||||
::operator()(BOOST_FUNCTION_PARMS) const
|
||||
{
|
||||
if (this->empty())
|
||||
boost::throw_exception(bad_function_call());
|
||||
|
||||
return invoker(this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS);
|
||||
}
|
||||
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
|
||||
}
|
||||
#endif
|
||||
|
||||
// Poison comparisons between boost::function objects of the same type.
|
||||
@ -630,7 +640,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
|
||||
@ -656,7 +666,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
|
||||
@ -709,5 +719,3 @@ 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 Douglas Gregor 2001-2003. Use, modification and
|
||||
# Copyright Doug 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,9 +1,6 @@
|
||||
// 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
|
||||
// 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
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// For more information, see http://www.boost.org
|
||||
@ -12,16 +9,15 @@
|
||||
|
||||
namespace boost {
|
||||
|
||||
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
|
||||
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(const F& f, const G& g)
|
||||
{ return function_equal_impl(f, g, 0); }
|
||||
{ return ::boost::detail::function_equal_impl(f, g, 0); }
|
||||
|
||||
} // end namespace boost
|
||||
|
||||
|
Reference in New Issue
Block a user