Added boost header
This commit is contained in:
19
test/external/boost/functional/detail/container_fwd.hpp
vendored
Normal file
19
test/external/boost/functional/detail/container_fwd.hpp
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
// Copyright 2005-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Forwarding header for container_fwd.hpp's new location.
|
||||
// This header is deprecated, I'll be adding a warning in a future release,
|
||||
// then converting it to an error and finally removing this header completely.
|
||||
|
||||
#if !defined(BOOST_FUNCTIONAL_DETAIL_CONTAINER_FWD_HPP)
|
||||
#define BOOST_FUNCTIONAL_DETAIL_CONTAINER_FWD_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/detail/container_fwd.hpp>
|
||||
|
||||
#endif
|
||||
163
test/external/boost/functional/factory.hpp
vendored
Normal file
163
test/external/boost/functional/factory.hpp
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUNCTIONAL_FACTORY_HPP_INCLUDED
|
||||
# ifndef BOOST_PP_IS_ITERATING
|
||||
|
||||
# include <boost/preprocessor/iteration/iterate.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
# include <new>
|
||||
# include <boost/pointee.hpp>
|
||||
# include <boost/none_t.hpp>
|
||||
# include <boost/get_pointer.hpp>
|
||||
# include <boost/non_type.hpp>
|
||||
# include <boost/type_traits/remove_cv.hpp>
|
||||
|
||||
# ifndef BOOST_FUNCTIONAL_FACTORY_MAX_ARITY
|
||||
# define BOOST_FUNCTIONAL_FACTORY_MAX_ARITY 10
|
||||
# elif BOOST_FUNCTIONAL_FACTORY_MAX_ARITY < 3
|
||||
# undef BOOST_FUNCTIONAL_FACTORY_MAX_ARITY
|
||||
# define BOOST_FUNCTIONAL_FACTORY_MAX_ARITY 3
|
||||
# endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
enum factory_alloc_propagation
|
||||
{
|
||||
factory_alloc_for_pointee_and_deleter,
|
||||
factory_passes_alloc_to_smart_pointer
|
||||
};
|
||||
|
||||
template< typename Pointer, class Allocator = boost::none_t,
|
||||
factory_alloc_propagation AP = factory_alloc_for_pointee_and_deleter >
|
||||
class factory;
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
template< typename Pointer, factory_alloc_propagation AP >
|
||||
class factory<Pointer, boost::none_t, AP>
|
||||
{
|
||||
public:
|
||||
typedef typename boost::remove_cv<Pointer>::type result_type;
|
||||
typedef typename boost::pointee<result_type>::type value_type;
|
||||
|
||||
factory()
|
||||
{ }
|
||||
|
||||
# define BOOST_PP_FILENAME_1 <boost/functional/factory.hpp>
|
||||
# define BOOST_PP_ITERATION_LIMITS (0,BOOST_FUNCTIONAL_FACTORY_MAX_ARITY)
|
||||
# include BOOST_PP_ITERATE()
|
||||
};
|
||||
|
||||
template< class Pointer, class Allocator, factory_alloc_propagation AP >
|
||||
class factory
|
||||
: private Allocator::template rebind< typename boost::pointee<
|
||||
typename boost::remove_cv<Pointer>::type >::type >::other
|
||||
{
|
||||
public:
|
||||
typedef typename boost::remove_cv<Pointer>::type result_type;
|
||||
typedef typename boost::pointee<result_type>::type value_type;
|
||||
|
||||
typedef typename Allocator::template rebind<value_type>::other
|
||||
allocator_type;
|
||||
|
||||
explicit factory(allocator_type const & a = allocator_type())
|
||||
: allocator_type(a)
|
||||
{ }
|
||||
|
||||
private:
|
||||
|
||||
struct deleter
|
||||
: allocator_type
|
||||
{
|
||||
inline deleter(allocator_type const& that)
|
||||
: allocator_type(that)
|
||||
{ }
|
||||
|
||||
allocator_type& get_allocator() const
|
||||
{
|
||||
return *const_cast<allocator_type*>(
|
||||
static_cast<allocator_type const*>(this));
|
||||
}
|
||||
|
||||
void operator()(value_type* ptr) const
|
||||
{
|
||||
if (!! ptr) ptr->~value_type();
|
||||
const_cast<allocator_type*>(static_cast<allocator_type const*>(
|
||||
this))->deallocate(ptr,1);
|
||||
}
|
||||
};
|
||||
|
||||
inline allocator_type& get_allocator() const
|
||||
{
|
||||
return *const_cast<allocator_type*>(
|
||||
static_cast<allocator_type const*>(this));
|
||||
}
|
||||
|
||||
inline result_type make_pointer(value_type* ptr, boost::non_type<
|
||||
factory_alloc_propagation,factory_passes_alloc_to_smart_pointer>)
|
||||
const
|
||||
{
|
||||
return result_type(ptr,deleter(this->get_allocator()));
|
||||
}
|
||||
inline result_type make_pointer(value_type* ptr, boost::non_type<
|
||||
factory_alloc_propagation,factory_alloc_for_pointee_and_deleter>)
|
||||
const
|
||||
{
|
||||
return result_type(ptr,deleter(this->get_allocator()),
|
||||
this->get_allocator());
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
# define BOOST_TMP_MACRO
|
||||
# define BOOST_PP_FILENAME_1 <boost/functional/factory.hpp>
|
||||
# define BOOST_PP_ITERATION_LIMITS (0,BOOST_FUNCTIONAL_FACTORY_MAX_ARITY)
|
||||
# include BOOST_PP_ITERATE()
|
||||
# undef BOOST_TMP_MACRO
|
||||
};
|
||||
|
||||
template< typename Pointer, class Allocator, factory_alloc_propagation AP >
|
||||
class factory<Pointer&, Allocator, AP>;
|
||||
// forbidden, would create a dangling reference
|
||||
}
|
||||
|
||||
# define BOOST_FUNCTIONAL_FACTORY_HPP_INCLUDED
|
||||
# else // defined(BOOST_PP_IS_ITERATING)
|
||||
# define N BOOST_PP_ITERATION()
|
||||
# if !defined(BOOST_TMP_MACRO)
|
||||
# if N > 0
|
||||
template< BOOST_PP_ENUM_PARAMS(N, typename T) >
|
||||
# endif
|
||||
inline result_type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) const
|
||||
{
|
||||
return result_type( new value_type(BOOST_PP_ENUM_PARAMS(N,a)) );
|
||||
}
|
||||
# else // defined(BOOST_TMP_MACRO)
|
||||
# if N > 0
|
||||
template< BOOST_PP_ENUM_PARAMS(N, typename T) >
|
||||
# endif
|
||||
inline result_type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) const
|
||||
{
|
||||
value_type* memory = this->get_allocator().allocate(1);
|
||||
try
|
||||
{
|
||||
return make_pointer(
|
||||
new(memory) value_type(BOOST_PP_ENUM_PARAMS(N,a)),
|
||||
boost::non_type<factory_alloc_propagation,AP>() );
|
||||
}
|
||||
catch (...) { this->get_allocator().deallocate(memory,1); throw; }
|
||||
}
|
||||
# endif
|
||||
# undef N
|
||||
# endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#endif // include guard
|
||||
|
||||
472
test/external/boost/functional/forward_adapter.hpp
vendored
Normal file
472
test/external/boost/functional/forward_adapter.hpp
vendored
Normal file
@@ -0,0 +1,472 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2007-2008 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUNCTIONAL_FORWARD_ADAPTER_HPP_INCLUDED
|
||||
# ifndef BOOST_PP_IS_ITERATING
|
||||
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/detail/workaround.hpp>
|
||||
|
||||
# include <boost/preprocessor/iteration/iterate.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
# include <boost/preprocessor/facilities/intercept.hpp>
|
||||
# include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
|
||||
# include <boost/utility/result_of.hpp>
|
||||
|
||||
# ifndef BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY
|
||||
# define BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY 6
|
||||
# elif BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY < 3
|
||||
# undef BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY
|
||||
# define BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY 3
|
||||
# endif
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template< typename Function, int Arity_Or_MinArity = -1, int MaxArity = -1 >
|
||||
class forward_adapter;
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template< class MostDerived, typename Function, typename FunctionConst,
|
||||
int Arity, int MinArity >
|
||||
struct forward_adapter_impl;
|
||||
|
||||
struct forward_adapter_result
|
||||
{
|
||||
template< typename Sig > struct apply;
|
||||
|
||||
// Utility metafunction for qualification adjustment on arguments
|
||||
template< typename T > struct q { typedef T const t; };
|
||||
template< typename T > struct q<T const> { typedef T const t; };
|
||||
template< typename T > struct q<T &> { typedef T t; };
|
||||
|
||||
// Utility metafunction to choose target function qualification
|
||||
template< typename T > struct c
|
||||
{ typedef typename T::target_function_t t; };
|
||||
template< typename T > struct c<T& >
|
||||
{ typedef typename T::target_function_t t; };
|
||||
template< typename T > struct c<T const >
|
||||
{ typedef typename T::target_function_const_t t; };
|
||||
template< typename T > struct c<T const&>
|
||||
{ typedef typename T::target_function_const_t t; };
|
||||
};
|
||||
}
|
||||
|
||||
# define BOOST_TMP_MACRO(f,fn,fc) \
|
||||
boost::detail::forward_adapter_impl< \
|
||||
forward_adapter<f,Arity_Or_MinArity,MaxArity>, fn, fc, \
|
||||
(MaxArity!=-1? MaxArity :Arity_Or_MinArity!=-1? Arity_Or_MinArity \
|
||||
:BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY), \
|
||||
(Arity_Or_MinArity!=-1? Arity_Or_MinArity : 0) >
|
||||
|
||||
template< typename Function, int Arity_Or_MinArity, int MaxArity >
|
||||
class forward_adapter
|
||||
: public BOOST_TMP_MACRO(Function,Function,Function const)
|
||||
, private Function
|
||||
{
|
||||
public:
|
||||
forward_adapter(Function const& f = Function())
|
||||
: Function(f)
|
||||
{ }
|
||||
|
||||
typedef Function target_function_t;
|
||||
typedef Function const target_function_const_t;
|
||||
|
||||
Function & target_function() { return *this; }
|
||||
Function const & target_function() const { return *this; }
|
||||
|
||||
template< typename Sig > struct result
|
||||
: detail::forward_adapter_result::template apply<Sig>
|
||||
{ };
|
||||
|
||||
using BOOST_TMP_MACRO(Function,Function, Function const)::operator();
|
||||
};
|
||||
template< typename Function, int Arity_Or_MinArity, int MaxArity >
|
||||
class forward_adapter< Function const, Arity_Or_MinArity, MaxArity >
|
||||
: public BOOST_TMP_MACRO(Function const, Function const, Function const)
|
||||
, private Function
|
||||
{
|
||||
public:
|
||||
forward_adapter(Function const& f = Function())
|
||||
: Function(f)
|
||||
{ }
|
||||
|
||||
typedef Function const target_function_t;
|
||||
typedef Function const target_function_const_t;
|
||||
|
||||
Function const & target_function() const { return *this; }
|
||||
|
||||
template< typename Sig > struct result
|
||||
: detail::forward_adapter_result::template apply<Sig>
|
||||
{ };
|
||||
|
||||
using BOOST_TMP_MACRO(Function const,Function const, Function const)
|
||||
::operator();
|
||||
};
|
||||
template< typename Function, int Arity_Or_MinArity, int MaxArity >
|
||||
class forward_adapter< Function &, Arity_Or_MinArity, MaxArity >
|
||||
: public BOOST_TMP_MACRO(Function&, Function, Function)
|
||||
{
|
||||
Function& ref_function;
|
||||
public:
|
||||
forward_adapter(Function& f)
|
||||
: ref_function(f)
|
||||
{ }
|
||||
|
||||
typedef Function target_function_t;
|
||||
typedef Function target_function_const_t;
|
||||
|
||||
Function & target_function() const { return this->ref_function; }
|
||||
|
||||
template< typename Sig > struct result
|
||||
: detail::forward_adapter_result::template apply<Sig>
|
||||
{ };
|
||||
|
||||
using BOOST_TMP_MACRO(Function&, Function, Function)::operator();
|
||||
};
|
||||
|
||||
#undef BOOST_TMP_MACRO
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template< class Self >
|
||||
struct forward_adapter_result::apply< Self() >
|
||||
: boost::result_of< BOOST_DEDUCED_TYPENAME c<Self>::t() >
|
||||
{ };
|
||||
|
||||
template< class MD, class F, class FC >
|
||||
struct forward_adapter_impl<MD,F,FC,0,0>
|
||||
{
|
||||
inline typename boost::result_of< FC() >::type
|
||||
operator()() const
|
||||
{
|
||||
return static_cast<MD const*>(this)->target_function()();
|
||||
}
|
||||
|
||||
inline typename boost::result_of< F() >::type
|
||||
operator()()
|
||||
{
|
||||
return static_cast<MD*>(this)->target_function()();
|
||||
}
|
||||
|
||||
// closing brace gets generated by preprocessing code, below
|
||||
|
||||
# define BOOST_TMP_MACRO(tpl_params,arg_types,params,args) \
|
||||
template< tpl_params > \
|
||||
inline typename boost::result_of< FC(arg_types) >::type \
|
||||
operator()(params) const \
|
||||
{ \
|
||||
return static_cast<MD const*>(this)->target_function()(args); \
|
||||
} \
|
||||
template< tpl_params > \
|
||||
inline typename boost::result_of< F(arg_types)>::type \
|
||||
operator()(params) \
|
||||
{ \
|
||||
return static_cast<MD*>(this)->target_function()(args); \
|
||||
}
|
||||
|
||||
# // This is the total number of iterations we need
|
||||
# define count ((1 << BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY+1)-2)
|
||||
|
||||
# // Chain file iteration to virtually one loop
|
||||
# if BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY <= 7
|
||||
# define limit1 count
|
||||
# define limit2 0
|
||||
# define limit3 0
|
||||
# else
|
||||
# if BOOST_FUNCTIONAL_FORWARD_ADAPTER_MAX_ARITY <= 15
|
||||
# define limit1 (count >> 8)
|
||||
# define limit2 255
|
||||
# define limit3 0
|
||||
# else
|
||||
# define limit1 (count >> 16)
|
||||
# define limit2 255
|
||||
# define limit3 255
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# define N 0
|
||||
|
||||
# define BOOST_PP_FILENAME_1 <boost/functional/forward_adapter.hpp>
|
||||
# define BOOST_PP_ITERATION_LIMITS (0,limit1)
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
# undef N
|
||||
# undef limit3
|
||||
# undef limit2
|
||||
# undef limit1
|
||||
# undef count
|
||||
# undef BOOST_TMP_MACRO
|
||||
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<class F, int A0, int A1>
|
||||
struct result_of<boost::forward_adapter<F,A0,A1> const ()>
|
||||
: boost::detail::forward_adapter_result::template apply<
|
||||
boost::forward_adapter<F,A0,A1> const () >
|
||||
{ };
|
||||
template<class F, int A0, int A1>
|
||||
struct result_of<boost::forward_adapter<F,A0,A1>()>
|
||||
: boost::detail::forward_adapter_result::template apply<
|
||||
boost::forward_adapter<F,A0,A1>() >
|
||||
{ };
|
||||
template<class F, int A0, int A1>
|
||||
struct result_of<boost::forward_adapter<F,A0,A1> const& ()>
|
||||
: boost::detail::forward_adapter_result::template apply<
|
||||
boost::forward_adapter<F,A0,A1> const () >
|
||||
{ };
|
||||
template<class F, int A0, int A1>
|
||||
struct result_of<boost::forward_adapter<F,A0,A1>& ()>
|
||||
: boost::detail::forward_adapter_result::template apply<
|
||||
boost::forward_adapter<F,A0,A1>() >
|
||||
{ };
|
||||
}
|
||||
|
||||
# define BOOST_FUNCTIONAL_FORWARD_ADAPTER_HPP_INCLUDED
|
||||
|
||||
# elif BOOST_PP_ITERATION_DEPTH() == 1 && limit2
|
||||
# define BOOST_PP_FILENAME_2 <boost/functional/forward_adapter.hpp>
|
||||
# define BOOST_PP_ITERATION_LIMITS (0,limit2)
|
||||
# include BOOST_PP_ITERATE()
|
||||
# elif BOOST_PP_ITERATION_DEPTH() == 2 && limit3
|
||||
# define BOOST_PP_FILENAME_3 <boost/functional/forward_adapter.hpp>
|
||||
# define BOOST_PP_ITERATION_LIMITS (0,limit3)
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
# else
|
||||
|
||||
# // I is the loop counter
|
||||
# if limit2 && limit3
|
||||
# define I (BOOST_PP_ITERATION_1 << 16 | BOOST_PP_ITERATION_2 << 8 | \
|
||||
BOOST_PP_ITERATION_3)
|
||||
# elif limit2
|
||||
# define I (BOOST_PP_ITERATION_1 << 8 | BOOST_PP_ITERATION_2)
|
||||
# else
|
||||
# define I BOOST_PP_ITERATION_1
|
||||
# endif
|
||||
|
||||
# if I < count
|
||||
|
||||
# // Done for this arity? Increment N
|
||||
# if (I+2 >> N+1)
|
||||
# if N == 0
|
||||
# undef N
|
||||
# define N 1
|
||||
# elif N == 1
|
||||
# undef N
|
||||
# define N 2
|
||||
# elif N == 2
|
||||
# undef N
|
||||
# define N 3
|
||||
# elif N == 3
|
||||
# undef N
|
||||
# define N 4
|
||||
# elif N == 4
|
||||
# undef N
|
||||
# define N 5
|
||||
# elif N == 5
|
||||
# undef N
|
||||
# define N 6
|
||||
# elif N == 6
|
||||
# undef N
|
||||
# define N 7
|
||||
# elif N == 7
|
||||
# undef N
|
||||
# define N 8
|
||||
# elif N == 8
|
||||
# undef N
|
||||
# define N 9
|
||||
# elif N == 9
|
||||
# undef N
|
||||
# define N 10
|
||||
# elif N == 10
|
||||
# undef N
|
||||
# define N 11
|
||||
# elif N == 11
|
||||
# undef N
|
||||
# define N 12
|
||||
# elif N == 12
|
||||
# undef N
|
||||
# define N 13
|
||||
# elif N == 13
|
||||
# undef N
|
||||
# define N 14
|
||||
# elif N == 14
|
||||
# undef N
|
||||
# define N 15
|
||||
# elif N == 15
|
||||
# undef N
|
||||
# define N 16
|
||||
# endif
|
||||
|
||||
};
|
||||
|
||||
template< class Self, BOOST_PP_ENUM_PARAMS(N,typename T) >
|
||||
struct forward_adapter_result::apply< Self(BOOST_PP_ENUM_PARAMS(N,T)) >
|
||||
: boost::result_of<
|
||||
BOOST_DEDUCED_TYPENAME c<Self>::t(BOOST_PP_ENUM_BINARY_PARAMS(N,
|
||||
typename q<T,>::t& BOOST_PP_INTERCEPT)) >
|
||||
{ };
|
||||
|
||||
template< class MD, class F, class FC >
|
||||
struct forward_adapter_impl<MD,F,FC,BOOST_PP_DEC(N),N>
|
||||
{
|
||||
template< BOOST_PP_ENUM_PARAMS(N,typename T) >
|
||||
inline typename boost::result_of< F(
|
||||
BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT)) >::type
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT));
|
||||
};
|
||||
|
||||
template< class MD, class F, class FC, int MinArity >
|
||||
struct forward_adapter_impl<MD,F,FC,N,MinArity>
|
||||
: forward_adapter_impl<MD,F,FC,BOOST_PP_DEC(N),MinArity>
|
||||
{
|
||||
using forward_adapter_impl<MD,F,FC,BOOST_PP_DEC(N),MinArity>::operator();
|
||||
|
||||
# endif
|
||||
|
||||
# // Zero based count for each arity would be I-(1<<N)+2, but we don't
|
||||
# // need it, unless we need a nicer order.
|
||||
|
||||
# // Macros for the parameter's type modifiers.
|
||||
# if I & 0x000001
|
||||
# define PT0 T0 &
|
||||
# else
|
||||
# define PT0 T0 const &
|
||||
# endif
|
||||
# if I & 0x000002
|
||||
# define PT1 T1 &
|
||||
# else
|
||||
# define PT1 T1 const &
|
||||
# endif
|
||||
# if I & 0x000004
|
||||
# define PT2 T2 &
|
||||
# else
|
||||
# define PT2 T2 const &
|
||||
# endif
|
||||
# if I & 0x000008
|
||||
# define PT3 T3 &
|
||||
# else
|
||||
# define PT3 T3 const &
|
||||
# endif
|
||||
# if I & 0x000010
|
||||
# define PT4 T4 &
|
||||
# else
|
||||
# define PT4 T4 const &
|
||||
# endif
|
||||
# if I & 0x000020
|
||||
# define PT5 T5 &
|
||||
# else
|
||||
# define PT5 T5 const &
|
||||
# endif
|
||||
# if I & 0x000040
|
||||
# define PT6 T6 &
|
||||
# else
|
||||
# define PT6 T6 const &
|
||||
# endif
|
||||
# if I & 0x000080
|
||||
# define PT7 T7 &
|
||||
# else
|
||||
# define PT7 T7 const &
|
||||
# endif
|
||||
# if I & 0x000100
|
||||
# define PT8 T8 &
|
||||
# else
|
||||
# define PT8 T8 const &
|
||||
# endif
|
||||
# if I & 0x000200
|
||||
# define PT9 T9 &
|
||||
# else
|
||||
# define PT9 T9 const &
|
||||
# endif
|
||||
# if I & 0x000400
|
||||
# define PT10 T10 &
|
||||
# else
|
||||
# define PT10 T10 const &
|
||||
# endif
|
||||
# if I & 0x000800
|
||||
# define PT11 T11 &
|
||||
# else
|
||||
# define PT11 T11 const &
|
||||
# endif
|
||||
# if I & 0x001000
|
||||
# define PT12 T12 &
|
||||
# else
|
||||
# define PT12 T12 const &
|
||||
# endif
|
||||
# if I & 0x002000
|
||||
# define PT13 T13 &
|
||||
# else
|
||||
# define PT13 T13 const &
|
||||
# endif
|
||||
# if I & 0x004000
|
||||
# define PT14 T14 &
|
||||
# else
|
||||
# define PT14 T14 const &
|
||||
# endif
|
||||
# if I & 0x008000
|
||||
# define PT15 T15 &
|
||||
# else
|
||||
# define PT15 T15 const &
|
||||
# endif
|
||||
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1400))
|
||||
template< BOOST_PP_ENUM_PARAMS(N,typename T) >
|
||||
inline typename boost::result_of< FC(BOOST_PP_ENUM_PARAMS(N,PT))
|
||||
>::type
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,PT,a)) const
|
||||
{
|
||||
return static_cast<MD const* const>(this)
|
||||
->target_function()(BOOST_PP_ENUM_PARAMS(N,a));
|
||||
}
|
||||
template< BOOST_PP_ENUM_PARAMS(N,typename T) >
|
||||
inline typename boost::result_of< F(BOOST_PP_ENUM_PARAMS(N,PT))
|
||||
>::type
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,PT,a))
|
||||
{
|
||||
return static_cast<MD* const>(this)
|
||||
->target_function()(BOOST_PP_ENUM_PARAMS(N,a));
|
||||
}
|
||||
# else
|
||||
BOOST_TMP_MACRO(BOOST_PP_ENUM_PARAMS(N,typename T),
|
||||
BOOST_PP_ENUM_PARAMS(N,PT), BOOST_PP_ENUM_BINARY_PARAMS(N,PT,a),
|
||||
BOOST_PP_ENUM_PARAMS(N,a) )
|
||||
// ...generates uglier code but is faster - it caches ENUM_*
|
||||
# endif
|
||||
|
||||
# undef PT0
|
||||
# undef PT1
|
||||
# undef PT2
|
||||
# undef PT3
|
||||
# undef PT4
|
||||
# undef PT5
|
||||
# undef PT6
|
||||
# undef PT7
|
||||
# undef PT8
|
||||
# undef PT9
|
||||
# undef PT10
|
||||
# undef PT11
|
||||
# undef PT12
|
||||
# undef PT13
|
||||
# undef PT14
|
||||
# undef PT15
|
||||
|
||||
# endif // I < count
|
||||
|
||||
# undef I
|
||||
# endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#endif // include guard
|
||||
|
||||
7
test/external/boost/functional/hash.hpp
vendored
Normal file
7
test/external/boost/functional/hash.hpp
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/functional/hash/hash.hpp>
|
||||
|
||||
246
test/external/boost/functional/hash/detail/float_functions.hpp
vendored
Normal file
246
test/external/boost/functional/hash/detail/float_functions.hpp
vendored
Normal file
@@ -0,0 +1,246 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP)
|
||||
#define BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
// The C++ standard requires that the C float functions are overloarded
|
||||
// for float, double and long double in the std namespace, but some of the older
|
||||
// library implementations don't support this. On some that don't, the C99
|
||||
// float functions (frexpf, frexpl, etc.) are available.
|
||||
//
|
||||
// The following tries to automatically detect which are available.
|
||||
|
||||
namespace boost {
|
||||
namespace hash_detail {
|
||||
|
||||
// Returned by dummy versions of the float functions.
|
||||
|
||||
struct not_found {
|
||||
// Implicitly convertible to float and long double in order to avoid
|
||||
// a compile error when the dummy float functions are used.
|
||||
|
||||
inline operator float() const { return 0; }
|
||||
inline operator long double() const { return 0; }
|
||||
};
|
||||
|
||||
// A type for detecting the return type of functions.
|
||||
|
||||
template <typename T> struct is;
|
||||
template <> struct is<float> { char x[10]; };
|
||||
template <> struct is<double> { char x[20]; };
|
||||
template <> struct is<long double> { char x[30]; };
|
||||
template <> struct is<boost::hash_detail::not_found> { char x[40]; };
|
||||
|
||||
// Used to convert the return type of a function to a type for sizeof.
|
||||
|
||||
template <typename T> is<T> float_type(T);
|
||||
|
||||
// call_ldexp
|
||||
//
|
||||
// This will get specialized for float and long double
|
||||
|
||||
template <typename Float> struct call_ldexp
|
||||
{
|
||||
typedef double float_type;
|
||||
|
||||
inline double operator()(double a, int b) const
|
||||
{
|
||||
using namespace std;
|
||||
return ldexp(a, b);
|
||||
}
|
||||
};
|
||||
|
||||
// call_frexp
|
||||
//
|
||||
// This will get specialized for float and long double
|
||||
|
||||
template <typename Float> struct call_frexp
|
||||
{
|
||||
typedef double float_type;
|
||||
|
||||
inline double operator()(double a, int* b) const
|
||||
{
|
||||
using namespace std;
|
||||
return frexp(a, b);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// A namespace for dummy functions to detect when the actual function we want
|
||||
// isn't available. ldexpl, ldexpf etc. might be added tby the macros below.
|
||||
//
|
||||
// AFAICT these have to be outside of the boost namespace, as if they're in
|
||||
// the boost namespace they'll always be preferable to any other function
|
||||
// (since the arguments are built in types, ADL can't be used).
|
||||
|
||||
namespace boost_hash_detect_float_functions {
|
||||
template <class Float> boost::hash_detail::not_found ldexp(Float, int);
|
||||
template <class Float> boost::hash_detail::not_found frexp(Float, int*);
|
||||
}
|
||||
|
||||
// Macros for generating specializations of call_ldexp and call_frexp.
|
||||
//
|
||||
// check_cpp and check_c99 check if the C++ or C99 functions are available.
|
||||
//
|
||||
// Then the call_* functions select an appropriate implementation.
|
||||
//
|
||||
// I used c99_func in a few places just to get a unique name.
|
||||
//
|
||||
// Important: when using 'using namespace' at namespace level, include as
|
||||
// little as possible in that namespace, as Visual C++ has an odd bug which
|
||||
// can cause the namespace to be imported at the global level. This seems to
|
||||
// happen mainly when there's a template in the same namesapce.
|
||||
|
||||
#define BOOST_HASH_CALL_FLOAT_FUNC(cpp_func, c99_func, type1, type2) \
|
||||
namespace boost_hash_detect_float_functions { \
|
||||
template <class Float> \
|
||||
boost::hash_detail::not_found c99_func(Float, type2); \
|
||||
} \
|
||||
\
|
||||
namespace boost { \
|
||||
namespace hash_detail { \
|
||||
namespace c99_func##_detect { \
|
||||
using namespace std; \
|
||||
using namespace boost_hash_detect_float_functions; \
|
||||
\
|
||||
struct check { \
|
||||
static type1 x; \
|
||||
static type2 y; \
|
||||
BOOST_STATIC_CONSTANT(bool, cpp = \
|
||||
sizeof(float_type(cpp_func(x,y))) \
|
||||
== sizeof(is<type1>)); \
|
||||
BOOST_STATIC_CONSTANT(bool, c99 = \
|
||||
sizeof(float_type(c99_func(x,y))) \
|
||||
== sizeof(is<type1>)); \
|
||||
}; \
|
||||
} \
|
||||
\
|
||||
template <bool x> \
|
||||
struct call_c99_##c99_func : \
|
||||
boost::hash_detail::call_##cpp_func<double> {}; \
|
||||
\
|
||||
template <> \
|
||||
struct call_c99_##c99_func<true> { \
|
||||
typedef type1 float_type; \
|
||||
\
|
||||
template <typename T> \
|
||||
inline type1 operator()(type1 a, T b) const \
|
||||
{ \
|
||||
using namespace std; \
|
||||
return c99_func(a, b); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
template <bool x> \
|
||||
struct call_cpp_##c99_func : \
|
||||
call_c99_##c99_func< \
|
||||
::boost::hash_detail::c99_func##_detect::check::c99 \
|
||||
> {}; \
|
||||
\
|
||||
template <> \
|
||||
struct call_cpp_##c99_func<true> { \
|
||||
typedef type1 float_type; \
|
||||
\
|
||||
template <typename T> \
|
||||
inline type1 operator()(type1 a, T b) const \
|
||||
{ \
|
||||
using namespace std; \
|
||||
return cpp_func(a, b); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
template <> \
|
||||
struct call_##cpp_func<type1> : \
|
||||
call_cpp_##c99_func< \
|
||||
::boost::hash_detail::c99_func##_detect::check::cpp \
|
||||
> {}; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define BOOST_HASH_CALL_FLOAT_MACRO(cpp_func, c99_func, type1, type2) \
|
||||
namespace boost { \
|
||||
namespace hash_detail { \
|
||||
\
|
||||
template <> \
|
||||
struct call_##cpp_func<type1> { \
|
||||
typedef type1 float_type; \
|
||||
inline type1 operator()(type1 x, type2 y) const { \
|
||||
return c99_func(x, y); \
|
||||
} \
|
||||
}; \
|
||||
} \
|
||||
}
|
||||
|
||||
#if defined(ldexpf)
|
||||
BOOST_HASH_CALL_FLOAT_MACRO(ldexp, ldexpf, float, int)
|
||||
#else
|
||||
BOOST_HASH_CALL_FLOAT_FUNC(ldexp, ldexpf, float, int)
|
||||
#endif
|
||||
|
||||
#if defined(ldexpl)
|
||||
BOOST_HASH_CALL_FLOAT_MACRO(ldexp, ldexpl, long double, int)
|
||||
#else
|
||||
BOOST_HASH_CALL_FLOAT_FUNC(ldexp, ldexpl, long double, int)
|
||||
#endif
|
||||
|
||||
#if defined(frexpf)
|
||||
BOOST_HASH_CALL_FLOAT_MACRO(frexp, frexpf, float, int*)
|
||||
#else
|
||||
BOOST_HASH_CALL_FLOAT_FUNC(frexp, frexpf, float, int*)
|
||||
#endif
|
||||
|
||||
#if defined(frexpl)
|
||||
BOOST_HASH_CALL_FLOAT_MACRO(frexp, frexpl, long double, int*)
|
||||
#else
|
||||
BOOST_HASH_CALL_FLOAT_FUNC(frexp, frexpl, long double, int*)
|
||||
#endif
|
||||
|
||||
#undef BOOST_HASH_CALL_FLOAT_MACRO
|
||||
#undef BOOST_HASH_CALL_FLOAT_FUNC
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace hash_detail
|
||||
{
|
||||
template <typename Float1, typename Float2>
|
||||
struct select_hash_type_impl {
|
||||
typedef double type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct select_hash_type_impl<float, float> {
|
||||
typedef float type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct select_hash_type_impl<long double, long double> {
|
||||
typedef long double type;
|
||||
};
|
||||
|
||||
|
||||
// select_hash_type
|
||||
//
|
||||
// If there is support for a particular floating point type, use that
|
||||
// otherwise use double (there's always support for double).
|
||||
|
||||
template <typename Float>
|
||||
struct select_hash_type : select_hash_type_impl<
|
||||
BOOST_DEDUCED_TYPENAME call_ldexp<Float>::float_type,
|
||||
BOOST_DEDUCED_TYPENAME call_frexp<Float>::float_type
|
||||
> {};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
101
test/external/boost/functional/hash/detail/hash_float.hpp
vendored
Normal file
101
test/external/boost/functional/hash/detail/hash_float.hpp
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER)
|
||||
#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/functional/hash/detail/float_functions.hpp>
|
||||
#include <boost/functional/hash/detail/limits.hpp>
|
||||
#include <boost/integer/static_log2.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
// Include hash implementation for the current platform.
|
||||
|
||||
// Cygwn
|
||||
#if defined(__CYGWIN__)
|
||||
# if defined(__i386__) || defined(_M_IX86)
|
||||
# include <boost/functional/hash/detail/hash_float_x86.hpp>
|
||||
# else
|
||||
# include <boost/functional/hash/detail/hash_float_generic.hpp>
|
||||
# endif
|
||||
#else
|
||||
# include <boost/functional/hash/detail/hash_float_generic.hpp>
|
||||
#endif
|
||||
|
||||
// Can we use fpclassify?
|
||||
|
||||
// STLport
|
||||
#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
|
||||
#define BOOST_HASH_USE_FPCLASSIFY 0
|
||||
|
||||
// GNU libstdc++ 3
|
||||
#elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
|
||||
# if (defined(__USE_ISOC99) || defined(_GLIBCXX_USE_C99_MATH)) && \
|
||||
!(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))
|
||||
# define BOOST_HASH_USE_FPCLASSIFY 1
|
||||
# else
|
||||
# define BOOST_HASH_USE_FPCLASSIFY 0
|
||||
# endif
|
||||
|
||||
// Everything else
|
||||
#else
|
||||
# define BOOST_HASH_USE_FPCLASSIFY 0
|
||||
#endif
|
||||
|
||||
#if BOOST_HASH_USE_FPCLASSIFY
|
||||
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace hash_detail
|
||||
{
|
||||
template <class T>
|
||||
inline std::size_t float_hash_value(T v)
|
||||
{
|
||||
using namespace std;
|
||||
switch (fpclassify(v)) {
|
||||
case FP_ZERO:
|
||||
return 0;
|
||||
case FP_INFINITE:
|
||||
return (std::size_t)(v > 0 ? -1 : -2);
|
||||
case FP_NAN:
|
||||
return (std::size_t)(-3);
|
||||
case FP_NORMAL:
|
||||
case FP_SUBNORMAL:
|
||||
return float_hash_impl(v);
|
||||
default:
|
||||
BOOST_ASSERT(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else // !BOOST_HASH_USE_FPCLASSIFY
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace hash_detail
|
||||
{
|
||||
template <class T>
|
||||
inline std::size_t float_hash_value(T v)
|
||||
{
|
||||
return v == 0 ? 0 : float_hash_impl(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_HASH_USE_FPCLASSIFY
|
||||
|
||||
#undef BOOST_HASH_USE_FPCLASSIFY
|
||||
|
||||
#endif
|
||||
91
test/external/boost/functional/hash/detail/hash_float_generic.hpp
vendored
Normal file
91
test/external/boost/functional/hash/detail/hash_float_generic.hpp
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// A general purpose hash function for non-zero floating point values.
|
||||
|
||||
#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER)
|
||||
#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER
|
||||
|
||||
#include <boost/functional/hash/detail/float_functions.hpp>
|
||||
#include <boost/integer/static_log2.hpp>
|
||||
#include <boost/functional/hash/detail/limits.hpp>
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(push)
|
||||
#if BOOST_MSVC >= 1400
|
||||
#pragma warning(disable:6294) // Ill-defined for-loop: initial condition does
|
||||
// not satisfy test. Loop body not executed
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace hash_detail
|
||||
{
|
||||
inline void hash_float_combine(std::size_t& seed, std::size_t value)
|
||||
{
|
||||
seed ^= value + (seed<<6) + (seed>>2);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline std::size_t float_hash_impl2(T v)
|
||||
{
|
||||
boost::hash_detail::call_frexp<T> frexp;
|
||||
boost::hash_detail::call_ldexp<T> ldexp;
|
||||
|
||||
int exp = 0;
|
||||
|
||||
v = frexp(v, &exp);
|
||||
|
||||
// A postive value is easier to hash, so combine the
|
||||
// sign with the exponent and use the absolute value.
|
||||
if(v < 0) {
|
||||
v = -v;
|
||||
exp += limits<T>::max_exponent -
|
||||
limits<T>::min_exponent;
|
||||
}
|
||||
|
||||
v = ldexp(v, limits<std::size_t>::digits);
|
||||
std::size_t seed = static_cast<std::size_t>(v);
|
||||
v -= static_cast<T>(seed);
|
||||
|
||||
// ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1;
|
||||
std::size_t const length
|
||||
= (limits<T>::digits *
|
||||
boost::static_log2<limits<T>::radix>::value
|
||||
+ limits<std::size_t>::digits - 1)
|
||||
/ limits<std::size_t>::digits;
|
||||
|
||||
for(std::size_t i = 0; i != length; ++i)
|
||||
{
|
||||
v = ldexp(v, limits<std::size_t>::digits);
|
||||
std::size_t part = static_cast<std::size_t>(v);
|
||||
v -= static_cast<T>(part);
|
||||
hash_float_combine(seed, part);
|
||||
}
|
||||
|
||||
hash_float_combine(seed, exp);
|
||||
|
||||
return seed;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline std::size_t float_hash_impl(T v)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME select_hash_type<T>::type type;
|
||||
return float_hash_impl2(static_cast<type>(v));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
56
test/external/boost/functional/hash/detail/hash_float_x86.hpp
vendored
Normal file
56
test/external/boost/functional/hash/detail/hash_float_x86.hpp
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// A non-portable hash function form non-zero floats on x86.
|
||||
//
|
||||
// Even if you're on an x86 platform, this might not work if their floating
|
||||
// point isn't set up as this expects. So this should only be used if it's
|
||||
// absolutely certain that it will work.
|
||||
|
||||
#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER)
|
||||
#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace hash_detail
|
||||
{
|
||||
inline void hash_float_combine(std::size_t& seed, std::size_t value)
|
||||
{
|
||||
seed ^= value + (seed<<6) + (seed>>2);
|
||||
}
|
||||
|
||||
inline std::size_t float_hash_impl(float v)
|
||||
{
|
||||
boost::uint32_t* ptr = (boost::uint32_t*)&v;
|
||||
std::size_t seed = *ptr;
|
||||
return seed;
|
||||
}
|
||||
|
||||
inline std::size_t float_hash_impl(double v)
|
||||
{
|
||||
boost::uint32_t* ptr = (boost::uint32_t*)&v;
|
||||
std::size_t seed = *ptr++;
|
||||
hash_float_combine(seed, *ptr);
|
||||
return seed;
|
||||
}
|
||||
|
||||
inline std::size_t float_hash_impl(long double v)
|
||||
{
|
||||
boost::uint32_t* ptr = (boost::uint32_t*)&v;
|
||||
std::size_t seed = *ptr++;
|
||||
hash_float_combine(seed, *ptr++);
|
||||
hash_float_combine(seed, *(boost::uint16_t*)ptr);
|
||||
return seed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
61
test/external/boost/functional/hash/detail/limits.hpp
vendored
Normal file
61
test/external/boost/functional/hash/detail/limits.hpp
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// On some platforms std::limits gives incorrect values for long double.
|
||||
// This tries to work around them.
|
||||
|
||||
#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER)
|
||||
#define BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/limits.hpp>
|
||||
|
||||
// On OpenBSD, numeric_limits is not reliable for long doubles, but
|
||||
// the macros defined in <float.h> are and support long double when STLport
|
||||
// doesn't.
|
||||
|
||||
#if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE)
|
||||
#include <float.h>
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace hash_detail
|
||||
{
|
||||
template <class T>
|
||||
struct limits : std::numeric_limits<T> {};
|
||||
|
||||
#if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE)
|
||||
template <>
|
||||
struct limits<long double>
|
||||
: std::numeric_limits<long double>
|
||||
{
|
||||
static long double epsilon() {
|
||||
return LDBL_EPSILON;
|
||||
}
|
||||
|
||||
static long double (max)() {
|
||||
return LDBL_MAX;
|
||||
}
|
||||
|
||||
static long double (min)() {
|
||||
return LDBL_MIN;
|
||||
}
|
||||
|
||||
BOOST_STATIC_CONSTANT(int, digits = LDBL_MANT_DIG);
|
||||
BOOST_STATIC_CONSTANT(int, max_exponent = LDBL_MAX_EXP);
|
||||
BOOST_STATIC_CONSTANT(int, min_exponent = LDBL_MIN_EXP);
|
||||
#if defined(_STLP_NO_LONG_DOUBLE)
|
||||
BOOST_STATIC_CONSTANT(int, radix = FLT_RADIX);
|
||||
#endif
|
||||
};
|
||||
#endif // __OpenBSD__
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
286
test/external/boost/functional/hash/extensions.hpp
vendored
Normal file
286
test/external/boost/functional/hash/extensions.hpp
vendored
Normal file
@@ -0,0 +1,286 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Based on Peter Dimov's proposal
|
||||
// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
|
||||
// issue 6.18.
|
||||
|
||||
// This implements the extensions to the standard.
|
||||
// It's undocumented, so you shouldn't use it....
|
||||
|
||||
#if !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP)
|
||||
#define BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP
|
||||
|
||||
#include <boost/functional/hash/hash.hpp>
|
||||
#include <boost/detail/container_fwd.hpp>
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template <class A, class B>
|
||||
std::size_t hash_value(std::pair<A, B> const&);
|
||||
template <class T, class A>
|
||||
std::size_t hash_value(std::vector<T, A> const&);
|
||||
template <class T, class A>
|
||||
std::size_t hash_value(std::list<T, A> const& v);
|
||||
template <class T, class A>
|
||||
std::size_t hash_value(std::deque<T, A> const& v);
|
||||
template <class K, class C, class A>
|
||||
std::size_t hash_value(std::set<K, C, A> const& v);
|
||||
template <class K, class C, class A>
|
||||
std::size_t hash_value(std::multiset<K, C, A> const& v);
|
||||
template <class K, class T, class C, class A>
|
||||
std::size_t hash_value(std::map<K, T, C, A> const& v);
|
||||
template <class K, class T, class C, class A>
|
||||
std::size_t hash_value(std::multimap<K, T, C, A> const& v);
|
||||
|
||||
template <class T>
|
||||
std::size_t hash_value(std::complex<T> const&);
|
||||
|
||||
template <class A, class B>
|
||||
std::size_t hash_value(std::pair<A, B> const& v)
|
||||
{
|
||||
std::size_t seed = 0;
|
||||
hash_combine(seed, v.first);
|
||||
hash_combine(seed, v.second);
|
||||
return seed;
|
||||
}
|
||||
|
||||
template <class T, class A>
|
||||
std::size_t hash_value(std::vector<T, A> const& v)
|
||||
{
|
||||
return hash_range(v.begin(), v.end());
|
||||
}
|
||||
|
||||
template <class T, class A>
|
||||
std::size_t hash_value(std::list<T, A> const& v)
|
||||
{
|
||||
return hash_range(v.begin(), v.end());
|
||||
}
|
||||
|
||||
template <class T, class A>
|
||||
std::size_t hash_value(std::deque<T, A> const& v)
|
||||
{
|
||||
return hash_range(v.begin(), v.end());
|
||||
}
|
||||
|
||||
template <class K, class C, class A>
|
||||
std::size_t hash_value(std::set<K, C, A> const& v)
|
||||
{
|
||||
return hash_range(v.begin(), v.end());
|
||||
}
|
||||
|
||||
template <class K, class C, class A>
|
||||
std::size_t hash_value(std::multiset<K, C, A> const& v)
|
||||
{
|
||||
return hash_range(v.begin(), v.end());
|
||||
}
|
||||
|
||||
template <class K, class T, class C, class A>
|
||||
std::size_t hash_value(std::map<K, T, C, A> const& v)
|
||||
{
|
||||
return hash_range(v.begin(), v.end());
|
||||
}
|
||||
|
||||
template <class K, class T, class C, class A>
|
||||
std::size_t hash_value(std::multimap<K, T, C, A> const& v)
|
||||
{
|
||||
return hash_range(v.begin(), v.end());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
std::size_t hash_value(std::complex<T> const& v)
|
||||
{
|
||||
boost::hash<T> hasher;
|
||||
std::size_t seed = hasher(v.imag());
|
||||
seed ^= hasher(v.real()) + (seed<<6) + (seed>>2);
|
||||
return seed;
|
||||
}
|
||||
|
||||
//
|
||||
// call_hash_impl
|
||||
//
|
||||
|
||||
// On compilers without function template ordering, this deals with arrays.
|
||||
|
||||
#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
namespace hash_detail
|
||||
{
|
||||
template <bool IsArray>
|
||||
struct call_hash_impl
|
||||
{
|
||||
template <class T>
|
||||
struct inner
|
||||
{
|
||||
static std::size_t call(T const& v)
|
||||
{
|
||||
using namespace boost;
|
||||
return hash_value(v);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct call_hash_impl<true>
|
||||
{
|
||||
template <class Array>
|
||||
struct inner
|
||||
{
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
static std::size_t call(Array const& v)
|
||||
#else
|
||||
static std::size_t call(Array& v)
|
||||
#endif
|
||||
{
|
||||
const int size = sizeof(v) / sizeof(*v);
|
||||
return boost::hash_range(v, v + size);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct call_hash
|
||||
: public call_hash_impl<boost::is_array<T>::value>
|
||||
::BOOST_NESTED_TEMPLATE inner<T>
|
||||
{
|
||||
};
|
||||
}
|
||||
#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||
|
||||
//
|
||||
// boost::hash
|
||||
//
|
||||
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
|
||||
template <class T> struct hash
|
||||
: std::unary_function<T, std::size_t>
|
||||
{
|
||||
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
std::size_t operator()(T const& val) const
|
||||
{
|
||||
return hash_value(val);
|
||||
}
|
||||
#else
|
||||
std::size_t operator()(T const& val) const
|
||||
{
|
||||
return hash_detail::call_hash<T>::call(val);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(__DMC__, <= 0x848)
|
||||
template <class T, unsigned int n> struct hash<T[n]>
|
||||
: std::unary_function<T[n], std::size_t>
|
||||
{
|
||||
std::size_t operator()(const T* val) const
|
||||
{
|
||||
return boost::hash_range(val, val+n);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
// On compilers without partial specialization, boost::hash<T>
|
||||
// has already been declared to deal with pointers, so just
|
||||
// need to supply the non-pointer version of hash_impl.
|
||||
|
||||
namespace hash_detail
|
||||
{
|
||||
template <bool IsPointer>
|
||||
struct hash_impl;
|
||||
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
|
||||
template <>
|
||||
struct hash_impl<false>
|
||||
{
|
||||
template <class T>
|
||||
struct inner
|
||||
: std::unary_function<T, std::size_t>
|
||||
{
|
||||
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
std::size_t operator()(T const& val) const
|
||||
{
|
||||
return hash_value(val);
|
||||
}
|
||||
#else
|
||||
std::size_t operator()(T const& val) const
|
||||
{
|
||||
return hash_detail::call_hash<T>::call(val);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
#else // Visual C++ 6.5
|
||||
|
||||
// Visual C++ 6.5 has problems with nested member functions and
|
||||
// applying const to const types in templates. So we get this:
|
||||
|
||||
template <bool IsConst>
|
||||
struct hash_impl_msvc
|
||||
{
|
||||
template <class T>
|
||||
struct inner
|
||||
: public std::unary_function<T, std::size_t>
|
||||
{
|
||||
std::size_t operator()(T const& val) const
|
||||
{
|
||||
return hash_detail::call_hash<T const>::call(val);
|
||||
}
|
||||
|
||||
std::size_t operator()(T& val) const
|
||||
{
|
||||
return hash_detail::call_hash<T>::call(val);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct hash_impl_msvc<true>
|
||||
{
|
||||
template <class T>
|
||||
struct inner
|
||||
: public std::unary_function<T, std::size_t>
|
||||
{
|
||||
std::size_t operator()(T& val) const
|
||||
{
|
||||
return hash_detail::call_hash<T>::call(val);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct hash_impl_msvc2
|
||||
: public hash_impl_msvc<boost::is_const<T>::value>
|
||||
::BOOST_NESTED_TEMPLATE inner<T> {};
|
||||
|
||||
template <>
|
||||
struct hash_impl<false>
|
||||
{
|
||||
template <class T>
|
||||
struct inner : public hash_impl_msvc2<T> {};
|
||||
};
|
||||
|
||||
#endif // Visual C++ 6.5
|
||||
}
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
}
|
||||
|
||||
#endif
|
||||
536
test/external/boost/functional/hash/hash.hpp
vendored
Normal file
536
test/external/boost/functional/hash/hash.hpp
vendored
Normal file
@@ -0,0 +1,536 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Based on Peter Dimov's proposal
|
||||
// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
|
||||
// issue 6.18.
|
||||
|
||||
#if !defined(BOOST_FUNCTIONAL_HASH_HASH_HPP)
|
||||
#define BOOST_FUNCTIONAL_HASH_HASH_HPP
|
||||
|
||||
#include <boost/functional/hash/hash_fwd.hpp>
|
||||
#include <functional>
|
||||
#include <boost/functional/hash/detail/hash_float.hpp>
|
||||
#include <string>
|
||||
#include <boost/limits.hpp>
|
||||
|
||||
#if defined(BOOST_HASH_NO_IMPLICIT_CASTS)
|
||||
#include <boost/static_assert.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_0X_HDR_TYPEINDEX)
|
||||
#include <typeindex>
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(__GNUC__, < 3) \
|
||||
&& !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
|
||||
#define BOOST_HASH_CHAR_TRAITS string_char_traits
|
||||
#else
|
||||
#define BOOST_HASH_CHAR_TRAITS char_traits
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
#if defined(BOOST_HASH_NO_IMPLICIT_CASTS)
|
||||
|
||||
// If you get a static assertion here, it's because hash_value
|
||||
// isn't declared for your type.
|
||||
template <typename T>
|
||||
std::size_t hash_value(T const&) {
|
||||
BOOST_STATIC_ASSERT((T*) 0 && false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
std::size_t hash_value(bool);
|
||||
std::size_t hash_value(char);
|
||||
std::size_t hash_value(unsigned char);
|
||||
std::size_t hash_value(signed char);
|
||||
std::size_t hash_value(short);
|
||||
std::size_t hash_value(unsigned short);
|
||||
std::size_t hash_value(int);
|
||||
std::size_t hash_value(unsigned int);
|
||||
std::size_t hash_value(long);
|
||||
std::size_t hash_value(unsigned long);
|
||||
|
||||
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
std::size_t hash_value(wchar_t);
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_LONG_LONG)
|
||||
std::size_t hash_value(boost::long_long_type);
|
||||
std::size_t hash_value(boost::ulong_long_type);
|
||||
#endif
|
||||
|
||||
#if !BOOST_WORKAROUND(__DMC__, <= 0x848)
|
||||
template <class T> std::size_t hash_value(T* const&);
|
||||
#else
|
||||
template <class T> std::size_t hash_value(T*);
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
template< class T, unsigned N >
|
||||
std::size_t hash_value(const T (&x)[N]);
|
||||
|
||||
template< class T, unsigned N >
|
||||
std::size_t hash_value(T (&x)[N]);
|
||||
#endif
|
||||
|
||||
std::size_t hash_value(float v);
|
||||
std::size_t hash_value(double v);
|
||||
std::size_t hash_value(long double v);
|
||||
|
||||
template <class Ch, class A>
|
||||
std::size_t hash_value(
|
||||
std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const&);
|
||||
|
||||
#if !defined(BOOST_NO_0X_HDR_TYPEINDEX)
|
||||
std::size_t hash_value(std::type_index);
|
||||
#endif
|
||||
|
||||
// Implementation
|
||||
|
||||
namespace hash_detail
|
||||
{
|
||||
template <class T>
|
||||
inline std::size_t hash_value_signed(T val)
|
||||
{
|
||||
const int size_t_bits = std::numeric_limits<std::size_t>::digits;
|
||||
// ceiling(std::numeric_limits<T>::digits / size_t_bits) - 1
|
||||
const int length = (std::numeric_limits<T>::digits - 1)
|
||||
/ size_t_bits;
|
||||
|
||||
std::size_t seed = 0;
|
||||
T positive = val < 0 ? -1 - val : val;
|
||||
|
||||
// Hopefully, this loop can be unrolled.
|
||||
for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits)
|
||||
{
|
||||
seed ^= (std::size_t) (positive >> i) + (seed<<6) + (seed>>2);
|
||||
}
|
||||
seed ^= (std::size_t) val + (seed<<6) + (seed>>2);
|
||||
|
||||
return seed;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline std::size_t hash_value_unsigned(T val)
|
||||
{
|
||||
const int size_t_bits = std::numeric_limits<std::size_t>::digits;
|
||||
// ceiling(std::numeric_limits<T>::digits / size_t_bits) - 1
|
||||
const int length = (std::numeric_limits<T>::digits - 1)
|
||||
/ size_t_bits;
|
||||
|
||||
std::size_t seed = 0;
|
||||
|
||||
// Hopefully, this loop can be unrolled.
|
||||
for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits)
|
||||
{
|
||||
seed ^= (std::size_t) (val >> i) + (seed<<6) + (seed>>2);
|
||||
}
|
||||
seed ^= (std::size_t) val + (seed<<6) + (seed>>2);
|
||||
|
||||
return seed;
|
||||
}
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(bool v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(char v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(unsigned char v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(signed char v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(short v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(unsigned short v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(int v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(unsigned int v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(long v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(unsigned long v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
inline std::size_t hash_value(wchar_t v)
|
||||
{
|
||||
return static_cast<std::size_t>(v);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_LONG_LONG)
|
||||
inline std::size_t hash_value(boost::long_long_type v)
|
||||
{
|
||||
return hash_detail::hash_value_signed(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(boost::ulong_long_type v)
|
||||
{
|
||||
return hash_detail::hash_value_unsigned(v);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Implementation by Alberto Barbati and Dave Harris.
|
||||
#if !BOOST_WORKAROUND(__DMC__, <= 0x848)
|
||||
template <class T> std::size_t hash_value(T* const& v)
|
||||
#else
|
||||
template <class T> std::size_t hash_value(T* v)
|
||||
#endif
|
||||
{
|
||||
#if defined(__VMS) && __INITIAL_POINTER_SIZE == 64
|
||||
// for some reason ptrdiff_t on OpenVMS compiler with
|
||||
// 64 bit is not 64 bit !!!
|
||||
std::size_t x = static_cast<std::size_t>(
|
||||
reinterpret_cast<long long int>(v));
|
||||
#else
|
||||
std::size_t x = static_cast<std::size_t>(
|
||||
reinterpret_cast<std::ptrdiff_t>(v));
|
||||
#endif
|
||||
return x + (x >> 3);
|
||||
}
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(push)
|
||||
#if BOOST_MSVC <= 1400
|
||||
#pragma warning(disable:4267) // 'argument' : conversion from 'size_t' to
|
||||
// 'unsigned int', possible loss of data
|
||||
// A misguided attempt to detect 64-bit
|
||||
// incompatability.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
template <class T>
|
||||
inline void hash_combine(std::size_t& seed, T& v)
|
||||
#else
|
||||
template <class T>
|
||||
inline void hash_combine(std::size_t& seed, T const& v)
|
||||
#endif
|
||||
{
|
||||
boost::hash<T> hasher;
|
||||
seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
|
||||
}
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
template <class It>
|
||||
inline std::size_t hash_range(It first, It last)
|
||||
{
|
||||
std::size_t seed = 0;
|
||||
|
||||
for(; first != last; ++first)
|
||||
{
|
||||
hash_combine(seed, *first);
|
||||
}
|
||||
|
||||
return seed;
|
||||
}
|
||||
|
||||
template <class It>
|
||||
inline void hash_range(std::size_t& seed, It first, It last)
|
||||
{
|
||||
for(; first != last; ++first)
|
||||
{
|
||||
hash_combine(seed, *first);
|
||||
}
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
||||
template <class T>
|
||||
inline std::size_t hash_range(T* first, T* last)
|
||||
{
|
||||
std::size_t seed = 0;
|
||||
|
||||
for(; first != last; ++first)
|
||||
{
|
||||
boost::hash<T> hasher;
|
||||
seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2);
|
||||
}
|
||||
|
||||
return seed;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void hash_range(std::size_t& seed, T* first, T* last)
|
||||
{
|
||||
for(; first != last; ++first)
|
||||
{
|
||||
boost::hash<T> hasher;
|
||||
seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
template< class T, unsigned N >
|
||||
inline std::size_t hash_value(const T (&x)[N])
|
||||
{
|
||||
return hash_range(x, x + N);
|
||||
}
|
||||
|
||||
template< class T, unsigned N >
|
||||
inline std::size_t hash_value(T (&x)[N])
|
||||
{
|
||||
return hash_range(x, x + N);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class Ch, class A>
|
||||
inline std::size_t hash_value(
|
||||
std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const& v)
|
||||
{
|
||||
return hash_range(v.begin(), v.end());
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(float v)
|
||||
{
|
||||
return boost::hash_detail::float_hash_value(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(double v)
|
||||
{
|
||||
return boost::hash_detail::float_hash_value(v);
|
||||
}
|
||||
|
||||
inline std::size_t hash_value(long double v)
|
||||
{
|
||||
return boost::hash_detail::float_hash_value(v);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_0X_HDR_TYPEINDEX)
|
||||
inline std::size_t hash_value(std::type_index v)
|
||||
{
|
||||
return v.hash_code();
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// boost::hash
|
||||
//
|
||||
|
||||
// Define the specializations required by the standard. The general purpose
|
||||
// boost::hash is defined later in extensions.hpp if
|
||||
// BOOST_HASH_NO_EXTENSIONS is not defined.
|
||||
|
||||
// BOOST_HASH_SPECIALIZE - define a specialization for a type which is
|
||||
// passed by copy.
|
||||
//
|
||||
// BOOST_HASH_SPECIALIZE_REF - define a specialization for a type which is
|
||||
// passed by copy.
|
||||
//
|
||||
// These are undefined later.
|
||||
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
#define BOOST_HASH_SPECIALIZE(type) \
|
||||
template <> struct hash<type> \
|
||||
: public std::unary_function<type, std::size_t> \
|
||||
{ \
|
||||
std::size_t operator()(type v) const \
|
||||
{ \
|
||||
return boost::hash_value(v); \
|
||||
} \
|
||||
};
|
||||
|
||||
#define BOOST_HASH_SPECIALIZE_REF(type) \
|
||||
template <> struct hash<type> \
|
||||
: public std::unary_function<type, std::size_t> \
|
||||
{ \
|
||||
std::size_t operator()(type const& v) const \
|
||||
{ \
|
||||
return boost::hash_value(v); \
|
||||
} \
|
||||
};
|
||||
#else
|
||||
#define BOOST_HASH_SPECIALIZE(type) \
|
||||
template <> struct hash<type> \
|
||||
: public std::unary_function<type, std::size_t> \
|
||||
{ \
|
||||
std::size_t operator()(type v) const \
|
||||
{ \
|
||||
return boost::hash_value(v); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
template <> struct hash<const type> \
|
||||
: public std::unary_function<const type, std::size_t> \
|
||||
{ \
|
||||
std::size_t operator()(const type v) const \
|
||||
{ \
|
||||
return boost::hash_value(v); \
|
||||
} \
|
||||
};
|
||||
|
||||
#define BOOST_HASH_SPECIALIZE_REF(type) \
|
||||
template <> struct hash<type> \
|
||||
: public std::unary_function<type, std::size_t> \
|
||||
{ \
|
||||
std::size_t operator()(type const& v) const \
|
||||
{ \
|
||||
return boost::hash_value(v); \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
template <> struct hash<const type> \
|
||||
: public std::unary_function<const type, std::size_t> \
|
||||
{ \
|
||||
std::size_t operator()(type const& v) const \
|
||||
{ \
|
||||
return boost::hash_value(v); \
|
||||
} \
|
||||
};
|
||||
#endif
|
||||
|
||||
BOOST_HASH_SPECIALIZE(bool)
|
||||
BOOST_HASH_SPECIALIZE(char)
|
||||
BOOST_HASH_SPECIALIZE(signed char)
|
||||
BOOST_HASH_SPECIALIZE(unsigned char)
|
||||
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
BOOST_HASH_SPECIALIZE(wchar_t)
|
||||
#endif
|
||||
BOOST_HASH_SPECIALIZE(short)
|
||||
BOOST_HASH_SPECIALIZE(unsigned short)
|
||||
BOOST_HASH_SPECIALIZE(int)
|
||||
BOOST_HASH_SPECIALIZE(unsigned int)
|
||||
BOOST_HASH_SPECIALIZE(long)
|
||||
BOOST_HASH_SPECIALIZE(unsigned long)
|
||||
|
||||
BOOST_HASH_SPECIALIZE(float)
|
||||
BOOST_HASH_SPECIALIZE(double)
|
||||
BOOST_HASH_SPECIALIZE(long double)
|
||||
|
||||
BOOST_HASH_SPECIALIZE_REF(std::string)
|
||||
#if !defined(BOOST_NO_STD_WSTRING)
|
||||
BOOST_HASH_SPECIALIZE_REF(std::wstring)
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_LONG_LONG)
|
||||
BOOST_HASH_SPECIALIZE(boost::long_long_type)
|
||||
BOOST_HASH_SPECIALIZE(boost::ulong_long_type)
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_0X_HDR_TYPEINDEX)
|
||||
BOOST_HASH_SPECIALIZE(std::type_index)
|
||||
#endif
|
||||
|
||||
#undef BOOST_HASH_SPECIALIZE
|
||||
#undef BOOST_HASH_SPECIALIZE_REF
|
||||
|
||||
// Specializing boost::hash for pointers.
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
|
||||
template <class T>
|
||||
struct hash<T*>
|
||||
: public std::unary_function<T*, std::size_t>
|
||||
{
|
||||
std::size_t operator()(T* v) const
|
||||
{
|
||||
#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590)
|
||||
return boost::hash_value(v);
|
||||
#else
|
||||
std::size_t x = static_cast<std::size_t>(
|
||||
reinterpret_cast<std::ptrdiff_t>(v));
|
||||
|
||||
return x + (x >> 3);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
// For compilers without partial specialization, we define a
|
||||
// boost::hash for all remaining types. But hash_impl is only defined
|
||||
// for pointers in 'extensions.hpp' - so when BOOST_HASH_NO_EXTENSIONS
|
||||
// is defined there will still be a compile error for types not supported
|
||||
// in the standard.
|
||||
|
||||
namespace hash_detail
|
||||
{
|
||||
template <bool IsPointer>
|
||||
struct hash_impl;
|
||||
|
||||
template <>
|
||||
struct hash_impl<true>
|
||||
{
|
||||
template <class T>
|
||||
struct inner
|
||||
: public std::unary_function<T, std::size_t>
|
||||
{
|
||||
std::size_t operator()(T val) const
|
||||
{
|
||||
#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 590)
|
||||
return boost::hash_value(val);
|
||||
#else
|
||||
std::size_t x = static_cast<std::size_t>(
|
||||
reinterpret_cast<std::ptrdiff_t>(val));
|
||||
|
||||
return x + (x >> 3);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
template <class T> struct hash
|
||||
: public boost::hash_detail::hash_impl<boost::is_pointer<T>::value>
|
||||
::BOOST_NESTED_TEMPLATE inner<T>
|
||||
{
|
||||
};
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#undef BOOST_HASH_CHAR_TRAITS
|
||||
|
||||
#endif // BOOST_FUNCTIONAL_HASH_HASH_HPP
|
||||
|
||||
// Include this outside of the include guards in case the file is included
|
||||
// twice - once with BOOST_HASH_NO_EXTENSIONS defined, and then with it
|
||||
// undefined.
|
||||
|
||||
#if !defined(BOOST_HASH_NO_EXTENSIONS) \
|
||||
&& !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP)
|
||||
#include <boost/functional/hash/extensions.hpp>
|
||||
#endif
|
||||
40
test/external/boost/functional/hash/hash_fwd.hpp
vendored
Normal file
40
test/external/boost/functional/hash/hash_fwd.hpp
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Based on Peter Dimov's proposal
|
||||
// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf
|
||||
// issue 6.18.
|
||||
|
||||
#if !defined(BOOST_FUNCTIONAL_HASH_FWD_HPP)
|
||||
#define BOOST_FUNCTIONAL_HASH_FWD_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <cstddef>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template <class T> struct hash;
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
template <class T> void hash_combine(std::size_t& seed, T& v);
|
||||
#else
|
||||
template <class T> void hash_combine(std::size_t& seed, T const& v);
|
||||
#endif
|
||||
|
||||
template <class It> std::size_t hash_range(It, It);
|
||||
template <class It> void hash_range(std::size_t&, It, It);
|
||||
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
||||
template <class T> inline std::size_t hash_range(T*, T*);
|
||||
template <class T> inline void hash_range(std::size_t&, T*, T*);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
7
test/external/boost/functional/hash_fwd.hpp
vendored
Normal file
7
test/external/boost/functional/hash_fwd.hpp
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
// Copyright 2005-2009 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/functional/hash/hash_fwd.hpp>
|
||||
|
||||
259
test/external/boost/functional/lightweight_forward_adapter.hpp
vendored
Normal file
259
test/external/boost/functional/lightweight_forward_adapter.hpp
vendored
Normal file
@@ -0,0 +1,259 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUNCTIONAL_LIGHTWEIGHT_FORWARD_ADAPTER_HPP_INCLUDED
|
||||
# ifndef BOOST_PP_IS_ITERATING
|
||||
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/detail/workaround.hpp>
|
||||
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/iteration/iterate.hpp>
|
||||
# include <boost/preprocessor/repetition/enum.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
# include <boost/preprocessor/facilities/intercept.hpp>
|
||||
|
||||
# include <boost/utility/result_of.hpp>
|
||||
# include <boost/ref.hpp>
|
||||
|
||||
# ifndef BOOST_FUNCTIONAL_LIGHTWEIGHT_FORWARD_ADAPTER_MAX_ARITY
|
||||
# define BOOST_FUNCTIONAL_LIGHTWEIGHT_FORWARD_ADAPTER_MAX_ARITY 10
|
||||
# elif BOOST_FUNCTIONAL_FORDWARD_ADAPTER_MAX_ARITY < 3
|
||||
# undef BOOST_FUNCTIONAL_LIGHTWEIGHT_FORWARD_ADAPTER_MAX_ARITY
|
||||
# define BOOST_FUNCTIONAL_LIGHTWEIGHT_FORWARD_ADAPTER_MAX_ARITY 3
|
||||
# endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template< typename Function, int Arity_Or_MinArity = -1, int MaxArity = -1 >
|
||||
class lightweight_forward_adapter;
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template< class MostDerived, typename Function, typename FunctionConst,
|
||||
int Arity, int MinArity >
|
||||
struct lightweight_forward_adapter_impl;
|
||||
|
||||
struct lightweight_forward_adapter_result
|
||||
{
|
||||
template< typename Sig > struct apply;
|
||||
|
||||
// Utility metafunction for argument transform
|
||||
template< typename T > struct x { typedef T const& t; };
|
||||
template< typename T > struct x< boost::reference_wrapper<T> >
|
||||
{ typedef T& t; };
|
||||
template< typename T > struct x<T&> : x<T> { };
|
||||
template< typename T > struct x<T const&> : x<T> { };
|
||||
template< typename T > struct x<T const> : x<T> { };
|
||||
|
||||
// Utility metafunction to choose target function qualification
|
||||
template< typename T > struct c
|
||||
{ typedef typename T::target_function_t t; };
|
||||
template< typename T > struct c<T& >
|
||||
{ typedef typename T::target_function_t t; };
|
||||
template< typename T > struct c<T const >
|
||||
{ typedef typename T::target_function_const_t t; };
|
||||
template< typename T > struct c<T const&>
|
||||
{ typedef typename T::target_function_const_t t; };
|
||||
};
|
||||
}
|
||||
|
||||
# define BOOST_TMP_MACRO(f,fn,fc) \
|
||||
boost::detail::lightweight_forward_adapter_impl< \
|
||||
lightweight_forward_adapter<f,Arity_Or_MinArity,MaxArity>, fn, fc, \
|
||||
(MaxArity!=-1? MaxArity :Arity_Or_MinArity!=-1? Arity_Or_MinArity \
|
||||
:BOOST_FUNCTIONAL_LIGHTWEIGHT_FORWARD_ADAPTER_MAX_ARITY), \
|
||||
(Arity_Or_MinArity!=-1? Arity_Or_MinArity : 0) >
|
||||
|
||||
template< typename Function, int Arity_Or_MinArity, int MaxArity >
|
||||
class lightweight_forward_adapter
|
||||
: public BOOST_TMP_MACRO(Function,Function,Function const)
|
||||
, private Function
|
||||
{
|
||||
public:
|
||||
lightweight_forward_adapter(Function const& f = Function())
|
||||
: Function(f)
|
||||
{ }
|
||||
|
||||
typedef Function target_function_t;
|
||||
typedef Function const target_function_const_t;
|
||||
|
||||
Function & target_function() { return *this; }
|
||||
Function const & target_function() const { return *this; }
|
||||
|
||||
template< typename Sig > struct result
|
||||
: detail::lightweight_forward_adapter_result::template apply<Sig>
|
||||
{ };
|
||||
|
||||
using BOOST_TMP_MACRO(Function,Function, Function const)::operator();
|
||||
};
|
||||
template< typename Function, int Arity_Or_MinArity, int MaxArity >
|
||||
class lightweight_forward_adapter< Function const, Arity_Or_MinArity,
|
||||
MaxArity >
|
||||
: public BOOST_TMP_MACRO(Function const, Function const, Function const)
|
||||
, private Function
|
||||
{
|
||||
public:
|
||||
lightweight_forward_adapter(Function const& f = Function())
|
||||
: Function(f)
|
||||
{ }
|
||||
|
||||
typedef Function const target_function_t;
|
||||
typedef Function const target_function_const_t;
|
||||
|
||||
Function const & target_function() const { return *this; }
|
||||
|
||||
template< typename Sig > struct result
|
||||
: detail::lightweight_forward_adapter_result::template apply<Sig>
|
||||
{ };
|
||||
|
||||
using BOOST_TMP_MACRO(Function const,Function const, Function const)
|
||||
::operator();
|
||||
};
|
||||
template< typename Function, int Arity_Or_MinArity, int MaxArity >
|
||||
class lightweight_forward_adapter< Function &, Arity_Or_MinArity, MaxArity >
|
||||
: public BOOST_TMP_MACRO(Function&, Function, Function)
|
||||
{
|
||||
Function& ref_function;
|
||||
public:
|
||||
lightweight_forward_adapter(Function& f)
|
||||
: ref_function(f)
|
||||
{ }
|
||||
|
||||
typedef Function target_function_t;
|
||||
typedef Function target_function_const_t;
|
||||
|
||||
Function & target_function() const { return this->ref_function; }
|
||||
|
||||
template< typename Sig > struct result
|
||||
: detail::lightweight_forward_adapter_result::template apply<Sig>
|
||||
{ };
|
||||
|
||||
using BOOST_TMP_MACRO(Function&, Function, Function)::operator();
|
||||
};
|
||||
|
||||
#undef BOOST_TMP_MACRO
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template< class Self >
|
||||
struct lightweight_forward_adapter_result::apply< Self() >
|
||||
: boost::result_of< BOOST_DEDUCED_TYPENAME c<Self>::t() >
|
||||
{ };
|
||||
|
||||
template< class MD, class F, class FC >
|
||||
struct lightweight_forward_adapter_impl<MD,F,FC,0,0>
|
||||
: lightweight_forward_adapter_result
|
||||
{
|
||||
inline typename boost::result_of< FC() >::type
|
||||
operator()() const
|
||||
{
|
||||
return static_cast<MD const*>(this)->target_function()();
|
||||
}
|
||||
|
||||
inline typename boost::result_of< F() >::type
|
||||
operator()()
|
||||
{
|
||||
return static_cast<MD*>(this)->target_function()();
|
||||
}
|
||||
};
|
||||
|
||||
# define BOOST_PP_FILENAME_1 \
|
||||
<boost/functional/lightweight_forward_adapter.hpp>
|
||||
# define BOOST_PP_ITERATION_LIMITS \
|
||||
(1,BOOST_FUNCTIONAL_LIGHTWEIGHT_FORWARD_ADAPTER_MAX_ARITY)
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<class F, int A0, int A1>
|
||||
struct result_of<boost::lightweight_forward_adapter<F,A0,A1> const ()>
|
||||
: boost::detail::lightweight_forward_adapter_result::template apply<
|
||||
boost::lightweight_forward_adapter<F,A0,A1> const () >
|
||||
{ };
|
||||
template<class F, int A0, int A1>
|
||||
struct result_of<boost::lightweight_forward_adapter<F,A0,A1>()>
|
||||
: boost::detail::lightweight_forward_adapter_result::template apply<
|
||||
boost::lightweight_forward_adapter<F,A0,A1>() >
|
||||
{ };
|
||||
template<class F, int A0, int A1>
|
||||
struct result_of<boost::lightweight_forward_adapter<F,A0,A1> const& ()>
|
||||
: boost::detail::lightweight_forward_adapter_result::template apply<
|
||||
boost::lightweight_forward_adapter<F,A0,A1> const () >
|
||||
{ };
|
||||
template<class F, int A0, int A1>
|
||||
struct result_of<boost::lightweight_forward_adapter<F,A0,A1>& ()>
|
||||
: boost::detail::lightweight_forward_adapter_result::template apply<
|
||||
boost::lightweight_forward_adapter<F,A0,A1>() >
|
||||
{ };
|
||||
}
|
||||
|
||||
# define BOOST_FUNCTIONAL_LIGHTWEIGHT_FORWARD_ADAPTER_HPP_INCLUDED
|
||||
|
||||
# else // defined(BOOST_PP_IS_ITERATING)
|
||||
# define N BOOST_PP_ITERATION()
|
||||
|
||||
template< class Self, BOOST_PP_ENUM_PARAMS(N,typename T) >
|
||||
struct lightweight_forward_adapter_result::apply<
|
||||
Self (BOOST_PP_ENUM_PARAMS(N,T)) >
|
||||
: boost::result_of<
|
||||
BOOST_DEDUCED_TYPENAME c<Self>::t (BOOST_PP_ENUM_BINARY_PARAMS(N,
|
||||
typename x<T,>::t BOOST_PP_INTERCEPT)) >
|
||||
{ };
|
||||
|
||||
template< class MD, class F, class FC >
|
||||
struct lightweight_forward_adapter_impl<MD,F,FC,BOOST_PP_DEC(N),N>
|
||||
: lightweight_forward_adapter_result
|
||||
{
|
||||
template< BOOST_PP_ENUM_PARAMS(N,typename T) >
|
||||
inline typename boost::result_of< F(BOOST_PP_ENUM_BINARY_PARAMS(N,
|
||||
T,const& BOOST_PP_INTERCEPT)) >::type
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& BOOST_PP_INTERCEPT));
|
||||
};
|
||||
|
||||
template< class MD, class F, class FC, int MinArity >
|
||||
struct lightweight_forward_adapter_impl<MD,F,FC,N,MinArity>
|
||||
: lightweight_forward_adapter_impl<MD,F,FC,BOOST_PP_DEC(N),MinArity>
|
||||
{
|
||||
using lightweight_forward_adapter_impl<MD,F,FC,BOOST_PP_DEC(N),
|
||||
MinArity>::operator();
|
||||
|
||||
# define M(z,i,d) \
|
||||
static_cast<typename d::template x<T##i>::t>(a##i)
|
||||
|
||||
template< BOOST_PP_ENUM_PARAMS(N,typename T) >
|
||||
inline typename lightweight_forward_adapter_result::template apply<
|
||||
MD const (BOOST_PP_ENUM_BINARY_PARAMS(N,
|
||||
T,const& BOOST_PP_INTERCEPT)) >::type
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& a)) const
|
||||
{
|
||||
typedef lightweight_forward_adapter_result _;
|
||||
return static_cast<MD const*>(this)->target_function()(
|
||||
BOOST_PP_ENUM(N,M,_));
|
||||
}
|
||||
template< BOOST_PP_ENUM_PARAMS(N,typename T) >
|
||||
inline typename lightweight_forward_adapter_result::template apply<
|
||||
MD (BOOST_PP_ENUM_BINARY_PARAMS(N,
|
||||
T,const& BOOST_PP_INTERCEPT)) >::type
|
||||
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,const& a))
|
||||
{
|
||||
typedef lightweight_forward_adapter_result _;
|
||||
return static_cast<MD*>(this)->target_function()(
|
||||
BOOST_PP_ENUM(N,M,_));
|
||||
}
|
||||
# undef M
|
||||
};
|
||||
|
||||
# undef N
|
||||
# endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#endif // include guard
|
||||
|
||||
70
test/external/boost/functional/value_factory.hpp
vendored
Normal file
70
test/external/boost/functional/value_factory.hpp
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2007 Tobias Schwinger
|
||||
|
||||
Use modification and distribution are subject to the Boost Software
|
||||
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_FUNCTIONAL_VALUE_FACTORY_HPP_INCLUDED
|
||||
# ifndef BOOST_PP_IS_ITERATING
|
||||
|
||||
# include <boost/preprocessor/iteration/iterate.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
|
||||
# include <new>
|
||||
# include <boost/pointee.hpp>
|
||||
# include <boost/none_t.hpp>
|
||||
# include <boost/get_pointer.hpp>
|
||||
# include <boost/non_type.hpp>
|
||||
# include <boost/type_traits/remove_cv.hpp>
|
||||
|
||||
# ifndef BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY
|
||||
# define BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY 10
|
||||
# elif BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY < 3
|
||||
# undef BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY
|
||||
# define BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY 3
|
||||
# endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template< typename T >
|
||||
class value_factory;
|
||||
|
||||
//----- ---- --- -- - - - -
|
||||
|
||||
template< typename T >
|
||||
class value_factory
|
||||
{
|
||||
public:
|
||||
typedef T result_type;
|
||||
|
||||
value_factory()
|
||||
{ }
|
||||
|
||||
# define BOOST_PP_FILENAME_1 <boost/functional/value_factory.hpp>
|
||||
# define BOOST_PP_ITERATION_LIMITS (0,BOOST_FUNCTIONAL_VALUE_FACTORY_MAX_ARITY)
|
||||
# include BOOST_PP_ITERATE()
|
||||
};
|
||||
|
||||
template< typename T > class value_factory<T&>;
|
||||
// forbidden, would create a dangling reference
|
||||
}
|
||||
# define BOOST_FUNCTIONAL_VALUE_FACTORY_HPP_INCLUDED
|
||||
# else // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
# define N BOOST_PP_ITERATION()
|
||||
# if N > 0
|
||||
template< BOOST_PP_ENUM_PARAMS(N, typename T) >
|
||||
# endif
|
||||
inline result_type operator()(BOOST_PP_ENUM_BINARY_PARAMS(N,T,& a)) const
|
||||
{
|
||||
return result_type(BOOST_PP_ENUM_PARAMS(N,a));
|
||||
}
|
||||
# undef N
|
||||
|
||||
# endif // defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
#endif // include guard
|
||||
|
||||
Reference in New Issue
Block a user