mirror of
https://github.com/boostorg/function.git
synced 2026-01-29 07:32:15 +00:00
Compare commits
9 Commits
boost-1.34
...
svn-branch
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
687dff0782 | ||
|
|
80a3f47099 | ||
|
|
2a85edbd31 | ||
|
|
5c514ebe35 | ||
|
|
6a3f0df553 | ||
|
|
64c8d10fa8 | ||
|
|
a2a810d2c1 | ||
|
|
d84481361f | ||
|
|
872f12efee |
@@ -1,8 +1,3 @@
|
|||||||
# 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,11 +1,4 @@
|
|||||||
<?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,11 +1,4 @@
|
|||||||
<?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,11 +1,4 @@
|
|||||||
<?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,11 +1,4 @@
|
|||||||
<?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,11 +1,4 @@
|
|||||||
<?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,11 +1,4 @@
|
|||||||
<?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,14 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <boost/function_equal.hpp>
|
#include <boost/function_equal.hpp>
|
||||||
|
|
||||||
|
// 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 +67,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
|
||||||
|
|
||||||
@@ -215,8 +223,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 +273,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
|
||||||
@@ -287,8 +295,8 @@ namespace boost {
|
|||||||
// Some compilers (Borland, vc6, ...) are unhappy with ~functor_type.
|
// Some compilers (Borland, vc6, ...) are unhappy with ~functor_type.
|
||||||
reinterpret_cast<functor_type*>(&out_buffer.data)->~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
|
||||||
@@ -348,8 +356,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
|
||||||
@@ -480,13 +488,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>
|
||||||
|
|||||||
@@ -70,16 +70,6 @@
|
|||||||
# define BOOST_FUNCTION_RETURN(X) X; return BOOST_FUNCTION_VOID_RETURN_TYPE ()
|
# define BOOST_FUNCTION_RETURN(X) X; return BOOST_FUNCTION_VOID_RETURN_TYPE ()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BOOST_MSVC
|
|
||||||
# pragma warning(push)
|
|
||||||
# pragma warning(disable: 4127) // conditional expression is constant.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BOOST_MSVC
|
|
||||||
# pragma warning(push)
|
|
||||||
# pragma warning(disable: 4127) // conditional expression is constant.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
namespace function {
|
namespace function {
|
||||||
@@ -456,6 +446,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
|
||||||
@@ -798,19 +799,11 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef BOOST_MSVC
|
|
||||||
# pragma warning(pop)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef BOOST_FUNCTION_PARTIAL_SPEC
|
#undef BOOST_FUNCTION_PARTIAL_SPEC
|
||||||
#endif // have partial specialization
|
#endif // have partial specialization
|
||||||
|
|
||||||
} // end namespace boost
|
} // end namespace boost
|
||||||
|
|
||||||
#ifdef BOOST_MSVC
|
|
||||||
# pragma warning(pop)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Cleanup after ourselves...
|
// Cleanup after ourselves...
|
||||||
#undef BOOST_FUNCTION_VTABLE
|
#undef BOOST_FUNCTION_VTABLE
|
||||||
#undef BOOST_FUNCTION_DEFAULT_ALLOCATOR
|
#undef BOOST_FUNCTION_DEFAULT_ALLOCATOR
|
||||||
|
|||||||
@@ -1,11 +1,4 @@
|
|||||||
<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>
|
||||||
|
|||||||
Reference in New Issue
Block a user