From 9e27f631a78f02650fa5da65077c00cfc25abbe3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Fri, 9 Aug 2002 08:51:51 +0000 Subject: [PATCH] update from Boost CVS git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4918 a592a061-630c-0410-9148-cb99ea01b6c8 --- boost/ChangeLog | 7 + boost/boost/array_traits.hpp | 2 +- boost/boost/config/stdlib/dinkumware.hpp | 2 +- boost/boost/config/user.hpp | 2 +- boost/boost/cstdint.hpp | 8 +- boost/boost/function.hpp | 649 +++++++++++--------- boost/boost/function/function_base.hpp | 310 +++++----- boost/boost/function/function_template.hpp | 69 ++- boost/boost/iterator_adaptors.hpp | 6 +- boost/boost/last_value.hpp | 2 +- boost/boost/limits.hpp | 4 +- boost/boost/pending/ct_if.hpp | 101 +++ boost/boost/regex/regex_traits.hpp | 2 - boost/boost/signal.hpp | 569 ++++++++--------- boost/boost/signals/connection.hpp | 2 +- boost/boost/type_traits/function_traits.hpp | 213 +++++++ boost/libs/regex/src/cpp_regex_traits.cpp | 1 - boost/libs/signals/src/connection.cpp | 2 +- 18 files changed, 1161 insertions(+), 790 deletions(-) create mode 100644 boost/boost/pending/ct_if.hpp diff --git a/boost/ChangeLog b/boost/ChangeLog index 05400b33ac..d1793574d8 100644 --- a/boost/ChangeLog +++ b/boost/ChangeLog @@ -1,3 +1,10 @@ +2002-08-09 Lars Gullik Bjønnes + + * update boost + [Remember that all changes to boost code _must_ go through me, + then I can sync up with my boost tree, and also request changes on + the boost developers list.] + 2002-07-29 Lars Gullik Bjønnes * update boost diff --git a/boost/boost/array_traits.hpp b/boost/boost/array_traits.hpp index b8ae77ab5b..6c7e43dc59 100644 --- a/boost/boost/array_traits.hpp +++ b/boost/boost/array_traits.hpp @@ -13,7 +13,7 @@ // Author: Dietmar Kuehl dietmar.kuehl@claas-solutions.de // Title: STL container support, including support for built-in arrays -// Version: $Id: array_traits.hpp,v 1.4 2002/07/28 23:38:36 larsbj Exp $ +// Version: $Id: array_traits.hpp,v 1.5 2002/08/09 08:51:50 larsbj Exp $ // Dec 4, 2000 Added some more typedefs to array_traits including // an iterator type to supersede iter_type. -J.Siek diff --git a/boost/boost/config/stdlib/dinkumware.hpp b/boost/boost/config/stdlib/dinkumware.hpp index 95689396c5..cdc3c5d22e 100644 --- a/boost/boost/config/stdlib/dinkumware.hpp +++ b/boost/boost/config/stdlib/dinkumware.hpp @@ -50,7 +50,7 @@ # endif #endif -#if (defined(_MSC_VER) && (_MSC_VER <= 1300)) || !defined(_CPPLIB_VER) || _CPPLIB_VER < 306 +#if (defined(_MSC_VER) && (_MSC_VER <= 1300)) || !defined(_CPPLIB_VER) || (_CPPLIB_VER < 306) // if we're using a dinkum lib that's // been configured for VC6/7 then there is // no iterator traits (true even for icl) diff --git a/boost/boost/config/user.hpp b/boost/boost/config/user.hpp index 6cada00978..65d22e216f 100644 --- a/boost/boost/config/user.hpp +++ b/boost/boost/config/user.hpp @@ -59,7 +59,7 @@ // define if you want to disable threading support, even // when available: -// #define BOOST_DISABLE_THREADS +#define BOOST_DISABLE_THREADS 1 // define when you want to disable Win32 specific features // even when available: diff --git a/boost/boost/cstdint.hpp b/boost/boost/cstdint.hpp index 06959a9780..20678c5076 100644 --- a/boost/boost/cstdint.hpp +++ b/boost/boost/cstdint.hpp @@ -228,9 +228,9 @@ namespace boost # else # error defaults not correct; you must hand modify boost/cstdint.hpp # endif -# elif (defined(BOOST_MSVC) && (BOOST_MSVC >= 1100)) || (defined(__BORLANDC__) && (__BORLANDC__ >= 0x520)) +# elif defined(BOOST_HAS_MS_INT64) // - // we have Borland/Microsoft __int64: + // we have Borland/Intel/Microsoft __int64: // typedef __int64 intmax_t; typedef unsigned __int64 uintmax_t; @@ -272,9 +272,9 @@ BOOST_HAS_STDINT_H is defined (John Maddock). #if defined(__STDC_CONSTANT_MACROS) && !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(BOOST_HAS_STDINT_H) # define BOOST__STDC_CONSTANT_MACROS_DEFINED -# if (defined(BOOST_MSVC) && (BOOST_MSVC >= 1100)) || (defined(__BORLANDC__) && (__BORLANDC__ >= 0x520)) +# if defined(BOOST_HAS_MS_INT64) // -// Borland/Microsoft compilers have width specific suffixes: +// Borland/Intel/Microsoft compilers have width specific suffixes: // # define INT8_C(value) value##i8 # define INT16_C(value) value##i16 diff --git a/boost/boost/function.hpp b/boost/boost/function.hpp index 2cf9f0f741..89fac72902 100644 --- a/boost/boost/function.hpp +++ b/boost/boost/function.hpp @@ -1,6 +1,6 @@ // Boost.Function library -// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu) +// Copyright (C) 2001, 2002 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. @@ -36,210 +36,14 @@ #include #include +// Don't compile any of this code if we've asked not to include the deprecated +// syntax and we don't have partial specialization, because none of this code +// can work. +#if !defined (BOOST_FUNCTION_NO_DEPRECATED) || !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + namespace boost { namespace detail { namespace function { -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template - struct function_traits - { - typedef void result_type; - typedef void arg1_type; - typedef void arg2_type; - typedef void arg3_type; - typedef void arg4_type; - typedef void arg5_type; - typedef void arg6_type; - typedef void arg7_type; - typedef void arg8_type; - typedef void arg9_type; - typedef void arg10_type; - }; - - template - struct function_traits - { - typedef R result_type; - typedef unusable arg1_type; - typedef unusable arg2_type; - typedef unusable arg3_type; - typedef unusable arg4_type; - typedef unusable arg5_type; - typedef unusable arg6_type; - typedef unusable arg7_type; - typedef unusable arg8_type; - typedef unusable arg9_type; - typedef unusable arg10_type; - }; - - template - struct function_traits - { - typedef R result_type; - typedef T1 arg1_type; - typedef unusable arg2_type; - typedef unusable arg3_type; - typedef unusable arg4_type; - typedef unusable arg5_type; - typedef unusable arg6_type; - typedef unusable arg7_type; - typedef unusable arg8_type; - typedef unusable arg9_type; - typedef unusable arg10_type; - }; - - template - struct function_traits - { - typedef R result_type; - typedef T1 arg1_type; - typedef T2 arg2_type; - typedef unusable arg3_type; - typedef unusable arg4_type; - typedef unusable arg5_type; - typedef unusable arg6_type; - typedef unusable arg7_type; - typedef unusable arg8_type; - typedef unusable arg9_type; - typedef unusable arg10_type; - }; - - template - struct function_traits - { - typedef R result_type; - typedef T1 arg1_type; - typedef T2 arg2_type; - typedef T3 arg3_type; - typedef unusable arg4_type; - typedef unusable arg5_type; - typedef unusable arg6_type; - typedef unusable arg7_type; - typedef unusable arg8_type; - typedef unusable arg9_type; - typedef unusable arg10_type; - }; - - template - struct function_traits - { - typedef R result_type; - typedef T1 arg1_type; - typedef T2 arg2_type; - typedef T3 arg3_type; - typedef T4 arg4_type; - typedef unusable arg5_type; - typedef unusable arg6_type; - typedef unusable arg7_type; - typedef unusable arg8_type; - typedef unusable arg9_type; - typedef unusable arg10_type; - }; - - template - struct function_traits - { - typedef R result_type; - typedef T1 arg1_type; - typedef T2 arg2_type; - typedef T3 arg3_type; - typedef T4 arg4_type; - typedef T5 arg5_type; - typedef unusable arg6_type; - typedef unusable arg7_type; - typedef unusable arg8_type; - typedef unusable arg9_type; - typedef unusable arg10_type; - }; - - template - struct function_traits - { - typedef R result_type; - typedef T1 arg1_type; - typedef T2 arg2_type; - typedef T3 arg3_type; - typedef T4 arg4_type; - typedef T5 arg5_type; - typedef T6 arg6_type; - typedef unusable arg7_type; - typedef unusable arg8_type; - typedef unusable arg9_type; - typedef unusable arg10_type; - }; - - template - struct function_traits - { - typedef R result_type; - typedef T1 arg1_type; - typedef T2 arg2_type; - typedef T3 arg3_type; - typedef T4 arg4_type; - typedef T5 arg5_type; - typedef T6 arg6_type; - typedef T7 arg7_type; - typedef unusable arg8_type; - typedef unusable arg9_type; - typedef unusable arg10_type; - }; - - template - struct function_traits - { - typedef R result_type; - typedef T1 arg1_type; - typedef T2 arg2_type; - typedef T3 arg3_type; - typedef T4 arg4_type; - typedef T5 arg5_type; - typedef T6 arg6_type; - typedef T7 arg7_type; - typedef T8 arg8_type; - typedef unusable arg9_type; - typedef unusable arg10_type; - }; - - template - struct function_traits - { - typedef R result_type; - typedef T1 arg1_type; - typedef T2 arg2_type; - typedef T3 arg3_type; - typedef T4 arg4_type; - typedef T5 arg5_type; - typedef T6 arg6_type; - typedef T7 arg7_type; - typedef T8 arg8_type; - typedef T9 arg9_type; - typedef unusable arg10_type; - }; - - template - struct function_traits - { - typedef R result_type; - typedef T1 arg1_type; - typedef T2 arg2_type; - typedef T3 arg3_type; - typedef T4 arg4_type; - typedef T5 arg5_type; - typedef T6 arg6_type; - typedef T7 arg7_type; - typedef T8 arg8_type; - typedef T9 arg9_type; - typedef T10 arg10_type; - }; -#endif - // Choose the appropriate underlying implementation template struct real_get_function_impl {}; @@ -258,13 +62,19 @@ namespace boost { typename T8, typename T9, typename T10, +#ifndef BOOST_FUNCTION_NO_DEPRECATED typename Policy, typename Mixin, +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED typename Allocator > struct params { - typedef function0 type; + typedef function0 type; }; }; @@ -283,13 +93,19 @@ namespace boost { typename T8, typename T9, typename T10, +#ifndef BOOST_FUNCTION_NO_DEPRECATED typename Policy, typename Mixin, +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED typename Allocator > struct params { - typedef function1 type; + typedef function1 type; }; }; @@ -308,13 +124,19 @@ namespace boost { typename T8, typename T9, typename T10, +#ifndef BOOST_FUNCTION_NO_DEPRECATED typename Policy, typename Mixin, +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED typename Allocator > struct params { - typedef function2 type; + typedef function2 type; }; }; @@ -333,13 +155,19 @@ namespace boost { typename T8, typename T9, typename T10, +#ifndef BOOST_FUNCTION_NO_DEPRECATED typename Policy, typename Mixin, +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED typename Allocator > struct params { - typedef function3 type; + typedef function3 type; }; }; @@ -358,13 +186,19 @@ namespace boost { typename T8, typename T9, typename T10, +#ifndef BOOST_FUNCTION_NO_DEPRECATED typename Policy, typename Mixin, +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED typename Allocator > struct params { - typedef function4 type; + typedef function4 type; }; }; @@ -383,13 +217,19 @@ namespace boost { typename T8, typename T9, typename T10, +#ifndef BOOST_FUNCTION_NO_DEPRECATED typename Policy, typename Mixin, +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED typename Allocator > struct params { - typedef function5 + typedef function5 type; }; }; @@ -409,13 +249,19 @@ namespace boost { typename T8, typename T9, typename T10, +#ifndef BOOST_FUNCTION_NO_DEPRECATED typename Policy, typename Mixin, +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED typename Allocator > struct params { - typedef function6 + typedef function6 type; }; }; @@ -435,13 +281,18 @@ namespace boost { typename T8, typename T9, typename T10, +#ifndef BOOST_FUNCTION_NO_DEPRECATED typename Policy, typename Mixin, +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED typename Allocator > struct params { - typedef function7 type; }; }; @@ -461,13 +312,18 @@ namespace boost { typename T8, typename T9, typename T10, +#ifndef BOOST_FUNCTION_NO_DEPRECATED typename Policy, typename Mixin, +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED typename Allocator > struct params { - typedef function8 type; }; }; @@ -487,14 +343,19 @@ namespace boost { typename T8, typename T9, typename T10, +#ifndef BOOST_FUNCTION_NO_DEPRECATED typename Policy, typename Mixin, +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED typename Allocator > struct params { - typedef function9 type; + typedef function9 type; }; }; @@ -513,23 +374,256 @@ namespace boost { typename T8, typename T9, typename T10, +#ifndef BOOST_FUNCTION_NO_DEPRECATED typename Policy, typename Mixin, +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED typename Allocator > struct params { typedef function10 type; +#ifndef BOOST_FUNCTION_NO_DEPRECATED + Policy, Mixin, +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED + Allocator> type; + }; + }; + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + template + struct get_arg1_type + { + typedef unusable type; + }; + + template + struct get_arg1_type + { + typedef typename Traits::arg1_type type; + }; + + template + struct get_arg2_type + { + typedef unusable type; + }; + + template + struct get_arg2_type + { + typedef typename Traits::arg2_type type; + }; + + template + struct get_arg3_type + { + typedef unusable type; + }; + + template + struct get_arg3_type + { + typedef typename Traits::arg3_type type; + }; + + template + struct get_arg4_type + { + typedef unusable type; + }; + + template + struct get_arg4_type + { + typedef typename Traits::arg4_type type; + }; + + template + struct get_arg5_type + { + typedef unusable type; + }; + + template + struct get_arg5_type + { + typedef typename Traits::arg5_type type; + }; + + template + struct get_arg6_type + { + typedef unusable type; + }; + + template + struct get_arg6_type + { + typedef typename Traits::arg6_type type; + }; + + template + struct get_arg7_type + { + typedef unusable type; + }; + + template + struct get_arg7_type + { + typedef typename Traits::arg7_type type; + }; + + template + struct get_arg8_type + { + typedef unusable type; + }; + + template + struct get_arg8_type + { + typedef typename Traits::arg8_type type; }; + + template + struct get_arg9_type + { + typedef unusable type; }; - template - struct is_not_same + template + struct get_arg9_type { - BOOST_STATIC_CONSTANT(bool, value = !(is_same::value)); + typedef typename Traits::arg9_type type; }; + template + struct get_arg10_type + { + typedef unusable type; + }; + + template + struct get_arg10_type + { + typedef typename Traits::arg10_type type; + }; + + template + struct gte + { + BOOST_STATIC_CONSTANT(bool, value = (X >= Y)); + }; + + template + struct maybe_decode_function_args + { + typedef function_traits traits; + + typedef typename traits::result_type R; + typedef typename get_arg1_type<(gte<(traits::arity), 1>::value), + traits>::type T1; + typedef typename get_arg2_type<(gte<(traits::arity), 2>::value), + traits>::type T2; + typedef typename get_arg3_type<(gte<(traits::arity), 3>::value), + traits>::type T3; + typedef typename get_arg4_type<(gte<(traits::arity), 4>::value), + traits>::type T4; + typedef typename get_arg5_type<(gte<(traits::arity), 5>::value), + traits>::type T5; + typedef typename get_arg6_type<(gte<(traits::arity), 6>::value), + traits>::type T6; + typedef typename get_arg7_type<(gte<(traits::arity), 7>::value), + traits>::type T7; + typedef typename get_arg8_type<(gte<(traits::arity), 8>::value), + traits>::type T8; + typedef typename get_arg9_type<(gte<(traits::arity), 9>::value), + traits>::type T9; + typedef typename get_arg10_type<(gte<(traits::arity), 10>::value), + traits>::type T10; + +#ifndef BOOST_FUNCTION_NO_DEPRECATED + typedef typename ct_if<(is_same::value), + empty_function_policy, + InT1>::type Policy; + typedef typename ct_if<(is_same::value), + empty_function_mixin, + InT2>::type Mixin; + typedef typename ct_if<(is_same::value), + std::allocator, + InT3>::type Allocator; +#else + typedef typename ct_if<(is_same::value), + std::allocator, + InT1>::type Allocator; +#endif // BOOST_FUNCTION_NO_DEPRECATED + }; + +#ifndef BOOST_FUNCTION_NO_DEPRECATED + template + struct maybe_decode_function_args + { + // Not a function, so just map the types directly + typedef InR R; + typedef InT1 T1; + typedef InT2 T2; + typedef InT3 T3; + typedef InT4 T4; + typedef InT5 T5; + typedef InT6 T6; + typedef InT7 T7; + typedef InT8 T8; + typedef InT9 T9; + typedef InT10 T10; +#ifndef BOOST_FUNCTION_NO_DEPRECATED + typedef InPolicy Policy; + typedef InMixin Mixin; +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED + typedef InAllocator Allocator; + + }; +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED + +#endif // ndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + template< typename InR, typename InT1, @@ -546,70 +640,33 @@ namespace boost { typename InMixin = empty_function_mixin, typename InAllocator = std::allocator > - class get_function_impl + struct get_function_impl { #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - typedef function_traits::type> traits; - public: - - typedef typename ct_if<(is_function::value), - typename traits::result_type, - InR>::type R; - typedef typename ct_if<(is_function::value), - typename traits::arg1_type, - InT1>::type T1; - typedef typename ct_if<(is_function::value), - typename traits::arg2_type, - InT2>::type T2; - typedef typename ct_if<(is_function::value), - typename traits::arg3_type, - InT3>::type T3; - typedef typename ct_if<(is_function::value), - typename traits::arg4_type, - InT4>::type T4; - typedef typename ct_if<(is_function::value), - typename traits::arg5_type, - InT5>::type T5; - typedef typename ct_if<(is_function::value), - typename traits::arg6_type, - InT6>::type T6; - typedef typename ct_if<(is_function::value), - typename traits::arg7_type, - InT7>::type T7; - typedef typename ct_if<(is_function::value), - typename traits::arg8_type, - InT8>::type T8; - typedef typename ct_if<(is_function::value), - typename traits::arg9_type, - InT9>::type T9; - typedef typename ct_if<(is_function::value), - typename traits::arg10_type, - InT10>::type T10; - typedef typename ct_if< - (type_traits::ice_and< - (is_function::value), - (is_not_same::value) - >::value), - InT1, - InPolicy>::type Policy; - - typedef typename ct_if< - (type_traits::ice_and< - (is_function::value), - (is_not_same::value) - >::value), - InT2, - InMixin>::type Mixin; - - typedef typename ct_if< - (type_traits::ice_and< - (is_function::value), - (is_not_same::value) - >::value), - InT3, - InAllocator>::type Allocator; + typedef maybe_decode_function_args<(is_function::value), + InR, InT1, InT2, InT3, InT4, InT5, + InT6, InT7, InT8, InT9, InT10, +#ifndef BOOST_FUNCTION_NO_DEPRECATED + InPolicy, InMixin, +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED + InAllocator> decoder; + typedef typename decoder::R R; + typedef typename decoder::T1 T1; + typedef typename decoder::T2 T2; + typedef typename decoder::T3 T3; + typedef typename decoder::T4 T4; + typedef typename decoder::T5 T5; + typedef typename decoder::T6 T6; + typedef typename decoder::T7 T7; + typedef typename decoder::T8 T8; + typedef typename decoder::T9 T9; + typedef typename decoder::T10 T10; +#ifndef BOOST_FUNCTION_NO_DEPRECATED + typedef typename decoder::Policy Policy; + typedef typename decoder::Mixin Mixin; +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED + typedef typename decoder::Allocator Allocator; #else - public: typedef InR R; typedef InT1 T1; typedef InT2 T2; @@ -624,14 +681,19 @@ namespace boost { typedef InPolicy Policy; typedef InMixin Mixin; typedef InAllocator Allocator; -#endif +#endif // def BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + typedef typename real_get_function_impl< (count_used_args::value) >::template params::type +#ifndef BOOST_FUNCTION_NO_DEPRECATED + Policy, Mixin, +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED + Allocator>::type type; }; +#ifndef BOOST_FUNCTION_NO_DEPRECATED template< typename InR, typename InT1, @@ -724,9 +786,9 @@ namespace boost { Allocator>::type type; }; -#endif +#endif // ndef NO_DEPENDENT_NESTED_DERIVATIONS }; - +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED } // end namespace function } // end namespace detail @@ -745,9 +807,11 @@ namespace boost { > class function : public detail::function::get_function_impl::type, - public detail::function::function_traits_builder + T8, T9, T10>::type +#ifndef BOOST_FUNCTION_NO_DEPRECATED + , public detail::function::function_traits_builder +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED { typedef typename detail::function::get_function_impl + BOOST_FUNCTION_DEPRECATED_PRE void set(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) { - int deprecated; + BOOST_FUNCTION_DEPRECATED_INNER self_type(f).swap(*this); } + BOOST_FUNCTION_DEPRECATED_PRE void set(const base_type& f) { - int deprecated; + BOOST_FUNCTION_DEPRECATED_INNER self_type(f).swap(*this); } + BOOST_FUNCTION_DEPRECATED_PRE void set(const self_type& f) { - int deprecated; + BOOST_FUNCTION_DEPRECATED_INNER self_type(f).swap(*this); } +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED }; template #include #include +#include #if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__ICL) && __ICL <= 600 || defined(__MWERKS__) && __MWERKS__ < 0x2406 # define BOOST_FUNCTION_TARGET_FIX(x) x @@ -31,68 +32,33 @@ # define BOOST_FUNCTION_TARGET_FIX(x) #endif // not MSVC +#if defined (BOOST_MSVC) && (BOOST_MSVC >= 1300) +# define BOOST_FUNCTION_DEPRECATED_PRE __declspec(deprecated) +# define BOOST_FUNCTION_DEPRECATED_INNER +#else +# define BOOST_FUNCTION_DEPRECATED_PRE +# define BOOST_FUNCTION_DEPRECATED_INNER int deprecated; +#endif + namespace boost { namespace detail { namespace function { - /* - * The ct_if implementation is temporary code. When a Boost metaprogramming - * library is introduced, Boost.Function will use it instead. - */ - namespace intimate { - struct SelectThen - { - template - struct Result - { - typedef Then type; - }; - }; - - struct SelectElse - { - template - struct Result - { - typedef Else type; - }; - }; - - template - struct Selector - { - typedef SelectThen type; - }; - - template<> - struct Selector - { - typedef SelectElse type; - }; - } // end namespace intimate - - template - struct ct_if - { - typedef typename intimate::Selector::type select; - typedef typename select::template Result::type type; - }; - /** * 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 + * 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 + union any_pointer { - void* obj_ptr; - const void* const_obj_ptr; - void (*func_ptr)(); + void* obj_ptr; + const void* const_obj_ptr; + void (*func_ptr)(); - explicit any_pointer(void* p) : obj_ptr(p) {} - explicit any_pointer(const void* p) : const_obj_ptr(p) {} - explicit any_pointer(void (*p)()) : func_ptr(p) {} + explicit any_pointer(void* p) : obj_ptr(p) {} + explicit any_pointer(const void* p) : const_obj_ptr(p) {} + explicit any_pointer(void (*p)()) : func_ptr(p) {} }; /** @@ -101,28 +67,28 @@ namespace boost { * anything. This helps compilers without partial specialization to * handle Boost.Function objects returning void. */ - struct unusable + struct unusable { - unusable() {} - template unusable(const T&) {} + 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". + * type to "unusable". */ template struct function_return_type { typedef T type; }; - template<> - struct function_return_type + template<> + struct function_return_type { - typedef unusable 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 + enum functor_manager_operation_type { + clone_functor_tag, + destroy_functor_tag }; // Tags used to decide between different types of functions @@ -135,155 +101,155 @@ namespace boost { 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_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_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; + 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; + 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). - inline any_pointer trivial_manager(any_pointer f, - functor_manager_operation_type op) + inline any_pointer trivial_manager(any_pointer f, + functor_manager_operation_type op) { - if (op == clone_functor_tag) - return f; - else - return any_pointer(reinterpret_cast(0)); + if (op == clone_functor_tag) + return f; + else + return 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. + * 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 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) - { + 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 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; + typedef typename Allocator::template rebind::other + allocator_type; + typedef typename allocator_type::pointer pointer_type; #else - typedef functor_type* pointer_type; + typedef functor_type* pointer_type; #endif // BOOST_NO_STD_ALLOCATOR # ifndef BOOST_NO_STD_ALLOCATOR - allocator_type allocator; + allocator_type allocator; # endif // BOOST_NO_STD_ALLOCATOR - if (op == clone_functor_tag) { - functor_type* f = - static_cast(function_obj_ptr.obj_ptr); + if (op == clone_functor_tag) { + functor_type* f = + static_cast(function_obj_ptr.obj_ptr); - // Clone the functor + // Clone the functor # ifndef BOOST_NO_STD_ALLOCATOR - pointer_type copy = allocator.allocate(1); - allocator.construct(copy, *f); + pointer_type copy = allocator.allocate(1); + allocator.construct(copy, *f); - // Get back to the original pointer type - functor_type* new_f = static_cast(copy); + // Get back to the original pointer type + functor_type* new_f = static_cast(copy); # else - functor_type* new_f = new functor_type(*f); + functor_type* new_f = new functor_type(*f); # endif // BOOST_NO_STD_ALLOCATOR - return 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); + return 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); + /* 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); + // Destroy and deallocate the functor + allocator.destroy(victim); + allocator.deallocate(victim, 1); # else - delete f; + delete f; # endif // BOOST_NO_STD_ALLOCATOR - return any_pointer(static_cast(0)); - } - } + return 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) - { - typedef typename get_function_tag::type tag_type; - return manager(functor_ptr, op, tag_type()); - } + /* 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) + { + typedef typename get_function_tag::type tag_type; + return manager(functor_ptr, op, tag_type()); + } }; // value=1 if the given type is not "unusable" template struct count_if_used { - BOOST_STATIC_CONSTANT(int, value = 1); + BOOST_STATIC_CONSTANT(int, value = 1); }; - + // value=0 for unusable types template<> struct count_if_used { - BOOST_STATIC_CONSTANT(int, value = 0); + BOOST_STATIC_CONSTANT(int, value = 0); }; - - // Count the number of arguments (from the given set) which are not + + // Count the number of arguments (from the given set) which are not // "unusable" (therefore, count those arguments that are used). - template + template struct count_used_args { - BOOST_STATIC_CONSTANT(int, value = - (count_if_used::value + - count_if_used::value + - count_if_used::value + - count_if_used::value + - count_if_used::value + - count_if_used::value + - count_if_used::value + - count_if_used::value + - count_if_used::value + - count_if_used::value)); + BOOST_STATIC_CONSTANT(int, value = + (count_if_used::value + + count_if_used::value + + count_if_used::value + + count_if_used::value + + count_if_used::value + + count_if_used::value + + count_if_used::value + + count_if_used::value + + count_if_used::value + + count_if_used::value)); }; } // end namespace function } // end namespace detail @@ -292,20 +258,20 @@ namespace boost { * 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). + * functionN objects). */ - class function_base + class function_base { public: function_base() : manager(0), functor(static_cast(0)) {} - + // Is this function empty? bool empty() const { return !manager; } - + 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, + detail::function::functor_manager_operation_type); detail::function::any_pointer functor; #if (defined __SUNPRO_CC) && (__SUNPRO_CC <= 0x530) && !(defined BOOST_NO_COMPILER_CONFIG) @@ -320,7 +286,7 @@ namespace boost { typedef void (dummy::*safe_bool)(); public: - operator safe_bool () const + operator safe_bool () const { return (this->empty())? 0 : &dummy::nonnull; } safe_bool operator!() const @@ -328,7 +294,7 @@ namespace boost { #endif }; - /* Poison comparison between Boost.Function objects (because it is + /* Poison comparison between Boost.Function objects (because it is * meaningless). The comparisons would otherwise be allowed because of the * conversion required to allow syntax such as: * boost::function f; @@ -341,12 +307,12 @@ namespace boost { namespace function { inline bool has_empty_target(const function_base* f) { - return f->empty(); + return f->empty(); } inline bool has_empty_target(...) { - return false; + return false; } } // end namespace function } // end namespace detail @@ -361,14 +327,14 @@ namespace boost { // The default function mixin does nothing. The assignment and // copy-construction operators are all defined because MSVC defines broken // versions. - struct empty_function_mixin + struct empty_function_mixin { empty_function_mixin() {} empty_function_mixin(const empty_function_mixin&) {} - empty_function_mixin& operator=(const empty_function_mixin&) + empty_function_mixin& operator=(const empty_function_mixin&) { - return *this; + return *this; } }; } diff --git a/boost/boost/function/function_template.hpp b/boost/boost/function/function_template.hpp index 7c724fea61..9683b4d76b 100644 --- a/boost/boost/function/function_template.hpp +++ b/boost/boost/function/function_template.hpp @@ -229,11 +229,16 @@ namespace boost { template< typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS, +#ifndef BOOST_FUNCTION_NO_DEPRECATED typename Policy = empty_function_policy, typename Mixin = empty_function_mixin, +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED typename Allocator = BOOST_FUNCTION_DEFAULT_ALLOCATOR > - class BOOST_FUNCTION_FUNCTION : public function_base, public Mixin + class BOOST_FUNCTION_FUNCTION : public function_base +#ifndef BOOST_FUNCTION_NO_DEPRECATED + , public Mixin +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED { typedef typename detail::function::function_return_type::type internal_result_type; @@ -253,36 +258,58 @@ namespace boost { #else typedef internal_result_type result_type; #endif // BOOST_NO_VOID_RETURNS +#ifndef BOOST_FUNCTION_NO_DEPRECATED typedef Policy policy_type; typedef Mixin mixin_type; +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED typedef Allocator allocator_type; typedef BOOST_FUNCTION_FUNCTION self_type; - BOOST_FUNCTION_FUNCTION() : function_base(), Mixin(), invoker(0) {} + BOOST_FUNCTION_FUNCTION() : function_base() +#ifndef BOOST_FUNCTION_NO_DEPRECATED + , Mixin() +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED + , invoker(0) {} +#ifndef BOOST_FUNCTION_NO_DEPRECATED explicit BOOST_FUNCTION_FUNCTION(const Mixin& m) : - function_base(), Mixin(m), invoker(0) + function_base(), + Mixin(m), + invoker(0) { } +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED // 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) : - function_base(), Mixin(), invoker(0) + function_base(), +#ifndef BOOST_FUNCTION_NO_DEPRECATED + Mixin(), +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED + invoker(0) { this->assign_to(f); } +#ifndef BOOST_FUNCTION_NO_DEPRECATED template BOOST_FUNCTION_FUNCTION(Functor f, const Mixin& m) : - function_base(), Mixin(m), invoker(0) + function_base(), + Mixin(m), + invoker(0) { this->assign_to(f); } +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED BOOST_FUNCTION_FUNCTION(const BOOST_FUNCTION_FUNCTION& f) : - function_base(), Mixin(static_cast(f)), invoker(0) + function_base(), +#ifndef BOOST_FUNCTION_NO_DEPRECATED + Mixin(static_cast(f)), +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED + invoker(0) { this->assign_to_own(f); } @@ -293,14 +320,19 @@ namespace boost { { assert(!this->empty()); +#ifndef BOOST_FUNCTION_NO_DEPRECATED policy_type policy; policy.precall(this); +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED internal_result_type result = invoker(function_base::functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); +#ifndef BOOST_FUNCTION_NO_DEPRECATED policy.postcall(this); +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED + #ifndef BOOST_NO_VOID_RETURNS return static_cast(result); #else @@ -317,16 +349,23 @@ namespace boost { BOOST_FUNCTION_FUNCTION& operator=(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) { +#ifndef BOOST_FUNCTION_NO_DEPRECATED self_type(f, static_cast(*this)).swap(*this); +#else + self_type(f).swap(*this); +#endif // BOOST_FUNCTION_NO_DEPRECATED return *this; } +#ifndef BOOST_FUNCTION_NO_DEPRECATED template + BOOST_FUNCTION_DEPRECATED_PRE void set(Functor BOOST_FUNCTION_TARGET_FIX(const &) f) { - int deprecated; + BOOST_FUNCTION_DEPRECATED_INNER self_type(f, static_cast(*this)).swap(*this); } +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED // Assignment from another BOOST_FUNCTION_FUNCTION BOOST_FUNCTION_FUNCTION& operator=(const BOOST_FUNCTION_FUNCTION& f) @@ -338,15 +377,18 @@ namespace boost { return *this; } +#ifndef BOOST_FUNCTION_NO_DEPRECATED // Assignment from another BOOST_FUNCTION_FUNCTION + BOOST_FUNCTION_DEPRECATED_PRE void set(const BOOST_FUNCTION_FUNCTION& f) { - //int deprecated; + BOOST_FUNCTION_DEPRECATED_INNER if (&f == this) return; self_type(f).swap(*this); } +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED void swap(BOOST_FUNCTION_FUNCTION& other) { @@ -356,7 +398,9 @@ namespace boost { std::swap(function_base::manager, other.manager); std::swap(function_base::functor, other.functor); std::swap(invoker, other.invoker); +#ifndef BOOST_FUNCTION_NO_DEPRECATED std::swap(static_cast(*this), static_cast(other)); +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED } // Clear out a target, if there is one @@ -504,19 +548,26 @@ namespace boost { }; template +#ifndef BOOST_FUNCTION_NO_DEPRECATED + typename Policy, typename Mixin, +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED + typename Allocator> inline void swap(BOOST_FUNCTION_FUNCTION< R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS , +#ifndef BOOST_FUNCTION_NO_DEPRECATED Policy, Mixin, +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED Allocator >& f1, BOOST_FUNCTION_FUNCTION< R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS, +#ifndef BOOST_FUNCTION_NO_DEPRECATED Policy, Mixin, +#endif // ndef BOOST_FUNCTION_NO_DEPRECATED Allocator >& f2) { diff --git a/boost/boost/iterator_adaptors.hpp b/boost/boost/iterator_adaptors.hpp index f0ef01068b..df91dcf775 100644 --- a/boost/boost/iterator_adaptors.hpp +++ b/boost/boost/iterator_adaptors.hpp @@ -382,7 +382,7 @@ namespace detail { }; -# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_NO_STD_ITERATOR_TRAITS) // Select default pointer and reference types for adapted non-pointer // iterators based on the iterator and the value_type. Poor man's partial @@ -1150,7 +1150,7 @@ template ::iterator_category , class Pointer @@ -1160,7 +1160,7 @@ template struct indirect_iterator_pair_generator { diff --git a/boost/boost/last_value.hpp b/boost/boost/last_value.hpp index a9920653ae..b771b2afbd 100644 --- a/boost/boost/last_value.hpp +++ b/boost/boost/last_value.hpp @@ -35,7 +35,7 @@ namespace boost { }; template<> - class last_value { + struct last_value { struct unusable {}; public: diff --git a/boost/boost/limits.hpp b/boost/boost/limits.hpp index 9151acc80b..da7cfff48d 100644 --- a/boost/boost/limits.hpp +++ b/boost/boost/limits.hpp @@ -90,10 +90,10 @@ namespace std #ifdef BOOST_HAS_MS_INT64 static unsigned BOOST_LLT min(){ return 0ui64; } static unsigned BOOST_LLT max(){ return 0xFFFFFFFFFFFFFFFFui64; } -#elif defined(ULLONG_MAX) +#elif defined(ULLONG_MAX) && defined(ULLONG_MIN) static unsigned BOOST_LLT min(){ return ULLONG_MIN; } static unsigned BOOST_LLT max(){ return ULLONG_MAX; } -#elif defined(ULONGLONG_MAX) +#elif defined(ULONGLONG_MAX) && defined(ULONG_LONG_MIN) static unsigned BOOST_LLT min(){ return ULONGLONG_MIN; } static unsigned BOOST_LLT max(){ return ULONGLONG_MAX; } #else diff --git a/boost/boost/pending/ct_if.hpp b/boost/boost/pending/ct_if.hpp new file mode 100644 index 0000000000..1655cfab5a --- /dev/null +++ b/boost/boost/pending/ct_if.hpp @@ -0,0 +1,101 @@ +// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or implied +// warranty, and with no claim as to its suitability for any purpose. + +// The ct_if implementation that avoids partial specialization is +// based on the IF class by Ulrich W. Eisenecker and Krzysztof +// Czarnecki. + +#ifndef BOOST_CT_IF_HPP +#define BOOST_CT_IF_HPP + +#include + +/* + There is a bug in the Borland compiler with regards to using + integers to specialize templates. This made it hard to use ct_if in + the graph library. Changing from 'ct_if' to 'ct_if_t' fixed the + problem. +*/ + +namespace boost { + + struct ct_if_error { }; + + struct true_type { enum { value = true }; }; + struct false_type { enum { value = false }; }; + + template + struct ct_and { typedef false_type type; }; + template <> struct ct_and { typedef true_type type; }; + + template struct ct_not { typedef ct_if_error type; }; + template <> struct ct_not { typedef false_type type; }; + template <> struct ct_not { typedef true_type type; }; + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + + template + struct ct_if { typedef ct_if_error type; }; + template + struct ct_if<1, A, B> { typedef A type; }; + template + struct ct_if<0, A, B> { typedef B type; }; + + template + struct ct_if_t { typedef ct_if_error type; }; + template + struct ct_if_t { typedef A type; }; + template + struct ct_if_t { typedef B type; }; + +#else + + namespace detail { + + template struct IF; + template struct SlectSelector; + struct SelectFirstType; + struct SelectSecondType; + + struct SelectFirstType { + template + struct Template { typedef A type; }; + }; + + struct SelectSecondType { + template + struct Template { typedef B type; }; + }; + + template + struct SlectSelector { + typedef SelectFirstType type; + }; + + template <> + struct SlectSelector<0> { + typedef SelectSecondType type; + }; + + } // namespace detail + + template + struct ct_if + { + typedef typename detail::SlectSelector::type Selector; + typedef typename Selector::template Template::type type; + }; + + template + struct ct_if_t { + typedef typename ct_if::type type; + }; + +#endif + +} // namespace boost + +#endif // BOOST_CT_IF_HPP + diff --git a/boost/boost/regex/regex_traits.hpp b/boost/boost/regex/regex_traits.hpp index 6edb4b8cb7..bab6b61bfd 100644 --- a/boost/boost/regex/regex_traits.hpp +++ b/boost/boost/regex/regex_traits.hpp @@ -47,8 +47,6 @@ struct mss BOOST_REGEX_DECL bool BOOST_REGEX_CALL re_lookup_def_collate_name(std::string& buf, const char* name); BOOST_REGEX_DECL std::size_t BOOST_REGEX_CALL re_get_default_message(char* buf, std::size_t len, std::size_t id); extern BOOST_REGEX_DECL const char *re_default_error_messages[]; -BOOST_REGEX_DECL bool BOOST_REGEX_CALL re_lookup_def_collate_name(std::string& buf, const char* name); -//extern BOOST_REGEX_DECL const wchar_t combining_ranges[]; #ifndef BOOST_NO_WREGEX extern BOOST_REGEX_DECL wchar_t wide_lower_case_map[]; diff --git a/boost/boost/signal.hpp b/boost/boost/signal.hpp index ac1ead9559..940694560d 100644 --- a/boost/boost/signal.hpp +++ b/boost/boost/signal.hpp @@ -1,6 +1,6 @@ // Boost.Signals library // -// Copyright (C) 2001 Doug Gregor (gregod@cs.rpi.edu) +// Copyright (C) 2001-2002 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. @@ -19,6 +19,7 @@ #define BOOST_SIGNALS_MAX_ARGS 10 #include +#include #include #include #include @@ -30,329 +31,288 @@ #include #include #include +#include namespace boost { +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION namespace BOOST_SIGNALS_NAMESPACE { namespace detail { - // The unusable class is a placeholder for unused function arguments. - struct unused {}; + template + struct real_get_signal_impl; - // value=1 if the given type is not "unused" - template - struct count_if_used + template + class real_get_signal_impl<0, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - BOOST_STATIC_CONSTANT(int, value = 1); - }; - - // value=0 for unused types - template<> - struct count_if_used - { - BOOST_STATIC_CONSTANT(int, value = 0); - }; + typedef function_traits traits; - // Count the number of arguments (from the given set) which are not - // "unused" (therefore, count those arguments that are used). - template - struct count_used_args - { - BOOST_STATIC_CONSTANT(int, value = - (count_if_used::value + - count_if_used::value + - count_if_used::value + - count_if_used::value + - count_if_used::value + - count_if_used::value + - count_if_used::value + - count_if_used::value + - count_if_used::value + - count_if_used::value)); + public: + typedef signal0 type; }; - // Choose the appropriate underlying implementation - template struct real_get_signal_impl {}; - - template<> - struct real_get_signal_impl<0> + template + class real_get_signal_impl<1, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - template< - typename R, - typename T1, - typename T2, - typename T3, - typename T4, - typename T5, - typename T6, - typename T7, - typename T8, - typename T9, - typename T10, - typename Combiner - > - struct params - { - typedef signal0 type; - }; + typedef function_traits traits; + + public: + typedef signal1 type; }; - template<> - struct real_get_signal_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 Combiner - > - struct params + template + class real_get_signal_impl<2, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - typedef signal1 type; - }; + typedef function_traits traits; + + public: + typedef signal2 type; }; - template<> - struct real_get_signal_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 Combiner - > - struct params + template + class real_get_signal_impl<3, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - typedef signal2 type; - }; + typedef function_traits traits; + + public: + typedef signal3 type; }; - template<> - struct real_get_signal_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 Combiner - > - struct params + template + class real_get_signal_impl<4, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - typedef signal3 type; - }; + typedef function_traits traits; + + public: + typedef signal4 type; }; - template<> - struct real_get_signal_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 Combiner - > - struct params + template + class real_get_signal_impl<5, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - typedef signal4 type; - }; + typedef function_traits traits; + + public: + typedef signal5 type; }; - template<> - struct real_get_signal_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 Combiner - > - struct params + template + class real_get_signal_impl<6, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - typedef signal5 - type; - }; + typedef function_traits traits; + + public: + typedef signal6 type; }; - template<> - struct real_get_signal_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 Combiner - > - struct params + template + class real_get_signal_impl<7, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - typedef signal6 type; - }; + typedef function_traits traits; + + public: + typedef signal7 type; }; - template<> - struct real_get_signal_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 Combiner - > - struct params + template + class real_get_signal_impl<8, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - typedef signal7 type; - }; + typedef function_traits traits; + + public: + typedef signal8 type; }; - template<> - struct real_get_signal_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 Combiner - > - struct params + template + class real_get_signal_impl<9, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - typedef signal8 type; - }; + typedef function_traits traits; + + public: + typedef signal9 type; }; - template<> - struct real_get_signal_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 Combiner - > - struct params + template + class real_get_signal_impl<10, Signature, Combiner, Group, GroupCompare, + SlotFunction> { - typedef signal9 type; - }; + typedef function_traits traits; + + public: + typedef signal10 type; }; - template<> - struct real_get_signal_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 Combiner - > - struct params + template + struct get_signal_impl : + public real_get_signal_impl<(function_traits::arity), + Signature, + Combiner, + Group, + GroupCompare, + SlotFunction> { - typedef signal10 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 Combiner - > - struct get_signal_impl - { - private: - typedef real_get_signal_impl< - (::boost::BOOST_SIGNALS_NAMESPACE::detail::count_used_args::value)> t1; - typedef typename t1::template params t2; - public: - typedef typename t2::type type; - }; } // end namespace detail } // end namespace BOOST_SIGNALS_NAMESPACE @@ -360,32 +320,35 @@ namespace boost { // be created where the number of arguments does not need to be part of the // class name. template< - typename R, - typename T1 = BOOST_SIGNALS_NAMESPACE::detail::unused, - typename T2 = BOOST_SIGNALS_NAMESPACE::detail::unused, - typename T3 = BOOST_SIGNALS_NAMESPACE::detail::unused, - typename T4 = BOOST_SIGNALS_NAMESPACE::detail::unused, - typename T5 = BOOST_SIGNALS_NAMESPACE::detail::unused, - typename T6 = BOOST_SIGNALS_NAMESPACE::detail::unused, - typename T7 = BOOST_SIGNALS_NAMESPACE::detail::unused, - typename T8 = BOOST_SIGNALS_NAMESPACE::detail::unused, - typename T9 = BOOST_SIGNALS_NAMESPACE::detail::unused, - typename T10 = BOOST_SIGNALS_NAMESPACE::detail::unused + typename Signature, // function type R (T1, T2, ..., TN) + typename Combiner = last_value::result_type>, + typename Group = int, + typename GroupCompare = std::less, + typename SlotFunction = function > class signal : - public BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl >::type + public BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl::type { - public: - template - struct combiner { - private: - typedef BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl t1; + typedef typename BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl< + Signature, + Combiner, + Group, + GroupCompare, + SlotFunction>::type base_type; + public: - typedef typename t1::type type; - }; + explicit signal(const Combiner& combiner = Combiner(), + const GroupCompare& group_compare = GroupCompare()) : + base_type(combiner, group_compare) + { + } }; +#endif // ndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + } // end namespace boost #endif // BOOST_SIGNAL_HPP diff --git a/boost/boost/signals/connection.hpp b/boost/boost/signals/connection.hpp index e032ab8b85..3381c99ad7 100644 --- a/boost/boost/signals/connection.hpp +++ b/boost/boost/signals/connection.hpp @@ -151,7 +151,7 @@ namespace boost { inline void connection::add_bound_object(const BOOST_SIGNALS_NAMESPACE::detail::bound_object& b) { - assert(con.get()); + assert(con.get() != 0); con->bound_objects.push_back(b); } diff --git a/boost/boost/type_traits/function_traits.hpp b/boost/boost/type_traits/function_traits.hpp index df098456ee..2ec084b547 100644 --- a/boost/boost/type_traits/function_traits.hpp +++ b/boost/boost/type_traits/function_traits.hpp @@ -148,6 +148,219 @@ public: BOOST_STATIC_CONSTANT(bool, value = m_type::value); }; +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +namespace detail { + +template struct function_traits_helper; + +template +struct function_traits_helper +{ + BOOST_STATIC_CONSTANT(int, arity = 0); + typedef R result_type; +}; + +template +struct function_traits_helper +{ + BOOST_STATIC_CONSTANT(int, arity = 1); + typedef R result_type; + typedef T1 arg1_type; +}; + +template +struct function_traits_helper +{ + BOOST_STATIC_CONSTANT(int, arity = 2); + typedef R result_type; + typedef T1 arg1_type; + typedef T2 arg2_type; +}; + +template +struct function_traits_helper +{ + BOOST_STATIC_CONSTANT(int, arity = 3); + typedef R result_type; + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; +}; + +template +struct function_traits_helper +{ + BOOST_STATIC_CONSTANT(int, arity = 4); + typedef R result_type; + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef T4 arg4_type; +}; + +template +struct function_traits_helper +{ + BOOST_STATIC_CONSTANT(int, arity = 5); + typedef R result_type; + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef T4 arg4_type; + typedef T5 arg5_type; +}; + +template +struct function_traits_helper +{ + BOOST_STATIC_CONSTANT(int, arity = 6); + typedef R result_type; + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef T4 arg4_type; + typedef T5 arg5_type; + typedef T6 arg6_type; +}; + +template +struct function_traits_helper +{ + BOOST_STATIC_CONSTANT(int, arity = 7); + typedef R result_type; + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef T4 arg4_type; + typedef T5 arg5_type; + typedef T6 arg6_type; + typedef T7 arg7_type; +}; + +template +struct function_traits_helper +{ + BOOST_STATIC_CONSTANT(int, arity = 8); + typedef R result_type; + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef T4 arg4_type; + typedef T5 arg5_type; + typedef T6 arg6_type; + typedef T7 arg7_type; + typedef T8 arg8_type; +}; + +template +struct function_traits_helper +{ + BOOST_STATIC_CONSTANT(int, arity = 9); + typedef R result_type; + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef T4 arg4_type; + typedef T5 arg5_type; + typedef T6 arg6_type; + typedef T7 arg7_type; + typedef T8 arg8_type; + typedef T9 arg9_type; +}; + +template +struct function_traits_helper +{ + BOOST_STATIC_CONSTANT(int, arity = 10); + typedef R result_type; + typedef T1 arg1_type; + typedef T2 arg2_type; + typedef T3 arg3_type; + typedef T4 arg4_type; + typedef T5 arg5_type; + typedef T6 arg6_type; + typedef T7 arg7_type; + typedef T8 arg8_type; + typedef T9 arg9_type; + typedef T10 arg10_type; +}; + +} // end namespace detail + +template +struct function_traits : + public detail::function_traits_helper::type> +{ +}; + +#else + +namespace detail { + +template +struct type_of_size +{ + char elements[N]; +}; + +template +type_of_size<1> function_arity_helper(R (*f)()); + +template +type_of_size<2> function_arity_helper(R (*f)(T1)); + +template +type_of_size<3> function_arity_helper(R (*f)(T1, T2)); + +template +type_of_size<4> function_arity_helper(R (*f)(T1, T2, T3)); + +template +type_of_size<5> function_arity_helper(R (*f)(T1, T2, T3, T4)); + +template +type_of_size<6> function_arity_helper(R (*f)(T1, T2, T3, T4, T5)); + +template +type_of_size<7> function_arity_helper(R (*f)(T1, T2, T3, T4, T5, T6)); + +template +type_of_size<8> function_arity_helper(R (*f)(T1, T2, T3, T4, T5, T6, T7)); + +template +type_of_size<9> function_arity_helper(R (*f)(T1, T2, T3, T4, T5, T6, T7, T8)); + +template +type_of_size<10> function_arity_helper(R (*f)(T1, T2, T3, T4, T5, T6, T7, T8, + T9)); + +template +type_of_size<11> function_arity_helper(R (*f)(T1, T2, T3, T4, T5, T6, T7, T8, + T9, T10)); +} // end namespace detail + +// Won't work with references +template +struct function_traits +{ + BOOST_STATIC_CONSTANT(int, arity = (sizeof(detail::function_arity_helper((Function*)0))-1)); +}; + +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } // boost #endif // BOOST_FUNCTION_TYPE_TRAITS_HPP diff --git a/boost/libs/regex/src/cpp_regex_traits.cpp b/boost/libs/regex/src/cpp_regex_traits.cpp index f9ecf07477..afe3d94625 100644 --- a/boost/libs/regex/src/cpp_regex_traits.cpp +++ b/boost/libs/regex/src/cpp_regex_traits.cpp @@ -145,7 +145,6 @@ parser_buf::seekoff(off_type off, ::std::ios_base::seekdir way, : else this->setg(g, g + newpos, g + size); } - default: ; } return static_cast(this->gptr() - this->eback()); } diff --git a/boost/libs/signals/src/connection.cpp b/boost/libs/signals/src/connection.cpp index d30d69cc6b..3f7020a054 100644 --- a/boost/libs/signals/src/connection.cpp +++ b/boost/libs/signals/src/connection.cpp @@ -39,7 +39,7 @@ namespace boost { typedef std::list::iterator iterator; for (iterator i = local_con->bound_objects.begin(); i != local_con->bound_objects.end(); ++i) { - assert(i->disconnect); + assert(i->disconnect != 0); i->disconnect(i->obj, i->data); } } -- 2.39.2