Initial Commit

This commit is contained in:
Jordan Sherer
2018-02-08 21:28:33 -05:00
commit 678c1d3966
14352 changed files with 3176737 additions and 0 deletions
@@ -0,0 +1,30 @@
# /* Copyright (C) 2001
# * Housemarque Oy
# * http://www.housemarque.com
# *
# * 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)
# */
#
# /* Revised by Paul Mensonides (2002) */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_LOGICAL_NOT_HPP
# define BOOST_PREPROCESSOR_LOGICAL_NOT_HPP
#
# include <boost/preprocessor/config/config.hpp>
# include <boost/preprocessor/logical/bool.hpp>
# include <boost/preprocessor/logical/compl.hpp>
#
# /* BOOST_PP_NOT */
#
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
# define BOOST_PP_NOT(x) BOOST_PP_COMPL(BOOST_PP_BOOL(x))
# else
# define BOOST_PP_NOT(x) BOOST_PP_NOT_I(x)
# define BOOST_PP_NOT_I(x) BOOST_PP_COMPL(BOOST_PP_BOOL(x))
# endif
#
# endif
@@ -0,0 +1,142 @@
// (C) Copyright David Abrahams 2000.
// 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)
//
// The author gratefully acknowleges the support of Dragon Systems, Inc., in
// producing this work.
// Revision History:
// 04 Mar 01 Some fixes so it will compile with Intel C++ (Dave Abrahams)
#ifndef CONFIG_DWA052200_H_
# define CONFIG_DWA052200_H_
# include <boost/config.hpp>
# include <boost/detail/workaround.hpp>
# ifdef BOOST_NO_OPERATORS_IN_NAMESPACE
// A gcc bug forces some symbols into the global namespace
# define BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE
# define BOOST_PYTHON_END_CONVERSION_NAMESPACE
# define BOOST_PYTHON_CONVERSION
# define BOOST_PYTHON_IMPORT_CONVERSION(x) using ::x
# else
# define BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE namespace boost { namespace python {
# define BOOST_PYTHON_END_CONVERSION_NAMESPACE }} // namespace boost::python
# define BOOST_PYTHON_CONVERSION boost::python
# define BOOST_PYTHON_IMPORT_CONVERSION(x) void never_defined() // so we can follow the macro with a ';'
# endif
# if defined(BOOST_MSVC)
# pragma warning (disable : 4786) // disable truncated debug symbols
# pragma warning (disable : 4251) // disable exported dll function
# pragma warning (disable : 4800) //'int' : forcing value to bool 'true' or 'false'
# pragma warning (disable : 4275) // non dll-interface class
# elif defined(__ICL) && __ICL < 600 // Intel C++ 5
# pragma warning(disable: 985) // identifier was truncated in debug information
# endif
// The STLport puts all of the standard 'C' library names in std (as far as the
// user is concerned), but without it you need a fix if you're using MSVC or
// Intel C++
# if defined(BOOST_NO_STDC_NAMESPACE)
# define BOOST_CSTD_
# else
# define BOOST_CSTD_ std
# endif
/*****************************************************************************
*
* Set up dll import/export options:
*
****************************************************************************/
// backwards compatibility:
#ifdef BOOST_PYTHON_STATIC_LIB
# define BOOST_PYTHON_STATIC_LINK
# elif !defined(BOOST_PYTHON_DYNAMIC_LIB)
# define BOOST_PYTHON_DYNAMIC_LIB
#endif
#if defined(BOOST_PYTHON_DYNAMIC_LIB)
# if !defined(_WIN32) && !defined(__CYGWIN__) \
&& !defined(BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY) \
&& BOOST_WORKAROUND(__GNUC__, >= 3) && (__GNUC_MINOR__ >=5 || __GNUC__ > 3)
# define BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY 1
# endif
# if BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY
# if defined(BOOST_PYTHON_SOURCE)
# define BOOST_PYTHON_DECL __attribute__ ((__visibility__("default")))
# define BOOST_PYTHON_BUILD_DLL
# else
# define BOOST_PYTHON_DECL
# endif
# define BOOST_PYTHON_DECL_FORWARD
# define BOOST_PYTHON_DECL_EXCEPTION __attribute__ ((__visibility__("default")))
# elif (defined(_WIN32) || defined(__CYGWIN__))
# if defined(BOOST_PYTHON_SOURCE)
# define BOOST_PYTHON_DECL __declspec(dllexport)
# define BOOST_PYTHON_BUILD_DLL
# else
# define BOOST_PYTHON_DECL __declspec(dllimport)
# endif
# endif
#endif
#ifndef BOOST_PYTHON_DECL
# define BOOST_PYTHON_DECL
#endif
#ifndef BOOST_PYTHON_DECL_FORWARD
# define BOOST_PYTHON_DECL_FORWARD BOOST_PYTHON_DECL
#endif
#ifndef BOOST_PYTHON_DECL_EXCEPTION
# define BOOST_PYTHON_DECL_EXCEPTION BOOST_PYTHON_DECL
#endif
#if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
// Replace broken Tru64/cxx offsetof macro
# define BOOST_PYTHON_OFFSETOF(s_name, s_member) \
((size_t)__INTADDR__(&(((s_name *)0)->s_member)))
#else
# define BOOST_PYTHON_OFFSETOF offsetof
#endif
// enable automatic library variant selection ------------------------------//
#if !defined(BOOST_PYTHON_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_PYTHON_NO_LIB)
//
// Set the name of our library, this will get undef'ed by auto_link.hpp
// once it's done with it:
//
#define BOOST_LIB_NAME boost_python
//
// If we're importing code from a dll, then tell auto_link.hpp about it:
//
#ifdef BOOST_PYTHON_DYNAMIC_LIB
# define BOOST_DYN_LINK
#endif
//
// And include the header that does the work:
//
#include <boost/config/auto_link.hpp>
#endif // auto-linking disabled
#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
#define BOOST_PYTHON_SUPPORTS_PY_SIGNATURES // enables smooth transition
#endif
#if !defined(BOOST_ATTRIBUTE_UNUSED) && defined(__GNUC__) && (__GNUC__ >= 4)
# define BOOST_ATTRIBUTE_UNUSED __attribute__((unused))
#endif
#endif // CONFIG_DWA052200_H_
@@ -0,0 +1,276 @@
// (C) Copyright Gennadiy Rozental 2001.
// 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)
// See http://www.boost.org/libs/test for the library home page.
//
//!@file
//!@brief Defines Unit Test Framework mono-state interfaces.
//! The framework interfaces are based on Monostate design pattern.
// ***************************************************************************
#ifndef BOOST_TEST_FRAMEWORK_HPP_020805GER
#define BOOST_TEST_FRAMEWORK_HPP_020805GER
// Boost.Test
#include <boost/test/detail/global_typedef.hpp>
#include <boost/test/detail/fwd_decl.hpp>
#include <boost/test/detail/throw_exception.hpp>
#include <boost/test/utils/trivial_singleton.hpp>
#include <boost/test/detail/suppress_warnings.hpp>
// STL
#include <stdexcept>
//____________________________________________________________________________//
namespace boost {
/// Main namespace for the Unit Test Framework interfaces and implementation
namespace unit_test {
// ************************************************************************** //
// ************** init_unit_test_func ************** //
// ************************************************************************** //
/// Test module initialization routine signature
/// Different depending on whether BOOST_TEST_ALTERNATIVE_INIT_API is defined or not
#ifdef BOOST_TEST_ALTERNATIVE_INIT_API
typedef bool (*init_unit_test_func)();
#else
typedef test_suite* (*init_unit_test_func)( int, char* [] );
#endif
// ************************************************************************** //
// ************** framework ************** //
// ************************************************************************** //
/// Namespace of the Unit Test Framework mono-state
namespace framework {
/// @name Unit Test Framework initialization and shutdown
/// @{
/// @brief This function performs initialization of the framework mono-state.
///
/// It needs to be called every time before the test is started.
/// @param[in] init_func test module initialization routine
/// @param[in] argc command line arguments collection
/// @param[in] argv command line arguments collection
BOOST_TEST_DECL void init( init_unit_test_func init_func, int argc, char* argv[] );
/// This function applies all the decorators and figures out default run status. This argument facilitates an
/// ability of the test cases to prepare some other test units (primarily used internally for self testing).
/// @param[in] tu Optional id of the test unit representing root of test tree. If absent, master test suite is used
BOOST_TEST_DECL void finalize_setup_phase( test_unit_id tu = INV_TEST_UNIT_ID);
/// This function returns true when testing is in progress (setup is finished).
BOOST_TEST_DECL bool test_in_progress();
/// This function shuts down the framework and clears up its mono-state.
///
/// It needs to be at the very end of test module execution
BOOST_TEST_DECL void shutdown();
/// @}
/// @name Test unit registration
/// @{
/// Provides both read and write access to current "leaf" auto test suite during the test unit registration phase.
///
/// During auto-registration phase the framework maintain a FIFO queue of test units being registered. New test units become children
/// of the current "leaf" test suite and if this is test suite it is pushed back into queue and becomes a new leaf.
/// When test suite registration is completed, a test suite is popped from the back of the queue. Only automatically registered test suites
/// should be added to this queue. Master test suite is always a zero element in this queue, so if no other test suites are registered
/// all test cases are added to master test suite.
/// This function facilitates all three possible actions:
/// - if no argument are provided it returns the current queue leaf test suite
/// - if test suite is provided and no second argument are set, test suite is added to the queue
/// - if no test suite are provided and last argument is false, the semantic of this function is similar to queue pop: last element is popped from the queue
/// @param[in] ts test suite to push back to the queue
/// @param[in] push_or_pop should we push ts to the queue or pop leaf test suite instead
/// @returns a reference to the currently active/"leaf" test suite
BOOST_TEST_DECL test_suite& current_auto_test_suite( test_suite* ts = 0, bool push_or_pop = true );
/// This function add new test case into the global collection of test units the framework aware of.
/// This function also assignes unique test unit id for every test case. Later on one can use this id to locate
/// the test case if necessary. This is the way for the framework to maintain weak references between test units.
/// @param[in] tc test case to register
BOOST_TEST_DECL void register_test_unit( test_case* tc );
/// This function add new test suite into the global collection of test units the framework aware of.
/// This function also assignes unique test unit id for every test suite. Later on one can use this id to locate
/// the test case if necessary. This is the way for the framework to maintain weak references between test units.
/// @param[in] ts test suite to register
BOOST_TEST_DECL void register_test_unit( test_suite* ts );
/// This function removes the test unit from the collection of known test units and destroys the test unit object.
/// This function also assigns unique test unit id for every test case. Later on one can use this id to located
/// the test case if necessary. This is the way for the framework to maintain weak references between test units.
/// @param[in] tu test unit to deregister
BOOST_TEST_DECL void deregister_test_unit( test_unit* tu );
// This function clears up the framework mono-state.
/// After this call the framework can be reinitialized to perform a second test run during the same program lifetime.
BOOST_TEST_DECL void clear();
/// @}
/// @name Test observer registration
/// @{
/// Adds new test execution observer object into the framework's list of test observers.
/// Observer lifetime should exceed the the testing execution timeframe
/// @param[in] to test observer object to add
BOOST_TEST_DECL void register_observer( test_observer& to );
/// Excldes the observer object form the framework's list of test observers
/// @param[in] to test observer object to exclude
BOOST_TEST_DECL void deregister_observer( test_observer& to );
/// @}
/// @name Assertion/uncaught exception context support
/// @{
/// Context accessor
struct BOOST_TEST_DECL context_generator {
context_generator() : m_curr_frame( 0 ) {}
/// Is there any context?
bool is_empty() const;
/// Give me next frame; empty - last frame
const_string next() const;
private:
// Data members
mutable unsigned m_curr_frame;
};
/// Records context frame message.
/// Some context frames are sticky - they can only explicitly cleared by specifying context id. Other (non sticky) context frames cleared after every assertion.
/// @param[in] context_descr context frame message
/// @param[in] sticky is this sticky frame or not
/// @returns id of the newly created frame
BOOST_TEST_DECL int add_context( lazy_ostream const& context_descr, bool sticky );
/// Erases context frame (when test exits context scope)
/// If context_id is passed clears that specific context frame identified by this id, otherwise clears all non sticky contexts.
BOOST_TEST_DECL void clear_context( int context_id = -1 );
/// Produces an instance of small "delegate" object, which facilitates access to collected context.
BOOST_TEST_DECL context_generator get_context();
/// @}
/// @name Access to registered test units.
/// @{
/// This function provides access to the master test suite.
/// There is only only master test suite per test module.
/// @returns a reference the master test suite instance
BOOST_TEST_DECL master_test_suite_t& master_test_suite();
/// This function provides an access to the test case currently being executed.
/// This function is only valid during test execution phase.
/// @see current_test_case_id
BOOST_TEST_DECL test_case const& current_test_case();
/// This function provides an access to an id of the test case currently being executed.
/// This function safer than current_test_case, cause if wont throw if no test case is being executed.
/// @see current_test_case
BOOST_TEST_DECL test_unit_id current_test_case_id(); /* safe version of above */
/// This function provides access to a test unit by id and type combination. It will throw if no test unit located.
/// @param[in] tu_id id of a test unit to locate
/// @param[in] tu_type type of a test unit to locate
/// @returns located test unit
BOOST_TEST_DECL test_unit& get( test_unit_id tu_id, test_unit_type tu_type );
/// This function template provides access to a typed test unit by id
/// It will throw if you specify incorrect test unit type
/// @tparam UnitType compile time type of test unit to get (test_suite or test_case)
/// @param id id of test unit to get
template<typename UnitType>
inline UnitType& get( test_unit_id id )
{
return static_cast<UnitType&>( get( id, static_cast<test_unit_type>(UnitType::type) ) );
}
///@}
/// @name Test initiation interface
/// @{
/// Initiates test execution
/// This function is used to start the test execution from a specific "root" test unit.
/// If no root provided, test is started from master test suite. This second argument facilitates an ability of the test cases to
/// start some other test units (primarily used internally for self testing).
/// @param[in] tu Optional id of the test unit or test unit itself from which the test is started. If absent, master test suite is used
/// @param[in] continue_test true == continue test if it was already started, false == restart the test from scratch regardless
BOOST_TEST_DECL void run( test_unit_id tu = INV_TEST_UNIT_ID, bool continue_test = true );
/// Initiates test execution. Same as other overload
BOOST_TEST_DECL void run( test_unit const* tu, bool continue_test = true );
/// @}
/// @name Test events dispatchers
/// @{
/// Reports results of assertion to all test observers
BOOST_TEST_DECL void assertion_result( unit_test::assertion_result ar );
/// Reports uncaught exception to all test observers
BOOST_TEST_DECL void exception_caught( execution_exception const& );
/// Reports aborted test unit to all test observers
BOOST_TEST_DECL void test_unit_aborted( test_unit const& );
/// @}
namespace impl {
// exclusively for self test
BOOST_TEST_DECL void setup_for_execution( test_unit const& );
BOOST_TEST_DECL void setup_loggers( );
} // namespace impl
// ************************************************************************** //
// ************** framework errors ************** //
// ************************************************************************** //
/// This exception type is used to report internal Boost.Test framework errors.
struct BOOST_TEST_DECL internal_error : public std::runtime_error {
internal_error( const_string m ) : std::runtime_error( std::string( m.begin(), m.size() ) ) {}
};
//____________________________________________________________________________//
/// This exception type is used to report test module setup errors.
struct BOOST_TEST_DECL setup_error : public std::runtime_error {
setup_error( const_string m ) : std::runtime_error( std::string( m.begin(), m.size() ) ) {}
};
#define BOOST_TEST_SETUP_ASSERT( cond, msg ) BOOST_TEST_I_ASSRT( cond, unit_test::framework::setup_error( msg ) )
//____________________________________________________________________________//
struct nothing_to_test {
explicit nothing_to_test( int rc ) : m_result_code( rc ) {}
int m_result_code;
};
//____________________________________________________________________________//
} // namespace framework
} // unit_test
} // namespace boost
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_FRAMEWORK_HPP_020805GER
@@ -0,0 +1,63 @@
# /* **************************************************************************
# * *
# * (C) Copyright Paul Mensonides 2002.
# * 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)
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_REPETITION_ENUM_TRAILING_HPP
# define BOOST_PREPROCESSOR_REPETITION_ENUM_TRAILING_HPP
#
# include <boost/preprocessor/cat.hpp>
# include <boost/preprocessor/config/config.hpp>
# include <boost/preprocessor/debug/error.hpp>
# include <boost/preprocessor/detail/auto_rec.hpp>
# include <boost/preprocessor/repetition/repeat.hpp>
# include <boost/preprocessor/tuple/elem.hpp>
# include <boost/preprocessor/tuple/rem.hpp>
#
# /* BOOST_PP_ENUM_TRAILING */
#
# if 0
# define BOOST_PP_ENUM_TRAILING(count, macro, data)
# endif
#
# define BOOST_PP_ENUM_TRAILING BOOST_PP_CAT(BOOST_PP_ENUM_TRAILING_, BOOST_PP_AUTO_REC(BOOST_PP_REPEAT_P, 4))
#
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
# define BOOST_PP_ENUM_TRAILING_1(c, m, d) BOOST_PP_REPEAT_1(c, BOOST_PP_ENUM_TRAILING_M_1, (m, d))
# define BOOST_PP_ENUM_TRAILING_2(c, m, d) BOOST_PP_REPEAT_2(c, BOOST_PP_ENUM_TRAILING_M_2, (m, d))
# define BOOST_PP_ENUM_TRAILING_3(c, m, d) BOOST_PP_REPEAT_3(c, BOOST_PP_ENUM_TRAILING_M_3, (m, d))
# else
# define BOOST_PP_ENUM_TRAILING_1(c, m, d) BOOST_PP_ENUM_TRAILING_1_I(c, m, d)
# define BOOST_PP_ENUM_TRAILING_2(c, m, d) BOOST_PP_ENUM_TRAILING_2_I(c, m, d)
# define BOOST_PP_ENUM_TRAILING_3(c, m, d) BOOST_PP_ENUM_TRAILING_3_I(c, m, d)
# define BOOST_PP_ENUM_TRAILING_1_I(c, m, d) BOOST_PP_REPEAT_1(c, BOOST_PP_ENUM_TRAILING_M_1, (m, d))
# define BOOST_PP_ENUM_TRAILING_2_I(c, m, d) BOOST_PP_REPEAT_2(c, BOOST_PP_ENUM_TRAILING_M_2, (m, d))
# define BOOST_PP_ENUM_TRAILING_3_I(c, m, d) BOOST_PP_REPEAT_3(c, BOOST_PP_ENUM_TRAILING_M_3, (m, d))
# endif
#
# define BOOST_PP_ENUM_TRAILING_4(c, m, d) BOOST_PP_ERROR(0x0003)
#
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
# define BOOST_PP_ENUM_TRAILING_M_1(z, n, md) BOOST_PP_ENUM_TRAILING_M_1_IM(z, n, BOOST_PP_TUPLE_REM_2 md)
# define BOOST_PP_ENUM_TRAILING_M_2(z, n, md) BOOST_PP_ENUM_TRAILING_M_2_IM(z, n, BOOST_PP_TUPLE_REM_2 md)
# define BOOST_PP_ENUM_TRAILING_M_3(z, n, md) BOOST_PP_ENUM_TRAILING_M_3_IM(z, n, BOOST_PP_TUPLE_REM_2 md)
# define BOOST_PP_ENUM_TRAILING_M_1_IM(z, n, im) BOOST_PP_ENUM_TRAILING_M_1_I(z, n, im)
# define BOOST_PP_ENUM_TRAILING_M_2_IM(z, n, im) BOOST_PP_ENUM_TRAILING_M_2_I(z, n, im)
# define BOOST_PP_ENUM_TRAILING_M_3_IM(z, n, im) BOOST_PP_ENUM_TRAILING_M_3_I(z, n, im)
# else
# define BOOST_PP_ENUM_TRAILING_M_1(z, n, md) BOOST_PP_ENUM_TRAILING_M_1_I(z, n, BOOST_PP_TUPLE_ELEM(2, 0, md), BOOST_PP_TUPLE_ELEM(2, 1, md))
# define BOOST_PP_ENUM_TRAILING_M_2(z, n, md) BOOST_PP_ENUM_TRAILING_M_2_I(z, n, BOOST_PP_TUPLE_ELEM(2, 0, md), BOOST_PP_TUPLE_ELEM(2, 1, md))
# define BOOST_PP_ENUM_TRAILING_M_3(z, n, md) BOOST_PP_ENUM_TRAILING_M_3_I(z, n, BOOST_PP_TUPLE_ELEM(2, 0, md), BOOST_PP_TUPLE_ELEM(2, 1, md))
# endif
#
# define BOOST_PP_ENUM_TRAILING_M_1_I(z, n, m, d) , m(z, n, d)
# define BOOST_PP_ENUM_TRAILING_M_2_I(z, n, m, d) , m(z, n, d)
# define BOOST_PP_ENUM_TRAILING_M_3_I(z, n, m, d) , m(z, n, d)
#
# endif
@@ -0,0 +1,453 @@
///////////////////////////////////////////////////////////////////////////////
/// \file decltype.hpp
/// Contains definition the BOOST_PROTO_DECLTYPE_() macro and assorted helpers
//
// Copyright 2008 Eric Niebler. 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)
#ifndef BOOST_PROTO_DETAIL_DECLTYPE_HPP_EAN_04_04_2008
#define BOOST_PROTO_DETAIL_DECLTYPE_HPP_EAN_04_04_2008
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/get_pointer.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_trailing_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#include <boost/preprocessor/iteration/local.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_class.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/is_pointer.hpp>
#include <boost/type_traits/is_function.hpp>
#include <boost/type_traits/is_member_object_pointer.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/typeof/typeof.hpp>
#include <boost/utility/addressof.hpp>
#include <boost/utility/result_of.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/proto/proto_fwd.hpp>
#include <boost/proto/detail/any.hpp>
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4714) // function 'xxx' marked as __forceinline not inlined
#endif
// We're STILL using Boost.Typeof on MSVC even for msvc-11.0 because of this bug:
// https://connect.microsoft.com/VisualStudio/feedback/details/765392/decltype-of-a-pointer-to-member-operator-gets-ref-qualification-wrong
#if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1700))
# define BOOST_PROTO_DECLTYPE_(EXPR, TYPE) typedef decltype((EXPR)) TYPE;
#else
# define BOOST_PROTO_DECLTYPE_NESTED_TYPEDEF_TPL_(NESTED, EXPR) \
BOOST_TYPEOF_NESTED_TYPEDEF_TPL(BOOST_PP_CAT(nested_and_hidden_, NESTED), EXPR) \
static int const BOOST_PP_CAT(sz, NESTED) = sizeof(boost::proto::detail::check_reference(EXPR));\
struct NESTED \
: boost::mpl::if_c< \
1 == BOOST_PP_CAT(sz, NESTED) \
, typename BOOST_PP_CAT(nested_and_hidden_, NESTED)::type & \
, typename BOOST_PP_CAT(nested_and_hidden_, NESTED)::type \
> \
{};
# define BOOST_PROTO_DECLTYPE_(EXPR, TYPE) \
BOOST_PROTO_DECLTYPE_NESTED_TYPEDEF_TPL_(BOOST_PP_CAT(nested_, TYPE), (EXPR)) \
typedef typename BOOST_PP_CAT(nested_, TYPE)::type TYPE;
#endif
namespace boost { namespace proto
{
namespace detail
{
////////////////////////////////////////////////////////////////////////////////////////////
template<typename T>
struct as_mutable
{
typedef T &type;
};
template<typename T>
struct as_mutable<T &>
{
typedef T &type;
};
template<typename T>
struct as_mutable<T const &>
{
typedef T &type;
};
////////////////////////////////////////////////////////////////////////////////////////////
template<typename T>
T make();
////////////////////////////////////////////////////////////////////////////////////////////
template<typename T>
typename as_mutable<T>::type make_mutable();
////////////////////////////////////////////////////////////////////////////////////////////
template<typename T>
struct subscript_wrapper
: T
{
using T::operator[];
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
any operator[](any const volatile &) const volatile;
#else
any operator[](any const &) const volatile;
#endif
};
////////////////////////////////////////////////////////////////////////////////////////////
template<typename T>
struct as_subscriptable
{
typedef
typename mpl::if_c<
is_class<T>::value
, subscript_wrapper<T>
, T
>::type
type;
};
template<typename T>
struct as_subscriptable<T const>
{
typedef
typename mpl::if_c<
is_class<T>::value
, subscript_wrapper<T> const
, T const
>::type
type;
};
template<typename T>
struct as_subscriptable<T &>
{
typedef
typename mpl::if_c<
is_class<T>::value
, subscript_wrapper<T> &
, T &
>::type
type;
};
template<typename T>
struct as_subscriptable<T const &>
{
typedef
typename mpl::if_c<
is_class<T>::value
, subscript_wrapper<T> const &
, T const &
>::type
type;
};
////////////////////////////////////////////////////////////////////////////////////////////
template<typename T>
typename as_subscriptable<T>::type make_subscriptable();
////////////////////////////////////////////////////////////////////////////////////////////
template<typename T>
char check_reference(T &);
template<typename T>
char (&check_reference(T const &))[2];
namespace has_get_pointerns
{
using boost::get_pointer;
void *(&get_pointer(...))[2];
////////////////////////////////////////////////////////////////////////////////////////////
template<typename T>
struct has_get_pointer
{
static const bool value = sizeof(void *) == sizeof(get_pointer(make<T &>()));
typedef mpl::bool_<value> type;
};
}
using has_get_pointerns::has_get_pointer;
////////////////////////////////////////////////////////////////////////////////////////////
template<typename T>
struct class_member_traits;
template<typename T, typename U>
struct class_member_traits<T U::*>
{
typedef U class_type;
typedef T result_type;
};
// Other specializations are generated by the preprocessor
#include <boost/proto/detail/class_member_traits.hpp>
////////////////////////////////////////////////////////////////////////////////////////////
template<typename T>
T &lvalue(T &t)
{
return t;
}
template<typename T>
T const &lvalue(T const &t)
{
return t;
}
////////////////////////////////////////////////////////////////////////////////////////////
template<typename U, typename V, typename T>
U *proto_get_pointer(T &t, V *, U *)
{
return boost::addressof(t);
}
template<typename U, typename V, typename T>
U const *proto_get_pointer(T &t, V *, U const *)
{
return boost::addressof(t);
}
template<typename U, typename V, typename T>
V *proto_get_pointer(T &t, V *, ...)
{
return get_pointer(t);
}
////////////////////////////////////////////////////////////////////////////////////////////
#define BOOST_PROTO_USE_GET_POINTER() \
using namespace boost::proto::detail::get_pointerns \
/**/
#define BOOST_PROTO_GET_POINTER(Type, Obj) \
boost::proto::detail::proto_get_pointer<Type>( \
boost::proto::detail::lvalue(Obj) \
, (true ? 0 : get_pointer(Obj)) \
, (true ? 0 : boost::addressof(boost::proto::detail::lvalue(Obj))) \
) \
/**/
////////////////////////////////////////////////////////////////////////////////////////////
namespace get_pointerns
{
using boost::get_pointer;
template<typename T>
typename disable_if_c<has_get_pointer<T>::value, T *>::type
get_pointer(T &t)
{
return boost::addressof(t);
}
template<typename T>
typename disable_if_c<has_get_pointer<T>::value, T const *>::type
get_pointer(T const &t)
{
return boost::addressof(t);
}
char test_ptr_to_const(void *);
char (&test_ptr_to_const(void const *))[2];
template<typename U> char test_V_is_a_U(U *);
template<typename U> char test_V_is_a_U(U const *);
template<typename U> char (&test_V_is_a_U(...))[2];
////////////////////////////////////////////////////////////////////////////////////////////
// result_of_ is a wrapper around boost::result_of that also handles "invocations" of
// member object pointers.
template<typename T, typename Void = void>
struct result_of_
: BOOST_PROTO_RESULT_OF<T>
{};
template<typename T, typename U, typename V>
struct result_of_<T U::*(V), typename enable_if_c<is_member_object_pointer<T U::*>::value>::type>
{
static const bool is_V_a_smart_ptr = 2 == sizeof(test_V_is_a_U<U>(&lvalue(make<V>())));
static const bool is_ptr_to_const = 2 == sizeof(test_ptr_to_const(BOOST_PROTO_GET_POINTER(U, make<V>())));
// If V is not a U, then it is a (smart) pointer and we can always return an lvalue.
// Otherwise, we can only return an lvalue if we are given one.
typedef
typename mpl::eval_if_c<
(is_V_a_smart_ptr || is_reference<V>::value)
, mpl::eval_if_c<
is_ptr_to_const
, add_reference<typename add_const<T>::type>
, add_reference<T>
>
, mpl::identity<T>
>::type
type;
};
////////////////////////////////////////////////////////////////////////////////////////////
template<
typename T
, typename U
, bool IsMemPtr = is_member_object_pointer<
typename remove_reference<U>::type
>::value
>
struct mem_ptr_fun
{
BOOST_PROTO_DECLTYPE_(
proto::detail::make_mutable<T>() ->* proto::detail::make<U>()
, result_type
)
result_type operator()(
typename add_reference<typename add_const<T>::type>::type t
, typename add_reference<typename add_const<U>::type>::type u
) const
{
return t ->* u;
}
};
////////////////////////////////////////////////////////////////////////////////////////////
template<typename T, typename U>
struct mem_ptr_fun<T, U, true>
{
typedef
typename class_member_traits<
typename uncvref<U>::type
>::class_type
V;
BOOST_PROTO_DECLTYPE_(
BOOST_PROTO_GET_POINTER(V, proto::detail::make_mutable<T>()) ->* proto::detail::make<U>()
, result_type
)
result_type operator()(
typename add_reference<typename add_const<T>::type>::type t
, U u
) const
{
return BOOST_PROTO_GET_POINTER(V, t) ->* u;
}
};
}
using get_pointerns::result_of_;
using get_pointerns::mem_ptr_fun;
////////////////////////////////////////////////////////////////////////////////////////////
template<typename A0, typename A1>
struct comma_result
{
BOOST_PROTO_DECLTYPE_((proto::detail::make<A0>(), proto::detail::make<A1>()), type)
};
template<typename A0>
struct comma_result<A0, void>
{
typedef void type;
};
template<typename A1>
struct comma_result<void, A1>
{
typedef A1 type;
};
template<>
struct comma_result<void, void>
{
typedef void type;
};
////////////////////////////////////////////////////////////////////////////////////////////
// normalize a function type for use with boost::result_of
template<typename T, typename U = T>
struct result_of_fixup
: mpl::if_c<is_function<T>::value, T *, U>
{};
template<typename T, typename U>
struct result_of_fixup<T &, U>
: result_of_fixup<T, T>
{};
template<typename T, typename U>
struct result_of_fixup<T const &, U>
: result_of_fixup<T, T>
{};
template<typename T, typename U>
struct result_of_fixup<T *, U>
: result_of_fixup<T, U>
{};
template<typename R, typename T, typename U>
struct result_of_fixup<R T::*, U>
{
typedef R T::*type;
};
template<typename T, typename U>
struct result_of_fixup<T const, U>
: result_of_fixup<T, U>
{};
//// Tests for result_of_fixup
//struct bar {};
//BOOST_MPL_ASSERT((is_same<bar, result_of_fixup<bar>::type>));
//BOOST_MPL_ASSERT((is_same<bar const, result_of_fixup<bar const>::type>));
//BOOST_MPL_ASSERT((is_same<bar, result_of_fixup<bar &>::type>));
//BOOST_MPL_ASSERT((is_same<bar const, result_of_fixup<bar const &>::type>));
//BOOST_MPL_ASSERT((is_same<void(*)(), result_of_fixup<void(*)()>::type>));
//BOOST_MPL_ASSERT((is_same<void(*)(), result_of_fixup<void(* const)()>::type>));
//BOOST_MPL_ASSERT((is_same<void(*)(), result_of_fixup<void(* const &)()>::type>));
//BOOST_MPL_ASSERT((is_same<void(*)(), result_of_fixup<void(&)()>::type>));
template<typename T, typename PMF>
struct memfun
{
typedef typename uncvref<PMF>::type pmf_type;
typedef typename class_member_traits<pmf_type>::class_type V;
typedef typename class_member_traits<pmf_type>::result_type result_type;
memfun(T t, pmf_type p)
: obj(t)
, pmf(p)
{}
result_type operator()() const
{
BOOST_PROTO_USE_GET_POINTER();
return (BOOST_PROTO_GET_POINTER(V, obj) ->* pmf)();
}
// Other overloads generated by the preprocessor
#include <boost/proto/detail/memfun_funop.hpp>
private:
T obj;
pmf_type pmf;
};
} // namespace detail
}}
#if defined(_MSC_VER)
# pragma warning(pop)
#endif
#endif
@@ -0,0 +1,122 @@
// (C) Copyright John Maddock 2000.
// 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).
//
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
#ifndef BOOST_TT_IS_POLYMORPHIC_HPP
#define BOOST_TT_IS_POLYMORPHIC_HPP
#include <boost/type_traits/intrinsics.hpp>
#include <boost/type_traits/integral_constant.hpp>
#ifndef BOOST_IS_POLYMORPHIC
#include <boost/type_traits/is_class.hpp>
#endif
#include <boost/detail/workaround.hpp>
#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1700)
#pragma warning(push)
#pragma warning(disable:4250)
#endif
namespace boost{
#ifndef BOOST_IS_POLYMORPHIC
namespace detail{
template <class T>
struct is_polymorphic_imp1
{
# if BOOST_WORKAROUND(__MWERKS__, <= 0x2407) // CWPro7 should return false always.
typedef char d1, (&d2)[2];
# else
struct d1 : public T
{
d1();
# if !defined(__GNUC__) // this raises warnings with some classes, and buys nothing with GCC
~d1()throw();
# endif
char padding[256];
private:
// keep some picky compilers happy:
d1(const d1&);
d1& operator=(const d1&);
};
struct d2 : public T
{
d2();
virtual ~d2()throw();
# if !defined(BOOST_MSVC) && !defined(__ICL)
// for some reason this messes up VC++ when T has virtual bases,
// probably likewise for compilers that use the same ABI:
struct unique{};
virtual void unique_name_to_boost5487629(unique*);
# endif
char padding[256];
private:
// keep some picky compilers happy:
d2(const d2&);
d2& operator=(const d2&);
};
# endif
BOOST_STATIC_CONSTANT(bool, value = (sizeof(d2) == sizeof(d1)));
};
template <class T> struct is_polymorphic_imp1<T const> : public is_polymorphic_imp1<T>{};
template <class T> struct is_polymorphic_imp1<T const volatile> : public is_polymorphic_imp1<T>{};
template <class T> struct is_polymorphic_imp1<T volatile> : public is_polymorphic_imp1<T>{};
template <class T>
struct is_polymorphic_imp2
{
BOOST_STATIC_CONSTANT(bool, value = false);
};
template <bool is_class>
struct is_polymorphic_selector
{
template <class T>
struct rebind
{
typedef is_polymorphic_imp2<T> type;
};
};
template <>
struct is_polymorphic_selector<true>
{
template <class T>
struct rebind
{
typedef is_polymorphic_imp1<T> type;
};
};
template <class T>
struct is_polymorphic_imp
{
typedef is_polymorphic_selector< ::boost::is_class<T>::value> selector;
typedef typename selector::template rebind<T> binder;
typedef typename binder::type imp_type;
BOOST_STATIC_CONSTANT(bool, value = imp_type::value);
};
} // namespace detail
template <class T> struct is_polymorphic : public integral_constant<bool, ::boost::detail::is_polymorphic_imp<T>::value> {};
#else // BOOST_IS_POLYMORPHIC
template <class T> struct is_polymorphic : public integral_constant<bool, BOOST_IS_POLYMORPHIC(T)> {};
#endif
} // namespace boost
#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1700)
#pragma warning(pop)
#endif
#endif
@@ -0,0 +1,30 @@
// Boost.Range library
//
// Copyright Thorsten Ottosen 2003-2004. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// For more information, see http://www.boost.org/libs/range/
//
#ifndef BOOST_RANGE_VALUE_TYPE_HPP
#define BOOST_RANGE_VALUE_TYPE_HPP
#if defined(_MSC_VER)
# pragma once
#endif
#include <boost/range/config.hpp>
#include <boost/range/iterator.hpp>
#include <boost/iterator/iterator_traits.hpp>
namespace boost
{
template< class T >
struct range_value : iterator_value< typename range_iterator<T>::type >
{ };
}
#endif
@@ -0,0 +1,38 @@
subroutine grid2deg(grid0,dlong,dlat)
! Converts Maidenhead grid locator to degrees of West longitude
! and North latitude.
character*6 grid0,grid
character*1 g1,g2,g3,g4,g5,g6
grid=grid0
i=ichar(grid(5:5))
if(grid(5:5).eq.' ' .or. i.le.64 .or. i.ge.128) grid(5:6)='mm'
if(grid(1:1).ge.'a' .and. grid(1:1).le.'z') grid(1:1)= &
char(ichar(grid(1:1))+ichar('A')-ichar('a'))
if(grid(2:2).ge.'a' .and. grid(2:2).le.'z') grid(2:2)= &
char(ichar(grid(2:2))+ichar('A')-ichar('a'))
if(grid(5:5).ge.'A' .and. grid(5:5).le.'Z') grid(5:5)= &
char(ichar(grid(5:5))-ichar('A')+ichar('a'))
if(grid(6:6).ge.'A' .and. grid(6:6).le.'Z') grid(6:6)= &
char(ichar(grid(6:6))-ichar('A')+ichar('a'))
g1=grid(1:1)
g2=grid(2:2)
g3=grid(3:3)
g4=grid(4:4)
g5=grid(5:5)
g6=grid(6:6)
nlong = 180 - 20*(ichar(g1)-ichar('A'))
n20d = 2*(ichar(g3)-ichar('0'))
xminlong = 5*(ichar(g5)-ichar('a')+0.5)
dlong = nlong - n20d - xminlong/60.0
nlat = -90+10*(ichar(g2)-ichar('A')) + ichar(g4)-ichar('0')
xminlat = 2.5*(ichar(g6)-ichar('a')+0.5)
dlat = nlat + xminlat/60.0
return
end subroutine grid2deg
@@ -0,0 +1,58 @@
/*=============================================================================
Copyright (c) 2014 Kohei Takahashi
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)
==============================================================================*/
#ifndef FUSION_VALUE_AT_IMPL_16122014_1641
#define FUSION_VALUE_AT_IMPL_16122014_1641
#include <boost/config.hpp>
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/detail/config.hpp>
///////////////////////////////////////////////////////////////////////////////
// Without variadics, we will use the PP version
///////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
# include <boost/fusion/container/vector/detail/cpp03/value_at_impl.hpp>
#else
///////////////////////////////////////////////////////////////////////////////
// C++11 interface
///////////////////////////////////////////////////////////////////////////////
#include <boost/fusion/container/vector/vector_fwd.hpp>
#include <boost/type_traits/declval.hpp>
#include <boost/type_traits/remove_cv.hpp>
namespace boost { namespace fusion
{
struct vector_tag;
namespace vector_detail
{
template <typename I, typename ...T>
struct vector_data;
}
namespace extension
{
template <typename Tag>
struct value_at_impl;
template <>
struct value_at_impl<vector_tag>
{
template <typename Sequence, typename N>
struct apply
{
typedef typename boost::remove_cv<Sequence>::type seq;
typedef typename mpl::identity<decltype(seq::template value_at_impl<N::value>(boost::declval<seq*>()))>::type::type type;
};
};
}
}}
#endif
#endif
@@ -0,0 +1,89 @@
////////////////////////////////////////////////////////////////////
//
// Copyright Vicente J. Botet Escriba 2010
//
// 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)
//
// See http://www.boost.org/libs/mpl for documentation.
//
////////////////////////////////////////////////////////////////////
#ifndef BOOST_MPL_ABS_HPP_INCLUDED
#define BOOST_MPL_ABS_HPP_INCLUDED
#include <boost/mpl/integral_c.hpp>
#include <boost/mpl/aux_/na_spec.hpp>
#include <boost/mpl/aux_/lambda_support.hpp>
#include <boost/mpl/aux_/config/integral.hpp>
#include <boost/mpl/aux_/config/static_constant.hpp>
#if !defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2) \
&& !defined(BOOST_MPL_PREPROCESSING_MODE) \
&& !defined(__CUDACC__) \
&& ( defined(BOOST_MSVC) \
|| BOOST_WORKAROUND(__EDG_VERSION__, <= 238) \
)
# define BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2
#endif
namespace boost { namespace mpl {
template< typename Tag > struct abs_impl;
template< typename T > struct abs_tag
{
typedef typename T::tag type;
};
template<
typename BOOST_MPL_AUX_NA_PARAM(N)
>
struct abs
: abs_impl<
typename abs_tag<N>::type
>::template apply<N>::type
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(1, abs, (N))
};
BOOST_MPL_AUX_NA_SPEC(1, abs)
template<
typename T
, T n1
>
struct abs_c
: abs<integral_c<T,n1> >
{
};
#if defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2)
namespace aux {
template< typename T, T n > struct abs_wknd
{
BOOST_STATIC_CONSTANT(T, value = (n < 0 ? -n : n));
typedef integral_c<T,value> type;
};
}
#endif
template<>
struct abs_impl<integral_c_tag>
{
#if defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2)
template< typename N > struct apply
: aux::abs_wknd< typename N::value_type, N::value >
#else
template< typename N > struct apply
: integral_c< typename N::value_type, ((N::value < 0) ? (-N::value) : N::value ) >
#endif
{
};
};
}}
#endif // BOOST_MPL_ABS_HPP_INCLUDED
@@ -0,0 +1,96 @@
// (C) Copyright John Maddock 2005.
// 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_MATH_COMPLEX_DETAILS_INCLUDED
#define BOOST_MATH_COMPLEX_DETAILS_INCLUDED
//
// This header contains all the support code that is common to the
// inverse trig complex functions, it also contains all the includes
// that we need to implement all these functions.
//
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/config/no_tr1/complex.hpp>
#include <boost/limits.hpp>
#include <math.h> // isnan where available
#include <boost/config/no_tr1/cmath.hpp>
#include <boost/math/special_functions/sign.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/math/special_functions/sign.hpp>
#include <boost/math/constants/constants.hpp>
#ifdef BOOST_NO_STDC_NAMESPACE
namespace std{ using ::sqrt; }
#endif
namespace boost{ namespace math{ namespace detail{
template <class T>
inline T mult_minus_one(const T& t)
{
return (boost::math::isnan)(t) ? t : (boost::math::changesign)(t);
}
template <class T>
inline std::complex<T> mult_i(const std::complex<T>& t)
{
return std::complex<T>(mult_minus_one(t.imag()), t.real());
}
template <class T>
inline std::complex<T> mult_minus_i(const std::complex<T>& t)
{
return std::complex<T>(t.imag(), mult_minus_one(t.real()));
}
template <class T>
inline T safe_max(T t)
{
return std::sqrt((std::numeric_limits<T>::max)()) / t;
}
inline long double safe_max(long double t)
{
// long double sqrt often returns infinity due to
// insufficient internal precision:
return std::sqrt((std::numeric_limits<double>::max)()) / t;
}
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
// workaround for type deduction bug:
inline float safe_max(float t)
{
return std::sqrt((std::numeric_limits<float>::max)()) / t;
}
inline double safe_max(double t)
{
return std::sqrt((std::numeric_limits<double>::max)()) / t;
}
#endif
template <class T>
inline T safe_min(T t)
{
return std::sqrt((std::numeric_limits<T>::min)()) * t;
}
inline long double safe_min(long double t)
{
// long double sqrt often returns zero due to
// insufficient internal precision:
return std::sqrt((std::numeric_limits<double>::min)()) * t;
}
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
// type deduction workaround:
inline double safe_min(double t)
{
return std::sqrt((std::numeric_limits<double>::min)()) * t;
}
inline float safe_min(float t)
{
return std::sqrt((std::numeric_limits<float>::min)()) * t;
}
#endif
} } } // namespaces
#endif // BOOST_MATH_COMPLEX_DETAILS_INCLUDED
@@ -0,0 +1,666 @@
/////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2007-2014
//
// 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)
//
// See http://www.boost.org/libs/intrusive for documentation.
//
/////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_INTRUSIVE_SPLAYTREE_HPP
#define BOOST_INTRUSIVE_SPLAYTREE_HPP
#include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/intrusive_fwd.hpp>
#include <cstddef>
#include <boost/intrusive/detail/minimal_less_equal_header.hpp>
#include <boost/intrusive/detail/minimal_pair_header.hpp> //std::pair
#include <boost/static_assert.hpp>
#include <boost/intrusive/bstree.hpp>
#include <boost/intrusive/detail/tree_node.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/detail/function_detector.hpp>
#include <boost/intrusive/detail/get_value_traits.hpp>
#include <boost/intrusive/splaytree_algorithms.hpp>
#include <boost/intrusive/link_mode.hpp>
#include <boost/intrusive/detail/key_nodeptr_comp.hpp>
#include <boost/move/utility_core.hpp>
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
namespace boost {
namespace intrusive {
/// @cond
struct splaytree_defaults
: bstree_defaults
{};
/// @endcond
//! The class template splaytree is an intrusive splay tree container that
//! is used to construct intrusive splay_set and splay_multiset containers. The no-throw
//! guarantee holds only, if the key_compare object
//! doesn't throw.
//!
//! The template parameter \c T is the type to be managed by the container.
//! The user can specify additional options and if no options are provided
//! default options are used.
//!
//! The container supports the following options:
//! \c base_hook<>/member_hook<>/value_traits<>,
//! \c constant_time_size<>, \c size_type<> and
//! \c compare<>.
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class T, class ...Options>
#else
template<class ValueTraits, class VoidOrKeyOfValue, class VoidOrKeyComp, class SizeType, bool ConstantTimeSize, typename HeaderHolder>
#endif
class splaytree_impl
/// @cond
: public bstree_impl<ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, SizeType, ConstantTimeSize, SplayTreeAlgorithms, HeaderHolder>
/// @endcond
{
public:
typedef ValueTraits value_traits;
/// @cond
typedef bstree_impl< ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, SizeType
, ConstantTimeSize, SplayTreeAlgorithms
, HeaderHolder> tree_type;
typedef tree_type implementation_defined;
/// @endcond
typedef typename implementation_defined::pointer pointer;
typedef typename implementation_defined::const_pointer const_pointer;
typedef typename implementation_defined::value_type value_type;
typedef typename implementation_defined::key_type key_type;
typedef typename implementation_defined::key_of_value key_of_value;
typedef typename implementation_defined::reference reference;
typedef typename implementation_defined::const_reference const_reference;
typedef typename implementation_defined::difference_type difference_type;
typedef typename implementation_defined::size_type size_type;
typedef typename implementation_defined::value_compare value_compare;
typedef typename implementation_defined::key_compare key_compare;
typedef typename implementation_defined::iterator iterator;
typedef typename implementation_defined::const_iterator const_iterator;
typedef typename implementation_defined::reverse_iterator reverse_iterator;
typedef typename implementation_defined::const_reverse_iterator const_reverse_iterator;
typedef typename implementation_defined::node_traits node_traits;
typedef typename implementation_defined::node node;
typedef typename implementation_defined::node_ptr node_ptr;
typedef typename implementation_defined::const_node_ptr const_node_ptr;
typedef typename implementation_defined::node_algorithms node_algorithms;
static const bool constant_time_size = implementation_defined::constant_time_size;
/// @cond
private:
//noncopyable
BOOST_MOVABLE_BUT_NOT_COPYABLE(splaytree_impl)
/// @endcond
public:
typedef typename implementation_defined::insert_commit_data insert_commit_data;
//! @copydoc ::boost::intrusive::bstree::bstree()
splaytree_impl()
: tree_type()
{}
//! @copydoc ::boost::intrusive::bstree::bstree(const key_compare &,const value_traits &)
explicit splaytree_impl( const key_compare &cmp, const value_traits &v_traits = value_traits())
: tree_type(cmp, v_traits)
{}
//! @copydoc ::boost::intrusive::bstree::bstree(bool,Iterator,Iterator,const key_compare &,const value_traits &)
template<class Iterator>
splaytree_impl( bool unique, Iterator b, Iterator e
, const key_compare &cmp = key_compare()
, const value_traits &v_traits = value_traits())
: tree_type(cmp, v_traits)
{
if(unique)
this->insert_unique(b, e);
else
this->insert_equal(b, e);
}
//! @copydoc ::boost::intrusive::bstree::bstree(bstree &&)
splaytree_impl(BOOST_RV_REF(splaytree_impl) x)
: tree_type(BOOST_MOVE_BASE(tree_type, x))
{}
//! @copydoc ::boost::intrusive::bstree::operator=(bstree &&)
splaytree_impl& operator=(BOOST_RV_REF(splaytree_impl) x)
{ return static_cast<splaytree_impl&>(tree_type::operator=(BOOST_MOVE_BASE(tree_type, x))); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
//! @copydoc ::boost::intrusive::bstree::~bstree()
~splaytree_impl();
//! @copydoc ::boost::intrusive::bstree::begin()
iterator begin();
//! @copydoc ::boost::intrusive::bstree::begin()const
const_iterator begin() const;
//! @copydoc ::boost::intrusive::bstree::cbegin()const
const_iterator cbegin() const;
//! @copydoc ::boost::intrusive::bstree::end()
iterator end();
//! @copydoc ::boost::intrusive::bstree::end()const
const_iterator end() const;
//! @copydoc ::boost::intrusive::bstree::cend()const
const_iterator cend() const;
//! @copydoc ::boost::intrusive::bstree::rbegin()
reverse_iterator rbegin();
//! @copydoc ::boost::intrusive::bstree::rbegin()const
const_reverse_iterator rbegin() const;
//! @copydoc ::boost::intrusive::bstree::crbegin()const
const_reverse_iterator crbegin() const;
//! @copydoc ::boost::intrusive::bstree::rend()
reverse_iterator rend();
//! @copydoc ::boost::intrusive::bstree::rend()const
const_reverse_iterator rend() const;
//! @copydoc ::boost::intrusive::bstree::crend()const
const_reverse_iterator crend() const;
//! @copydoc ::boost::intrusive::bstree::root()
iterator root();
//! @copydoc ::boost::intrusive::bstree::root()const
const_iterator root() const;
//! @copydoc ::boost::intrusive::bstree::croot()const
const_iterator croot() const;
//! @copydoc ::boost::intrusive::bstree::container_from_end_iterator(iterator)
static splaytree_impl &container_from_end_iterator(iterator end_iterator);
//! @copydoc ::boost::intrusive::bstree::container_from_end_iterator(const_iterator)
static const splaytree_impl &container_from_end_iterator(const_iterator end_iterator);
//! @copydoc ::boost::intrusive::bstree::container_from_iterator(iterator)
static splaytree_impl &container_from_iterator(iterator it);
//! @copydoc ::boost::intrusive::bstree::container_from_iterator(const_iterator)
static const splaytree_impl &container_from_iterator(const_iterator it);
//! @copydoc ::boost::intrusive::bstree::key_comp()const
key_compare key_comp() const;
//! @copydoc ::boost::intrusive::bstree::value_comp()const
value_compare value_comp() const;
//! @copydoc ::boost::intrusive::bstree::empty()const
bool empty() const;
//! @copydoc ::boost::intrusive::bstree::size()const
size_type size() const;
//! @copydoc ::boost::intrusive::bstree::swap
void swap(splaytree_impl& other);
//! @copydoc ::boost::intrusive::bstree::clone_from(const bstree&,Cloner,Disposer)
//! Additional notes: it also copies the alpha factor from the source container.
template <class Cloner, class Disposer>
void clone_from(const splaytree_impl &src, Cloner cloner, Disposer disposer);
#else //BOOST_INTRUSIVE_DOXYGEN_INVOKED
using tree_type::clone_from;
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
//! @copydoc ::boost::intrusive::bstree::clone_from(bstree&&,Cloner,Disposer)
template <class Cloner, class Disposer>
void clone_from(BOOST_RV_REF(splaytree_impl) src, Cloner cloner, Disposer disposer)
{ tree_type::clone_from(BOOST_MOVE_BASE(tree_type, src), cloner, disposer); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
//! @copydoc ::boost::intrusive::bstree::insert_equal(reference)
iterator insert_equal(reference value);
//! @copydoc ::boost::intrusive::bstree::insert_equal(const_iterator,reference)
iterator insert_equal(const_iterator hint, reference value);
//! @copydoc ::boost::intrusive::bstree::insert_equal(Iterator,Iterator)
template<class Iterator>
void insert_equal(Iterator b, Iterator e);
//! @copydoc ::boost::intrusive::bstree::insert_unique(reference)
std::pair<iterator, bool> insert_unique(reference value);
//! @copydoc ::boost::intrusive::bstree::insert_unique(const_iterator,reference)
iterator insert_unique(const_iterator hint, reference value);
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const key_type&,insert_commit_data&)
std::pair<iterator, bool> insert_unique_check
(const key_type &key, insert_commit_data &commit_data);
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const_iterator,const key_type&,insert_commit_data&)
std::pair<iterator, bool> insert_unique_check
(const_iterator hint, const key_type &key, insert_commit_data &commit_data);
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
template<class KeyType, class KeyTypeKeyCompare>
std::pair<iterator, bool> insert_unique_check
(const KeyType &key, KeyTypeKeyCompare comp, insert_commit_data &commit_data);
//! @copydoc ::boost::intrusive::bstree::insert_unique_check(const_iterator,const KeyType&,KeyTypeKeyCompare,insert_commit_data&)
template<class KeyType, class KeyTypeKeyCompare>
std::pair<iterator, bool> insert_unique_check
(const_iterator hint, const KeyType &key
,KeyTypeKeyCompare comp, insert_commit_data &commit_data);
//! @copydoc ::boost::intrusive::bstree::insert_unique_commit
iterator insert_unique_commit(reference value, const insert_commit_data &commit_data);
//! @copydoc ::boost::intrusive::bstree::insert_unique(Iterator,Iterator)
template<class Iterator>
void insert_unique(Iterator b, Iterator e);
//! @copydoc ::boost::intrusive::bstree::insert_before
iterator insert_before(const_iterator pos, reference value);
//! @copydoc ::boost::intrusive::bstree::push_back
void push_back(reference value);
//! @copydoc ::boost::intrusive::bstree::push_front
void push_front(reference value);
//! @copydoc ::boost::intrusive::bstree::erase(const_iterator)
iterator erase(const_iterator i);
//! @copydoc ::boost::intrusive::bstree::erase(const_iterator,const_iterator)
iterator erase(const_iterator b, const_iterator e);
//! @copydoc ::boost::intrusive::bstree::erase(const key_type &)
size_type erase(const key_type &key);
//! @copydoc ::boost::intrusive::bstree::erase(const KeyType&,KeyTypeKeyCompare)
template<class KeyType, class KeyTypeKeyCompare>
size_type erase(const KeyType& key, KeyTypeKeyCompare comp);
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_iterator,Disposer)
template<class Disposer>
iterator erase_and_dispose(const_iterator i, Disposer disposer);
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const_iterator,const_iterator,Disposer)
template<class Disposer>
iterator erase_and_dispose(const_iterator b, const_iterator e, Disposer disposer);
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const key_type &, Disposer)
template<class Disposer>
size_type erase_and_dispose(const key_type &key, Disposer disposer);
//! @copydoc ::boost::intrusive::bstree::erase_and_dispose(const KeyType&,KeyTypeKeyCompare,Disposer)
template<class KeyType, class KeyTypeKeyCompare, class Disposer>
size_type erase_and_dispose(const KeyType& key, KeyTypeKeyCompare comp, Disposer disposer);
//! @copydoc ::boost::intrusive::bstree::clear
void clear();
//! @copydoc ::boost::intrusive::bstree::clear_and_dispose
template<class Disposer>
void clear_and_dispose(Disposer disposer);
//! @copydoc ::boost::intrusive::bstree::count(const key_type &)const
//! Additional note: non-const function, splaying is performed.
size_type count(const key_type &key);
//! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyTypeKeyCompare)const
//! Additional note: non-const function, splaying is performed.
template<class KeyType, class KeyTypeKeyCompare>
size_type count(const KeyType &key, KeyTypeKeyCompare comp);
//! @copydoc ::boost::intrusive::bstree::count(const key_type &)const
//! Additional note: const function, no splaying is performed
size_type count(const key_type &key) const;
//! @copydoc ::boost::intrusive::bstree::count(const KeyType&,KeyTypeKeyCompare)const
//! Additional note: const function, no splaying is performed
template<class KeyType, class KeyTypeKeyCompare>
size_type count(const KeyType &key, KeyTypeKeyCompare comp) const;
//! @copydoc ::boost::intrusive::bstree::lower_bound(const key_type &)
//! Additional note: non-const function, splaying is performed.
iterator lower_bound(const key_type &key);
//! @copydoc ::boost::intrusive::bstree::lower_bound(const key_type &)const
//! Additional note: const function, no splaying is performed
const_iterator lower_bound(const key_type &key) const;
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyTypeKeyCompare)
//! Additional note: non-const function, splaying is performed for the first
//! element of the equal range of "key"
template<class KeyType, class KeyTypeKeyCompare>
iterator lower_bound(const KeyType &key, KeyTypeKeyCompare comp);
//! @copydoc ::boost::intrusive::bstree::lower_bound(const KeyType&,KeyTypeKeyCompare)const
//! Additional note: const function, no splaying is performed
template<class KeyType, class KeyTypeKeyCompare>
const_iterator lower_bound(const KeyType &key, KeyTypeKeyCompare comp) const;
//! @copydoc ::boost::intrusive::bstree::upper_bound(const key_type &)
//! Additional note: non-const function, splaying is performed for the first
//! element of the equal range of "value"
iterator upper_bound(const key_type &key);
//! @copydoc ::boost::intrusive::bstree::upper_bound(const key_type &)const
//! Additional note: const function, no splaying is performed
const_iterator upper_bound(const key_type &key) const;
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyTypeKeyCompare)
//! Additional note: non-const function, splaying is performed for the first
//! element of the equal range of "key"
template<class KeyType, class KeyTypeKeyCompare>
iterator upper_bound(const KeyType &key, KeyTypeKeyCompare comp);
//! @copydoc ::boost::intrusive::bstree::upper_bound(const KeyType&,KeyTypeKeyCompare)const
//! Additional note: const function, no splaying is performed
template<class KeyType, class KeyTypeKeyCompare>
const_iterator upper_bound(const KeyType &key, KeyTypeKeyCompare comp) const;
//! @copydoc ::boost::intrusive::bstree::find(const key_type &)
//! Additional note: non-const function, splaying is performed for the first
//! element of the equal range of "value"
iterator find(const key_type &key);
//! @copydoc ::boost::intrusive::bstree::find(const key_type &)const
//! Additional note: const function, no splaying is performed
const_iterator find(const key_type &key) const;
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyTypeKeyCompare)
//! Additional note: non-const function, splaying is performed for the first
//! element of the equal range of "key"
template<class KeyType, class KeyTypeKeyCompare>
iterator find(const KeyType &key, KeyTypeKeyCompare comp);
//! @copydoc ::boost::intrusive::bstree::find(const KeyType&,KeyTypeKeyCompare)const
//! Additional note: const function, no splaying is performed
template<class KeyType, class KeyTypeKeyCompare>
const_iterator find(const KeyType &key, KeyTypeKeyCompare comp) const;
//! @copydoc ::boost::intrusive::bstree::equal_range(const key_type &)
//! Additional note: non-const function, splaying is performed for the first
//! element of the equal range of "value"
std::pair<iterator, iterator> equal_range(const key_type &key);
//! @copydoc ::boost::intrusive::bstree::equal_range(const key_type &)const
//! Additional note: const function, no splaying is performed
std::pair<const_iterator, const_iterator> equal_range(const key_type &key) const;
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyTypeKeyCompare)
//! Additional note: non-const function, splaying is performed for the first
//! element of the equal range of "key"
template<class KeyType, class KeyTypeKeyCompare>
std::pair<iterator, iterator> equal_range(const KeyType &key, KeyTypeKeyCompare comp);
//! @copydoc ::boost::intrusive::bstree::equal_range(const KeyType&,KeyTypeKeyCompare)const
//! Additional note: const function, no splaying is performed
template<class KeyType, class KeyTypeKeyCompare>
std::pair<const_iterator, const_iterator> equal_range(const KeyType &key, KeyTypeKeyCompare comp) const;
//! @copydoc ::boost::intrusive::bstree::bounded_range(const key_type &,const key_type &,bool,bool)
std::pair<iterator,iterator> bounded_range
(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed);
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)
template<class KeyType, class KeyTypeKeyCompare>
std::pair<iterator,iterator> bounded_range
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed);
//! @copydoc ::boost::intrusive::bstree::bounded_range(const key_type &,const key_type &,bool,bool)const
std::pair<const_iterator, const_iterator> bounded_range
(const key_type &lower_key, const key_type &upper_key, bool left_closed, bool right_closed) const;
//! @copydoc ::boost::intrusive::bstree::bounded_range(const KeyType&,const KeyType&,KeyTypeKeyCompare,bool,bool)const
template<class KeyType, class KeyTypeKeyCompare>
std::pair<const_iterator, const_iterator> bounded_range
(const KeyType& lower_key, const KeyType& upper_key, KeyTypeKeyCompare comp, bool left_closed, bool right_closed) const;
//! @copydoc ::boost::intrusive::bstree::s_iterator_to(reference)
static iterator s_iterator_to(reference value);
//! @copydoc ::boost::intrusive::bstree::s_iterator_to(const_reference)
static const_iterator s_iterator_to(const_reference value);
//! @copydoc ::boost::intrusive::bstree::iterator_to(reference)
iterator iterator_to(reference value);
//! @copydoc ::boost::intrusive::bstree::iterator_to(const_reference)const
const_iterator iterator_to(const_reference value) const;
//! @copydoc ::boost::intrusive::bstree::init_node(reference)
static void init_node(reference value);
//! @copydoc ::boost::intrusive::bstree::unlink_leftmost_without_rebalance
pointer unlink_leftmost_without_rebalance();
//! @copydoc ::boost::intrusive::bstree::replace_node
void replace_node(iterator replace_this, reference with_this);
//! @copydoc ::boost::intrusive::bstree::remove_node
void remove_node(reference value);
//! @copydoc ::boost::intrusive::bstree::merge_unique(bstree<T, Options2...>&)
template<class T, class ...Options2>
void merge_unique(splaytree<T, Options2...> &);
//! @copydoc ::boost::intrusive::bstree::merge_equal(bstree<T, Options2...>&)
template<class T, class ...Options2>
void merge_equal(splaytree<T, Options2...> &);
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
//! <b>Requires</b>: i must be a valid iterator of *this.
//!
//! <b>Effects</b>: Rearranges the container so that the element pointed by i
//! is placed as the root of the tree, improving future searches of this value.
//!
//! <b>Complexity</b>: Amortized logarithmic.
//!
//! <b>Throws</b>: Nothing.
void splay_up(iterator i)
{ return node_algorithms::splay_up(i.pointed_node(), tree_type::header_ptr()); }
//! <b>Effects</b>: Rearranges the container so that if *this stores an element
//! with a key equivalent to value the element is placed as the root of the
//! tree. If the element is not present returns the last node compared with the key.
//! If the tree is empty, end() is returned.
//!
//! <b>Complexity</b>: Amortized logarithmic.
//!
//! <b>Returns</b>: An iterator to the new root of the tree, end() if the tree is empty.
//!
//! <b>Throws</b>: If the comparison functor throws.
template<class KeyType, class KeyTypeKeyCompare>
iterator splay_down(const KeyType &key, KeyTypeKeyCompare comp)
{
detail::key_nodeptr_comp<value_compare, value_traits>
key_node_comp(comp, &this->get_value_traits());
node_ptr r = node_algorithms::splay_down(tree_type::header_ptr(), key, key_node_comp);
return iterator(r, this->priv_value_traits_ptr());
}
//! <b>Effects</b>: Rearranges the container so that if *this stores an element
//! with a key equivalent to value the element is placed as the root of the
//! tree.
//!
//! <b>Complexity</b>: Amortized logarithmic.
//!
//! <b>Returns</b>: An iterator to the new root of the tree, end() if the tree is empty.
//!
//! <b>Throws</b>: If the predicate throws.
iterator splay_down(const key_type &key)
{ return this->splay_down(key, this->key_comp()); }
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
//! @copydoc ::boost::intrusive::bstree::rebalance
void rebalance();
//! @copydoc ::boost::intrusive::bstree::rebalance_subtree
iterator rebalance_subtree(iterator root);
friend bool operator< (const splaytree_impl &x, const splaytree_impl &y);
friend bool operator==(const splaytree_impl &x, const splaytree_impl &y);
friend bool operator!= (const splaytree_impl &x, const splaytree_impl &y);
friend bool operator>(const splaytree_impl &x, const splaytree_impl &y);
friend bool operator<=(const splaytree_impl &x, const splaytree_impl &y);
friend bool operator>=(const splaytree_impl &x, const splaytree_impl &y);
friend void swap(splaytree_impl &x, splaytree_impl &y);
#endif //#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
};
//! Helper metafunction to define a \c splaytree that yields to the same type when the
//! same options (either explicitly or implicitly) are used.
#if defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED) || defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class ...Options>
#else
template<class T, class O1 = void, class O2 = void
, class O3 = void, class O4 = void
, class O5 = void, class O6 = void>
#endif
struct make_splaytree
{
/// @cond
typedef typename pack_options
< splaytree_defaults,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4, O5, O6
#else
Options...
#endif
>::type packed_options;
typedef typename detail::get_value_traits
<T, typename packed_options::proto_value_traits>::type value_traits;
typedef splaytree_impl
< value_traits
, typename packed_options::key_of_value
, typename packed_options::compare
, typename packed_options::size_type
, packed_options::constant_time_size
, typename packed_options::header_holder_type
> implementation_defined;
/// @endcond
typedef implementation_defined type;
};
#ifndef BOOST_INTRUSIVE_DOXYGEN_INVOKED
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
template<class T, class O1, class O2, class O3, class O4, class O5, class O6>
#else
template<class T, class ...Options>
#endif
class splaytree
: public make_splaytree<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4, O5, O6
#else
Options...
#endif
>::type
{
typedef typename make_splaytree
<T,
#if !defined(BOOST_INTRUSIVE_VARIADIC_TEMPLATES)
O1, O2, O3, O4, O5, O6
#else
Options...
#endif
>::type Base;
BOOST_MOVABLE_BUT_NOT_COPYABLE(splaytree)
public:
typedef typename Base::key_compare key_compare;
typedef typename Base::value_traits value_traits;
typedef typename Base::iterator iterator;
typedef typename Base::const_iterator const_iterator;
typedef typename Base::reverse_iterator reverse_iterator;
typedef typename Base::const_reverse_iterator const_reverse_iterator;
//Assert if passed value traits are compatible with the type
BOOST_STATIC_ASSERT((detail::is_same<typename value_traits::value_type, T>::value));
splaytree()
: Base()
{}
explicit splaytree( const key_compare &cmp, const value_traits &v_traits = value_traits())
: Base(cmp, v_traits)
{}
template<class Iterator>
splaytree( bool unique, Iterator b, Iterator e
, const key_compare &cmp = key_compare()
, const value_traits &v_traits = value_traits())
: Base(unique, b, e, cmp, v_traits)
{}
splaytree(BOOST_RV_REF(splaytree) x)
: Base(BOOST_MOVE_BASE(Base, x))
{}
splaytree& operator=(BOOST_RV_REF(splaytree) x)
{ return static_cast<splaytree &>(this->Base::operator=(BOOST_MOVE_BASE(Base, x))); }
template <class Cloner, class Disposer>
void clone_from(const splaytree &src, Cloner cloner, Disposer disposer)
{ Base::clone_from(src, cloner, disposer); }
template <class Cloner, class Disposer>
void clone_from(BOOST_RV_REF(splaytree) src, Cloner cloner, Disposer disposer)
{ Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
static splaytree &container_from_end_iterator(iterator end_iterator)
{ return static_cast<splaytree &>(Base::container_from_end_iterator(end_iterator)); }
static const splaytree &container_from_end_iterator(const_iterator end_iterator)
{ return static_cast<const splaytree &>(Base::container_from_end_iterator(end_iterator)); }
static splaytree &container_from_iterator(iterator it)
{ return static_cast<splaytree &>(Base::container_from_iterator(it)); }
static const splaytree &container_from_iterator(const_iterator it)
{ return static_cast<const splaytree &>(Base::container_from_iterator(it)); }
};
#endif
} //namespace intrusive
} //namespace boost
#include <boost/intrusive/detail/config_end.hpp>
#endif //BOOST_INTRUSIVE_SPLAYTREE_HPP
@@ -0,0 +1,47 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2011 Eric Niebler
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_FUSION_SINGLE_VIEW_BEGIN_IMPL_05052005_0305)
#define BOOST_FUSION_SINGLE_VIEW_BEGIN_IMPL_05052005_0305
#include <boost/fusion/support/config.hpp>
#include <boost/mpl/int.hpp>
namespace boost { namespace fusion
{
struct single_view_tag;
template <typename SingleView, typename Pos>
struct single_view_iterator;
namespace extension
{
template <typename Tag>
struct begin_impl;
template <>
struct begin_impl<single_view_tag>
{
template <typename Sequence>
struct apply
{
typedef single_view_iterator<Sequence, mpl::int_<0> > type;
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
static type
call(Sequence& seq)
{
return type(seq);
}
};
};
}
}}
#endif
@@ -0,0 +1,61 @@
/*=============================================================================
Copyright (c) 2010 Christopher Schmidt
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2015 Kohei Takahashi
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)
==============================================================================*/
#ifndef BOOST_FUSION_ALGORITHM_ITERATION_REVERSE_ITER_FOLD_HPP
#define BOOST_FUSION_ALGORITHM_ITERATION_REVERSE_ITER_FOLD_HPP
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/algorithm/iteration/reverse_iter_fold_fwd.hpp>
#include <boost/config.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/support/is_segmented.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/iterator/prior.hpp>
#include <boost/utility/result_of.hpp>
#include <boost/core/enable_if.hpp>
#include <boost/type_traits/add_reference.hpp>
#define BOOST_FUSION_REVERSE_FOLD
#define BOOST_FUSION_ITER_FOLD
#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
#include <boost/fusion/algorithm/iteration/detail/preprocessed/reverse_iter_fold.hpp>
#else
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
#pragma wave option(preserve: 2, line: 0, output: "detail/preprocessed/reverse_iter_fold.hpp")
#endif
/*=============================================================================
Copyright (c) 2010 Christopher Schmidt
Copyright (c) 2001-2011 Joel de Guzman
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)
This is an auto-generated file. Do not edit!
==============================================================================*/
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
#pragma wave option(preserve: 1)
#endif
#include <boost/fusion/algorithm/iteration/detail/fold.hpp>
#if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
#pragma wave option(output: null)
#endif
#endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
#undef BOOST_FUSION_REVERSE_FOLD
#undef BOOST_FUSION_ITER_FOLD
#endif
@@ -0,0 +1,147 @@
// (C) Copyright Tobias Schwinger
//
// Use modification and distribution are subject to the boost Software License,
// Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt).
//------------------------------------------------------------------------------
#ifndef BOOST_FT_DETAIL_TAGS_HPP_INCLUDED
#define BOOST_FT_DETAIL_TAGS_HPP_INCLUDED
#include <cstddef>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/mpl/bitxor.hpp>
namespace boost { namespace function_types {
namespace detail
{
typedef long bits_t;
template<bits_t Value> struct constant
: boost::integral_constant<bits_t,Value>
{ };
template<bits_t Bits, bits_t Mask> struct property_tag
{
typedef constant<Bits> bits;
typedef constant<Mask> mask;
};
template<typename T> struct bits : T::bits { };
template<typename T> struct mask : T::mask { };
// forward declaration, defined in pp_tags
template<bits_t Bits, bits_t CCID> struct encode_bits_impl;
// forward declaration, defined in pp_tags
template<bits_t LHS_bits, bits_t LHS_mask,
bits_t RHS_bits, bits_t RHS_mask>
struct tag_ice;
// forward declaration, defined in retag_default_cc
template<class Tag, class RegTag = Tag> struct retag_default_cc;
template<bits_t Bits, bits_t CCID> struct encode_bits
: constant<
::boost::function_types::detail::encode_bits_impl<Bits,CCID>::value
>
{ };
template<class LHS, class RHS> struct compound_tag
{
typedef constant<
::boost::function_types::detail::tag_ice
< ::boost::function_types::detail::bits<LHS>::value
, ::boost::function_types::detail::mask<LHS>::value
, ::boost::function_types::detail::bits<RHS>::value
, ::boost::function_types::detail::mask<RHS>::value
>::combined_bits
> bits;
typedef constant<
::boost::function_types::detail::tag_ice
< ::boost::function_types::detail::bits<LHS>::value
, ::boost::function_types::detail::mask<LHS>::value
, ::boost::function_types::detail::bits<RHS>::value
, ::boost::function_types::detail::mask<RHS>::value
>::combined_mask
> mask;
};
template <class Base, class PropOld, class PropNew>
struct changed_tag
: Base
{
typedef mpl::bitxor_
<typename Base::bits, typename PropOld::bits, typename PropNew::bits>
bits;
};
template<class Tag, class QueryTag> struct represents_impl
: boost::integral_constant<bool,
::boost::function_types::detail::tag_ice
< ::boost::function_types::detail::bits<Tag>::value
, ::boost::function_types::detail::mask<Tag>::value
, ::boost::function_types::detail::bits<QueryTag>::value
, ::boost::function_types::detail::mask<QueryTag>::value
>::match
>
{ };
} // namespace detail
typedef detail::property_tag<0,0> null_tag;
template<class Tag1, class Tag2, class Tag3 = null_tag, class Tag4 = null_tag>
struct tag
: detail::compound_tag< detail::compound_tag<Tag1,Tag2>,
detail::compound_tag<Tag3,Tag4> >
{ };
template<class Tag1, class Tag2, class Tag3> struct tag<Tag1,Tag2,Tag3,null_tag>
: detail::compound_tag<detail::compound_tag<Tag1,Tag2>,Tag3>
{ };
template<class Tag1, class Tag2> struct tag<Tag1,Tag2,null_tag,null_tag>
: detail::compound_tag<Tag1,Tag2>
{ };
template<class Tag1> struct tag<Tag1,null_tag,null_tag,null_tag>
: Tag1
{ };
template<class Tag, class QueryTag> struct represents
: detail::represents_impl<Tag, detail::retag_default_cc<QueryTag,Tag> >
{ };
template<class Tag, class QueryTag> struct extract
{
typedef detail::constant<
::boost::function_types::detail::tag_ice
< ::boost::function_types::detail::bits<Tag>::value
, ::boost::function_types::detail::mask<Tag>::value
, ::boost::function_types::detail::bits<QueryTag>::value
, ::boost::function_types::detail::mask<QueryTag>::value
>::extracted_bits
> bits;
typedef detail::constant<
::boost::function_types::detail::mask<QueryTag>::value
> mask;
};
} } // namespace ::boost::function_types
#include <boost/function_types/detail/pp_tags/preprocessed.hpp>
namespace boost { namespace function_types {
#define BOOST_FT_cc_file <boost/function_types/detail/pp_tags/cc_tag.hpp>
#include <boost/function_types/detail/pp_loop.hpp>
} } // namespace boost::function_types
#endif
@@ -0,0 +1,186 @@
// Copyright Jim Bosch 2010-2012.
// Copyright Stefan Seefeld 2016.
// 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)
#ifndef boost_python_numpy_invoke_matching_hpp_
#define boost_python_numpy_invoke_matching_hpp_
/**
* @brief Template invocation based on dtype matching.
*/
#include <boost/python/numpy/dtype.hpp>
#include <boost/python/numpy/ndarray.hpp>
#include <boost/mpl/integral_c.hpp>
namespace boost { namespace python { namespace numpy {
namespace detail
{
struct add_pointer_meta
{
template <typename T>
struct apply
{
typedef typename boost::add_pointer<T>::type type;
};
};
struct dtype_template_match_found {};
struct nd_template_match_found {};
template <typename Function>
struct dtype_template_invoker
{
template <typename T>
void operator()(T *) const
{
if (dtype::get_builtin<T>() == m_dtype)
{
m_func.Function::template apply<T>();
throw dtype_template_match_found();
}
}
dtype_template_invoker(dtype const & dtype_, Function func)
: m_dtype(dtype_), m_func(func) {}
private:
dtype const & m_dtype;
Function m_func;
};
template <typename Function>
struct dtype_template_invoker< boost::reference_wrapper<Function> >
{
template <typename T>
void operator()(T *) const
{
if (dtype::get_builtin<T>() == m_dtype)
{
m_func.Function::template apply<T>();
throw dtype_template_match_found();
}
}
dtype_template_invoker(dtype const & dtype_, Function & func)
: m_dtype(dtype_), m_func(func) {}
private:
dtype const & m_dtype;
Function & m_func;
};
template <typename Function>
struct nd_template_invoker
{
template <int N>
void operator()(boost::mpl::integral_c<int,N> *) const
{
if (m_nd == N)
{
m_func.Function::template apply<N>();
throw nd_template_match_found();
}
}
nd_template_invoker(int nd, Function func) : m_nd(nd), m_func(func) {}
private:
int m_nd;
Function m_func;
};
template <typename Function>
struct nd_template_invoker< boost::reference_wrapper<Function> >
{
template <int N>
void operator()(boost::mpl::integral_c<int,N> *) const
{
if (m_nd == N)
{
m_func.Function::template apply<N>();
throw nd_template_match_found();
}
}
nd_template_invoker(int nd, Function & func) : m_nd(nd), m_func(func) {}
private:
int m_nd;
Function & m_func;
};
} // namespace boost::python::numpy::detail
template <typename Sequence, typename Function>
void invoke_matching_nd(int nd, Function f)
{
detail::nd_template_invoker<Function> invoker(nd, f);
try { boost::mpl::for_each< Sequence, detail::add_pointer_meta >(invoker);}
catch (detail::nd_template_match_found &) { return;}
PyErr_SetString(PyExc_TypeError, "number of dimensions not found in template list.");
python::throw_error_already_set();
}
template <typename Sequence, typename Function>
void invoke_matching_dtype(dtype const & dtype_, Function f)
{
detail::dtype_template_invoker<Function> invoker(dtype_, f);
try { boost::mpl::for_each< Sequence, detail::add_pointer_meta >(invoker);}
catch (detail::dtype_template_match_found &) { return;}
PyErr_SetString(PyExc_TypeError, "dtype not found in template list.");
python::throw_error_already_set();
}
namespace detail
{
template <typename T, typename Function>
struct array_template_invoker_wrapper_2
{
template <int N>
void apply() const { m_func.Function::template apply<T,N>();}
array_template_invoker_wrapper_2(Function & func) : m_func(func) {}
private:
Function & m_func;
};
template <typename DimSequence, typename Function>
struct array_template_invoker_wrapper_1
{
template <typename T>
void apply() const { invoke_matching_nd<DimSequence>(m_nd, array_template_invoker_wrapper_2<T,Function>(m_func));}
array_template_invoker_wrapper_1(int nd, Function & func) : m_nd(nd), m_func(func) {}
private:
int m_nd;
Function & m_func;
};
template <typename DimSequence, typename Function>
struct array_template_invoker_wrapper_1< DimSequence, boost::reference_wrapper<Function> >
: public array_template_invoker_wrapper_1< DimSequence, Function >
{
array_template_invoker_wrapper_1(int nd, Function & func)
: array_template_invoker_wrapper_1< DimSequence, Function >(nd, func) {}
};
} // namespace boost::python::numpy::detail
template <typename TypeSequence, typename DimSequence, typename Function>
void invoke_matching_array(ndarray const & array_, Function f)
{
detail::array_template_invoker_wrapper_1<DimSequence,Function> wrapper(array_.get_nd(), f);
invoke_matching_dtype<TypeSequence>(array_.get_dtype(), wrapper);
}
}}} // namespace boost::python::numpy
#endif
@@ -0,0 +1,36 @@
// (C) Copyright Gennadiy Rozental 2001.
// 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)
// See http://www.boost.org/libs/test for the library home page.
//
//!@file
//!@brief enable previously suppressed warnings
// ***************************************************************************
#ifdef BOOST_MSVC
# pragma warning(default: 4511) // copy constructor can't not be generated
# pragma warning(default: 4512) // assignment operator can't not be generated
# pragma warning(default: 4100) // unreferenced formal parameter
# pragma warning(default: 4996) // <symbol> was declared deprecated
# pragma warning(default: 4355) // 'this' : used in base member initializer list
# pragma warning(default: 4706) // assignment within conditional expression
# pragma warning(default: 4251) // class 'A<T>' needs to have dll-interface to be used by clients of class 'B'
# pragma warning(default: 4127) // conditional expression is constant
# pragma warning(default: 4290) // C++ exception specification ignored except to ...
# pragma warning(default: 4180) // qualifier applied to function type has no meaning; ignored
# pragma warning(default: 4275) // non dll-interface class ... used as base for dll-interface class ...
# pragma warning(default: 4267) // 'var' : conversion from 'size_t' to 'type', possible loss of data
# pragma warning(default: 4511) // 'class' : copy constructor could not be generated
# pragma warning(pop)
#endif
#if BOOST_CLANG
#pragma clang diagnostic pop
#endif
#if defined(BOOST_GCC) && (BOOST_GCC >= 4 * 10000 + 6 * 100)
# pragma GCC diagnostic pop
#endif
@@ -0,0 +1,101 @@
/* Boost interval/compare/set.hpp template implementation file
*
* Copyright 2002-2003 Guillaume Melquiond
*
* 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)
*/
#ifndef BOOST_NUMERIC_INTERVAL_COMPARE_SET_HPP
#define BOOST_NUMERIC_INTERVAL_COMPARE_SET_HPP
#include <boost/numeric/interval/detail/interval_prototype.hpp>
#include <boost/numeric/interval/detail/test_input.hpp>
#include <boost/numeric/interval/utility.hpp>
namespace boost {
namespace numeric {
namespace interval_lib {
namespace compare {
namespace set {
template<class T, class Policies1, class Policies2> inline
bool operator<(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
{
return proper_subset(x, y);
}
template<class T, class Policies> inline
bool operator<(const interval<T, Policies>& , const T& )
{
throw comparison_error();
}
template<class T, class Policies1, class Policies2> inline
bool operator<=(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
{
return subset(x, y);
}
template<class T, class Policies> inline
bool operator<=(const interval<T, Policies>& , const T& )
{
throw comparison_error();
}
template<class T, class Policies1, class Policies2> inline
bool operator>(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
{
return proper_subset(y, x);
}
template<class T, class Policies> inline
bool operator>(const interval<T, Policies>& , const T& )
{
throw comparison_error();
}
template<class T, class Policies1, class Policies2> inline
bool operator>=(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
{
return subset(y, x);
}
template<class T, class Policies> inline
bool operator>=(const interval<T, Policies>& , const T& )
{
throw comparison_error();
}
template<class T, class Policies1, class Policies2> inline
bool operator==(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
{
return equal(y, x);
}
template<class T, class Policies> inline
bool operator==(const interval<T, Policies>& , const T& )
{
throw comparison_error();
}
template<class T, class Policies1, class Policies2> inline
bool operator!=(const interval<T, Policies1>& x, const interval<T, Policies2>& y)
{
return !equal(y, x);
}
template<class T, class Policies> inline
bool operator!=(const interval<T, Policies>& , const T& )
{
throw comparison_error();
}
} // namespace set
} // namespace compare
} // namespace interval_lib
} // namespace numeric
} // namespace boost
#endif // BOOST_NUMERIC_INTERVAL_COMPARE_SET_HPP
File diff suppressed because one or more lines are too long
@@ -0,0 +1,16 @@
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
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)
This is an auto-generated file. Do not edit!
==============================================================================*/
namespace boost { namespace fusion
{
struct void_;
template <
typename T0 = void_ , typename T1 = void_ , typename T2 = void_ , typename T3 = void_ , typename T4 = void_ , typename T5 = void_ , typename T6 = void_ , typename T7 = void_ , typename T8 = void_ , typename T9 = void_
>
struct vector;
}}
@@ -0,0 +1,789 @@
// Boost Lambda Library - function_adaptors.hpp ----------------------------
// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
//
// 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)
//
// For more information, see www.boost.org
#ifndef BOOST_LAMBDA_FUNCTION_ADAPTORS_HPP
#define BOOST_LAMBDA_FUNCTION_ADAPTORS_HPP
#include "boost/mpl/has_xxx.hpp"
#include "boost/tuple/tuple.hpp"
#include "boost/type_traits/same_traits.hpp"
#include "boost/type_traits/remove_reference.hpp"
#include "boost/type_traits/remove_cv.hpp"
#include "boost/type_traits/add_const.hpp"
#include "boost/type_traits/add_volatile.hpp"
#include "boost/utility/result_of.hpp"
namespace boost {
namespace lambda {
namespace detail {
BOOST_MPL_HAS_XXX_TEMPLATE_DEF(sig)
template<class Tuple>
struct remove_references_from_elements {
typedef typename boost::tuples::cons<
typename boost::remove_reference<typename Tuple::head_type>::type,
typename remove_references_from_elements<typename Tuple::tail_type>::type
> type;
};
template<>
struct remove_references_from_elements<boost::tuples::null_type> {
typedef boost::tuples::null_type type;
};
}
template <class Func> struct function_adaptor {
typedef typename detail::remove_reference_and_cv<Func>::type plainF;
#if !defined(BOOST_NO_RESULT_OF)
// Support functors that use the boost::result_of return type convention.
template<class Tuple, int Length, bool HasSig>
struct result_converter;
template<class Tuple, int Length>
struct result_converter<Tuple, Length, true>
: plainF::template sig<
typename detail::remove_references_from_elements<Tuple>::type
>
{};
template<class Tuple>
struct result_converter<Tuple, 0, false>
: result_of<plainF()>
{};
template<class Tuple>
struct result_converter<Tuple, 1, false>
: result_of<plainF(
typename tuples::element<1, Tuple>::type)
>
{};
template<class Tuple>
struct result_converter<Tuple, 2, false>
: result_of<plainF(
typename tuples::element<1, Tuple>::type,
typename tuples::element<2, Tuple>::type)
>
{};
template<class Tuple>
struct result_converter<Tuple, 3, false>
: result_of<plainF(
typename tuples::element<1, Tuple>::type,
typename tuples::element<2, Tuple>::type,
typename tuples::element<3, Tuple>::type)
>
{};
template<class Tuple>
struct result_converter<Tuple, 4, false>
: result_of<plainF(
typename tuples::element<1, Tuple>::type,
typename tuples::element<2, Tuple>::type,
typename tuples::element<3, Tuple>::type,
typename tuples::element<4, Tuple>::type)
>
{};
template<class Tuple>
struct result_converter<Tuple, 5, false>
: result_of<plainF(
typename tuples::element<1, Tuple>::type,
typename tuples::element<2, Tuple>::type,
typename tuples::element<3, Tuple>::type,
typename tuples::element<4, Tuple>::type,
typename tuples::element<5, Tuple>::type)
>
{};
template<class Tuple>
struct result_converter<Tuple, 6, false>
: result_of<plainF(
typename tuples::element<1, Tuple>::type,
typename tuples::element<2, Tuple>::type,
typename tuples::element<3, Tuple>::type,
typename tuples::element<4, Tuple>::type,
typename tuples::element<5, Tuple>::type,
typename tuples::element<6, Tuple>::type)
>
{};
template<class Tuple>
struct result_converter<Tuple, 7, false>
: result_of<plainF(
typename tuples::element<1, Tuple>::type,
typename tuples::element<2, Tuple>::type,
typename tuples::element<3, Tuple>::type,
typename tuples::element<4, Tuple>::type,
typename tuples::element<5, Tuple>::type,
typename tuples::element<6, Tuple>::type,
typename tuples::element<7, Tuple>::type)
>
{};
template<class Tuple>
struct result_converter<Tuple, 8, false>
: result_of<plainF(
typename tuples::element<1, Tuple>::type,
typename tuples::element<2, Tuple>::type,
typename tuples::element<3, Tuple>::type,
typename tuples::element<4, Tuple>::type,
typename tuples::element<5, Tuple>::type,
typename tuples::element<6, Tuple>::type,
typename tuples::element<7, Tuple>::type,
typename tuples::element<8, Tuple>::type)
>
{};
template<class Tuple>
struct result_converter<Tuple, 9, false>
: result_of<plainF(
typename tuples::element<1, Tuple>::type,
typename tuples::element<2, Tuple>::type,
typename tuples::element<3, Tuple>::type,
typename tuples::element<4, Tuple>::type,
typename tuples::element<5, Tuple>::type,
typename tuples::element<6, Tuple>::type,
typename tuples::element<7, Tuple>::type,
typename tuples::element<8, Tuple>::type,
typename tuples::element<9, Tuple>::type)
>
{};
// we do not know the return type off-hand, we must ask it from Func
// To sig we pass a cons list, where the head is the function object type
// itself (potentially cv-qualified)
// and the tail contains the types of the actual arguments to be passed
// to the function object. The arguments can be cv qualified
// as well.
template <class Args>
struct sig
: result_converter<
Args
, tuples::length<typename Args::tail_type>::value
, detail::has_sig<plainF>::value
>
{};
#else // BOOST_NO_RESULT_OF
template <class Args> class sig {
typedef typename detail::remove_reference_and_cv<Func>::type plainF;
public:
typedef typename plainF::template sig<
typename detail::remove_references_from_elements<Args>::type
>::type type;
};
#endif
template<class RET, class A1>
static RET apply(A1& a1) {
return a1();
}
template<class RET, class A1, class A2>
static RET apply(A1& a1, A2& a2) {
return a1(a2);
}
template<class RET, class A1, class A2, class A3>
static RET apply(A1& a1, A2& a2, A3& a3) {
return a1(a2, a3);
}
template<class RET, class A1, class A2, class A3, class A4>
static RET apply(A1& a1, A2& a2, A3& a3, A4& a4) {
return a1(a2, a3, a4);
}
template<class RET, class A1, class A2, class A3, class A4, class A5>
static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
return a1(a2, a3, a4, a5);
}
template<class RET, class A1, class A2, class A3, class A4, class A5, class A6>
static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
return a1(a2, a3, a4, a5, a6);
}
template<class RET, class A1, class A2, class A3, class A4, class A5, class A6,
class A7>
static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6,
A7& a7) {
return a1(a2, a3, a4, a5, a6, a7);
}
template<class RET, class A1, class A2, class A3, class A4, class A5, class A6,
class A7, class A8>
static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6,
A7& a7, A8& a8) {
return a1(a2, a3, a4, a5, a6, a7, a8);
}
template<class RET, class A1, class A2, class A3, class A4, class A5, class A6,
class A7, class A8, class A9>
static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6,
A7& a7, A8& a8, A9& a9) {
return a1(a2, a3, a4, a5, a6, a7, a8, a9);
}
template<class RET, class A1, class A2, class A3, class A4, class A5, class A6,
class A7, class A8, class A9, class A10>
static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6,
A7& a7, A8& a8, A9& a9, A10& a10) {
return a1(a2, a3, a4, a5, a6, a7, a8, a9, a10);
}
};
template <class Func> struct function_adaptor<const Func>; // error
// -- function adaptors with data member access
template <class Object, class T>
struct function_adaptor<T Object::*> {
// typedef detail::unspecified type;
// T can have qualifiers and can be a reference type
// We get the return type by adding const, if the object through which
// the data member is accessed is const, and finally adding a reference
template<class Args> class sig {
typedef typename boost::tuples::element<1, Args>::type argument_type;
typedef typename boost::remove_reference<
argument_type
>::type unref_type;
typedef typename detail::IF<boost::is_const<unref_type>::value,
typename boost::add_const<T>::type,
T
>::RET properly_consted_return_type;
typedef typename detail::IF<boost::is_volatile<unref_type>::value,
typename boost::add_volatile<properly_consted_return_type>::type,
properly_consted_return_type
>::RET properly_cvd_return_type;
public:
typedef typename detail::IF<boost::is_reference<argument_type>::value,
typename boost::add_reference<properly_cvd_return_type>::type,
typename boost::remove_cv<T>::type
>::RET type;
};
template <class RET>
static RET apply( T Object::*data, Object& o) {
return o.*data;
}
template <class RET>
static RET apply( T Object::*data, const Object& o) {
return o.*data;
}
template <class RET>
static RET apply( T Object::*data, volatile Object& o) {
return o.*data;
}
template <class RET>
static RET apply( T Object::*data, const volatile Object& o) {
return o.*data;
}
template <class RET>
static RET apply( T Object::*data, Object* o) {
return o->*data;
}
template <class RET>
static RET apply( T Object::*data, const Object* o) {
return o->*data;
}
template <class RET>
static RET apply( T Object::*data, volatile Object* o) {
return o->*data;
}
template <class RET>
static RET apply( T Object::*data, const volatile Object* o) {
return o->*data;
}
};
// -- function adaptors with 1 argument apply
template <class Result>
struct function_adaptor<Result (void)> {
template<class T> struct sig { typedef Result type; };
template <class RET>
static Result apply(Result (*func)()) {
return func();
}
};
template <class Result>
struct function_adaptor<Result (*)(void)> {
template<class T> struct sig { typedef Result type; };
template <class RET>
static Result apply(Result (*func)()) {
return func();
}
};
// -- function adaptors with 2 argument apply
template <class Object, class Result>
struct function_adaptor<Result (Object::*)() const> {
template<class T> struct sig { typedef Result type; };
template <class RET>
static Result apply( Result (Object::*func)() const, const Object* o) {
return (o->*func)();
}
template <class RET>
static Result apply( Result (Object::*func)() const, const Object& o) {
return (o.*func)();
}
};
template <class Object, class Result>
struct function_adaptor<Result (Object::*)()> {
template<class T> struct sig { typedef Result type; };
template <class RET>
static Result apply( Result (Object::*func)(), Object* o) {
return (o->*func)();
}
template <class RET>
static Result apply( Result (Object::*func)(), Object& o) {
return (o.*func)();
}
};
template <class Arg1, class Result>
struct function_adaptor<Result (Arg1)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1>
static Result apply(Result (*func)(Arg1), A1& a1) {
return func(a1);
}
};
template <class Arg1, class Result>
struct function_adaptor<Result (*)(Arg1)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1>
static Result apply(Result (*func)(Arg1), A1& a1) {
return func(a1);
}
};
// -- function adaptors with 3 argument apply
template <class Object, class Arg1, class Result>
struct function_adaptor<Result (Object::*)(Arg1) const> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1>
static Result apply( Result (Object::*func)(Arg1) const, const Object* o,
A1& a1) {
return (o->*func)(a1);
}
template <class RET, class A1>
static Result apply( Result (Object::*func)(Arg1) const, const Object& o,
A1& a1) {
return (o.*func)(a1);
}
};
template <class Object, class Arg1, class Result>
struct function_adaptor<Result (Object::*)(Arg1)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1>
static Result apply( Result (Object::*func)(Arg1), Object* o, A1& a1) {
return (o->*func)(a1);
}
template <class RET, class A1>
static Result apply( Result (Object::*func)(Arg1), Object& o, A1& a1) {
return (o.*func)(a1);
}
};
template <class Arg1, class Arg2, class Result>
struct function_adaptor<Result (Arg1, Arg2)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2>
static Result apply(Result (*func)(Arg1, Arg2), A1& a1, A2& a2) {
return func(a1, a2);
}
};
template <class Arg1, class Arg2, class Result>
struct function_adaptor<Result (*)(Arg1, Arg2)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2>
static Result apply(Result (*func)(Arg1, Arg2), A1& a1, A2& a2) {
return func(a1, a2);
}
};
// -- function adaptors with 4 argument apply
template <class Object, class Arg1, class Arg2, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2) const> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2>
static Result apply( Result (Object::*func)(Arg1, Arg2) const, const Object* o, A1& a1, A2& a2) {
return (o->*func)(a1, a2);
}
template <class RET, class A1, class A2>
static Result apply( Result (Object::*func)(Arg1, Arg2) const, const Object& o, A1& a1, A2& a2) {
return (o.*func)(a1, a2);
}
};
template <class Object, class Arg1, class Arg2, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2>
static Result apply( Result (Object::*func)(Arg1, Arg2), Object* o, A1& a1, A2& a2) {
return (o->*func)(a1, a2);
}
template <class RET, class A1, class A2>
static Result apply( Result (Object::*func)(Arg1, Arg2), Object& o, A1& a1, A2& a2) {
return (o.*func)(a1, a2);
}
};
template <class Arg1, class Arg2, class Arg3, class Result>
struct function_adaptor<Result (Arg1, Arg2, Arg3)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3>
static Result apply(Result (*func)(Arg1, Arg2, Arg3), A1& a1, A2& a2, A3& a3) {
return func(a1, a2, a3);
}
};
template <class Arg1, class Arg2, class Arg3, class Result>
struct function_adaptor<Result (*)(Arg1, Arg2, Arg3)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3>
static Result apply(Result (*func)(Arg1, Arg2, Arg3), A1& a1, A2& a2, A3& a3) {
return func(a1, a2, a3);
}
};
// -- function adaptors with 5 argument apply
template <class Object, class Arg1, class Arg2, class Arg3, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3) const> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3) const, const Object* o, A1& a1, A2& a2, A3& a3) {
return (o->*func)(a1, a2, a3);
}
template <class RET, class A1, class A2, class A3>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3) const, const Object& o, A1& a1, A2& a2, A3& a3) {
return (o.*func)(a1, a2, a3);
}
};
template <class Object, class Arg1, class Arg2, class Arg3, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3), Object* o, A1& a1, A2& a2, A3& a3) {
return (o->*func)(a1, a2, a3);
}
template <class RET, class A1, class A2, class A3>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3), Object& o, A1& a1, A2& a2, A3& a3) {
return (o.*func)(a1, a2, a3);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Result>
struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4), A1& a1, A2& a2, A3& a3, A4& a4) {
return func(a1, a2, a3, a4);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Result>
struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4), A1& a1, A2& a2, A3& a3, A4& a4) {
return func(a1, a2, a3, a4);
}
};
// -- function adaptors with 6 argument apply
template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4) const> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4) {
return (o->*func)(a1, a2, a3, a4);
}
template <class RET, class A1, class A2, class A3, class A4>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4) {
return (o.*func)(a1, a2, a3, a4);
}
};
template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4), Object* o, A1& a1, A2& a2, A3& a3, A4& a4) {
return (o->*func)(a1, a2, a3, a4);
}
template <class RET, class A1, class A2, class A3, class A4>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4), Object& o, A1& a1, A2& a2, A3& a3, A4& a4) {
return (o.*func)(a1, a2, a3, a4);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Result>
struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
return func(a1, a2, a3, a4, a5);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Result>
struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
return func(a1, a2, a3, a4, a5);
}
};
// -- function adaptors with 7 argument apply
template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5) const> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
return (o->*func)(a1, a2, a3, a4, a5);
}
template <class RET, class A1, class A2, class A3, class A4, class A5>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
return (o.*func)(a1, a2, a3, a4, a5);
}
};
template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5), Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
return (o->*func)(a1, a2, a3, a4, a5);
}
template <class RET, class A1, class A2, class A3, class A4, class A5>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5), Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) {
return (o.*func)(a1, a2, a3, a4, a5);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Result>
struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
return func(a1, a2, a3, a4, a5, a6);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Result>
struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
return func(a1, a2, a3, a4, a5, a6);
}
};
// -- function adaptors with 8 argument apply
template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) const> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
return (o->*func)(a1, a2, a3, a4, a5, a6);
}
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
return (o.*func)(a1, a2, a3, a4, a5, a6);
}
};
template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
return (o->*func)(a1, a2, a3, a4, a5, a6);
}
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) {
return (o.*func)(a1, a2, a3, a4, a5, a6);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Result>
struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) {
return func(a1, a2, a3, a4, a5, a6, a7);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Result>
struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) {
return func(a1, a2, a3, a4, a5, a6, a7);
}
};
// -- function adaptors with 9 argument apply
template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) const> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) {
return (o->*func)(a1, a2, a3, a4, a5, a6, a7);
}
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) {
return (o.*func)(a1, a2, a3, a4, a5, a6, a7);
}
};
template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7), Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) {
return (o->*func)(a1, a2, a3, a4, a5, a6, a7);
}
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7), Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) {
return (o.*func)(a1, a2, a3, a4, a5, a6, a7);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Result>
struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) {
return func(a1, a2, a3, a4, a5, a6, a7, a8);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Result>
struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) {
return func(a1, a2, a3, a4, a5, a6, a7, a8);
}
};
// -- function adaptors with 10 argument apply
template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8) const> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) {
return (o->*func)(a1, a2, a3, a4, a5, a6, a7, a8);
}
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) {
return (o.*func)(a1, a2, a3, a4, a5, a6, a7, a8);
}
};
template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Result>
struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8), Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) {
return (o->*func)(a1, a2, a3, a4, a5, a6, a7, a8);
}
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8>
static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8), Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) {
return (o.*func)(a1, a2, a3, a4, a5, a6, a7, a8);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Arg9, class Result>
struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8, A9& a9) {
return func(a1, a2, a3, a4, a5, a6, a7, a8, a9);
}
};
template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Arg9, class Result>
struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9)> {
template<class T> struct sig { typedef Result type; };
template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9>
static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8, A9& a9) {
return func(a1, a2, a3, a4, a5, a6, a7, a8, a9);
}
};
} // namespace lambda
} // namespace boost
#endif
@@ -0,0 +1,615 @@
// Boost Lambda Library lambda_functor_base.hpp -----------------------------
//
// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
//
// 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)
//
// For more information, see www.boost.org
// ------------------------------------------------------------
#ifndef BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_HPP
#define BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_HPP
#include "boost/type_traits/add_reference.hpp"
#include "boost/type_traits/add_const.hpp"
#include "boost/type_traits/remove_const.hpp"
#include "boost/lambda/detail/lambda_fwd.hpp"
#include "boost/lambda/detail/lambda_traits.hpp"
namespace boost {
namespace lambda {
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
#pragma warning(push)
#pragma warning(disable:4512) //assignment operator could not be generated
#endif
// for return type deductions we wrap bound argument to this class,
// which fulfils the base class contract for lambda_functors
template <class T>
class identity {
T elem;
public:
typedef T element_t;
// take all parameters as const references. Note that non-const references
// stay as they are.
typedef typename boost::add_reference<
typename boost::add_const<T>::type
>::type par_t;
explicit identity(par_t t) : elem(t) {}
template <typename SigArgs>
struct sig { typedef typename boost::remove_const<element_t>::type type; };
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return elem; }
};
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
#pragma warning(pop)
#endif
template <class T>
inline lambda_functor<identity<T&> > var(T& t) { return identity<T&>(t); }
// for lambda functors, var is an identity operator. It was forbidden
// at some point, but we might want to var something that can be a
// non-lambda functor or a lambda functor.
template <class T>
lambda_functor<T> var(const lambda_functor<T>& t) { return t; }
template <class T> struct var_type {
typedef lambda_functor<identity<T&> > type;
};
template <class T>
inline
lambda_functor<identity<typename bound_argument_conversion<const T>::type> >
constant(const T& t) {
return identity<typename bound_argument_conversion<const T>::type>(t);
}
template <class T>
lambda_functor<T> constant(const lambda_functor<T>& t) { return t; }
template <class T> struct constant_type {
typedef
lambda_functor<
identity<typename bound_argument_conversion<const T>::type>
> type;
};
template <class T>
inline lambda_functor<identity<const T&> > constant_ref(const T& t) {
return identity<const T&>(t);
}
template <class T>
lambda_functor<T> constant_ref(const lambda_functor<T>& t) { return t; }
template <class T> struct constant_ref_type {
typedef
lambda_functor<identity<const T&> > type;
};
// as_lambda_functor turns any types to lambda functors
// non-lambda_functors will be bound argument types
template <class T>
struct as_lambda_functor {
typedef typename
detail::remove_reference_and_cv<T>::type plain_T;
typedef typename
detail::IF<is_lambda_functor<plain_T>::value,
plain_T,
lambda_functor<
identity<typename bound_argument_conversion<T>::type>
>
>::RET type;
};
// turns arbitrary objects into lambda functors
template <class T>
inline
lambda_functor<identity<typename bound_argument_conversion<const T>::type> >
to_lambda_functor(const T& t) {
return identity<typename bound_argument_conversion<const T>::type>(t);
}
template <class T>
inline lambda_functor<T>
to_lambda_functor(const lambda_functor<T>& t) {
return t;
}
namespace detail {
// In a call constify_rvals<T>::go(x)
// x should be of type T. If T is a non-reference type, do
// returns x as const reference.
// Otherwise the type doesn't change.
// The purpose of this class is to avoid
// 'cannot bind temporaries to non-const references' errors.
template <class T> struct constify_rvals {
template<class U>
static inline const U& go(const U& u) { return u; }
};
template <class T> struct constify_rvals<T&> {
template<class U>
static inline U& go(U& u) { return u; }
};
// check whether one of the elements of a tuple (cons list) is of type
// null_type. Needed, because the compiler goes ahead and instantiates
// sig template for nullary case even if the nullary operator() is not
// called
template <class T> struct is_null_type
{ BOOST_STATIC_CONSTANT(bool, value = false); };
template <> struct is_null_type<null_type>
{ BOOST_STATIC_CONSTANT(bool, value = true); };
template<class Tuple> struct has_null_type {
BOOST_STATIC_CONSTANT(bool, value = (is_null_type<typename Tuple::head_type>::value || has_null_type<typename Tuple::tail_type>::value));
};
template<> struct has_null_type<null_type> {
BOOST_STATIC_CONSTANT(bool, value = false);
};
// helpers -------------------
template<class Args, class SigArgs>
class deduce_argument_types_ {
typedef typename as_lambda_functor<typename Args::head_type>::type lf_t;
typedef typename lf_t::inherited::template sig<SigArgs>::type el_t;
public:
typedef
boost::tuples::cons<
el_t,
typename deduce_argument_types_<typename Args::tail_type, SigArgs>::type
> type;
};
template<class SigArgs>
class deduce_argument_types_<null_type, SigArgs> {
public:
typedef null_type type;
};
// // note that tuples cannot have plain function types as elements.
// // Hence, all other types will be non-const, except references to
// // functions.
// template <class T> struct remove_reference_except_from_functions {
// typedef typename boost::remove_reference<T>::type t;
// typedef typename detail::IF<boost::is_function<t>::value, T, t>::RET type;
// };
template<class Args, class SigArgs>
class deduce_non_ref_argument_types_ {
typedef typename as_lambda_functor<typename Args::head_type>::type lf_t;
typedef typename lf_t::inherited::template sig<SigArgs>::type el_t;
public:
typedef
boost::tuples::cons<
// typename detail::remove_reference_except_from_functions<el_t>::type,
typename boost::remove_reference<el_t>::type,
typename deduce_non_ref_argument_types_<typename Args::tail_type, SigArgs>::type
> type;
};
template<class SigArgs>
class deduce_non_ref_argument_types_<null_type, SigArgs> {
public:
typedef null_type type;
};
// -------------
// take stored Args and Open Args, and return a const list with
// deduced elements (real return types)
template<class Args, class SigArgs>
class deduce_argument_types {
typedef typename deduce_argument_types_<Args, SigArgs>::type t1;
public:
typedef typename detail::IF<
has_null_type<t1>::value, null_type, t1
>::RET type;
};
// take stored Args and Open Args, and return a const list with
// deduced elements (references are stripped from the element types)
template<class Args, class SigArgs>
class deduce_non_ref_argument_types {
typedef typename deduce_non_ref_argument_types_<Args, SigArgs>::type t1;
public:
typedef typename detail::IF<
has_null_type<t1>::value, null_type, t1
>::RET type;
};
template <int N, class Args, class SigArgs>
struct nth_return_type_sig {
typedef typename
as_lambda_functor<
typename boost::tuples::element<N, Args>::type
// typename tuple_element_as_reference<N, Args>::type
>::type lf_type;
typedef typename lf_type::inherited::template sig<SigArgs>::type type;
};
template<int N, class Tuple> struct element_or_null {
typedef typename boost::tuples::element<N, Tuple>::type type;
};
template<int N> struct element_or_null<N, null_type> {
typedef null_type type;
};
} // end detail
// -- lambda_functor base ---------------------
// the explicit_return_type_action case -----------------------------------
template<class RET, class Args>
class lambda_functor_base<explicit_return_type_action<RET>, Args>
{
public:
Args args;
typedef RET result_type;
explicit lambda_functor_base(const Args& a) : args(a) {}
template <class SigArgs> struct sig { typedef RET type; };
template<class RET_, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const
{
return detail::constify_rvals<RET>::go(
detail::r_select<RET>::go(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS));
}
};
// the protect_action case -----------------------------------
template<class Args>
class lambda_functor_base<protect_action, Args>
{
public:
Args args;
public:
explicit lambda_functor_base(const Args& a) : args(a) {}
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const
{
CALL_USE_ARGS;
return boost::tuples::get<0>(args);
}
template<class SigArgs> struct sig {
// typedef typename detail::tuple_element_as_reference<0, SigArgs>::type type;
typedef typename boost::tuples::element<0, Args>::type type;
};
};
// Do nothing --------------------------------------------------------
class do_nothing_action {};
template<class Args>
class lambda_functor_base<do_nothing_action, Args> {
// Args args;
public:
// explicit lambda_functor_base(const Args& a) {}
lambda_functor_base() {}
template<class RET, CALL_TEMPLATE_ARGS> RET call(CALL_FORMAL_ARGS) const {
return CALL_USE_ARGS;
}
template<class SigArgs> struct sig { typedef void type; };
};
// These specializations provide a shorter notation to define actions.
// These lambda_functor_base instances take care of the recursive evaluation
// of the arguments and pass the evaluated arguments to the apply function
// of an action class. To make action X work with these classes, one must
// instantiate the lambda_functor_base as:
// lambda_functor_base<action<ARITY, X>, Args>
// Where ARITY is the arity of the apply function in X
// The return type is queried as:
// return_type_N<X, EvaluatedArgumentTypes>::type
// for which there must be a specialization.
// Function actions, casts, throws,... all go via these classes.
template<class Act, class Args>
class lambda_functor_base<action<0, Act>, Args>
{
public:
// Args args; not needed
explicit lambda_functor_base(const Args& /*a*/) {}
template<class SigArgs> struct sig {
typedef typename return_type_N<Act, null_type>::type type;
};
template<class RET, CALL_TEMPLATE_ARGS>
RET call(CALL_FORMAL_ARGS) const {
CALL_USE_ARGS;
return Act::template apply<RET>();
}
};
#if defined BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART
#error "Multiple defines of BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART"
#endif
#define BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(ARITY) \
template<class Act, class Args> \
class lambda_functor_base<action<ARITY, Act>, Args> \
{ \
public: \
Args args; \
\
explicit lambda_functor_base(const Args& a) : args(a) {} \
\
template<class SigArgs> struct sig { \
typedef typename \
detail::deduce_argument_types<Args, SigArgs>::type rets_t; \
public: \
typedef typename \
return_type_N_prot<Act, rets_t>::type type; \
}; \
\
\
template<class RET, CALL_TEMPLATE_ARGS> \
RET call(CALL_FORMAL_ARGS) const { \
using boost::tuples::get; \
using detail::constify_rvals; \
using detail::r_select; \
using detail::element_or_null; \
using detail::deduce_argument_types;
BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(1)
typedef typename
deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
typedef typename element_or_null<0, rets_t>::type rt0;
return Act::template apply<RET>(
constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS))
);
}
};
BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(2)
typedef typename
deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
typedef typename element_or_null<0, rets_t>::type rt0;
typedef typename element_or_null<1, rets_t>::type rt1;
return Act::template apply<RET>(
constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS))
);
}
};
BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(3)
typedef typename
deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
typedef typename element_or_null<0, rets_t>::type rt0;
typedef typename element_or_null<1, rets_t>::type rt1;
typedef typename element_or_null<2, rets_t>::type rt2;
return Act::template apply<RET>(
constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS))
);
}
};
BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(4)
typedef typename
deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
typedef typename element_or_null<0, rets_t>::type rt0;
typedef typename element_or_null<1, rets_t>::type rt1;
typedef typename element_or_null<2, rets_t>::type rt2;
typedef typename element_or_null<3, rets_t>::type rt3;
return Act::template apply<RET>(
constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS))
);
}
};
BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(5)
typedef typename
deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
typedef typename element_or_null<0, rets_t>::type rt0;
typedef typename element_or_null<1, rets_t>::type rt1;
typedef typename element_or_null<2, rets_t>::type rt2;
typedef typename element_or_null<3, rets_t>::type rt3;
typedef typename element_or_null<4, rets_t>::type rt4;
return Act::template apply<RET>(
constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS))
);
}
};
BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(6)
typedef typename
deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
typedef typename element_or_null<0, rets_t>::type rt0;
typedef typename element_or_null<1, rets_t>::type rt1;
typedef typename element_or_null<2, rets_t>::type rt2;
typedef typename element_or_null<3, rets_t>::type rt3;
typedef typename element_or_null<4, rets_t>::type rt4;
typedef typename element_or_null<5, rets_t>::type rt5;
return Act::template apply<RET>(
constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS))
);
}
};
BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(7)
typedef typename
deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
typedef typename element_or_null<0, rets_t>::type rt0;
typedef typename element_or_null<1, rets_t>::type rt1;
typedef typename element_or_null<2, rets_t>::type rt2;
typedef typename element_or_null<3, rets_t>::type rt3;
typedef typename element_or_null<4, rets_t>::type rt4;
typedef typename element_or_null<5, rets_t>::type rt5;
typedef typename element_or_null<6, rets_t>::type rt6;
return Act::template apply<RET>(
constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS))
);
}
};
BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(8)
typedef typename
deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
typedef typename element_or_null<0, rets_t>::type rt0;
typedef typename element_or_null<1, rets_t>::type rt1;
typedef typename element_or_null<2, rets_t>::type rt2;
typedef typename element_or_null<3, rets_t>::type rt3;
typedef typename element_or_null<4, rets_t>::type rt4;
typedef typename element_or_null<5, rets_t>::type rt5;
typedef typename element_or_null<6, rets_t>::type rt6;
typedef typename element_or_null<7, rets_t>::type rt7;
return Act::template apply<RET>(
constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt7>::go(r_select<rt7>::go(get<7>(args), CALL_ACTUAL_ARGS))
);
}
};
BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(9)
typedef typename
deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
typedef typename element_or_null<0, rets_t>::type rt0;
typedef typename element_or_null<1, rets_t>::type rt1;
typedef typename element_or_null<2, rets_t>::type rt2;
typedef typename element_or_null<3, rets_t>::type rt3;
typedef typename element_or_null<4, rets_t>::type rt4;
typedef typename element_or_null<5, rets_t>::type rt5;
typedef typename element_or_null<6, rets_t>::type rt6;
typedef typename element_or_null<7, rets_t>::type rt7;
typedef typename element_or_null<8, rets_t>::type rt8;
return Act::template apply<RET>(
constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt7>::go(r_select<rt7>::go(get<7>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt8>::go(r_select<rt8>::go(get<8>(args), CALL_ACTUAL_ARGS))
);
}
};
BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(10)
typedef typename
deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t;
typedef typename element_or_null<0, rets_t>::type rt0;
typedef typename element_or_null<1, rets_t>::type rt1;
typedef typename element_or_null<2, rets_t>::type rt2;
typedef typename element_or_null<3, rets_t>::type rt3;
typedef typename element_or_null<4, rets_t>::type rt4;
typedef typename element_or_null<5, rets_t>::type rt5;
typedef typename element_or_null<6, rets_t>::type rt6;
typedef typename element_or_null<7, rets_t>::type rt7;
typedef typename element_or_null<8, rets_t>::type rt8;
typedef typename element_or_null<9, rets_t>::type rt9;
return Act::template apply<RET>(
constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt7>::go(r_select<rt7>::go(get<7>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt8>::go(r_select<rt8>::go(get<8>(args), CALL_ACTUAL_ARGS)),
constify_rvals<rt9>::go(r_select<rt9>::go(get<9>(args), CALL_ACTUAL_ARGS))
);
}
};
#undef BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART
} // namespace lambda
} // namespace boost
#endif
@@ -0,0 +1,42 @@
// (C) Copyright John Maddock 2007.
// 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)
//
// This file is machine generated, do not edit by hand
// Polynomial evaluation using Horners rule
#ifndef BOOST_MATH_TOOLS_POLY_EVAL_3_HPP
#define BOOST_MATH_TOOLS_POLY_EVAL_3_HPP
namespace boost{ namespace math{ namespace tools{ namespace detail{
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T*, const V&, const mpl::int_<0>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(0);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>(a[1] * x + a[0]);
}
template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) BOOST_MATH_NOEXCEPT(V)
{
return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
}
}}}} // namespaces
#endif // include guard
@@ -0,0 +1,31 @@
#ifndef LETTERS_SPIN_BOX_HPP_
#define LETTERS_SPIN_BOX_HPP_
#include <QSpinBox>
class QString;
//
// LettersSpinBox - select from consecutive letters
//
class LettersSpinBox final
: public QSpinBox
{
Q_OBJECT
Q_PROPERTY (bool lowercase MEMBER lowercase_)
public:
LettersSpinBox (QWidget * parent = nullptr)
: QSpinBox {parent}
, lowercase_ {false}
{
}
QString textFromValue (int) const override;
int valueFromText (QString const&) const override;
private:
bool lowercase_;
};
#endif
@@ -0,0 +1,163 @@
// scan_keyword.hpp --------------------------------------------------------------//
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// Adaptation to Boost of the libcxx
// Copyright 2010 Vicente J. Botet Escriba
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
#ifndef BOOST_CHRONO_DETAIL_SCAN_KEYWORD_HPP
#define BOOST_CHRONO_DETAIL_SCAN_KEYWORD_HPP
#include <boost/chrono/config.hpp>
#include <boost/move/unique_ptr.hpp>
#include <ios>
#include <exception>
#include <stdlib.h>
#include <boost/throw_exception.hpp>
namespace boost {
using movelib::unique_ptr;
namespace chrono {
namespace chrono_detail {
inline void free_aux(void* ptr) { free(ptr); }
// scan_keyword
// Scans [b, e) until a match is found in the basic_strings range
// [kb, ke) or until it can be shown that there is no match in [kb, ke).
// b will be incremented (visibly), consuming CharT until a match is found
// or proved to not exist. A keyword may be "", in which will match anything.
// If one keyword is a prefix of another, and the next CharT in the input
// might match another keyword, the algorithm will attempt to find the longest
// matching keyword. If the longer matching keyword ends up not matching, then
// no keyword match is found. If no keyword match is found, ke is returned
// and failbit is set in err.
// Else an iterator pointing to the matching keyword is found. If more than
// one keyword matches, an iterator to the first matching keyword is returned.
// If on exit b == e, eofbit is set in err.
// Examples:
// Keywords: "a", "abb"
// If the input is "a", the first keyword matches and eofbit is set.
// If the input is "abc", no match is found and "ab" are consumed.
template <class InputIterator, class ForwardIterator>
ForwardIterator
scan_keyword(InputIterator& b, InputIterator e,
ForwardIterator kb, ForwardIterator ke,
std::ios_base::iostate& err
)
{
typedef typename std::iterator_traits<InputIterator>::value_type CharT;
size_t nkw = std::distance(kb, ke);
const unsigned char doesnt_match = '\0';
const unsigned char might_match = '\1';
const unsigned char does_match = '\2';
unsigned char statbuf[100];
unsigned char* status = statbuf;
// Change free by free_aux to avoid
// Error: Could not find a match for boost::interprocess::unique_ptr<unsigned char, void(*)(void*)>::unique_ptr(int, extern "C" void(void*))
unique_ptr<unsigned char, void(*)(void*)> stat_hold(0, free_aux);
if (nkw > sizeof(statbuf))
{
status = (unsigned char*)malloc(nkw);
if (status == 0)
throw_exception(std::bad_alloc());
stat_hold.reset(status);
}
size_t n_might_match = nkw; // At this point, any keyword might match
size_t n_does_match = 0; // but none of them definitely do
// Initialize all statuses to might_match, except for "" keywords are does_match
unsigned char* st = status;
for (ForwardIterator ky = kb; ky != ke; ++ky, ++st)
{
if (!ky->empty())
*st = might_match;
else
{
*st = does_match;
--n_might_match;
++n_does_match;
}
}
// While there might be a match, test keywords against the next CharT
for (size_t indx = 0; b != e && n_might_match > 0; ++indx)
{
// Peek at the next CharT but don't consume it
CharT c = *b;
bool consume = false;
// For each keyword which might match, see if the indx character is c
// If a match if found, consume c
// If a match is found, and that is the last character in the keyword,
// then that keyword matches.
// If the keyword doesn't match this character, then change the keyword
// to doesn't match
st = status;
for (ForwardIterator ky = kb; ky != ke; ++ky, ++st)
{
if (*st == might_match)
{
CharT kc = (*ky)[indx];
if (c == kc)
{
consume = true;
if (ky->size() == indx+1)
{
*st = does_match;
--n_might_match;
++n_does_match;
}
}
else
{
*st = doesnt_match;
--n_might_match;
}
}
}
// consume if we matched a character
if (consume)
{
++b;
// If we consumed a character and there might be a matched keyword that
// was marked matched on a previous iteration, then such keywords
// which are now marked as not matching.
if (n_might_match + n_does_match > 1)
{
st = status;
for (ForwardIterator ky = kb; ky != ke; ++ky, ++st)
{
if (*st == does_match && ky->size() != indx+1)
{
*st = doesnt_match;
--n_does_match;
}
}
}
}
}
// We've exited the loop because we hit eof and/or we have no more "might matches".
if (b == e)
err |= std::ios_base::eofbit;
// Return the first matching result
for (st = status; kb != ke; ++kb, ++st)
if (*st == does_match)
break;
if (kb == ke)
err |= std::ios_base::failbit;
return kb;
}
}
}
}
#endif // BOOST_CHRONO_DETAIL_SCAN_KEYWORD_HPP