X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=boost%2Fboost%2Ffunction.hpp;h=b72842bb3b65120b4ceccb3bd51d1c65bbb8293f;hb=44cdffa39e9160bde46d824f1915f9ef3084b53e;hp=01e3fb3a9dc371b726b55c753e397e0c5357fbae;hpb=59b6a4701a8d2b5155af08cf758b4ca120201282;p=lyx.git diff --git a/boost/boost/function.hpp b/boost/boost/function.hpp index 01e3fb3a9d..b72842bb3b 100644 --- a/boost/boost/function.hpp +++ b/boost/boost/function.hpp @@ -1,517 +1,66 @@ // Boost.Function library -// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu) -// -// Permission to copy, use, sell and distribute this software is granted -// provided this copyright notice appears in all copies. -// 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 - -// William Kempf, Jesse Jones and Karl Nelson were all very helpful in the -// design of this library. - -#ifndef BOOST_FUNCTION_HPP -#define BOOST_FUNCTION_HPP - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace boost { - namespace detail { - namespace function { - // Choose the appropriate underlying implementation - template struct real_get_function_impl {}; - - template<> - struct real_get_function_impl<0> - { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Policy, - typename Mixin, - typename Allocator - > - struct params - { - typedef function0 type; - }; - }; - - template<> - struct real_get_function_impl<1> - { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Policy, - typename Mixin, - typename Allocator - > - struct params - { - typedef function1 type; - }; - }; - - template<> - struct real_get_function_impl<2> - { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Policy, - typename Mixin, - typename Allocator - > - struct params - { - typedef function2 type; - }; - }; - - template<> - struct real_get_function_impl<3> - { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Policy, - typename Mixin, - typename Allocator - > - struct params - { - typedef function3 type; - }; - }; - - template<> - struct real_get_function_impl<4> - { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Policy, - typename Mixin, - typename Allocator - > - struct params - { - typedef function4 type; - }; - }; - - template<> - struct real_get_function_impl<5> - { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Policy, - typename Mixin, - typename Allocator - > - struct params - { - typedef function5 - type; - }; - }; - - template<> - struct real_get_function_impl<6> - { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Policy, - typename Mixin, - typename Allocator - > - struct params - { - typedef function6 - type; - }; - }; - - template<> - struct real_get_function_impl<7> - { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Policy, - typename Mixin, - typename Allocator - > - struct params - { - typedef function7 type; - }; - }; - - template<> - struct real_get_function_impl<8> - { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Policy, - typename Mixin, - typename Allocator - > - struct params - { - typedef function8 type; - }; - }; - - template<> - struct real_get_function_impl<9> - { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Policy, - typename Mixin, - typename Allocator - > - struct params - { - typedef function9 type; - }; - }; - - template<> - struct real_get_function_impl<10> - { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Policy, - typename Mixin, - typename Allocator - > - struct params - { - typedef function10 type; - }; - }; - - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Policy = empty_function_policy, - typename Mixin = empty_function_mixin, - typename Allocator = std::allocator - > - struct get_function_impl - { - typedef typename real_get_function_impl< - (count_used_args::value) - >::template params::type - type; - }; +// 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) - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename MyPolicy = empty_function_policy, - typename MyMixin = empty_function_mixin, - typename MyAllocator = std::allocator - > - struct function_traits_builder - { - typedef typename get_function_impl::type - type; +// For more information, see http://www.boost.org/libs/function - typedef MyPolicy policy_type; - typedef MyMixin mixin_type; - typedef MyAllocator allocator_type; - -#ifndef BOOST_NO_DEPENDENT_NESTED_DERIVATIONS - template - struct policy : - public function_traits_builder {}; - - template - struct mixin : - public function_traits_builder {}; +// William Kempf, Jesse Jones and Karl Nelson were all very helpful in the +// design of this library. - template - struct allocator : - public function_traits_builder {}; +#include // unary_function, binary_function + +#include +#include + +#ifndef BOOST_FUNCTION_MAX_ARGS +# define BOOST_FUNCTION_MAX_ARGS 10 +#endif // BOOST_FUNCTION_MAX_ARGS + +// Include the prologue here so that the use of file-level iteration +// in anything that may be included by function_template.hpp doesn't break +#include + +// Older Visual Age C++ version do not handle the file iteration well +#if BOOST_WORKAROUND(__IBMCPP__, >= 500) && BOOST_WORKAROUND(__IBMCPP__, < 800) +# if BOOST_FUNCTION_MAX_ARGS >= 0 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 1 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 2 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 3 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 4 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 5 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 6 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 7 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 8 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 9 +# include +# endif +# if BOOST_FUNCTION_MAX_ARGS >= 10 +# include +# endif #else - template - struct policy - { - typedef typename function_traits_builder::type - type; - }; - - template - struct mixin - { - typedef typename function_traits_builder::type - type; - }; - - template - struct allocator - { - typedef typename function_traits_builder::type - type; - }; -#endif - }; - - } // end namespace function - } // end namespace detail - - template< - typename R, - typename T1 = detail::function::unusable, - typename T2 = detail::function::unusable, - typename T3 = detail::function::unusable, - typename T4 = detail::function::unusable, - typename T5 = detail::function::unusable, - typename T6 = detail::function::unusable, - typename T7 = detail::function::unusable, - typename T8 = detail::function::unusable, - typename T9 = detail::function::unusable, - typename T10 = detail::function::unusable - > - class function : - public detail::function::get_function_impl::type, - public detail::function::function_traits_builder - { - typedef typename detail::function::get_function_impl::type - base_type; - - public: - typedef typename base_type::policy_type policy_type; - typedef typename base_type::mixin_type mixin_type; - typedef typename base_type::allocator_type allocator_type; - typedef function self_type; - - function() : base_type() {} - - template - function(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) : base_type(f) {} - - function(const self_type& f) : base_type(static_cast(f)){} - - template - self_type& operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) - { - self_type(f).swap(*this); - return *this; - } - - self_type& operator=(const base_type& f) - { - self_type(f).swap(*this); - return *this; - } - - self_type& operator=(const self_type& f) - { - self_type(f).swap(*this); - return *this; - } - - template - void set(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) - { - self_type(f).swap(*this); - } - - void set(const base_type& f) - { - self_type(f).swap(*this); - } - - void set(const self_type& f) - { - self_type(f).swap(*this); - } - }; - - template - inline void swap(function& f1, - function& f2) - { - f1.swap(f2); - } -} - +// What is the '3' for? +# define BOOST_PP_ITERATION_PARAMS_1 (3,(0,BOOST_FUNCTION_MAX_ARGS,)) +# include BOOST_PP_ITERATE() +# undef BOOST_PP_ITERATION_PARAMS_1 #endif