diff --git a/include/boost/function/detail/function_iterate.hpp b/include/boost/function/detail/function_iterate.hpp deleted file mode 100644 index 5370b36..0000000 --- a/include/boost/function/detail/function_iterate.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// Boost.Function library - -// 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) - -// For more information, see http://www.boost.org -#if !defined(BOOST_PP_IS_ITERATING) -# error Boost.Function - do not include this file! -#endif - -#define BOOST_FUNCTION_NUM_ARGS BOOST_PP_ITERATION() -#include -#undef BOOST_FUNCTION_NUM_ARGS - diff --git a/include/boost/function/detail/gen_maybe_include.pl b/include/boost/function/detail/gen_maybe_include.pl deleted file mode 100644 index d062920..0000000 --- a/include/boost/function/detail/gen_maybe_include.pl +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/perl -w -# -# Boost.Function library -# -# 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. -# Permission to modify the code and to distribute modified code is granted -# provided this copyright notice appears in all copies, and a notice -# that the code was modified is included with the copyright notice. -# -# This software is provided "as is" without express or implied warranty, -# and with no claim as to its suitability for any purpose. -# -# For more information, see http://www.boost.org -use English; - -$max_args = $ARGV[0]; - -open (OUT, ">maybe_include.hpp") or die("Cannot write to maybe_include.hpp"); -for($on_arg = 0; $on_arg <= $max_args; ++$on_arg) { - if ($on_arg == 0) { - print OUT "#if"; - } - else { - print OUT "#elif"; - } - print OUT " BOOST_FUNCTION_NUM_ARGS == $on_arg\n"; - print OUT "# ifndef BOOST_FUNCTION_$on_arg\n"; - print OUT "# define BOOST_FUNCTION_$on_arg\n"; - print OUT "# include \n"; - print OUT "# endif\n"; -} -print OUT "#else\n"; -print OUT "# error Cannot handle Boost.Function objects that accept more than $max_args arguments!\n"; -print OUT "#endif\n"; diff --git a/include/boost/function/detail/maybe_include.hpp b/include/boost/function/detail/maybe_include.hpp deleted file mode 100644 index 92f71bb..0000000 --- a/include/boost/function/detail/maybe_include.hpp +++ /dev/null @@ -1,267 +0,0 @@ -// Boost.Function library - -// 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) - -// For more information, see http://www.boost.org - -#if BOOST_FUNCTION_NUM_ARGS == 0 -# ifndef BOOST_FUNCTION_0 -# define BOOST_FUNCTION_0 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 1 -# ifndef BOOST_FUNCTION_1 -# define BOOST_FUNCTION_1 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 2 -# ifndef BOOST_FUNCTION_2 -# define BOOST_FUNCTION_2 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 3 -# ifndef BOOST_FUNCTION_3 -# define BOOST_FUNCTION_3 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 4 -# ifndef BOOST_FUNCTION_4 -# define BOOST_FUNCTION_4 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 5 -# ifndef BOOST_FUNCTION_5 -# define BOOST_FUNCTION_5 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 6 -# ifndef BOOST_FUNCTION_6 -# define BOOST_FUNCTION_6 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 7 -# ifndef BOOST_FUNCTION_7 -# define BOOST_FUNCTION_7 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 8 -# ifndef BOOST_FUNCTION_8 -# define BOOST_FUNCTION_8 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 9 -# ifndef BOOST_FUNCTION_9 -# define BOOST_FUNCTION_9 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 10 -# ifndef BOOST_FUNCTION_10 -# define BOOST_FUNCTION_10 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 11 -# ifndef BOOST_FUNCTION_11 -# define BOOST_FUNCTION_11 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 12 -# ifndef BOOST_FUNCTION_12 -# define BOOST_FUNCTION_12 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 13 -# ifndef BOOST_FUNCTION_13 -# define BOOST_FUNCTION_13 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 14 -# ifndef BOOST_FUNCTION_14 -# define BOOST_FUNCTION_14 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 15 -# ifndef BOOST_FUNCTION_15 -# define BOOST_FUNCTION_15 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 16 -# ifndef BOOST_FUNCTION_16 -# define BOOST_FUNCTION_16 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 17 -# ifndef BOOST_FUNCTION_17 -# define BOOST_FUNCTION_17 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 18 -# ifndef BOOST_FUNCTION_18 -# define BOOST_FUNCTION_18 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 19 -# ifndef BOOST_FUNCTION_19 -# define BOOST_FUNCTION_19 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 20 -# ifndef BOOST_FUNCTION_20 -# define BOOST_FUNCTION_20 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 21 -# ifndef BOOST_FUNCTION_21 -# define BOOST_FUNCTION_21 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 22 -# ifndef BOOST_FUNCTION_22 -# define BOOST_FUNCTION_22 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 23 -# ifndef BOOST_FUNCTION_23 -# define BOOST_FUNCTION_23 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 24 -# ifndef BOOST_FUNCTION_24 -# define BOOST_FUNCTION_24 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 25 -# ifndef BOOST_FUNCTION_25 -# define BOOST_FUNCTION_25 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 26 -# ifndef BOOST_FUNCTION_26 -# define BOOST_FUNCTION_26 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 27 -# ifndef BOOST_FUNCTION_27 -# define BOOST_FUNCTION_27 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 28 -# ifndef BOOST_FUNCTION_28 -# define BOOST_FUNCTION_28 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 29 -# ifndef BOOST_FUNCTION_29 -# define BOOST_FUNCTION_29 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 30 -# ifndef BOOST_FUNCTION_30 -# define BOOST_FUNCTION_30 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 31 -# ifndef BOOST_FUNCTION_31 -# define BOOST_FUNCTION_31 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 32 -# ifndef BOOST_FUNCTION_32 -# define BOOST_FUNCTION_32 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 33 -# ifndef BOOST_FUNCTION_33 -# define BOOST_FUNCTION_33 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 34 -# ifndef BOOST_FUNCTION_34 -# define BOOST_FUNCTION_34 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 35 -# ifndef BOOST_FUNCTION_35 -# define BOOST_FUNCTION_35 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 36 -# ifndef BOOST_FUNCTION_36 -# define BOOST_FUNCTION_36 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 37 -# ifndef BOOST_FUNCTION_37 -# define BOOST_FUNCTION_37 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 38 -# ifndef BOOST_FUNCTION_38 -# define BOOST_FUNCTION_38 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 39 -# ifndef BOOST_FUNCTION_39 -# define BOOST_FUNCTION_39 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 40 -# ifndef BOOST_FUNCTION_40 -# define BOOST_FUNCTION_40 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 41 -# ifndef BOOST_FUNCTION_41 -# define BOOST_FUNCTION_41 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 42 -# ifndef BOOST_FUNCTION_42 -# define BOOST_FUNCTION_42 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 43 -# ifndef BOOST_FUNCTION_43 -# define BOOST_FUNCTION_43 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 44 -# ifndef BOOST_FUNCTION_44 -# define BOOST_FUNCTION_44 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 45 -# ifndef BOOST_FUNCTION_45 -# define BOOST_FUNCTION_45 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 46 -# ifndef BOOST_FUNCTION_46 -# define BOOST_FUNCTION_46 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 47 -# ifndef BOOST_FUNCTION_47 -# define BOOST_FUNCTION_47 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 48 -# ifndef BOOST_FUNCTION_48 -# define BOOST_FUNCTION_48 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 49 -# ifndef BOOST_FUNCTION_49 -# define BOOST_FUNCTION_49 -# include -# endif -#elif BOOST_FUNCTION_NUM_ARGS == 50 -# ifndef BOOST_FUNCTION_50 -# define BOOST_FUNCTION_50 -# include -# endif -#else -# error Cannot handle Boost.Function objects that accept more than 50 arguments! -#endif diff --git a/include/boost/function/detail/prologue.hpp b/include/boost/function/detail/prologue.hpp deleted file mode 100644 index 1ef5f6e..0000000 --- a/include/boost/function/detail/prologue.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// Boost.Function library - -// 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) - -// For more information, see http://www.boost.org - -#ifndef BOOST_FUNCTION_PROLOGUE_HPP -#define BOOST_FUNCTION_PROLOGUE_HPP -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -#endif // BOOST_FUNCTION_PROLOGUE_HPP diff --git a/include/boost/function/function0.hpp b/include/boost/function/function0.hpp deleted file mode 100644 index 65a02e5..0000000 --- a/include/boost/function/function0.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// 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) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 0 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function1.hpp b/include/boost/function/function1.hpp deleted file mode 100644 index 9089715..0000000 --- a/include/boost/function/function1.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// 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) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 1 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function10.hpp b/include/boost/function/function10.hpp deleted file mode 100644 index 6562724..0000000 --- a/include/boost/function/function10.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// 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) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 10 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function2.hpp b/include/boost/function/function2.hpp deleted file mode 100644 index dc8bf97..0000000 --- a/include/boost/function/function2.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// 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) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 2 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function3.hpp b/include/boost/function/function3.hpp deleted file mode 100644 index 19d1a49..0000000 --- a/include/boost/function/function3.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// 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) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 3 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function4.hpp b/include/boost/function/function4.hpp deleted file mode 100644 index f3349e2..0000000 --- a/include/boost/function/function4.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// 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) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 4 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function5.hpp b/include/boost/function/function5.hpp deleted file mode 100644 index a1305eb..0000000 --- a/include/boost/function/function5.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// 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) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 5 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function6.hpp b/include/boost/function/function6.hpp deleted file mode 100644 index 1f60914..0000000 --- a/include/boost/function/function6.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// 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) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 6 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function7.hpp b/include/boost/function/function7.hpp deleted file mode 100644 index 68542ed..0000000 --- a/include/boost/function/function7.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// 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) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 7 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function8.hpp b/include/boost/function/function8.hpp deleted file mode 100644 index cf2c376..0000000 --- a/include/boost/function/function8.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// 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) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 8 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function9.hpp b/include/boost/function/function9.hpp deleted file mode 100644 index 590e088..0000000 --- a/include/boost/function/function9.hpp +++ /dev/null @@ -1,12 +0,0 @@ -// Boost.Function library - -// 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) - -// For more information, see http://www.boost.org - -#define BOOST_FUNCTION_NUM_ARGS 9 -#include -#undef BOOST_FUNCTION_NUM_ARGS diff --git a/include/boost/function/function_base.hpp b/include/boost/function/function_base.hpp deleted file mode 100644 index 23f5f20..0000000 --- a/include/boost/function/function_base.hpp +++ /dev/null @@ -1,660 +0,0 @@ -// Boost.Function library - -// 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) - -// For more information, see http://www.boost.org - -#ifndef BOOST_FUNCTION_BASE_HEADER -#define BOOST_FUNCTION_BASE_HEADER - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef BOOST_NO_SFINAE -# include "boost/utility/enable_if.hpp" -#else -# include "boost/mpl/bool.hpp" -#endif -#include - -// Borrowed from Boost.Python library: determines the cases where we -// need to use std::type_info::name to compare instead of operator==. -# if (defined(__GNUC__) && __GNUC__ >= 3) \ - || defined(_AIX) \ - || ( defined(__sgi) && defined(__host_mips)) -# include -# define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) \ - (std::strcmp((X).name(),(Y).name()) == 0) -# else -# define BOOST_FUNCTION_COMPARE_TYPE_ID(X,Y) ((X)==(Y)) -#endif - -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__ICL) && __ICL <= 600 || defined(__MWERKS__) && __MWERKS__ < 0x2406 && !defined(BOOST_STRICT_CONFIG) -# define BOOST_FUNCTION_TARGET_FIX(x) x -#else -# define BOOST_FUNCTION_TARGET_FIX(x) -#endif // not MSVC - -#if defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730 && !defined(BOOST_STRICT_CONFIG) -// Work around a compiler bug. -// boost::python::objects::function has to be seen by the compiler before the -// boost::function class template. -namespace boost { namespace python { namespace objects { - class function; -}}} -#endif - -#if defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ - || defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) \ - || !(BOOST_STRICT_CONFIG || !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x540) -# 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::value)>::value), \ - Type>::type - - -#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX) -namespace boost { - -#if defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730 && !defined(BOOST_STRICT_CONFIG) -// The library shipping with MIPSpro 7.3.1.3m has a broken allocator -class function_base; - -template > -class function; -#else -template > -class function; -#endif - -template -inline void swap(function& f1, - function& f2) -{ - f1.swap(f2); -} - -} // end namespace boost -#endif // have partial specialization - -namespace boost { - namespace detail { - namespace function { - /** - * A union of a function pointer and a void pointer. This is necessary - * because 5.2.10/6 allows reinterpret_cast<> to safely cast between - * function pointer types and 5.2.9/10 allows static_cast<> to safely - * cast between a void pointer and an object pointer. But it is not legal - * to cast between a function pointer and a void* (in either direction), - * so function requires a union of the two. */ - union any_pointer - { - void* obj_ptr; - const void* const_obj_ptr; - void (*func_ptr)(); - char data[1]; - }; - - inline any_pointer make_any_pointer(void* o) - { - any_pointer p; - p.obj_ptr = o; - return p; - } - - inline any_pointer make_any_pointer(const void* o) - { - any_pointer p; - p.const_obj_ptr = o; - return p; - } - - inline any_pointer make_any_pointer(void (*f)()) - { - any_pointer p; - p.func_ptr = f; - return p; - } - - /** - * The unusable class is a placeholder for unused function arguments - * It is also completely unusable except that it constructable from - * anything. This helps compilers without partial specialization to - * handle Boost.Function objects returning void. - */ - struct unusable - { - unusable() {} - template unusable(const T&) {} - }; - - /* Determine the return type. This supports compilers that do not support - * void returns or partial specialization by silently changing the return - * type to "unusable". - */ - template struct function_return_type { typedef T type; }; - - template<> - struct function_return_type - { - typedef unusable type; - }; - - // The operation type to perform on the given functor/function pointer - enum functor_manager_operation_type { - clone_functor_tag, - destroy_functor_tag, - check_functor_type_tag - }; - - // Tags used to decide between different types of functions - struct function_ptr_tag {}; - struct function_obj_tag {}; - struct member_ptr_tag {}; - struct function_obj_ref_tag {}; - struct stateless_function_obj_tag {}; - - template - class get_function_tag - { - typedef typename ct_if<(is_pointer::value), - function_ptr_tag, - function_obj_tag>::type ptr_or_obj_tag; - - typedef typename ct_if<(is_member_pointer::value), - member_ptr_tag, - ptr_or_obj_tag>::type ptr_or_obj_or_mem_tag; - - typedef typename ct_if<(is_reference_wrapper::value), - function_obj_ref_tag, - ptr_or_obj_or_mem_tag>::type or_ref_tag; - - public: - typedef typename ct_if<(is_stateless::value), - stateless_function_obj_tag, - or_ref_tag>::type type; - }; - - // The trivial manager does nothing but return the same pointer (if we - // are cloning) or return the null pointer (if we are deleting). - template - struct trivial_manager - { - static inline any_pointer - get(any_pointer f, functor_manager_operation_type op) - { - switch (op) { - case clone_functor_tag: return f; - - case destroy_functor_tag: - return make_any_pointer(reinterpret_cast(0)); - - case check_functor_type_tag: - { - std::type_info* t = static_cast(f.obj_ptr); - return BOOST_FUNCTION_COMPARE_TYPE_ID(typeid(F), *t)? - f - : make_any_pointer(reinterpret_cast(0)); - } - } - - // Clears up a warning with GCC 3.2.3 - return make_any_pointer(reinterpret_cast(0)); - } - }; - - /** - * The functor_manager class contains a static function "manage" which - * can clone or destroy the given function/function object pointer. - */ - template - struct functor_manager - { - private: - typedef Functor functor_type; - - // For function pointers, the manager is trivial - static inline any_pointer - manager(any_pointer function_ptr, - functor_manager_operation_type op, - function_ptr_tag) - { - if (op == clone_functor_tag) - return function_ptr; - else - return make_any_pointer(static_cast(0)); - } - - // For function object pointers, we clone the pointer to each - // function has its own version. - static inline any_pointer - manager(any_pointer function_obj_ptr, - functor_manager_operation_type op, - function_obj_tag) - { -#ifndef BOOST_NO_STD_ALLOCATOR - typedef typename Allocator::template rebind::other - allocator_type; - typedef typename allocator_type::pointer pointer_type; -#else - typedef functor_type* pointer_type; -#endif // BOOST_NO_STD_ALLOCATOR - -# ifndef BOOST_NO_STD_ALLOCATOR - allocator_type allocator; -# endif // BOOST_NO_STD_ALLOCATOR - - if (op == clone_functor_tag) { - functor_type* f = - static_cast(function_obj_ptr.obj_ptr); - - // Clone the functor -# ifndef BOOST_NO_STD_ALLOCATOR - pointer_type copy = allocator.allocate(1); - allocator.construct(copy, *f); - - // Get back to the original pointer type - functor_type* new_f = static_cast(copy); -# else - functor_type* new_f = new functor_type(*f); -# endif // BOOST_NO_STD_ALLOCATOR - return make_any_pointer(static_cast(new_f)); - } - else { - /* Cast from the void pointer to the functor pointer type */ - functor_type* f = - reinterpret_cast(function_obj_ptr.obj_ptr); - -# ifndef BOOST_NO_STD_ALLOCATOR - /* Cast from the functor pointer type to the allocator's pointer - type */ - pointer_type victim = static_cast(f); - - // Destroy and deallocate the functor - allocator.destroy(victim); - allocator.deallocate(victim, 1); -# else - delete f; -# endif // BOOST_NO_STD_ALLOCATOR - - return make_any_pointer(static_cast(0)); - } - } - public: - /* Dispatch to an appropriate manager based on whether we have a - function pointer or a function object pointer. */ - static any_pointer - manage(any_pointer functor_ptr, functor_manager_operation_type op) - { - if (op == check_functor_type_tag) { - std::type_info* type = - static_cast(functor_ptr.obj_ptr); - return (BOOST_FUNCTION_COMPARE_TYPE_ID(typeid(Functor), *type)? - functor_ptr - : make_any_pointer(reinterpret_cast(0))); - } - else { - typedef typename get_function_tag::type tag_type; - return manager(functor_ptr, op, tag_type()); - } - } - }; - - // A type that is only used for comparisons against zero - struct useless_clear_type {}; - -#ifdef BOOST_NO_SFINAE - // These routines perform comparisons between a Boost.Function - // object and an arbitrary function object (when the last - // parameter is mpl::bool_) or against zero (when the - // last parameter is mpl::bool_). They are only necessary - // for compilers that don't support SFINAE. - template - bool - compare_equal(const Function& f, const Functor&, int, mpl::bool_) - { return f.empty(); } - - template - bool - compare_not_equal(const Function& f, const Functor&, int, - mpl::bool_) - { return !f.empty(); } - - template - bool - compare_equal(const Function& f, const Functor& g, long, - mpl::bool_) - { - if (const Functor* fp = f.template target()) - return function_equal(*fp, g); - else return false; - } - - template - bool - compare_equal(const Function& f, const reference_wrapper& g, - int, mpl::bool_) - { - if (const Functor* fp = f.template target()) - return fp == g.get_pointer(); - else return false; - } - - template - bool - compare_not_equal(const Function& f, const Functor& g, long, - mpl::bool_) - { - if (const Functor* fp = f.template target()) - return !function_equal(*fp, g); - else return true; - } - - template - bool - compare_not_equal(const Function& f, - const reference_wrapper& g, int, - mpl::bool_) - { - if (const Functor* fp = f.template target()) - return fp != g.get_pointer(); - else return true; - } -#endif // BOOST_NO_SFINAE - } // end namespace function - } // end namespace detail - -/** - * The function_base class contains the basic elements needed for the - * function1, function2, function3, etc. classes. It is common to all - * functions (and as such can be used to tell if we have one of the - * functionN objects). - */ -class function_base -{ -public: - function_base() : manager(0) - { - functor.obj_ptr = 0; - } - - // Is this function empty? - bool empty() const { return !manager; } - - template - Functor* target() - { - if (!manager) return 0; - - detail::function::any_pointer result = - manager(detail::function::make_any_pointer(&typeid(Functor)), - detail::function::check_functor_type_tag); - if (!result.obj_ptr) return 0; - else { - typedef typename detail::function::get_function_tag::type tag; - return get_functor_pointer(tag(), 0); - } - } - - template - const Functor* target() const - { - if (!manager) return 0; - - detail::function::any_pointer result = - manager(detail::function::make_any_pointer(&typeid(Functor)), - detail::function::check_functor_type_tag); - if (!result.obj_ptr) return 0; - else { - typedef typename detail::function::get_function_tag::type tag; - return get_functor_pointer(tag(), 0); - } - } - - template - bool contains(const F& f) const - { - if (const F* fp = this->template target()) { - return function_equal(*fp, f); - } else { - return false; - } - } - -#if defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3 - // GCC 3.3 and newer cannot copy with the global operator==, due to - // problems with instantiation of function return types before it - // has been verified that the argument types match up. - template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator==(Functor g) const - { - if (const Functor* fp = target()) - return function_equal(*fp, g); - else return false; - } - - template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator!=(Functor g) const - { - if (const Functor* fp = target()) - return !function_equal(*fp, g); - else return true; - } -#endif - -public: // should be protected, but GCC 2.95.3 will fail to allow access - detail::function::any_pointer (*manager)( - detail::function::any_pointer, - detail::function::functor_manager_operation_type); - detail::function::any_pointer functor; - -private: - template - Functor* get_functor_pointer(detail::function::function_ptr_tag, int) - { return reinterpret_cast(&functor.func_ptr); } - - template - Functor* get_functor_pointer(Tag, long) - { return static_cast(functor.obj_ptr); } - - template - const Functor* - get_functor_pointer(detail::function::function_ptr_tag, int) const - { return reinterpret_cast(&functor.func_ptr); } - - template - const Functor* get_functor_pointer(Tag, long) const - { return static_cast(functor.const_obj_ptr); } -}; - -/** - * The bad_function_call exception class is thrown when a boost::function - * object is invoked - */ -class bad_function_call : public std::runtime_error -{ -public: - bad_function_call() : std::runtime_error("call to empty boost::function") {} -}; - -#ifndef BOOST_NO_SFINAE -inline bool operator==(const function_base& f, - detail::function::useless_clear_type*) -{ - return f.empty(); -} - -inline bool operator!=(const function_base& f, - detail::function::useless_clear_type*) -{ - return !f.empty(); -} - -inline bool operator==(detail::function::useless_clear_type*, - const function_base& f) -{ - return f.empty(); -} - -inline bool operator!=(detail::function::useless_clear_type*, - const function_base& f) -{ - return !f.empty(); -} -#endif - -#ifdef BOOST_NO_SFINAE -// Comparisons between boost::function objects and arbitrary function objects -template - inline bool operator==(const function_base& f, Functor g) - { - typedef mpl::bool_<(is_integral::value)> integral; - return detail::function::compare_equal(f, g, 0, integral()); - } - -template - inline bool operator==(Functor g, const function_base& f) - { - typedef mpl::bool_<(is_integral::value)> integral; - return detail::function::compare_equal(f, g, 0, integral()); - } - -template - inline bool operator!=(const function_base& f, Functor g) - { - typedef mpl::bool_<(is_integral::value)> integral; - return detail::function::compare_not_equal(f, g, 0, integral()); - } - -template - inline bool operator!=(Functor g, const function_base& f) - { - typedef mpl::bool_<(is_integral::value)> integral; - return detail::function::compare_not_equal(f, g, 0, integral()); - } -#else - -# if !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3) -// Comparisons between boost::function objects and arbitrary function -// objects. GCC 3.3 and before has an obnoxious bug that prevents this -// from working. -template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator==(const function_base& f, Functor g) - { - if (const Functor* fp = f.template target()) - return function_equal(*fp, g); - else return false; - } - -template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator==(Functor g, const function_base& f) - { - if (const Functor* fp = f.template target()) - return function_equal(g, *fp); - else return false; - } - -template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator!=(const function_base& f, Functor g) - { - if (const Functor* fp = f.template target()) - return !function_equal(*fp, g); - else return true; - } - -template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator!=(Functor g, const function_base& f) - { - if (const Functor* fp = f.template target()) - return !function_equal(g, *fp); - else return true; - } -# endif - -template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator==(const function_base& f, reference_wrapper g) - { - if (const Functor* fp = f.template target()) - return fp == g.get_pointer(); - else return false; - } - -template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator==(reference_wrapper g, const function_base& f) - { - if (const Functor* fp = f.template target()) - return g.get_pointer() == fp; - else return false; - } - -template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator!=(const function_base& f, reference_wrapper g) - { - if (const Functor* fp = f.template target()) - return fp != g.get_pointer(); - else return true; - } - -template - BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL(Functor, bool) - operator!=(reference_wrapper g, const function_base& f) - { - if (const Functor* fp = f.template target()) - return g.get_pointer() != fp; - else return true; - } - -#endif // Compiler supporting SFINAE - -namespace detail { - namespace function { - inline bool has_empty_target(const function_base* f) - { - return f->empty(); - } - -#if BOOST_WORKAROUND(BOOST_MSVC, <= 1310) - inline bool has_empty_target(const void*) - { - return false; - } -#else - inline bool has_empty_target(...) - { - return false; - } -#endif - } // end namespace function -} // end namespace detail -} // end namespace boost - -#undef BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL -#undef BOOST_FUNCTION_COMPARE_TYPE_ID - -#endif // BOOST_FUNCTION_BASE_HEADER diff --git a/include/boost/function/function_template.hpp b/include/boost/function/function_template.hpp deleted file mode 100644 index b00238b..0000000 --- a/include/boost/function/function_template.hpp +++ /dev/null @@ -1,721 +0,0 @@ -// Boost.Function library - -// 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) - -// For more information, see http://www.boost.org - -// Note: this header is a header template and must NOT have multiple-inclusion -// protection. -#include - -#define BOOST_FUNCTION_TEMPLATE_PARMS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, typename T) - -#define BOOST_FUNCTION_TEMPLATE_ARGS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, T) - -#define BOOST_FUNCTION_PARM(J,I,D) BOOST_PP_CAT(T,I) BOOST_PP_CAT(a,I) - -#define BOOST_FUNCTION_PARMS BOOST_PP_ENUM(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_PARM,BOOST_PP_EMPTY) - -#define BOOST_FUNCTION_ARGS BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS, a) - -#define BOOST_FUNCTION_ARG_TYPE(J,I,D) \ - typedef BOOST_PP_CAT(T,I) BOOST_PP_CAT(arg, BOOST_PP_CAT(BOOST_PP_INC(I),_type)); - -#define BOOST_FUNCTION_ARG_TYPES BOOST_PP_REPEAT(BOOST_FUNCTION_NUM_ARGS,BOOST_FUNCTION_ARG_TYPE,BOOST_PP_EMPTY) - -// Type of the default allocator -#ifndef BOOST_NO_STD_ALLOCATOR -# define BOOST_FUNCTION_DEFAULT_ALLOCATOR std::allocator -#else -# define BOOST_FUNCTION_DEFAULT_ALLOCATOR int -#endif // BOOST_NO_STD_ALLOCATOR - -// Comma if nonzero number of arguments -#if BOOST_FUNCTION_NUM_ARGS == 0 -# define BOOST_FUNCTION_COMMA -#else -# define BOOST_FUNCTION_COMMA , -#endif // BOOST_FUNCTION_NUM_ARGS > 0 - -// Class names used in this version of the code -#define BOOST_FUNCTION_FUNCTION BOOST_JOIN(function,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_FUNCTION_INVOKER \ - BOOST_JOIN(function_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_VOID_FUNCTION_INVOKER \ - BOOST_JOIN(void_function_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_FUNCTION_OBJ_INVOKER \ - BOOST_JOIN(function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER \ - BOOST_JOIN(void_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_STATELESS_FUNCTION_OBJ_INVOKER \ - BOOST_JOIN(stateless_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_STATELESS_VOID_FUNCTION_OBJ_INVOKER \ - BOOST_JOIN(stateless_void_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_GET_FUNCTION_INVOKER \ - BOOST_JOIN(get_function_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER \ - BOOST_JOIN(get_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) -#define BOOST_FUNCTION_GET_STATELESS_FUNCTION_OBJ_INVOKER \ - BOOST_JOIN(get_stateless_function_obj_invoker,BOOST_FUNCTION_NUM_ARGS) - -namespace boost { - namespace detail { - namespace function { - template< - typename FunctionPtr, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_FUNCTION_INVOKER - { - static R invoke(any_pointer function_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) - { - FunctionPtr f = reinterpret_cast(function_ptr.func_ptr); - return f(BOOST_FUNCTION_ARGS); - } - }; - - template< - typename FunctionPtr, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_VOID_FUNCTION_INVOKER - { - static unusable invoke(any_pointer function_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) - - { - FunctionPtr f = reinterpret_cast(function_ptr.func_ptr); - f(BOOST_FUNCTION_ARGS); - return unusable(); - } - }; - - template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_FUNCTION_OBJ_INVOKER - { - static R invoke(any_pointer function_obj_ptr BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) - - { - FunctionObj* f = (FunctionObj*)(function_obj_ptr.obj_ptr); - return (*f)(BOOST_FUNCTION_ARGS); - } - }; - - template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER - { - static unusable 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(); - } - }; - - template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_STATELESS_FUNCTION_OBJ_INVOKER - { - static R invoke(any_pointer BOOST_FUNCTION_COMMA BOOST_FUNCTION_PARMS) - { - FunctionObj f = FunctionObj(); - return f(BOOST_FUNCTION_ARGS); - } - }; - - template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_STATELESS_VOID_FUNCTION_OBJ_INVOKER - { - static unusable invoke(any_pointer BOOST_FUNCTION_COMMA - BOOST_FUNCTION_PARMS) - - { - FunctionObj f = FunctionObj(); - f(BOOST_FUNCTION_ARGS); - return unusable(); - } - }; - - template< - typename FunctionPtr, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_GET_FUNCTION_INVOKER - { - typedef typename ct_if<(is_void::value), - BOOST_FUNCTION_VOID_FUNCTION_INVOKER< - FunctionPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >, - BOOST_FUNCTION_FUNCTION_INVOKER< - FunctionPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - > - >::type type; - }; - - template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER - { - typedef typename ct_if<(is_void::value), - BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >, - BOOST_FUNCTION_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - > - >::type type; - }; - - template< - typename FunctionObj, - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS - > - struct BOOST_FUNCTION_GET_STATELESS_FUNCTION_OBJ_INVOKER - { - typedef typename ct_if<(is_void::value), - BOOST_FUNCTION_STATELESS_VOID_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >, - BOOST_FUNCTION_STATELESS_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - > - >::type type; - }; - - } // end namespace function - } // end namespace detail - - template< - typename R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_PARMS, - typename Allocator = BOOST_FUNCTION_DEFAULT_ALLOCATOR - > - class BOOST_FUNCTION_FUNCTION : public function_base - { - public: - typedef typename detail::function::function_return_type::type - internal_result_type; - - private: - struct clear_type {}; - - public: - BOOST_STATIC_CONSTANT(int, args = BOOST_FUNCTION_NUM_ARGS); - - // add signature for boost::lambda - template - struct sig - { - typedef internal_result_type type; - }; - -#if BOOST_FUNCTION_NUM_ARGS == 1 - typedef T0 argument_type; -#elif BOOST_FUNCTION_NUM_ARGS == 2 - typedef T0 first_argument_type; - typedef T1 second_argument_type; -#endif - - 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; - - BOOST_FUNCTION_FUNCTION() : function_base() - , invoker(0) {} - - // MSVC chokes if the following two constructors are collapsed into - // one with a default parameter. - template - BOOST_FUNCTION_FUNCTION(Functor BOOST_FUNCTION_TARGET_FIX(const &) f -#ifndef BOOST_NO_SFINAE - ,typename enable_if_c< - (::boost::type_traits::ice_not< - (is_integral::value)>::value), - int>::type = 0 -#endif // BOOST_NO_SFINAE - ) : - function_base(), - invoker(0) - { - this->assign_to(f); - } - -#ifndef BOOST_NO_SFINAE - BOOST_FUNCTION_FUNCTION(clear_type*) : function_base(), invoker(0) {} -#else - BOOST_FUNCTION_FUNCTION(int zero) : function_base(), invoker(0) - { - BOOST_ASSERT(zero == 0); - } -#endif - - BOOST_FUNCTION_FUNCTION(const BOOST_FUNCTION_FUNCTION& f) : - function_base(), - invoker(0) - { - this->assign_to_own(f); - } - - ~BOOST_FUNCTION_FUNCTION() { clear(); } - -#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 - { - 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); -#else - return result; -#endif // BOOST_NO_VOID_RETURNS - } -#else - result_type operator()(BOOST_FUNCTION_PARMS) const; -#endif - - // The distinction between when to use BOOST_FUNCTION_FUNCTION and - // when to use self_type is obnoxious. MSVC cannot handle self_type as - // the return type of these assignment operators, but Borland C++ cannot - // handle BOOST_FUNCTION_FUNCTION as the type of the temporary to - // construct. - template -#ifndef BOOST_NO_SFINAE - typename enable_if_c< - (::boost::type_traits::ice_not< - (is_integral::value)>::value), - BOOST_FUNCTION_FUNCTION&>::type -#else - BOOST_FUNCTION_FUNCTION& -#endif - operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) - { - self_type(f).swap(*this); - return *this; - } - -#ifndef BOOST_NO_SFINAE - BOOST_FUNCTION_FUNCTION& operator=(clear_type*) - { - this->clear(); - return *this; - } -#else - BOOST_FUNCTION_FUNCTION& operator=(int zero) - { - BOOST_ASSERT(zero == 0); - this->clear(); - return *this; - } -#endif - - // Assignment from another BOOST_FUNCTION_FUNCTION - BOOST_FUNCTION_FUNCTION& operator=(const BOOST_FUNCTION_FUNCTION& f) - { - if (&f == this) - return *this; - - self_type(f).swap(*this); - return *this; - } - - void swap(BOOST_FUNCTION_FUNCTION& other) - { - if (&other == this) - return; - - std::swap(this->manager, other.manager); - std::swap(this->functor, other.functor); - std::swap(invoker, other.invoker); - } - - // Clear out a target, if there is one - void clear() - { - if (this->manager) { - function_base::functor = - this->manager(this->functor, detail::function::destroy_functor_tag); - } - - this->manager = 0; - invoker = 0; - } - -#if (defined __SUNPRO_CC) && (__SUNPRO_CC <= 0x530) && !(defined BOOST_NO_COMPILER_CONFIG) - // Sun C++ 5.3 can't handle the safe_bool idiom, so don't use it - operator bool () const { return !this->empty(); } -#else - private: - struct dummy { - void nonnull() {}; - }; - - typedef void (dummy::*safe_bool)(); - - public: - operator safe_bool () const - { return (this->empty())? 0 : &dummy::nonnull; } - - bool operator!() const - { return this->empty(); } -#endif - - private: - void assign_to_own(const BOOST_FUNCTION_FUNCTION& f) - { - if (!f.empty()) { - invoker = f.invoker; - this->manager = f.manager; - this->functor = - f.manager(f.functor, detail::function::clone_functor_tag); - } - } - - template - void assign_to(Functor f) - { - typedef typename detail::function::get_function_tag::type tag; - this->assign_to(f, tag()); - } - - template - void assign_to(FunctionPtr f, detail::function::function_ptr_tag) - { - clear(); - - if (f) { - typedef typename detail::function::BOOST_FUNCTION_GET_FUNCTION_INVOKER< - FunctionPtr, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - actual_invoker_type; - - invoker = &actual_invoker_type::invoke; - this->manager = - &detail::function::functor_manager::manage; - this->functor = - 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) - ), - detail::function::clone_functor_tag); - } - } - -#if BOOST_FUNCTION_NUM_ARGS > 0 - template - void assign_to(MemberPtr f, detail::function::member_ptr_tag) - { - this->assign_to(mem_fn(f)); - } -#endif // BOOST_FUNCTION_NUM_ARGS > 0 - - template - void assign_to(FunctionObj f, detail::function::function_obj_tag) - { - if (!detail::function::has_empty_target(addressof(f))) { - typedef - typename detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - actual_invoker_type; - - invoker = &actual_invoker_type::invoke; - this->manager = &detail::function::functor_manager< - FunctionObj, Allocator>::manage; -#ifndef BOOST_NO_STD_ALLOCATOR - typedef typename Allocator::template rebind::other - rebound_allocator_type; - typedef typename rebound_allocator_type::pointer pointer_type; - rebound_allocator_type allocator; - pointer_type copy = allocator.allocate(1); - allocator.construct(copy, f); - - // Get back to the original pointer type - FunctionObj* new_f = static_cast(copy); -#else - FunctionObj* new_f = new FunctionObj(f); -#endif // BOOST_NO_STD_ALLOCATOR - this->functor = - detail::function::make_any_pointer(static_cast(new_f)); - } - } - - template - void assign_to(const reference_wrapper& f, - detail::function::function_obj_ref_tag) - { - if (!detail::function::has_empty_target(f.get_pointer())) { - typedef - typename detail::function::BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - actual_invoker_type; - - invoker = &actual_invoker_type::invoke; - this->manager = &detail::function::trivial_manager::get; - this->functor = - this->manager( - detail::function::make_any_pointer( - const_cast(f.get_pointer())), - detail::function::clone_functor_tag); - } - } - - template - void assign_to(FunctionObj, detail::function::stateless_function_obj_tag) - { - typedef - typename detail::function:: - BOOST_FUNCTION_GET_STATELESS_FUNCTION_OBJ_INVOKER< - FunctionObj, - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS - >::type - actual_invoker_type; - invoker = &actual_invoker_type::invoke; - this->manager = &detail::function::trivial_manager::get; - this->functor = detail::function::make_any_pointer(this); - } - - typedef internal_result_type (*invoker_type)(detail::function::any_pointer - BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS); - - invoker_type invoker; - }; - - template - inline void swap(BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS , - Allocator - >& f1, - BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS, - Allocator - >& f2) - { - f1.swap(f2); - } - -#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1200) - template - typename BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS, - Allocator>::result_type - BOOST_FUNCTION_FUNCTION - ::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); -# else - return result; -# endif // BOOST_NO_VOID_RETURNS - } -#endif - -// Poison comparisons between boost::function objects of the same type. -template - void operator==(const BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS , - Allocator>&, - const BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS , - Allocator>&); -template - void operator!=(const BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS , - Allocator>&, - const BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA - BOOST_FUNCTION_TEMPLATE_ARGS , - Allocator>&); - -#if !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX) - -#if BOOST_FUNCTION_NUM_ARGS == 0 -#define BOOST_FUNCTION_PARTIAL_SPEC R (void) -#else -#define BOOST_FUNCTION_PARTIAL_SPEC R (BOOST_PP_ENUM_PARAMS(BOOST_FUNCTION_NUM_ARGS,T)) -#endif - -template -class function - : public BOOST_FUNCTION_FUNCTION -{ - typedef BOOST_FUNCTION_FUNCTION base_type; - typedef function self_type; - - struct clear_type {}; - -public: - typedef typename base_type::allocator_type allocator_type; - - function() : base_type() {} - - template - function(Functor f -#ifndef BOOST_NO_SFINAE - ,typename enable_if_c< - (::boost::type_traits::ice_not< - (is_integral::value)>::value), - int>::type = 0 -#endif - ) : - base_type(f) - { - } - -#ifndef BOOST_NO_SFINAE - function(clear_type*) : base_type() {} -#endif - - function(const self_type& f) : base_type(static_cast(f)){} - - function(const base_type& f) : base_type(static_cast(f)){} - - self_type& operator=(const self_type& f) - { - self_type(f).swap(*this); - return *this; - } - - template -#ifndef BOOST_NO_SFINAE - typename enable_if_c< - (::boost::type_traits::ice_not< - (is_integral::value)>::value), - self_type&>::type -#else - self_type& -#endif - operator=(Functor f) - { - self_type(f).swap(*this); - return *this; - } - -#ifndef BOOST_NO_SFINAE - self_type& operator=(clear_type*) - { - this->clear(); - return *this; - } -#endif - - self_type& operator=(const base_type& f) - { - self_type(f).swap(*this); - return *this; - } -}; - -#undef BOOST_FUNCTION_PARTIAL_SPEC -#endif // have partial specialization - -} // end namespace boost - -// Cleanup after ourselves... -#undef BOOST_FUNCTION_DEFAULT_ALLOCATOR -#undef BOOST_FUNCTION_COMMA -#undef BOOST_FUNCTION_FUNCTION -#undef BOOST_FUNCTION_FUNCTION_INVOKER -#undef BOOST_FUNCTION_VOID_FUNCTION_INVOKER -#undef BOOST_FUNCTION_FUNCTION_OBJ_INVOKER -#undef BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER -#undef BOOST_FUNCTION_STATELESS_FUNCTION_OBJ_INVOKER -#undef BOOST_FUNCTION_STATELESS_VOID_FUNCTION_OBJ_INVOKER -#undef BOOST_FUNCTION_GET_FUNCTION_INVOKER -#undef BOOST_FUNCTION_GET_FUNCTION_OBJ_INVOKER -#undef BOOST_FUNCTION_GET_STATELESS_FUNCTION_OBJ_INVOKER -#undef BOOST_FUNCTION_GET_MEM_FUNCTION_INVOKER -#undef BOOST_FUNCTION_TEMPLATE_PARMS -#undef BOOST_FUNCTION_TEMPLATE_ARGS -#undef BOOST_FUNCTION_PARMS -#undef BOOST_FUNCTION_PARM -#undef BOOST_FUNCTION_ARGS -#undef BOOST_FUNCTION_ARG_TYPE -#undef BOOST_FUNCTION_ARG_TYPES diff --git a/include/boost/function/gen_function_N.pl b/include/boost/function/gen_function_N.pl deleted file mode 100644 index d8f1249..0000000 --- a/include/boost/function/gen_function_N.pl +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/perl -w -# -# Boost.Function library -# -# 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) -# -# For more information, see http://www.boost.org -use English; - -if ($#ARGV < 0) { - print "Usage: perl gen_function_N \n"; - exit; -} - - -$totalNumArgs = $ARGV[0]; -for ($numArgs = 0; $numArgs <= $totalNumArgs; ++$numArgs) { - open OUT, ">function$numArgs.hpp"; - print OUT "#define BOOST_FUNCTION_NUM_ARGS $numArgs\n"; - print OUT "#include \n"; - print OUT "#undef BOOST_FUNCTION_NUM_ARGS\n"; - close OUT; -}