mirror of
https://github.com/boostorg/function.git
synced 2025-06-26 20:41:32 +02:00
Compare commits
13 Commits
svn-branch
...
boost-1.35
Author | SHA1 | Date | |
---|---|---|---|
b83dfcf4a5 | |||
bfdb5b161d | |||
c4539395fe | |||
6147e7ddcc | |||
1b60e82b2f | |||
7581949360 | |||
0b2aeda226 | |||
2ecd62c612 | |||
47033bd162 | |||
c7d5016022 | |||
d92355cca2 | |||
0123f84bff | |||
0207da8008 |
@ -1,3 +1,8 @@
|
|||||||
|
# Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
|
||||||
|
|
||||||
|
# Distributed under 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)
|
||||||
project boost/doc ;
|
project boost/doc ;
|
||||||
import boostbook : boostbook ;
|
import boostbook : boostbook ;
|
||||||
|
|
||||||
|
@ -1,4 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
|
||||||
|
|
||||||
|
Distributed under 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)
|
||||||
|
-->
|
||||||
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
|
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
|
||||||
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
|
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
|
||||||
<section id="function.faq" last-revision="$Date$">
|
<section id="function.faq" last-revision="$Date$">
|
||||||
|
@ -1,4 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
|
||||||
|
|
||||||
|
Distributed under 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)
|
||||||
|
-->
|
||||||
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
|
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
|
||||||
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
|
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
|
||||||
<section id="function.history" last-revision="$Date$">
|
<section id="function.history" last-revision="$Date$">
|
||||||
|
@ -1,4 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
|
||||||
|
|
||||||
|
Distributed under 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)
|
||||||
|
-->
|
||||||
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
|
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
|
||||||
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
|
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
|
||||||
<section id="function.misc" last-revision="$Date$">
|
<section id="function.misc" last-revision="$Date$">
|
||||||
|
@ -1,4 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
|
||||||
|
|
||||||
|
Distributed under 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)
|
||||||
|
-->
|
||||||
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
|
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
|
||||||
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
|
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
|
||||||
|
|
||||||
|
@ -1,4 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
|
||||||
|
|
||||||
|
Distributed under 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)
|
||||||
|
-->
|
||||||
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
|
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
|
||||||
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
|
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
|
||||||
<testsuite id="function.testsuite" last-revision="$Date$">
|
<testsuite id="function.testsuite" last-revision="$Date$">
|
||||||
|
@ -1,4 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
|
||||||
|
|
||||||
|
Distributed under 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)
|
||||||
|
-->
|
||||||
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
|
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN"
|
||||||
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
|
"http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
|
||||||
<section xmlns:xi="http://www.w3.org/2001/XInclude" id="function.tutorial"
|
<section xmlns:xi="http://www.w3.org/2001/XInclude" id="function.tutorial"
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
// William Kempf, Jesse Jones and Karl Nelson were all very helpful in the
|
// William Kempf, Jesse Jones and Karl Nelson were all very helpful in the
|
||||||
// design of this library.
|
// design of this library.
|
||||||
|
|
||||||
|
#include <functional> // unary_function, binary_function
|
||||||
|
|
||||||
#include <boost/preprocessor/iterate.hpp>
|
#include <boost/preprocessor/iterate.hpp>
|
||||||
#include <boost/detail/workaround.hpp>
|
#include <boost/detail/workaround.hpp>
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#define BOOST_FUNCTION_PROLOGUE_HPP
|
#define BOOST_FUNCTION_PROLOGUE_HPP
|
||||||
# include <cassert>
|
# include <cassert>
|
||||||
# include <algorithm>
|
# include <algorithm>
|
||||||
|
# include <functional> // unary_function, binary_function
|
||||||
# include <boost/throw_exception.hpp>
|
# include <boost/throw_exception.hpp>
|
||||||
# include <boost/config.hpp>
|
# include <boost/config.hpp>
|
||||||
# include <boost/function/function_base.hpp>
|
# include <boost/function/function_base.hpp>
|
||||||
|
@ -30,6 +30,20 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <boost/function_equal.hpp>
|
#include <boost/function_equal.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
|
# pragma warning( push )
|
||||||
|
# pragma warning( disable : 4793 ) // complaint about native code generation
|
||||||
|
# pragma warning( disable : 4127 ) // "conditional expression is constant"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Define BOOST_FUNCTION_STD_NS to the namespace that contains type_info.
|
||||||
|
#ifdef BOOST_NO_EXCEPTION_STD_NAMESPACE
|
||||||
|
// Embedded VC++ does not have type_info in namespace std
|
||||||
|
# define BOOST_FUNCTION_STD_NS
|
||||||
|
#else
|
||||||
|
# define BOOST_FUNCTION_STD_NS std
|
||||||
|
#endif
|
||||||
|
|
||||||
// Borrowed from Boost.Python library: determines the cases where we
|
// Borrowed from Boost.Python library: determines the cases where we
|
||||||
// need to use std::type_info::name to compare instead of operator==.
|
// need to use std::type_info::name to compare instead of operator==.
|
||||||
# if (defined(__GNUC__) && __GNUC__ >= 3) \
|
# if (defined(__GNUC__) && __GNUC__ >= 3) \
|
||||||
@ -59,7 +73,7 @@ namespace boost { namespace python { namespace objects {
|
|||||||
|
|
||||||
#if defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
|
#if defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
|
||||||
|| defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) \
|
|| defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) \
|
||||||
|| !(BOOST_STRICT_CONFIG || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540)
|
|| !(defined(BOOST_STRICT_CONFIG) || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540)
|
||||||
# define BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX
|
# define BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -198,8 +212,8 @@ namespace boost {
|
|||||||
struct reference_manager
|
struct reference_manager
|
||||||
{
|
{
|
||||||
static inline void
|
static inline void
|
||||||
get(const function_buffer& in_buffer, function_buffer& out_buffer,
|
manage(const function_buffer& in_buffer, function_buffer& out_buffer,
|
||||||
functor_manager_operation_type op)
|
functor_manager_operation_type op)
|
||||||
{
|
{
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case clone_functor_tag:
|
case clone_functor_tag:
|
||||||
@ -215,8 +229,8 @@ namespace boost {
|
|||||||
// DPG TBD: Since we're only storing a pointer, it's
|
// DPG TBD: Since we're only storing a pointer, it's
|
||||||
// possible that the user could ask for a base class or
|
// possible that the user could ask for a base class or
|
||||||
// derived class. Is that okay?
|
// derived class. Is that okay?
|
||||||
const std::type_info& check_type =
|
const BOOST_FUNCTION_STD_NS::type_info& check_type =
|
||||||
*static_cast<const std::type_info*>(out_buffer.const_obj_ptr);
|
*static_cast<const BOOST_FUNCTION_STD_NS::type_info*>(out_buffer.const_obj_ptr);
|
||||||
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(F)))
|
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(F)))
|
||||||
out_buffer.obj_ptr = in_buffer.obj_ptr;
|
out_buffer.obj_ptr = in_buffer.obj_ptr;
|
||||||
else
|
else
|
||||||
@ -265,8 +279,8 @@ namespace boost {
|
|||||||
else if (op == destroy_functor_tag)
|
else if (op == destroy_functor_tag)
|
||||||
out_buffer.func_ptr = 0;
|
out_buffer.func_ptr = 0;
|
||||||
else /* op == check_functor_type_tag */ {
|
else /* op == check_functor_type_tag */ {
|
||||||
const std::type_info& check_type =
|
const BOOST_FUNCTION_STD_NS::type_info& check_type =
|
||||||
*static_cast<const std::type_info*>(out_buffer.const_obj_ptr);
|
*static_cast<const BOOST_FUNCTION_STD_NS::type_info*>(out_buffer.const_obj_ptr);
|
||||||
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor)))
|
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor)))
|
||||||
out_buffer.obj_ptr = &in_buffer.func_ptr;
|
out_buffer.obj_ptr = &in_buffer.func_ptr;
|
||||||
else
|
else
|
||||||
@ -284,13 +298,11 @@ namespace boost {
|
|||||||
reinterpret_cast<const functor_type*>(&in_buffer.data);
|
reinterpret_cast<const functor_type*>(&in_buffer.data);
|
||||||
new ((void*)&out_buffer.data) functor_type(*in_functor);
|
new ((void*)&out_buffer.data) functor_type(*in_functor);
|
||||||
} else if (op == destroy_functor_tag) {
|
} else if (op == destroy_functor_tag) {
|
||||||
functor_type* out_functor =
|
|
||||||
reinterpret_cast<functor_type*>(&out_buffer.data);
|
|
||||||
// Some compilers (Borland, vc6, ...) are unhappy with ~functor_type.
|
// Some compilers (Borland, vc6, ...) are unhappy with ~functor_type.
|
||||||
out_functor->~Functor();
|
reinterpret_cast<functor_type*>(&out_buffer.data)->~Functor();
|
||||||
} else /* op == check_functor_type_tag */ {
|
} else /* op == check_functor_type_tag */ {
|
||||||
const std::type_info& check_type =
|
const BOOST_FUNCTION_STD_NS::type_info& check_type =
|
||||||
*static_cast<const std::type_info*>(out_buffer.const_obj_ptr);
|
*static_cast<const BOOST_FUNCTION_STD_NS::type_info*>(out_buffer.const_obj_ptr);
|
||||||
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor)))
|
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor)))
|
||||||
out_buffer.obj_ptr = &in_buffer.data;
|
out_buffer.obj_ptr = &in_buffer.data;
|
||||||
else
|
else
|
||||||
@ -350,8 +362,8 @@ namespace boost {
|
|||||||
# endif // BOOST_NO_STD_ALLOCATOR
|
# endif // BOOST_NO_STD_ALLOCATOR
|
||||||
out_buffer.obj_ptr = 0;
|
out_buffer.obj_ptr = 0;
|
||||||
} else /* op == check_functor_type_tag */ {
|
} else /* op == check_functor_type_tag */ {
|
||||||
const std::type_info& check_type =
|
const BOOST_FUNCTION_STD_NS::type_info& check_type =
|
||||||
*static_cast<const std::type_info*>(out_buffer.const_obj_ptr);
|
*static_cast<const BOOST_FUNCTION_STD_NS::type_info*>(out_buffer.const_obj_ptr);
|
||||||
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor)))
|
if (BOOST_FUNCTION_COMPARE_TYPE_ID(check_type, typeid(Functor)))
|
||||||
out_buffer.obj_ptr = in_buffer.obj_ptr;
|
out_buffer.obj_ptr = in_buffer.obj_ptr;
|
||||||
else
|
else
|
||||||
@ -370,6 +382,15 @@ namespace boost {
|
|||||||
mpl::bool_<(function_allows_small_object_optimization<functor_type>::value)>());
|
mpl::bool_<(function_allows_small_object_optimization<functor_type>::value)>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For member pointers, we treat them as function objects with
|
||||||
|
// the small-object optimization always enabled.
|
||||||
|
static inline void
|
||||||
|
manager(const function_buffer& in_buffer, function_buffer& out_buffer,
|
||||||
|
functor_manager_operation_type op, member_ptr_tag)
|
||||||
|
{
|
||||||
|
manager(in_buffer, out_buffer, op, mpl::true_());
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/* Dispatch to an appropriate manager based on whether we have a
|
/* Dispatch to an appropriate manager based on whether we have a
|
||||||
function pointer or a function object pointer. */
|
function pointer or a function object pointer. */
|
||||||
@ -458,7 +479,6 @@ namespace boost {
|
|||||||
*/
|
*/
|
||||||
struct vtable_base
|
struct vtable_base
|
||||||
{
|
{
|
||||||
vtable_base() : manager(0) { }
|
|
||||||
void (*manager)(const function_buffer& in_buffer,
|
void (*manager)(const function_buffer& in_buffer,
|
||||||
function_buffer& out_buffer,
|
function_buffer& out_buffer,
|
||||||
functor_manager_operation_type op);
|
functor_manager_operation_type op);
|
||||||
@ -482,13 +502,13 @@ public:
|
|||||||
|
|
||||||
/** Retrieve the type of the stored function object, or typeid(void)
|
/** Retrieve the type of the stored function object, or typeid(void)
|
||||||
if this is empty. */
|
if this is empty. */
|
||||||
const std::type_info& target_type() const
|
const BOOST_FUNCTION_STD_NS::type_info& target_type() const
|
||||||
{
|
{
|
||||||
if (!vtable) return typeid(void);
|
if (!vtable) return typeid(void);
|
||||||
|
|
||||||
detail::function::function_buffer type;
|
detail::function::function_buffer type;
|
||||||
vtable->manager(functor, type, detail::function::get_functor_type_tag);
|
vtable->manager(functor, type, detail::function::get_functor_type_tag);
|
||||||
return *static_cast<const std::type_info*>(type.const_obj_ptr);
|
return *static_cast<const BOOST_FUNCTION_STD_NS::type_info*>(type.const_obj_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Functor>
|
template<typename Functor>
|
||||||
@ -560,7 +580,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
public: // should be protected, but GCC 2.95.3 will fail to allow access
|
public: // should be protected, but GCC 2.95.3 will fail to allow access
|
||||||
detail::function::vtable_base* vtable;
|
const detail::function::vtable_base* vtable;
|
||||||
mutable detail::function::function_buffer functor;
|
mutable detail::function::function_buffer functor;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -735,4 +755,8 @@ namespace detail {
|
|||||||
#undef BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL
|
#undef BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL
|
||||||
#undef BOOST_FUNCTION_COMPARE_TYPE_ID
|
#undef BOOST_FUNCTION_COMPARE_TYPE_ID
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
|
# pragma warning( pop )
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // BOOST_FUNCTION_BASE_HEADER
|
#endif // BOOST_FUNCTION_BASE_HEADER
|
||||||
|
@ -11,6 +11,11 @@
|
|||||||
// protection.
|
// protection.
|
||||||
#include <boost/function/detail/prologue.hpp>
|
#include <boost/function/detail/prologue.hpp>
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
|
# pragma warning( push )
|
||||||
|
# pragma warning( disable : 4127 ) // "conditional expression is constant"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define BOOST_FUNCTION_TEMPLATE_PARMS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, typename T)
|
#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_TEMPLATE_ARGS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, T)
|
||||||
@ -54,12 +59,20 @@
|
|||||||
BOOST_JOIN(function_ref_invoker,BOOST_FUNCTION_NUM_ARGS)
|
BOOST_JOIN(function_ref_invoker,BOOST_FUNCTION_NUM_ARGS)
|
||||||
#define BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER \
|
#define BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER \
|
||||||
BOOST_JOIN(void_function_ref_invoker,BOOST_FUNCTION_NUM_ARGS)
|
BOOST_JOIN(void_function_ref_invoker,BOOST_FUNCTION_NUM_ARGS)
|
||||||
|
#define BOOST_FUNCTION_MEMBER_INVOKER \
|
||||||
|
BOOST_JOIN(member_invoker,BOOST_FUNCTION_NUM_ARGS)
|
||||||
|
#define BOOST_FUNCTION_VOID_MEMBER_INVOKER \
|
||||||
|
BOOST_JOIN(void_member_invoker,BOOST_FUNCTION_NUM_ARGS)
|
||||||
#define BOOST_FUNCTION_GET_FUNCTION_INVOKER \
|
#define BOOST_FUNCTION_GET_FUNCTION_INVOKER \
|
||||||
BOOST_JOIN(get_function_invoker,BOOST_FUNCTION_NUM_ARGS)
|
BOOST_JOIN(get_function_invoker,BOOST_FUNCTION_NUM_ARGS)
|
||||||
#define BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER \
|
#define BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER \
|
||||||
BOOST_JOIN(get_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS)
|
BOOST_JOIN(get_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS)
|
||||||
#define BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER \
|
#define BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER \
|
||||||
BOOST_JOIN(get_function_ref_invoker,BOOST_FUNCTION_NUM_ARGS)
|
BOOST_JOIN(get_function_ref_invoker,BOOST_FUNCTION_NUM_ARGS)
|
||||||
|
#define BOOST_FUNCTION_GET_MEMBER_INVOKER \
|
||||||
|
BOOST_JOIN(get_member_invoker,BOOST_FUNCTION_NUM_ARGS)
|
||||||
|
#define BOOST_FUNCTION_GET_INVOKER \
|
||||||
|
BOOST_JOIN(get_invoker,BOOST_FUNCTION_NUM_ARGS)
|
||||||
#define BOOST_FUNCTION_VTABLE BOOST_JOIN(basic_vtable,BOOST_FUNCTION_NUM_ARGS)
|
#define BOOST_FUNCTION_VTABLE BOOST_JOIN(basic_vtable,BOOST_FUNCTION_NUM_ARGS)
|
||||||
|
|
||||||
#ifndef BOOST_NO_VOID_RETURNS
|
#ifndef BOOST_NO_VOID_RETURNS
|
||||||
@ -181,6 +194,44 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if BOOST_FUNCTION_NUM_ARGS > 0
|
||||||
|
/* Handle invocation of member pointers. */
|
||||||
|
template<
|
||||||
|
typename MemberPtr,
|
||||||
|
typename R BOOST_FUNCTION_COMMA
|
||||||
|
BOOST_FUNCTION_TEMPLATE_PARMS
|
||||||
|
>
|
||||||
|
struct BOOST_FUNCTION_MEMBER_INVOKER
|
||||||
|
{
|
||||||
|
static R invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA
|
||||||
|
BOOST_FUNCTION_PARMS)
|
||||||
|
|
||||||
|
{
|
||||||
|
MemberPtr* f =
|
||||||
|
reinterpret_cast<MemberPtr*>(&function_obj_ptr.data);
|
||||||
|
return boost::mem_fn(*f)(BOOST_FUNCTION_ARGS);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<
|
||||||
|
typename MemberPtr,
|
||||||
|
typename R BOOST_FUNCTION_COMMA
|
||||||
|
BOOST_FUNCTION_TEMPLATE_PARMS
|
||||||
|
>
|
||||||
|
struct BOOST_FUNCTION_VOID_MEMBER_INVOKER
|
||||||
|
{
|
||||||
|
static BOOST_FUNCTION_VOID_RETURN_TYPE
|
||||||
|
invoke(function_buffer& function_obj_ptr BOOST_FUNCTION_COMMA
|
||||||
|
BOOST_FUNCTION_PARMS)
|
||||||
|
|
||||||
|
{
|
||||||
|
MemberPtr* f =
|
||||||
|
reinterpret_cast<MemberPtr*>(&function_obj_ptr.data);
|
||||||
|
BOOST_FUNCTION_RETURN(boost::mem_fn(*f)(BOOST_FUNCTION_ARGS));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
template<
|
template<
|
||||||
typename FunctionPtr,
|
typename FunctionPtr,
|
||||||
typename R BOOST_FUNCTION_COMMA
|
typename R BOOST_FUNCTION_COMMA
|
||||||
@ -244,12 +295,130 @@ namespace boost {
|
|||||||
>::type type;
|
>::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if BOOST_FUNCTION_NUM_ARGS > 0
|
||||||
|
/* Retrieve the appropriate invoker for a member pointer. */
|
||||||
|
template<
|
||||||
|
typename MemberPtr,
|
||||||
|
typename R BOOST_FUNCTION_COMMA
|
||||||
|
BOOST_FUNCTION_TEMPLATE_PARMS
|
||||||
|
>
|
||||||
|
struct BOOST_FUNCTION_GET_MEMBER_INVOKER
|
||||||
|
{
|
||||||
|
typedef typename mpl::if_c<(is_void<R>::value),
|
||||||
|
BOOST_FUNCTION_VOID_MEMBER_INVOKER<
|
||||||
|
MemberPtr,
|
||||||
|
R BOOST_FUNCTION_COMMA
|
||||||
|
BOOST_FUNCTION_TEMPLATE_ARGS
|
||||||
|
>,
|
||||||
|
BOOST_FUNCTION_MEMBER_INVOKER<
|
||||||
|
MemberPtr,
|
||||||
|
R BOOST_FUNCTION_COMMA
|
||||||
|
BOOST_FUNCTION_TEMPLATE_ARGS
|
||||||
|
>
|
||||||
|
>::type type;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Given the tag returned by get_function_tag, retrieve the
|
||||||
|
actual invoker that will be used for the given function
|
||||||
|
object.
|
||||||
|
|
||||||
|
Each specialization contains an "apply" nested class template
|
||||||
|
that accepts the function object, return type, function
|
||||||
|
argument types, and allocator. The resulting "apply" class
|
||||||
|
contains two typedefs, "invoker_type" and "manager_type",
|
||||||
|
which correspond to the invoker and manager types. */
|
||||||
|
template<typename Tag>
|
||||||
|
struct BOOST_FUNCTION_GET_INVOKER { };
|
||||||
|
|
||||||
|
/* Retrieve the invoker for a function pointer. */
|
||||||
|
template<>
|
||||||
|
struct BOOST_FUNCTION_GET_INVOKER<function_ptr_tag>
|
||||||
|
{
|
||||||
|
template<typename FunctionPtr,
|
||||||
|
typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS,
|
||||||
|
typename Allocator>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef typename BOOST_FUNCTION_GET_FUNCTION_INVOKER<
|
||||||
|
FunctionPtr,
|
||||||
|
R BOOST_FUNCTION_COMMA
|
||||||
|
BOOST_FUNCTION_TEMPLATE_ARGS
|
||||||
|
>::type
|
||||||
|
invoker_type;
|
||||||
|
|
||||||
|
typedef functor_manager<FunctionPtr, Allocator> manager_type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#if BOOST_FUNCTION_NUM_ARGS > 0
|
||||||
|
/* Retrieve the invoker for a member pointer. */
|
||||||
|
template<>
|
||||||
|
struct BOOST_FUNCTION_GET_INVOKER<member_ptr_tag>
|
||||||
|
{
|
||||||
|
template<typename MemberPtr,
|
||||||
|
typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS,
|
||||||
|
typename Allocator>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef typename BOOST_FUNCTION_GET_MEMBER_INVOKER<
|
||||||
|
MemberPtr,
|
||||||
|
R BOOST_FUNCTION_COMMA
|
||||||
|
BOOST_FUNCTION_TEMPLATE_ARGS
|
||||||
|
>::type
|
||||||
|
invoker_type;
|
||||||
|
|
||||||
|
typedef functor_manager<MemberPtr, Allocator> manager_type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Retrieve the invoker for a function object. */
|
||||||
|
template<>
|
||||||
|
struct BOOST_FUNCTION_GET_INVOKER<function_obj_tag>
|
||||||
|
{
|
||||||
|
template<typename FunctionObj,
|
||||||
|
typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS,
|
||||||
|
typename Allocator>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef typename BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER<
|
||||||
|
FunctionObj,
|
||||||
|
R BOOST_FUNCTION_COMMA
|
||||||
|
BOOST_FUNCTION_TEMPLATE_ARGS
|
||||||
|
>::type
|
||||||
|
invoker_type;
|
||||||
|
|
||||||
|
typedef functor_manager<FunctionObj, Allocator> manager_type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Retrieve the invoker for a reference to a function object. */
|
||||||
|
template<>
|
||||||
|
struct BOOST_FUNCTION_GET_INVOKER<function_obj_ref_tag>
|
||||||
|
{
|
||||||
|
template<typename RefWrapper,
|
||||||
|
typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS,
|
||||||
|
typename Allocator>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef typename BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER<
|
||||||
|
typename RefWrapper::type,
|
||||||
|
R BOOST_FUNCTION_COMMA
|
||||||
|
BOOST_FUNCTION_TEMPLATE_ARGS
|
||||||
|
>::type
|
||||||
|
invoker_type;
|
||||||
|
|
||||||
|
typedef reference_manager<typename RefWrapper::type> manager_type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* vtable for a specific boost::function instance.
|
* vtable for a specific boost::function instance.
|
||||||
*/
|
*/
|
||||||
template<typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS,
|
template<typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS,
|
||||||
typename Allocator>
|
typename Allocator>
|
||||||
struct BOOST_FUNCTION_VTABLE : vtable_base
|
struct BOOST_FUNCTION_VTABLE
|
||||||
{
|
{
|
||||||
#ifndef BOOST_NO_VOID_RETURNS
|
#ifndef BOOST_NO_VOID_RETURNS
|
||||||
typedef R result_type;
|
typedef R result_type;
|
||||||
@ -262,50 +431,25 @@ namespace boost {
|
|||||||
BOOST_FUNCTION_TEMPLATE_ARGS);
|
BOOST_FUNCTION_TEMPLATE_ARGS);
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
BOOST_FUNCTION_VTABLE(F f) : vtable_base(), invoker(0)
|
bool assign_to(const F& f, function_buffer& functor) const
|
||||||
{
|
|
||||||
init(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename F>
|
|
||||||
bool assign_to(F f, function_buffer& functor)
|
|
||||||
{
|
{
|
||||||
typedef typename get_function_tag<F>::type tag;
|
typedef typename get_function_tag<F>::type tag;
|
||||||
return assign_to(f, functor, tag());
|
return assign_to(f, functor, tag());
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear(function_buffer& functor)
|
void clear(function_buffer& functor) const
|
||||||
{
|
{
|
||||||
if (manager)
|
if (base.manager)
|
||||||
manager(functor, functor, destroy_functor_tag);
|
base.manager(functor, functor, destroy_functor_tag);
|
||||||
}
|
}
|
||||||
|
#ifndef BOOST_NO_PRIVATE_IN_AGGREGATE
|
||||||
private:
|
private:
|
||||||
template<typename F>
|
#endif
|
||||||
void init(F f)
|
|
||||||
{
|
|
||||||
typedef typename get_function_tag<F>::type tag;
|
|
||||||
init(f, tag());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Function pointers
|
// Function pointers
|
||||||
template<typename FunctionPtr>
|
|
||||||
void init(FunctionPtr /*f*/, function_ptr_tag)
|
|
||||||
{
|
|
||||||
typedef typename BOOST_FUNCTION_GET_FUNCTION_INVOKER<
|
|
||||||
FunctionPtr,
|
|
||||||
R BOOST_FUNCTION_COMMA
|
|
||||||
BOOST_FUNCTION_TEMPLATE_ARGS
|
|
||||||
>::type
|
|
||||||
actual_invoker_type;
|
|
||||||
|
|
||||||
invoker = &actual_invoker_type::invoke;
|
|
||||||
manager = &functor_manager<FunctionPtr, Allocator>::manage;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename FunctionPtr>
|
template<typename FunctionPtr>
|
||||||
bool
|
bool
|
||||||
assign_to(FunctionPtr f, function_buffer& functor, function_ptr_tag)
|
assign_to(FunctionPtr f, function_buffer& functor,
|
||||||
|
function_ptr_tag) const
|
||||||
{
|
{
|
||||||
this->clear(functor);
|
this->clear(functor);
|
||||||
if (f) {
|
if (f) {
|
||||||
@ -321,22 +465,13 @@ namespace boost {
|
|||||||
// Member pointers
|
// Member pointers
|
||||||
#if BOOST_FUNCTION_NUM_ARGS > 0
|
#if BOOST_FUNCTION_NUM_ARGS > 0
|
||||||
template<typename MemberPtr>
|
template<typename MemberPtr>
|
||||||
void init(MemberPtr f, member_ptr_tag)
|
bool
|
||||||
|
assign_to(MemberPtr f, function_buffer& functor, member_ptr_tag) const
|
||||||
{
|
{
|
||||||
// DPG TBD: Add explicit support for member function
|
|
||||||
// objects, so we invoke through mem_fn() but we retain the
|
|
||||||
// right target_type() values.
|
|
||||||
this->init(mem_fn(f));
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename MemberPtr>
|
|
||||||
bool assign_to(MemberPtr f, function_buffer& functor, member_ptr_tag)
|
|
||||||
{
|
|
||||||
// DPG TBD: Add explicit support for member function
|
|
||||||
// objects, so we invoke through mem_fn() but we retain the
|
|
||||||
// right target_type() values.
|
|
||||||
if (f) {
|
if (f) {
|
||||||
this->assign_to(mem_fn(f), functor);
|
// Always use the small-object optimization for member
|
||||||
|
// pointers.
|
||||||
|
assign_functor(f, functor, mpl::true_());
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -345,24 +480,11 @@ namespace boost {
|
|||||||
#endif // BOOST_FUNCTION_NUM_ARGS > 0
|
#endif // BOOST_FUNCTION_NUM_ARGS > 0
|
||||||
|
|
||||||
// Function objects
|
// Function objects
|
||||||
template<typename FunctionObj>
|
|
||||||
void init(FunctionObj /*f*/, function_obj_tag)
|
|
||||||
{
|
|
||||||
typedef typename BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER<
|
|
||||||
FunctionObj,
|
|
||||||
R BOOST_FUNCTION_COMMA
|
|
||||||
BOOST_FUNCTION_TEMPLATE_ARGS
|
|
||||||
>::type
|
|
||||||
actual_invoker_type;
|
|
||||||
|
|
||||||
invoker = &actual_invoker_type::invoke;
|
|
||||||
manager = &functor_manager<FunctionObj, Allocator>::manage;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assign to a function object using the small object optimization
|
// Assign to a function object using the small object optimization
|
||||||
template<typename FunctionObj>
|
template<typename FunctionObj>
|
||||||
void
|
void
|
||||||
assign_functor(FunctionObj f, function_buffer& functor, mpl::true_)
|
assign_functor(const FunctionObj& f, function_buffer& functor,
|
||||||
|
mpl::true_) const
|
||||||
{
|
{
|
||||||
new ((void*)&functor.data) FunctionObj(f);
|
new ((void*)&functor.data) FunctionObj(f);
|
||||||
}
|
}
|
||||||
@ -370,7 +492,8 @@ namespace boost {
|
|||||||
// Assign to a function object allocated on the heap.
|
// Assign to a function object allocated on the heap.
|
||||||
template<typename FunctionObj>
|
template<typename FunctionObj>
|
||||||
void
|
void
|
||||||
assign_functor(FunctionObj f, function_buffer& functor, mpl::false_)
|
assign_functor(const FunctionObj& f, function_buffer& functor,
|
||||||
|
mpl::false_) const
|
||||||
{
|
{
|
||||||
#ifndef BOOST_NO_STD_ALLOCATOR
|
#ifndef BOOST_NO_STD_ALLOCATOR
|
||||||
typedef typename Allocator::template rebind<FunctionObj>::other
|
typedef typename Allocator::template rebind<FunctionObj>::other
|
||||||
@ -390,7 +513,8 @@ namespace boost {
|
|||||||
|
|
||||||
template<typename FunctionObj>
|
template<typename FunctionObj>
|
||||||
bool
|
bool
|
||||||
assign_to(FunctionObj f, function_buffer& functor, function_obj_tag)
|
assign_to(const FunctionObj& f, function_buffer& functor,
|
||||||
|
function_obj_tag) const
|
||||||
{
|
{
|
||||||
if (!boost::detail::function::has_empty_target(boost::addressof(f))) {
|
if (!boost::detail::function::has_empty_target(boost::addressof(f))) {
|
||||||
assign_functor(f, functor,
|
assign_functor(f, functor,
|
||||||
@ -402,25 +526,10 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reference to a function object
|
// Reference to a function object
|
||||||
template<typename FunctionObj>
|
|
||||||
void
|
|
||||||
init(const reference_wrapper<FunctionObj>& /*f*/, function_obj_ref_tag)
|
|
||||||
{
|
|
||||||
typedef typename BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER<
|
|
||||||
FunctionObj,
|
|
||||||
R BOOST_FUNCTION_COMMA
|
|
||||||
BOOST_FUNCTION_TEMPLATE_ARGS
|
|
||||||
>::type
|
|
||||||
actual_invoker_type;
|
|
||||||
|
|
||||||
invoker = &actual_invoker_type::invoke;
|
|
||||||
manager = &reference_manager<FunctionObj>::get;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename FunctionObj>
|
template<typename FunctionObj>
|
||||||
bool
|
bool
|
||||||
assign_to(const reference_wrapper<FunctionObj>& f,
|
assign_to(const reference_wrapper<FunctionObj>& f,
|
||||||
function_buffer& functor, function_obj_ref_tag)
|
function_buffer& functor, function_obj_ref_tag) const
|
||||||
{
|
{
|
||||||
if (!boost::detail::function::has_empty_target(f.get_pointer())) {
|
if (!boost::detail::function::has_empty_target(f.get_pointer())) {
|
||||||
// DPG TBD: We might need to detect constness of
|
// DPG TBD: We might need to detect constness of
|
||||||
@ -435,6 +544,7 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
vtable_base base;
|
||||||
invoker_type invoker;
|
invoker_type invoker;
|
||||||
};
|
};
|
||||||
} // end namespace function
|
} // end namespace function
|
||||||
@ -446,6 +556,17 @@ namespace boost {
|
|||||||
typename Allocator = BOOST_FUNCTION_DEFAULT_ALLOCATOR
|
typename Allocator = BOOST_FUNCTION_DEFAULT_ALLOCATOR
|
||||||
>
|
>
|
||||||
class BOOST_FUNCTION_FUNCTION : public function_base
|
class BOOST_FUNCTION_FUNCTION : public function_base
|
||||||
|
|
||||||
|
#if BOOST_FUNCTION_NUM_ARGS == 1
|
||||||
|
|
||||||
|
, public std::unary_function<T0,R>
|
||||||
|
|
||||||
|
#elif BOOST_FUNCTION_NUM_ARGS == 2
|
||||||
|
|
||||||
|
, public std::binary_function<T0,T1,R>
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#ifndef BOOST_NO_VOID_RETURNS
|
#ifndef BOOST_NO_VOID_RETURNS
|
||||||
@ -527,7 +648,7 @@ namespace boost {
|
|||||||
if (this->empty())
|
if (this->empty())
|
||||||
boost::throw_exception(bad_function_call());
|
boost::throw_exception(bad_function_call());
|
||||||
|
|
||||||
return static_cast<vtable_type*>(vtable)->invoker
|
return reinterpret_cast<const vtable_type*>(vtable)->invoker
|
||||||
(this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS);
|
(this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -551,12 +672,16 @@ namespace boost {
|
|||||||
operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f)
|
operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f)
|
||||||
{
|
{
|
||||||
this->clear();
|
this->clear();
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
try {
|
try {
|
||||||
this->assign_to(f);
|
this->assign_to(f);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
vtable = 0;
|
vtable = 0;
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
this->assign_to(f);
|
||||||
|
#endif
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,12 +707,16 @@ namespace boost {
|
|||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
this->clear();
|
this->clear();
|
||||||
|
#ifndef BOOST_NO_EXCEPTIONS
|
||||||
try {
|
try {
|
||||||
this->assign_to_own(f);
|
this->assign_to_own(f);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
vtable = 0;
|
vtable = 0;
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
this->assign_to_own(f);
|
||||||
|
#endif
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -605,7 +734,7 @@ namespace boost {
|
|||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
if (vtable) {
|
if (vtable) {
|
||||||
static_cast<vtable_type*>(vtable)->clear(this->functor);
|
reinterpret_cast<const vtable_type*>(vtable)->clear(this->functor);
|
||||||
vtable = 0;
|
vtable = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -640,10 +769,24 @@ namespace boost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename Functor>
|
template<typename Functor>
|
||||||
void assign_to(Functor f)
|
void assign_to(const Functor& f)
|
||||||
{
|
{
|
||||||
static vtable_type stored_vtable(f);
|
using detail::function::vtable_base;
|
||||||
if (stored_vtable.assign_to(f, functor)) vtable = &stored_vtable;
|
|
||||||
|
typedef typename detail::function::get_function_tag<Functor>::type tag;
|
||||||
|
typedef detail::function::BOOST_FUNCTION_GET_INVOKER<tag> get_invoker;
|
||||||
|
typedef typename get_invoker::
|
||||||
|
template apply<Functor, R BOOST_FUNCTION_COMMA
|
||||||
|
BOOST_FUNCTION_TEMPLATE_ARGS, Allocator>
|
||||||
|
handler_type;
|
||||||
|
|
||||||
|
typedef typename handler_type::invoker_type invoker_type;
|
||||||
|
typedef typename handler_type::manager_type manager_type;
|
||||||
|
|
||||||
|
static const vtable_type stored_vtable =
|
||||||
|
{ { &manager_type::manage }, &invoker_type::invoke };
|
||||||
|
|
||||||
|
if (stored_vtable.assign_to(f, functor)) vtable = &stored_vtable.base;
|
||||||
else vtable = 0;
|
else vtable = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -678,7 +821,7 @@ namespace boost {
|
|||||||
if (this->empty())
|
if (this->empty())
|
||||||
boost::throw_exception(bad_function_call());
|
boost::throw_exception(bad_function_call());
|
||||||
|
|
||||||
return static_cast<vtable_type*>(vtable)->invoker
|
return reinterpret_cast<const vtable_type*>(vtable)->invoker
|
||||||
(this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS);
|
(this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -795,6 +938,7 @@ public:
|
|||||||
|
|
||||||
// Cleanup after ourselves...
|
// Cleanup after ourselves...
|
||||||
#undef BOOST_FUNCTION_VTABLE
|
#undef BOOST_FUNCTION_VTABLE
|
||||||
|
#undef BOOST_FUNCTION_GET_INVOKER
|
||||||
#undef BOOST_FUNCTION_DEFAULT_ALLOCATOR
|
#undef BOOST_FUNCTION_DEFAULT_ALLOCATOR
|
||||||
#undef BOOST_FUNCTION_COMMA
|
#undef BOOST_FUNCTION_COMMA
|
||||||
#undef BOOST_FUNCTION_FUNCTION
|
#undef BOOST_FUNCTION_FUNCTION
|
||||||
@ -804,10 +948,12 @@ public:
|
|||||||
#undef BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER
|
#undef BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER
|
||||||
#undef BOOST_FUNCTION_FUNCTION_REF_INVOKER
|
#undef BOOST_FUNCTION_FUNCTION_REF_INVOKER
|
||||||
#undef BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER
|
#undef BOOST_FUNCTION_VOID_FUNCTION_REF_INVOKER
|
||||||
|
#undef BOOST_FUNCTION_MEMBER_INVOKER
|
||||||
|
#undef BOOST_FUNCTION_VOID_MEMBER_INVOKER
|
||||||
#undef BOOST_FUNCTION_GET_FUNCTION_INVOKER
|
#undef BOOST_FUNCTION_GET_FUNCTION_INVOKER
|
||||||
#undef BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER
|
#undef BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER
|
||||||
#undef BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER
|
#undef BOOST_FUNCTION_GET_FUNCTION_REF_INVOKER
|
||||||
#undef BOOST_FUNCTION_GET_MEM_FUNCTION_INVOKER
|
#undef BOOST_FUNCTION_GET_MEMBER_INVOKER
|
||||||
#undef BOOST_FUNCTION_TEMPLATE_PARMS
|
#undef BOOST_FUNCTION_TEMPLATE_PARMS
|
||||||
#undef BOOST_FUNCTION_TEMPLATE_ARGS
|
#undef BOOST_FUNCTION_TEMPLATE_ARGS
|
||||||
#undef BOOST_FUNCTION_PARMS
|
#undef BOOST_FUNCTION_PARMS
|
||||||
@ -817,3 +963,7 @@ public:
|
|||||||
#undef BOOST_FUNCTION_ARG_TYPES
|
#undef BOOST_FUNCTION_ARG_TYPES
|
||||||
#undef BOOST_FUNCTION_VOID_RETURN_TYPE
|
#undef BOOST_FUNCTION_VOID_RETURN_TYPE
|
||||||
#undef BOOST_FUNCTION_RETURN
|
#undef BOOST_FUNCTION_RETURN
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
|
# pragma warning( pop )
|
||||||
|
#endif
|
||||||
|
15
index.html
15
index.html
@ -1,9 +1,20 @@
|
|||||||
<html>
|
<html>
|
||||||
|
<!--
|
||||||
|
Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
|
||||||
|
|
||||||
|
Distributed under 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)
|
||||||
|
-->
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="refresh" content="0; URL=../../doc/html/function.html">
|
<meta http-equiv="refresh" content="0; URL=../../doc/html/function.html">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
Automatic redirection failed, please go to
|
Automatic redirection failed, please go to
|
||||||
<a href="../../doc/html/function.html">../../doc/html/function.html</a>
|
<a href="../../doc/html/function.html">../../doc/html/function.html</a> <hr>
|
||||||
|
<p><EFBFBD> Copyright Beman Dawes, 2001</p>
|
||||||
|
<p>Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||||
|
file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy
|
||||||
|
at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
68
test/Jamfile
68
test/Jamfile
@ -1,68 +0,0 @@
|
|||||||
# Function library
|
|
||||||
|
|
||||||
# Copyright (C) 2001-2003 Douglas Gregor
|
|
||||||
|
|
||||||
# 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/
|
|
||||||
|
|
||||||
|
|
||||||
# Testing Jamfile autogenerated from XML source
|
|
||||||
subproject libs/function/test ;
|
|
||||||
|
|
||||||
# bring in rules for testing
|
|
||||||
SEARCH on testing.jam = $(BOOST_BUILD_PATH) ;
|
|
||||||
include testing.jam ;
|
|
||||||
|
|
||||||
# Make tests run by default.
|
|
||||||
DEPENDS all : test ;
|
|
||||||
|
|
||||||
{
|
|
||||||
# look in BOOST_ROOT for sources first, just in this Jamfile
|
|
||||||
local SEARCH_SOURCE = $(BOOST_ROOT) $(SEARCH_SOURCE) ;
|
|
||||||
|
|
||||||
test-suite function
|
|
||||||
:
|
|
||||||
[ run libs/function/test/function_test.cpp : : : : lib_function_test ]
|
|
||||||
|
|
||||||
[ run libs/function/test/function_n_test.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/allocator_test.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/stateless_test.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/lambda_test.cpp : : : : ]
|
|
||||||
|
|
||||||
[ compile-fail libs/function/test/function_test_fail1.cpp : : : : ]
|
|
||||||
|
|
||||||
[ compile-fail libs/function/test/function_test_fail2.cpp : : : : ]
|
|
||||||
|
|
||||||
[ compile libs/function/test/function_30.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/function_arith_cxx98.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/function_arith_portable.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/sum_avg_cxx98.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/sum_avg_portable.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/mem_fun_cxx98.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/mem_fun_portable.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/std_bind_cxx98.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/std_bind_portable.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/function_ref_cxx98.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/function_ref_portable.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/contains_test.cpp : : : : ]
|
|
||||||
|
|
||||||
[ run libs/function/test/contains2_test.cpp : : : : ]
|
|
||||||
;
|
|
||||||
}
|
|
Reference in New Issue
Block a user