update from Boost CVS

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4918 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-08-09 08:51:51 +00:00
parent 9470c8daad
commit 9e27f631a7
18 changed files with 1192 additions and 821 deletions

View File

@ -1,3 +1,10 @@
2002-08-09 Lars Gullik Bjønnes <larsbj@gullik.net>
* 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 <larsbj@gullik.net>
* update boost

View File

@ -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

View File

@ -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)

View File

@ -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:

View File

@ -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

View File

@ -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 <boost/function/function9.hpp>
#include <boost/function/function10.hpp>
// 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<typename Signature>
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<typename R>
struct function_traits<R (*)(void)>
{
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<typename R, typename T1>
struct function_traits<R (*)(T1)>
{
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<typename R, typename T1, typename T2>
struct function_traits<R (*)(T1, T2)>
{
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<typename R, typename T1, typename T2, typename T3>
struct function_traits<R (*)(T1, T2, T3)>
{
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<typename R, typename T1, typename T2, typename T3, typename T4>
struct function_traits<R (*)(T1, T2, T3, T4)>
{
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<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5>
struct function_traits<R (*)(T1, T2, T3, T4, T5)>
{
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<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6>
struct function_traits<R (*)(T1, T2, T3, T4, T5, T6)>
{
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<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7>
struct function_traits<R (*)(T1, T2, T3, T4, T5, T6, T7)>
{
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<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8>
struct function_traits<R (*)(T1, T2, T3, T4, T5, T6, T7, T8)>
{
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<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8, typename T9>
struct function_traits<R (*)(T1, T2, T3, T4, T5, T6, T7, T8, T9)>
{
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<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8, typename T9,
typename T10>
struct function_traits<R (*)(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)>
{
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<int Args> 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<R, Policy, Mixin, Allocator> type;
typedef function0<R,
#ifndef BOOST_FUNCTION_NO_DEPRECATED
Policy, Mixin,
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
Allocator> 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<R, T1, Policy, Mixin, Allocator> type;
typedef function1<R, T1,
#ifndef BOOST_FUNCTION_NO_DEPRECATED
Policy, Mixin,
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
Allocator> 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<R, T1, T2, Policy, Mixin, Allocator> type;
typedef function2<R, T1, T2,
#ifndef BOOST_FUNCTION_NO_DEPRECATED
Policy, Mixin,
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
Allocator> 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<R, T1, T2, T3, Policy, Mixin, Allocator> type;
typedef function3<R, T1, T2, T3,
#ifndef BOOST_FUNCTION_NO_DEPRECATED
Policy, Mixin,
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
Allocator> 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<R, T1, T2, T3, T4, Policy, Mixin, Allocator> type;
typedef function4<R, T1, T2, T3, T4,
#ifndef BOOST_FUNCTION_NO_DEPRECATED
Policy, Mixin,
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
Allocator> 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<R, T1, T2, T3, T4, T5, Policy, Mixin, Allocator>
typedef function5<R, T1, T2, T3, T4, T5,
#ifndef BOOST_FUNCTION_NO_DEPRECATED
Policy, Mixin,
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
Allocator>
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<R, T1, T2, T3, T4, T5, T6, Policy, Mixin, Allocator>
typedef function6<R, T1, T2, T3, T4, T5, T6,
#ifndef BOOST_FUNCTION_NO_DEPRECATED
Policy, Mixin,
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
Allocator>
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<R, T1, T2, T3, T4, T5, T6, T7, Policy, Mixin,
typedef function7<R, T1, T2, T3, T4, T5, T6, T7,
#ifndef BOOST_FUNCTION_NO_DEPRECATED
Policy, Mixin,
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
Allocator> 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<R, T1, T2, T3, T4, T5, T6, T7, T8, Policy, Mixin,
typedef function8<R, T1, T2, T3, T4, T5, T6, T7, T8,
#ifndef BOOST_FUNCTION_NO_DEPRECATED
Policy, Mixin,
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
Allocator> 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<R, T1, T2, T3, T4, T5, T6, T7, T8, T9, Policy,
Mixin, Allocator> type;
typedef function9<R, T1, T2, T3, T4, T5, T6, T7, T8, T9,
#ifndef BOOST_FUNCTION_NO_DEPRECATED
Policy, Mixin,
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
Allocator> 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<R, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
Policy, Mixin, Allocator> type;
#ifndef BOOST_FUNCTION_NO_DEPRECATED
Policy, Mixin,
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
Allocator> type;
};
};
template<typename T1, typename T2>
struct is_not_same
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template<bool GetIt, typename Traits>
struct get_arg1_type
{
BOOST_STATIC_CONSTANT(bool, value = !(is_same<T1, T2>::value));
typedef unusable type;
};
template<typename Traits>
struct get_arg1_type<true, Traits>
{
typedef typename Traits::arg1_type type;
};
template<bool GetIt, typename Traits>
struct get_arg2_type
{
typedef unusable type;
};
template<typename Traits>
struct get_arg2_type<true, Traits>
{
typedef typename Traits::arg2_type type;
};
template<bool GetIt, typename Traits>
struct get_arg3_type
{
typedef unusable type;
};
template<typename Traits>
struct get_arg3_type<true, Traits>
{
typedef typename Traits::arg3_type type;
};
template<bool GetIt, typename Traits>
struct get_arg4_type
{
typedef unusable type;
};
template<typename Traits>
struct get_arg4_type<true, Traits>
{
typedef typename Traits::arg4_type type;
};
template<bool GetIt, typename Traits>
struct get_arg5_type
{
typedef unusable type;
};
template<typename Traits>
struct get_arg5_type<true, Traits>
{
typedef typename Traits::arg5_type type;
};
template<bool GetIt, typename Traits>
struct get_arg6_type
{
typedef unusable type;
};
template<typename Traits>
struct get_arg6_type<true, Traits>
{
typedef typename Traits::arg6_type type;
};
template<bool GetIt, typename Traits>
struct get_arg7_type
{
typedef unusable type;
};
template<typename Traits>
struct get_arg7_type<true, Traits>
{
typedef typename Traits::arg7_type type;
};
template<bool GetIt, typename Traits>
struct get_arg8_type
{
typedef unusable type;
};
template<typename Traits>
struct get_arg8_type<true, Traits>
{
typedef typename Traits::arg8_type type;
};
template<bool GetIt, typename Traits>
struct get_arg9_type
{
typedef unusable type;
};
template<typename Traits>
struct get_arg9_type<true, Traits>
{
typedef typename Traits::arg9_type type;
};
template<bool GetIt, typename Traits>
struct get_arg10_type
{
typedef unusable type;
};
template<typename Traits>
struct get_arg10_type<true, Traits>
{
typedef typename Traits::arg10_type type;
};
template<int X, int Y>
struct gte
{
BOOST_STATIC_CONSTANT(bool, value = (X >= Y));
};
template<bool IsFunction,
typename InR,
typename InT1,
typename InT2,
typename InT3,
typename InT4,
typename InT5,
typename InT6,
typename InT7,
typename InT8,
typename InT9,
typename InT10,
#ifndef BOOST_FUNCTION_NO_DEPRECATED
typename InPolicy,
typename InMixin,
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
typename InAllocator>
struct maybe_decode_function_args
{
typedef function_traits<InR> 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<InT1, unusable>::value),
empty_function_policy,
InT1>::type Policy;
typedef typename ct_if<(is_same<InT2, unusable>::value),
empty_function_mixin,
InT2>::type Mixin;
typedef typename ct_if<(is_same<InT3, unusable>::value),
std::allocator<function_base>,
InT3>::type Allocator;
#else
typedef typename ct_if<(is_same<InT1, unusable>::value),
std::allocator<function_base>,
InT1>::type Allocator;
#endif // BOOST_FUNCTION_NO_DEPRECATED
};
#ifndef BOOST_FUNCTION_NO_DEPRECATED
template<typename InR,
typename InT1,
typename InT2,
typename InT3,
typename InT4,
typename InT5,
typename InT6,
typename InT7,
typename InT8,
typename InT9,
typename InT10,
#ifndef BOOST_FUNCTION_NO_DEPRECATED
typename InPolicy,
typename InMixin,
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
typename InAllocator>
struct maybe_decode_function_args<false, 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>
{
// 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<function_base>
>
class get_function_impl
struct get_function_impl
{
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
typedef function_traits<typename add_pointer<InR>::type> traits;
public:
typedef typename ct_if<(is_function<InR>::value),
typename traits::result_type,
InR>::type R;
typedef typename ct_if<(is_function<InR>::value),
typename traits::arg1_type,
InT1>::type T1;
typedef typename ct_if<(is_function<InR>::value),
typename traits::arg2_type,
InT2>::type T2;
typedef typename ct_if<(is_function<InR>::value),
typename traits::arg3_type,
InT3>::type T3;
typedef typename ct_if<(is_function<InR>::value),
typename traits::arg4_type,
InT4>::type T4;
typedef typename ct_if<(is_function<InR>::value),
typename traits::arg5_type,
InT5>::type T5;
typedef typename ct_if<(is_function<InR>::value),
typename traits::arg6_type,
InT6>::type T6;
typedef typename ct_if<(is_function<InR>::value),
typename traits::arg7_type,
InT7>::type T7;
typedef typename ct_if<(is_function<InR>::value),
typename traits::arg8_type,
InT8>::type T8;
typedef typename ct_if<(is_function<InR>::value),
typename traits::arg9_type,
InT9>::type T9;
typedef typename ct_if<(is_function<InR>::value),
typename traits::arg10_type,
InT10>::type T10;
typedef typename ct_if<
(type_traits::ice_and<
(is_function<InR>::value),
(is_not_same<InT1, unusable>::value)
>::value),
InT1,
InPolicy>::type Policy;
typedef typename ct_if<
(type_traits::ice_and<
(is_function<InR>::value),
(is_not_same<InT2, unusable>::value)
>::value),
InT2,
InMixin>::type Mixin;
typedef typename ct_if<
(type_traits::ice_and<
(is_function<InR>::value),
(is_not_same<InT3, unusable>::value)
>::value),
InT3,
InAllocator>::type Allocator;
typedef maybe_decode_function_args<(is_function<InR>::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<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>::value)
>::template params<R, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
Policy, Mixin, Allocator>::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<R, T1, T2, T3, T4, T5, T6, T7,
T8, T9, T10>::type,
public detail::function::function_traits_builder<R, T1, T2, T3, T4, T5, T6,
T7, T8, T9, T10>
T8, T9, T10>::type
#ifndef BOOST_FUNCTION_NO_DEPRECATED
, public detail::function::function_traits_builder<R, T1, T2, T3, T4, T5,
T6, T7, T8, T9, T10>
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
{
typedef typename detail::function::get_function_impl<R, T1, T2, T3, T4, T5,
T6, T7, T8, T9, T10
@ -755,8 +819,10 @@ namespace boost {
base_type;
public:
#ifndef BOOST_FUNCTION_NO_DEPRECATED
typedef typename base_type::policy_type policy_type;
typedef typename base_type::mixin_type mixin_type;
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
typedef typename base_type::allocator_type allocator_type;
typedef function self_type;
@ -786,24 +852,29 @@ namespace boost {
return *this;
}
#ifndef BOOST_FUNCTION_NO_DEPRECATED
template<typename Functor>
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<typename R,
@ -824,4 +895,6 @@ namespace boost {
}
} // end namespace boost
#endif // !no deprecated || !no partial specialization
#endif

View File

@ -10,7 +10,7 @@
//
// 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
#ifndef BOOST_FUNCTION_BASE_HEADER
@ -24,6 +24,7 @@
#include <boost/config.hpp>
#include <boost/type_traits.hpp>
#include <boost/ref.hpp>
#include <boost/pending/ct_if.hpp>
#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<typename Then, typename Else>
struct Result
{
typedef Then type;
};
};
struct SelectElse
{
template<typename Then, typename Else>
struct Result
{
typedef Else type;
};
};
template<bool Condition>
struct Selector
{
typedef SelectThen type;
};
template<>
struct Selector<false>
{
typedef SelectElse type;
};
} // end namespace intimate
template<bool Condition, typename Then, typename Else>
struct ct_if
{
typedef typename intimate::Selector<Condition>::type select;
typedef typename select::template Result<Then,Else>::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<typename T> unusable(const T&) {}
unusable() {}
template<typename T> 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<typename T> struct function_return_type { typedef T type; };
template<>
struct function_return_type<void>
template<>
struct function_return_type<void>
{
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<typename F>
class get_function_tag
{
typedef typename ct_if<(is_pointer<F>::value),
function_ptr_tag,
function_obj_tag>::type ptr_or_obj_tag;
typedef typename ct_if<(is_pointer<F>::value),
function_ptr_tag,
function_obj_tag>::type ptr_or_obj_tag;
typedef typename ct_if<(is_member_pointer<F>::value),
member_ptr_tag,
ptr_or_obj_tag>::type ptr_or_obj_or_mem_tag;
typedef typename ct_if<(is_member_pointer<F>::value),
member_ptr_tag,
ptr_or_obj_tag>::type ptr_or_obj_or_mem_tag;
typedef typename ct_if<(is_reference_wrapper<F>::value),
function_obj_ref_tag,
ptr_or_obj_or_mem_tag>::type or_ref_tag;
typedef typename ct_if<(is_reference_wrapper<F>::value),
function_obj_ref_tag,
ptr_or_obj_or_mem_tag>::type or_ref_tag;
public:
typedef typename ct_if<(is_stateless<F>::value),
stateless_function_obj_tag,
or_ref_tag>::type type;
typedef typename ct_if<(is_stateless<F>::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<void*>(0));
if (op == clone_functor_tag)
return f;
else
return any_pointer(reinterpret_cast<void*>(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<typename Functor, typename Allocator>
struct functor_manager
{
private:
typedef Functor functor_type;
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<void (*)()>(0));
}
// 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<void (*)()>(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)
{
// 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<functor_type>::other
allocator_type;
typedef typename allocator_type::pointer pointer_type;
typedef typename Allocator::template rebind<functor_type>::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<functor_type*>(function_obj_ptr.obj_ptr);
if (op == clone_functor_tag) {
functor_type* f =
static_cast<functor_type*>(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<functor_type*>(copy);
// Get back to the original pointer type
functor_type* new_f = static_cast<functor_type*>(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<void*>(new_f));
}
else {
/* Cast from the void pointer to the functor pointer type */
functor_type* f =
reinterpret_cast<functor_type*>(function_obj_ptr.obj_ptr);
return any_pointer(static_cast<void*>(new_f));
}
else {
/* Cast from the void pointer to the functor pointer type */
functor_type* f =
reinterpret_cast<functor_type*>(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<pointer_type>(f);
/* Cast from the functor pointer type to the allocator's pointer
type */
pointer_type victim = static_cast<pointer_type>(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<void*>(0));
}
}
return any_pointer(static_cast<void*>(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<functor_type>::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<functor_type>::type tag_type;
return manager(functor_ptr, op, tag_type());
}
};
// value=1 if the given type is not "unusable"
template<typename T>
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<unusable>
{
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<typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8,
typename T9, typename T10>
template<typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8,
typename T9, typename T10>
struct count_used_args
{
BOOST_STATIC_CONSTANT(int, value =
(count_if_used<T1>::value +
count_if_used<T2>::value +
count_if_used<T3>::value +
count_if_used<T4>::value +
count_if_used<T5>::value +
count_if_used<T6>::value +
count_if_used<T7>::value +
count_if_used<T8>::value +
count_if_used<T9>::value +
count_if_used<T10>::value));
BOOST_STATIC_CONSTANT(int, value =
(count_if_used<T1>::value +
count_if_used<T2>::value +
count_if_used<T3>::value +
count_if_used<T4>::value +
count_if_used<T5>::value +
count_if_used<T6>::value +
count_if_used<T7>::value +
count_if_used<T8>::value +
count_if_used<T9>::value +
count_if_used<T10>::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<void*>(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<int, int> 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;
}
};
}

View File

@ -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<R>::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<typename Functor>
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<typename Functor>
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<const Mixin&>(f)), invoker(0)
function_base(),
#ifndef BOOST_FUNCTION_NO_DEPRECATED
Mixin(static_cast<const Mixin&>(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_type>(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<const Mixin&>(*this)).swap(*this);
#else
self_type(f).swap(*this);
#endif // BOOST_FUNCTION_NO_DEPRECATED
return *this;
}
#ifndef BOOST_FUNCTION_NO_DEPRECATED
template<typename Functor>
BOOST_FUNCTION_DEPRECATED_PRE
void set(Functor BOOST_FUNCTION_TARGET_FIX(const &) f)
{
int deprecated;
BOOST_FUNCTION_DEPRECATED_INNER
self_type(f, static_cast<const Mixin&>(*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<Mixin&>(*this), static_cast<Mixin&>(other));
#endif // ndef BOOST_FUNCTION_NO_DEPRECATED
}
// Clear out a target, if there is one
@ -504,19 +548,26 @@ namespace boost {
};
template<typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS ,
typename Policy, typename Mixin, typename Allocator>
#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)
{

View File

@ -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 <class OuterIterator, // Mutable or Immutable, does not matter
#else
= Value &
#endif
, class ConstReference = const Value&
, class ConstReference = Value const&
, class Category = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<
OuterIterator>::iterator_category
, class Pointer
@ -1160,7 +1160,7 @@ template <class OuterIterator, // Mutable or Immutable, does not matter
#else
= Value*
#endif
, class ConstPointer = const Value*
, class ConstPointer = Value const*
>
struct indirect_iterator_pair_generator
{

View File

@ -35,7 +35,7 @@ namespace boost {
};
template<>
class last_value<void> {
struct last_value<void> {
struct unusable {};
public:

View File

@ -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

View File

@ -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 <boost/config.hpp>
/*
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 <class A, class B>
struct ct_and { typedef false_type type; };
template <> struct ct_and<true_type,true_type> { typedef true_type type; };
template <class A> struct ct_not { typedef ct_if_error type; };
template <> struct ct_not<true_type> { typedef false_type type; };
template <> struct ct_not<false_type> { typedef true_type type; };
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <int cond, class A, class B>
struct ct_if { typedef ct_if_error type; };
template <class A, class B>
struct ct_if<1, A, B> { typedef A type; };
template <class A, class B>
struct ct_if<0, A, B> { typedef B type; };
template <class cond, class A, class B>
struct ct_if_t { typedef ct_if_error type; };
template <class A, class B>
struct ct_if_t<true_type, A, B> { typedef A type; };
template <class A, class B>
struct ct_if_t<false_type, A, B> { typedef B type; };
#else
namespace detail {
template <int condition, class A, class B> struct IF;
template <int condition> struct SlectSelector;
struct SelectFirstType;
struct SelectSecondType;
struct SelectFirstType {
template<class A, class B>
struct Template { typedef A type; };
};
struct SelectSecondType {
template<class A, class B>
struct Template { typedef B type; };
};
template<int condition>
struct SlectSelector {
typedef SelectFirstType type;
};
template <>
struct SlectSelector<0> {
typedef SelectSecondType type;
};
} // namespace detail
template<int condition, class A, class B>
struct ct_if
{
typedef typename detail::SlectSelector<condition>::type Selector;
typedef typename Selector::template Template<A, B>::type type;
};
template <class cond, class A, class B>
struct ct_if_t {
typedef typename ct_if<cond::value, A, B>::type type;
};
#endif
} // namespace boost
#endif // BOOST_CT_IF_HPP

View File

@ -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[];

View File

@ -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 <boost/config.hpp>
#include <boost/type_traits/function_traits.hpp>
#include <boost/signals/signal0.hpp>
#include <boost/signals/signal1.hpp>
#include <boost/signals/signal2.hpp>
@ -30,329 +31,288 @@
#include <boost/signals/signal8.hpp>
#include <boost/signals/signal9.hpp>
#include <boost/signals/signal10.hpp>
#include <boost/function.hpp>
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<int Arity,
typename Signature,
typename Combiner,
typename Group,
typename GroupCompare,
typename SlotFunction>
struct real_get_signal_impl;
// value=1 if the given type is not "unused"
template<typename T>
struct count_if_used
template<typename Signature,
typename Combiner,
typename Group,
typename GroupCompare,
typename SlotFunction>
class real_get_signal_impl<0, Signature, Combiner, Group, GroupCompare,
SlotFunction>
{
BOOST_STATIC_CONSTANT(int, value = 1);
};
typedef function_traits<Signature> traits;
// value=0 for unused types
template<>
struct count_if_used<unused>
{
BOOST_STATIC_CONSTANT(int, value = 0);
};
// Count the number of arguments (from the given set) which are not
// "unused" (therefore, count those arguments that are used).
template<typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8,
typename T9, typename T10>
struct count_used_args
{
BOOST_STATIC_CONSTANT(int, value =
(count_if_used<T1>::value +
count_if_used<T2>::value +
count_if_used<T3>::value +
count_if_used<T4>::value +
count_if_used<T5>::value +
count_if_used<T6>::value +
count_if_used<T7>::value +
count_if_used<T8>::value +
count_if_used<T9>::value +
count_if_used<T10>::value));
};
// Choose the appropriate underlying implementation
template<int Args> struct real_get_signal_impl {};
template<>
struct real_get_signal_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 Combiner
>
struct params
{
typedef signal0<R, Combiner> 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
{
typedef signal1<R, T1, Combiner> 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
{
typedef signal2<R, T1, T2, Combiner> 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
{
typedef signal3<R, T1, T2, T3, Combiner> 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
{
typedef signal4<R, T1, T2, T3, T4, Combiner> 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
{
typedef signal5<R, T1, T2, T3, T4, T5, Combiner>
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
{
typedef signal6<R, T1, T2, T3, T4, T5, T6, Combiner> 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
{
typedef signal7<R, T1, T2, T3, T4, T5, T6, T7, Combiner> 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
{
typedef signal8<R, T1, T2, T3, T4, T5, T6, T7, T8, Combiner> 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
{
typedef signal9<R, T1, T2, T3, T4, T5, T6, T7, T8, T9, Combiner> 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
{
typedef signal10<R, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
Combiner> 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<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>::value)> t1;
typedef typename t1::template params<R, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
Combiner> t2;
public:
typedef typename t2::type type;
typedef signal0<typename traits::result_type,
Combiner,
Group,
GroupCompare,
SlotFunction> type;
};
template<typename Signature,
typename Combiner,
typename Group,
typename GroupCompare,
typename SlotFunction>
class real_get_signal_impl<1, Signature, Combiner, Group, GroupCompare,
SlotFunction>
{
typedef function_traits<Signature> traits;
public:
typedef signal1<typename traits::result_type,
typename traits::arg1_type,
Combiner,
Group,
GroupCompare,
SlotFunction> type;
};
template<typename Signature,
typename Combiner,
typename Group,
typename GroupCompare,
typename SlotFunction>
class real_get_signal_impl<2, Signature, Combiner, Group, GroupCompare,
SlotFunction>
{
typedef function_traits<Signature> traits;
public:
typedef signal2<typename traits::result_type,
typename traits::arg1_type,
typename traits::arg2_type,
Combiner,
Group,
GroupCompare,
SlotFunction> type;
};
template<typename Signature,
typename Combiner,
typename Group,
typename GroupCompare,
typename SlotFunction>
class real_get_signal_impl<3, Signature, Combiner, Group, GroupCompare,
SlotFunction>
{
typedef function_traits<Signature> traits;
public:
typedef signal3<typename traits::result_type,
typename traits::arg1_type,
typename traits::arg2_type,
typename traits::arg3_type,
Combiner,
Group,
GroupCompare,
SlotFunction> type;
};
template<typename Signature,
typename Combiner,
typename Group,
typename GroupCompare,
typename SlotFunction>
class real_get_signal_impl<4, Signature, Combiner, Group, GroupCompare,
SlotFunction>
{
typedef function_traits<Signature> traits;
public:
typedef signal4<typename traits::result_type,
typename traits::arg1_type,
typename traits::arg2_type,
typename traits::arg3_type,
typename traits::arg4_type,
Combiner,
Group,
GroupCompare,
SlotFunction> type;
};
template<typename Signature,
typename Combiner,
typename Group,
typename GroupCompare,
typename SlotFunction>
class real_get_signal_impl<5, Signature, Combiner, Group, GroupCompare,
SlotFunction>
{
typedef function_traits<Signature> traits;
public:
typedef signal5<typename traits::result_type,
typename traits::arg1_type,
typename traits::arg2_type,
typename traits::arg3_type,
typename traits::arg4_type,
typename traits::arg5_type,
Combiner,
Group,
GroupCompare,
SlotFunction> type;
};
template<typename Signature,
typename Combiner,
typename Group,
typename GroupCompare,
typename SlotFunction>
class real_get_signal_impl<6, Signature, Combiner, Group, GroupCompare,
SlotFunction>
{
typedef function_traits<Signature> traits;
public:
typedef signal6<typename traits::result_type,
typename traits::arg1_type,
typename traits::arg2_type,
typename traits::arg3_type,
typename traits::arg4_type,
typename traits::arg5_type,
typename traits::arg6_type,
Combiner,
Group,
GroupCompare,
SlotFunction> type;
};
template<typename Signature,
typename Combiner,
typename Group,
typename GroupCompare,
typename SlotFunction>
class real_get_signal_impl<7, Signature, Combiner, Group, GroupCompare,
SlotFunction>
{
typedef function_traits<Signature> traits;
public:
typedef signal7<typename traits::result_type,
typename traits::arg1_type,
typename traits::arg2_type,
typename traits::arg3_type,
typename traits::arg4_type,
typename traits::arg5_type,
typename traits::arg6_type,
typename traits::arg7_type,
Combiner,
Group,
GroupCompare,
SlotFunction> type;
};
template<typename Signature,
typename Combiner,
typename Group,
typename GroupCompare,
typename SlotFunction>
class real_get_signal_impl<8, Signature, Combiner, Group, GroupCompare,
SlotFunction>
{
typedef function_traits<Signature> traits;
public:
typedef signal8<typename traits::result_type,
typename traits::arg1_type,
typename traits::arg2_type,
typename traits::arg3_type,
typename traits::arg4_type,
typename traits::arg5_type,
typename traits::arg6_type,
typename traits::arg7_type,
typename traits::arg8_type,
Combiner,
Group,
GroupCompare,
SlotFunction> type;
};
template<typename Signature,
typename Combiner,
typename Group,
typename GroupCompare,
typename SlotFunction>
class real_get_signal_impl<9, Signature, Combiner, Group, GroupCompare,
SlotFunction>
{
typedef function_traits<Signature> traits;
public:
typedef signal9<typename traits::result_type,
typename traits::arg1_type,
typename traits::arg2_type,
typename traits::arg3_type,
typename traits::arg4_type,
typename traits::arg5_type,
typename traits::arg6_type,
typename traits::arg7_type,
typename traits::arg8_type,
typename traits::arg9_type,
Combiner,
Group,
GroupCompare,
SlotFunction> type;
};
template<typename Signature,
typename Combiner,
typename Group,
typename GroupCompare,
typename SlotFunction>
class real_get_signal_impl<10, Signature, Combiner, Group, GroupCompare,
SlotFunction>
{
typedef function_traits<Signature> traits;
public:
typedef signal10<typename traits::result_type,
typename traits::arg1_type,
typename traits::arg2_type,
typename traits::arg3_type,
typename traits::arg4_type,
typename traits::arg5_type,
typename traits::arg6_type,
typename traits::arg7_type,
typename traits::arg8_type,
typename traits::arg9_type,
typename traits::arg10_type,
Combiner,
Group,
GroupCompare,
SlotFunction> type;
};
template<typename Signature,
typename Combiner,
typename Group,
typename GroupCompare,
typename SlotFunction>
struct get_signal_impl :
public real_get_signal_impl<(function_traits<Signature>::arity),
Signature,
Combiner,
Group,
GroupCompare,
SlotFunction>
{
};
} // 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<typename function_traits<Signature>::result_type>,
typename Group = int,
typename GroupCompare = std::less<int>,
typename SlotFunction = function<Signature>
>
class signal :
public BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl<R, T1, T2, T3, T4, T5, T6, T7,
T8, T9, T10, boost::last_value<R> >::type
public BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl<Signature,
Combiner,
Group,
GroupCompare,
SlotFunction>::type
{
public:
template<typename Combiner>
struct combiner {
private:
typedef BOOST_SIGNALS_NAMESPACE::detail::get_signal_impl<R, T1, T2, T3, T4, T5,
T6, T7, T8, T9, T10, Combiner> 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

View File

@ -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);
}

View File

@ -148,6 +148,219 @@ public:
BOOST_STATIC_CONSTANT(bool, value = m_type::value);
};
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
namespace detail {
template<typename Function> struct function_traits_helper;
template<typename R>
struct function_traits_helper<R (*)(void)>
{
BOOST_STATIC_CONSTANT(int, arity = 0);
typedef R result_type;
};
template<typename R, typename T1>
struct function_traits_helper<R (*)(T1)>
{
BOOST_STATIC_CONSTANT(int, arity = 1);
typedef R result_type;
typedef T1 arg1_type;
};
template<typename R, typename T1, typename T2>
struct function_traits_helper<R (*)(T1, T2)>
{
BOOST_STATIC_CONSTANT(int, arity = 2);
typedef R result_type;
typedef T1 arg1_type;
typedef T2 arg2_type;
};
template<typename R, typename T1, typename T2, typename T3>
struct function_traits_helper<R (*)(T1, T2, T3)>
{
BOOST_STATIC_CONSTANT(int, arity = 3);
typedef R result_type;
typedef T1 arg1_type;
typedef T2 arg2_type;
typedef T3 arg3_type;
};
template<typename R, typename T1, typename T2, typename T3, typename T4>
struct function_traits_helper<R (*)(T1, T2, T3, T4)>
{
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<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5>
struct function_traits_helper<R (*)(T1, T2, T3, T4, T5)>
{
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<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6>
struct function_traits_helper<R (*)(T1, T2, T3, T4, T5, T6)>
{
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<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7>
struct function_traits_helper<R (*)(T1, T2, T3, T4, T5, T6, T7)>
{
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<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8>
struct function_traits_helper<R (*)(T1, T2, T3, T4, T5, T6, T7, T8)>
{
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<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8, typename T9>
struct function_traits_helper<R (*)(T1, T2, T3, T4, T5, T6, T7, T8, T9)>
{
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<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8, typename T9,
typename T10>
struct function_traits_helper<R (*)(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)>
{
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<typename Function>
struct function_traits :
public detail::function_traits_helper<typename add_pointer<Function>::type>
{
};
#else
namespace detail {
template<int N>
struct type_of_size
{
char elements[N];
};
template<typename R>
type_of_size<1> function_arity_helper(R (*f)());
template<typename R, typename T1>
type_of_size<2> function_arity_helper(R (*f)(T1));
template<typename R, typename T1, typename T2>
type_of_size<3> function_arity_helper(R (*f)(T1, T2));
template<typename R, typename T1, typename T2, typename T3>
type_of_size<4> function_arity_helper(R (*f)(T1, T2, T3));
template<typename R, typename T1, typename T2, typename T3, typename T4>
type_of_size<5> function_arity_helper(R (*f)(T1, T2, T3, T4));
template<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5>
type_of_size<6> function_arity_helper(R (*f)(T1, T2, T3, T4, T5));
template<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6>
type_of_size<7> function_arity_helper(R (*f)(T1, T2, T3, T4, T5, T6));
template<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7>
type_of_size<8> function_arity_helper(R (*f)(T1, T2, T3, T4, T5, T6, T7));
template<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8>
type_of_size<9> function_arity_helper(R (*f)(T1, T2, T3, T4, T5, T6, T7, T8));
template<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8, typename T9>
type_of_size<10> function_arity_helper(R (*f)(T1, T2, T3, T4, T5, T6, T7, T8,
T9));
template<typename R, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8, typename T9,
typename T10>
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<typename Function>
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

View File

@ -145,7 +145,6 @@ parser_buf<charT, traits>::seekoff(off_type off, ::std::ios_base::seekdir way, :
else
this->setg(g, g + newpos, g + size);
}
default: ;
}
return static_cast<pos_type>(this->gptr() - this->eback());
}

View File

@ -39,7 +39,7 @@ namespace boost {
typedef std::list<BOOST_SIGNALS_NAMESPACE::detail::bound_object>::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);
}
}