Initial Commit
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED
|
||||
#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// detail/sp_counted_base_w32.hpp
|
||||
//
|
||||
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright 2004-2005 Peter Dimov
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
//
|
||||
// Lock-free algorithm by Alexander Terekhov
|
||||
//
|
||||
// Thanks to Ben Hitchings for the #weak + (#shared != 0)
|
||||
// formulation
|
||||
//
|
||||
|
||||
#include <boost/smart_ptr/detail/sp_interlocked.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/detail/sp_typeinfo.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class sp_counted_base
|
||||
{
|
||||
private:
|
||||
|
||||
sp_counted_base( sp_counted_base const & );
|
||||
sp_counted_base & operator= ( sp_counted_base const & );
|
||||
|
||||
long use_count_; // #shared
|
||||
long weak_count_; // #weak + (#shared != 0)
|
||||
|
||||
public:
|
||||
|
||||
sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~sp_counted_base() // nothrow
|
||||
{
|
||||
}
|
||||
|
||||
// dispose() is called when use_count_ drops to zero, to release
|
||||
// the resources managed by *this.
|
||||
|
||||
virtual void dispose() = 0; // nothrow
|
||||
|
||||
// destroy() is called when weak_count_ drops to zero.
|
||||
|
||||
virtual void destroy() // nothrow
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
|
||||
virtual void * get_untyped_deleter() = 0;
|
||||
|
||||
void add_ref_copy()
|
||||
{
|
||||
BOOST_SP_INTERLOCKED_INCREMENT( &use_count_ );
|
||||
}
|
||||
|
||||
bool add_ref_lock() // true on success
|
||||
{
|
||||
for( ;; )
|
||||
{
|
||||
long tmp = static_cast< long const volatile& >( use_count_ );
|
||||
if( tmp == 0 ) return false;
|
||||
|
||||
#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1200 )
|
||||
|
||||
// work around a code generation bug
|
||||
|
||||
long tmp2 = tmp + 1;
|
||||
if( BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp2, tmp ) == tmp2 - 1 ) return true;
|
||||
|
||||
#else
|
||||
|
||||
if( BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp + 1, tmp ) == tmp ) return true;
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void release() // nothrow
|
||||
{
|
||||
if( BOOST_SP_INTERLOCKED_DECREMENT( &use_count_ ) == 0 )
|
||||
{
|
||||
dispose();
|
||||
weak_release();
|
||||
}
|
||||
}
|
||||
|
||||
void weak_add_ref() // nothrow
|
||||
{
|
||||
BOOST_SP_INTERLOCKED_INCREMENT( &weak_count_ );
|
||||
}
|
||||
|
||||
void weak_release() // nothrow
|
||||
{
|
||||
if( BOOST_SP_INTERLOCKED_DECREMENT( &weak_count_ ) == 0 )
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
long use_count() const // nothrow
|
||||
{
|
||||
return static_cast<long const volatile &>( use_count_ );
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED
|
||||
@@ -0,0 +1,36 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (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_LOGICAL_COMPL_HPP
|
||||
# define BOOST_PREPROCESSOR_LOGICAL_COMPL_HPP
|
||||
#
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
#
|
||||
# /* BOOST_PP_COMPL */
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
|
||||
# define BOOST_PP_COMPL(x) BOOST_PP_COMPL_I(x)
|
||||
# else
|
||||
# define BOOST_PP_COMPL(x) BOOST_PP_COMPL_OO((x))
|
||||
# define BOOST_PP_COMPL_OO(par) BOOST_PP_COMPL_I ## par
|
||||
# endif
|
||||
#
|
||||
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
|
||||
# define BOOST_PP_COMPL_I(x) BOOST_PP_COMPL_ ## x
|
||||
# else
|
||||
# define BOOST_PP_COMPL_I(x) BOOST_PP_COMPL_ID(BOOST_PP_COMPL_ ## x)
|
||||
# define BOOST_PP_COMPL_ID(id) id
|
||||
# endif
|
||||
#
|
||||
# define BOOST_PP_COMPL_0 1
|
||||
# define BOOST_PP_COMPL_1 0
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,48 @@
|
||||
// (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_4_HPP
|
||||
#define BOOST_MATH_TOOLS_POLY_EVAL_4_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]);
|
||||
}
|
||||
|
||||
template <class T, class V>
|
||||
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
|
||||
}
|
||||
|
||||
|
||||
}}}} // namespaces
|
||||
|
||||
#endif // include guard
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
// (C) Copyright John Maddock 2001.
|
||||
// (C) Copyright Darin Adler 2001.
|
||||
// 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 for most recent version.
|
||||
|
||||
// Metrowerks standard library:
|
||||
|
||||
#ifndef __MSL_CPP__
|
||||
# include <boost/config/no_tr1/utility.hpp>
|
||||
# ifndef __MSL_CPP__
|
||||
# error This is not the MSL standard library!
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if __MSL_CPP__ >= 0x6000 // Pro 6
|
||||
# define BOOST_HAS_HASH
|
||||
# define BOOST_STD_EXTENSION_NAMESPACE Metrowerks
|
||||
#endif
|
||||
#define BOOST_HAS_SLIST
|
||||
|
||||
#if __MSL_CPP__ < 0x6209
|
||||
# define BOOST_NO_STD_MESSAGES
|
||||
#endif
|
||||
|
||||
// check C lib version for <stdint.h>
|
||||
#include <cstddef>
|
||||
|
||||
#if defined(__MSL__) && (__MSL__ >= 0x5000)
|
||||
# define BOOST_HAS_STDINT_H
|
||||
# if !defined(__PALMOS_TRAPS__)
|
||||
# define BOOST_HAS_UNISTD_H
|
||||
# endif
|
||||
// boilerplate code:
|
||||
# include <boost/config/posix_features.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(_MWMT) || _MSL_THREADSAFE
|
||||
# define BOOST_HAS_THREADS
|
||||
#endif
|
||||
|
||||
#ifdef _MSL_NO_EXPLICIT_FUNC_TEMPLATE_ARG
|
||||
# define BOOST_NO_STD_USE_FACET
|
||||
# define BOOST_HAS_TWO_ARG_USE_FACET
|
||||
#endif
|
||||
|
||||
// C++0x headers not yet implemented
|
||||
//
|
||||
# define BOOST_NO_CXX11_HDR_ARRAY
|
||||
# define BOOST_NO_CXX11_HDR_CHRONO
|
||||
# define BOOST_NO_CXX11_HDR_CODECVT
|
||||
# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
|
||||
# define BOOST_NO_CXX11_HDR_FORWARD_LIST
|
||||
# define BOOST_NO_CXX11_HDR_FUTURE
|
||||
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
|
||||
# define BOOST_NO_CXX11_HDR_MUTEX
|
||||
# define BOOST_NO_CXX11_HDR_RANDOM
|
||||
# define BOOST_NO_CXX11_HDR_RATIO
|
||||
# define BOOST_NO_CXX11_HDR_REGEX
|
||||
# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
|
||||
# define BOOST_NO_CXX11_HDR_THREAD
|
||||
# define BOOST_NO_CXX11_HDR_TUPLE
|
||||
# define BOOST_NO_CXX11_HDR_TYPE_TRAITS
|
||||
# define BOOST_NO_CXX11_HDR_TYPEINDEX
|
||||
# define BOOST_NO_CXX11_HDR_UNORDERED_MAP
|
||||
# define BOOST_NO_CXX11_HDR_UNORDERED_SET
|
||||
# define BOOST_NO_CXX11_NUMERIC_LIMITS
|
||||
# define BOOST_NO_CXX11_ALLOCATOR
|
||||
# define BOOST_NO_CXX11_ATOMIC_SMART_PTR
|
||||
# define BOOST_NO_CXX11_SMART_PTR
|
||||
# define BOOST_NO_CXX11_HDR_FUNCTIONAL
|
||||
# define BOOST_NO_CXX11_HDR_ATOMIC
|
||||
# define BOOST_NO_CXX11_STD_ALIGN
|
||||
# define BOOST_NO_CXX11_ADDRESSOF
|
||||
|
||||
#if defined(__has_include)
|
||||
#if !__has_include(<shared_mutex>)
|
||||
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
|
||||
#elif __cplusplus < 201402
|
||||
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
|
||||
#endif
|
||||
#else
|
||||
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
|
||||
#endif
|
||||
|
||||
// C++14 features
|
||||
# define BOOST_NO_CXX14_STD_EXCHANGE
|
||||
|
||||
// C++17 features
|
||||
# define BOOST_NO_CXX17_STD_APPLY
|
||||
# define BOOST_NO_CXX17_STD_INVOKE
|
||||
|
||||
#define BOOST_STDLIB "Metrowerks Standard Library version " BOOST_STRINGIZE(__MSL_CPP__)
|
||||
@@ -0,0 +1,154 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 1998-2003 Joel de Guzman
|
||||
Copyright (c) 2001 Daniel Nuffer
|
||||
Copyright (c) 2002 Hartmut Kaiser
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
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_SPIRIT_SEQUENTIAL_OR_HPP)
|
||||
#define BOOST_SPIRIT_SEQUENTIAL_OR_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/core/parser.hpp>
|
||||
#include <boost/spirit/home/classic/core/primitives/primitives.hpp>
|
||||
#include <boost/spirit/home/classic/core/composite/composite.hpp>
|
||||
#include <boost/spirit/home/classic/meta/as_parser.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// sequential-or class
|
||||
//
|
||||
// Handles expressions of the form:
|
||||
//
|
||||
// a || b
|
||||
//
|
||||
// Equivalent to
|
||||
//
|
||||
// a | b | a >> b;
|
||||
//
|
||||
// where a and b are parsers. The expression returns a composite
|
||||
// parser that matches matches a or b in sequence. One (not both) of
|
||||
// the operands may be a literal char, wchar_t or a primitive string
|
||||
// char const*, wchar_t const*.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
struct sequential_or_parser_gen;
|
||||
|
||||
template <typename A, typename B>
|
||||
struct sequential_or : public binary<A, B, parser<sequential_or<A, B> > >
|
||||
{
|
||||
typedef sequential_or<A, B> self_t;
|
||||
typedef binary_parser_category parser_category_t;
|
||||
typedef sequential_or_parser_gen parser_generator_t;
|
||||
typedef binary<A, B, parser<self_t> > base_t;
|
||||
|
||||
sequential_or(A const& a, B const& b)
|
||||
: base_t(a, b) {}
|
||||
|
||||
template <typename ScannerT>
|
||||
typename parser_result<self_t, ScannerT>::type
|
||||
parse(ScannerT const& scan) const
|
||||
{
|
||||
typedef typename parser_result<self_t, ScannerT>::type result_t;
|
||||
typedef typename ScannerT::iterator_t iterator_t;
|
||||
{ // scope for save
|
||||
iterator_t save = scan.first;
|
||||
if (result_t ma = this->left().parse(scan))
|
||||
{
|
||||
save = scan.first;
|
||||
if (result_t mb = this->right().parse(scan))
|
||||
{
|
||||
// matched a b
|
||||
scan.concat_match(ma, mb);
|
||||
return ma;
|
||||
}
|
||||
else
|
||||
{
|
||||
// matched a
|
||||
scan.first = save;
|
||||
return ma;
|
||||
}
|
||||
}
|
||||
scan.first = save;
|
||||
}
|
||||
|
||||
// matched b
|
||||
return this->right().parse(scan);
|
||||
}
|
||||
};
|
||||
|
||||
struct sequential_or_parser_gen
|
||||
{
|
||||
template <typename A, typename B>
|
||||
struct result
|
||||
{
|
||||
typedef
|
||||
sequential_or<
|
||||
typename as_parser<A>::type
|
||||
, typename as_parser<B>::type
|
||||
>
|
||||
type;
|
||||
};
|
||||
|
||||
template <typename A, typename B>
|
||||
static sequential_or<
|
||||
typename as_parser<A>::type
|
||||
, typename as_parser<B>::type
|
||||
>
|
||||
generate(A const& a, B const& b)
|
||||
{
|
||||
return sequential_or<BOOST_DEDUCED_TYPENAME as_parser<A>::type,
|
||||
BOOST_DEDUCED_TYPENAME as_parser<B>::type>
|
||||
(as_parser<A>::convert(a), as_parser<B>::convert(b));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename A, typename B>
|
||||
sequential_or<A, B>
|
||||
operator||(parser<A> const& a, parser<B> const& b);
|
||||
|
||||
template <typename A>
|
||||
sequential_or<A, chlit<char> >
|
||||
operator||(parser<A> const& a, char b);
|
||||
|
||||
template <typename B>
|
||||
sequential_or<chlit<char>, B>
|
||||
operator||(char a, parser<B> const& b);
|
||||
|
||||
template <typename A>
|
||||
sequential_or<A, strlit<char const*> >
|
||||
operator||(parser<A> const& a, char const* b);
|
||||
|
||||
template <typename B>
|
||||
sequential_or<strlit<char const*>, B>
|
||||
operator||(char const* a, parser<B> const& b);
|
||||
|
||||
template <typename A>
|
||||
sequential_or<A, chlit<wchar_t> >
|
||||
operator||(parser<A> const& a, wchar_t b);
|
||||
|
||||
template <typename B>
|
||||
sequential_or<chlit<wchar_t>, B>
|
||||
operator||(wchar_t a, parser<B> const& b);
|
||||
|
||||
template <typename A>
|
||||
sequential_or<A, strlit<wchar_t const*> >
|
||||
operator||(parser<A> const& a, wchar_t const* b);
|
||||
|
||||
template <typename B>
|
||||
sequential_or<strlit<wchar_t const*>, B>
|
||||
operator||(wchar_t const* a, parser<B> const& b);
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}} // namespace BOOST_SPIRIT_CLASSIC_NS
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/spirit/home/classic/core/composite/impl/sequential_or.ipp>
|
||||
@@ -0,0 +1,34 @@
|
||||
// get_current_process.hpp --------------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
// Copyright 2015 Andrey Semashev
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#ifndef BOOST_DETAIL_WINAPI_GET_CURRENT_PROCESS_HPP
|
||||
#define BOOST_DETAIL_WINAPI_GET_CURRENT_PROCESS_HPP
|
||||
|
||||
#include <boost/detail/winapi/basic_types.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
// Windows CE define GetCurrentProcess as an inline function in kfuncs.h
|
||||
#if !defined( BOOST_USE_WINDOWS_H ) && !defined( UNDER_CE )
|
||||
extern "C" {
|
||||
BOOST_SYMBOL_IMPORT boost::detail::winapi::HANDLE_ WINAPI GetCurrentProcess(BOOST_DETAIL_WINAPI_VOID);
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace winapi {
|
||||
using ::GetCurrentProcess;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_DETAIL_WINAPI_GET_CURRENT_PROCESS_HPP
|
||||
@@ -0,0 +1,95 @@
|
||||
/*=============================================================================
|
||||
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_SEGMENTED_FIND_IF_HPP_INCLUDED)
|
||||
#define BOOST_FUSION_SEGMENTED_FIND_IF_HPP_INCLUDED
|
||||
|
||||
#include <boost/fusion/support/config.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/fusion/algorithm/query/find_if_fwd.hpp>
|
||||
#include <boost/fusion/iterator/equal_to.hpp>
|
||||
#include <boost/fusion/sequence/intrinsic/end.hpp>
|
||||
#include <boost/fusion/support/segmented_fold_until.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace detail
|
||||
{
|
||||
template <typename Pred>
|
||||
struct segmented_find_if_fun
|
||||
{
|
||||
template <typename Sequence, typename State, typename Context>
|
||||
struct apply
|
||||
{
|
||||
typedef
|
||||
typename result_of::find_if<Sequence, Pred>::type
|
||||
iterator_type;
|
||||
|
||||
typedef
|
||||
typename result_of::equal_to<
|
||||
iterator_type
|
||||
, typename result_of::end<Sequence>::type
|
||||
>::type
|
||||
continue_type;
|
||||
|
||||
typedef
|
||||
typename mpl::eval_if<
|
||||
continue_type
|
||||
, mpl::identity<State>
|
||||
, result_of::make_segmented_iterator<
|
||||
iterator_type
|
||||
, Context
|
||||
>
|
||||
>::type
|
||||
type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(Sequence& seq, State const&state, Context const& context, segmented_find_if_fun)
|
||||
{
|
||||
return call_impl(seq, state, context, continue_type());
|
||||
}
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call_impl(Sequence&, State const&state, Context const&, mpl::true_)
|
||||
{
|
||||
return state;
|
||||
}
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call_impl(Sequence& seq, State const&, Context const& context, mpl::false_)
|
||||
{
|
||||
return fusion::make_segmented_iterator(fusion::find_if<Pred>(seq), context);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template <typename Sequence, typename Pred>
|
||||
struct result_of_segmented_find_if
|
||||
{
|
||||
struct filter
|
||||
{
|
||||
typedef
|
||||
typename result_of::segmented_fold_until<
|
||||
Sequence
|
||||
, typename result_of::end<Sequence>::type
|
||||
, segmented_find_if_fun<Pred>
|
||||
>::type
|
||||
type;
|
||||
|
||||
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
|
||||
static type call(Sequence& seq)
|
||||
{
|
||||
return fusion::segmented_fold_until(
|
||||
seq
|
||||
, fusion::end(seq)
|
||||
, segmented_find_if_fun<Pred>());
|
||||
}
|
||||
};
|
||||
|
||||
typedef typename filter::type type;
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,246 @@
|
||||
// (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_RAT_19_HPP
|
||||
#define BOOST_MATH_TOOLS_POLY_RAT_19_HPP
|
||||
|
||||
namespace boost{ namespace math{ namespace tools{ namespace detail{
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T*, const U*, const V&, const mpl::int_<0>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(0);
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const mpl::int_<1>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
return static_cast<V>(a[0]) / static_cast<V>(b[0]);
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<2>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<3>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<4>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<5>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>(((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((b[4] * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>(((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) / ((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<6>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>((((((a[5] * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((b[5] * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) / (((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<7>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>(((((((a[6] * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((b[6] * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>(((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) / ((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<8>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>((((((((a[7] * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((b[7] * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) / (((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<9>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>(((((((((a[8] * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((b[8] * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>(((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) / ((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<10>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>((((((((((a[9] * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((b[9] * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) / (((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<11>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>(((((((((((a[10] * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((b[10] * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>(((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) / ((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<12>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>((((((((((((a[11] * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((b[11] * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) / (((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<13>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>(((((((((((((a[12] * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((b[12] * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>(((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) / ((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<14>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>((((((((((((((a[13] * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((b[13] * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) / (((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<15>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>(((((((((((((((a[14] * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((b[14] * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>(((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) / ((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<16>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>((((((((((((((((a[15] * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((b[15] * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) / (((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<17>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>(((((((((((((((((a[16] * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((b[16] * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>(((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) / ((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<18>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>((((((((((((((((((a[17] * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / (((((((((((((((((b[17] * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) / (((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17]));
|
||||
}
|
||||
}
|
||||
|
||||
template <class T, class U, class V>
|
||||
inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const mpl::int_<19>*) BOOST_MATH_NOEXCEPT(V)
|
||||
{
|
||||
if(x <= 1)
|
||||
return static_cast<V>(((((((((((((((((((a[18] * x + a[17]) * x + a[16]) * x + a[15]) * x + a[14]) * x + a[13]) * x + a[12]) * x + a[11]) * x + a[10]) * x + a[9]) * x + a[8]) * x + a[7]) * x + a[6]) * x + a[5]) * x + a[4]) * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]) / ((((((((((((((((((b[18] * x + b[17]) * x + b[16]) * x + b[15]) * x + b[14]) * x + b[13]) * x + b[12]) * x + b[11]) * x + b[10]) * x + b[9]) * x + b[8]) * x + b[7]) * x + b[6]) * x + b[5]) * x + b[4]) * x + b[3]) * x + b[2]) * x + b[1]) * x + b[0]));
|
||||
else
|
||||
{
|
||||
V z = 1 / x;
|
||||
return static_cast<V>(((((((((((((((((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) * z + a[4]) * z + a[5]) * z + a[6]) * z + a[7]) * z + a[8]) * z + a[9]) * z + a[10]) * z + a[11]) * z + a[12]) * z + a[13]) * z + a[14]) * z + a[15]) * z + a[16]) * z + a[17]) * z + a[18]) / ((((((((((((((((((b[0] * z + b[1]) * z + b[2]) * z + b[3]) * z + b[4]) * z + b[5]) * z + b[6]) * z + b[7]) * z + b[8]) * z + b[9]) * z + b[10]) * z + b[11]) * z + b[12]) * z + b[13]) * z + b[14]) * z + b[15]) * z + b[16]) * z + b[17]) * z + b[18]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}}}} // namespaces
|
||||
|
||||
#endif // include guard
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
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_SPIRIT_ACTOR_HPP
|
||||
#define BOOST_SPIRIT_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/version.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Actors documentation and convention
|
||||
//
|
||||
// Actors
|
||||
//
|
||||
// Actors are predefined semantic action functors. They are used to do an
|
||||
// action on the parse result if the parser has had a successful match. An
|
||||
// example of actor is the append_actor described in the Spirit
|
||||
// documentation.
|
||||
//
|
||||
// The action takes place through a call to the () operator: single argument
|
||||
// () operator call for character parsers and two argument (first,last) call
|
||||
// for phrase parsers. Actors should implement at least one of the two ()
|
||||
// operator.
|
||||
//
|
||||
// Actor instances are not created direcly since they usually involve a
|
||||
// number of template parameters. Instead generator functions ("helper
|
||||
// functions") are provided to generate actors according to their arguments.
|
||||
// All helper functions have the "_a" suffix. For example, append_actor is
|
||||
// created using the append_a function.
|
||||
//
|
||||
// Policy holder actors and policy actions
|
||||
//
|
||||
// A lot of actors need to store reference to one or more objects. For
|
||||
// example, actions on container need to store a reference to the container.
|
||||
// Therefore, this kind of actor have been broken down into
|
||||
//
|
||||
// - a action policy that does the action (act method),
|
||||
// - a policy holder actor that stores the references and feeds the act
|
||||
// method.
|
||||
//
|
||||
// Policy holder actors
|
||||
//
|
||||
// Policy holder have the following naming convention:
|
||||
// <member>_ >> *<member> >> !value >> actor
|
||||
// where member are the policy stored member, they can be of type:
|
||||
//
|
||||
// - ref, a reference,
|
||||
// - const_ref, a const reference,
|
||||
// - value, by value,
|
||||
// - empty, no stored members
|
||||
// - !value states if the policy uses the parse result or not.
|
||||
//
|
||||
// The available policy holder are enumerated below:
|
||||
//
|
||||
// - empty_actor, nothing stored, feeds parse result
|
||||
// - value_actor, 1 object stored by value, feeds value
|
||||
// - ref_actor, 1 reference stored, feeds ref
|
||||
// - ref_value_actor, 1 reference stored, feeds ref and parse result
|
||||
//
|
||||
// Doc. convention
|
||||
//
|
||||
// - ref is a reference to an object stored in a policy holder actor,
|
||||
// - value_ref,value1_ref, value2_ref are a const reference stored in a
|
||||
// policy holder actor,
|
||||
// - value is the parse result in the single argument () operator,
|
||||
// - first,last are the parse result in the two argument () operator
|
||||
//
|
||||
// Actors (generator functions) and quick description
|
||||
//
|
||||
// - assign_a(ref) assign parse result to ref
|
||||
// - assign_a(ref, value_ref) assign value_ref to ref
|
||||
// - increment_a(ref) increment ref
|
||||
// - decrement_a(ref) decrement ref
|
||||
// - push_back_a(ref) push back the parse result in ref
|
||||
// - push_back_a(ref, value_ref) push back value_ref in ref
|
||||
// - push_front_a(ref) push front the parse result in ref
|
||||
// - push_front_a(ref, value_ref) push front value_ref in ref
|
||||
// - insert_key_a(ref,value_ref) insert value_ref in ref using the
|
||||
// parse result as key
|
||||
// - insert_at_a(ref, key_ref) insert the parse result in ref at key_ref
|
||||
// - insert_at_a(ref, key_ref insert value_ref in ref at key_ref
|
||||
// , value_ref)
|
||||
// - assign_key_a(ref, value_ref) assign value_ref in ref using the
|
||||
// parse result as key
|
||||
// - erase_a(ref, key) erase data at key from ref
|
||||
// - clear_a(ref) clears ref
|
||||
// - swap_a(aref, bref) swaps aref and bref
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <boost/spirit/home/classic/actor/ref_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_value_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_const_ref_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_const_ref_value_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_const_ref_const_ref_a.hpp>
|
||||
|
||||
#include <boost/spirit/home/classic/actor/assign_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/clear_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/increment_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/decrement_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/push_back_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/push_front_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/erase_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/insert_key_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/insert_at_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/assign_key_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/swap_actor.hpp>
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,217 @@
|
||||
/* boost random/linear_feedback_shift.hpp header file
|
||||
*
|
||||
* Copyright Jens Maurer 2002
|
||||
* Copyright Steven Watanabe 2011
|
||||
* 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 including documentation.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BOOST_RANDOM_LINEAR_FEEDBACK_SHIFT_HPP
|
||||
#define BOOST_RANDOM_LINEAR_FEEDBACK_SHIFT_HPP
|
||||
|
||||
#include <iosfwd>
|
||||
#include <stdexcept>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/integer/integer_mask.hpp>
|
||||
#include <boost/random/detail/config.hpp>
|
||||
#include <boost/random/detail/seed.hpp>
|
||||
#include <boost/random/detail/operators.hpp>
|
||||
#include <boost/random/detail/seed_impl.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace random {
|
||||
|
||||
/**
|
||||
* Instatiations of @c linear_feedback_shift model a
|
||||
* \pseudo_random_number_generator. It was originally
|
||||
* proposed in
|
||||
*
|
||||
* @blockquote
|
||||
* "Random numbers generated by linear recurrence modulo two.",
|
||||
* Tausworthe, R. C.(1965), Mathematics of Computation 19, 201-209.
|
||||
* @endblockquote
|
||||
*/
|
||||
template<class UIntType, int w, int k, int q, int s>
|
||||
class linear_feedback_shift_engine
|
||||
{
|
||||
public:
|
||||
typedef UIntType result_type;
|
||||
BOOST_STATIC_CONSTANT(bool, has_fixed_range = false);
|
||||
BOOST_STATIC_CONSTANT(int, word_size = w);
|
||||
BOOST_STATIC_CONSTANT(int, exponent1 = k);
|
||||
BOOST_STATIC_CONSTANT(int, exponent2 = q);
|
||||
BOOST_STATIC_CONSTANT(int, step_size = s);
|
||||
BOOST_STATIC_CONSTANT(UIntType, default_seed = 341);
|
||||
|
||||
/** Returns the smallest value that the generator can produce. */
|
||||
static result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () { return 0; }
|
||||
/** Returns the largest value that the generator can produce. */
|
||||
static result_type max BOOST_PREVENT_MACRO_SUBSTITUTION ()
|
||||
{ return wordmask(); }
|
||||
|
||||
BOOST_STATIC_ASSERT(w > 0);
|
||||
BOOST_STATIC_ASSERT(q > 0);
|
||||
BOOST_STATIC_ASSERT(k < w);
|
||||
BOOST_STATIC_ASSERT(0 < 2*q && 2*q < k);
|
||||
BOOST_STATIC_ASSERT(0 < s && s <= k-q);
|
||||
|
||||
/** Constructs a @c linear_feedback_shift_engine, using the default seed. */
|
||||
linear_feedback_shift_engine() { seed(); }
|
||||
|
||||
/** Constructs a @c linear_feedback_shift_engine, seeding it with s0. */
|
||||
BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(linear_feedback_shift_engine,
|
||||
UIntType, s0)
|
||||
{ seed(s0); }
|
||||
|
||||
/** Constructs a @c linear_feedback_shift_engine, seeding it with seq. */
|
||||
BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR(linear_feedback_shift_engine,
|
||||
SeedSeq, seq)
|
||||
{ seed(seq); }
|
||||
|
||||
/**
|
||||
* Constructs a @c linear_feedback_shift_engine, seeding it with
|
||||
* values from the range [first, last).
|
||||
*/
|
||||
template<class It> linear_feedback_shift_engine(It& first, It last)
|
||||
{ seed(first, last); }
|
||||
|
||||
/** Seeds a @c linear_feedback_shift_engine with the default seed. */
|
||||
void seed() { seed(default_seed); }
|
||||
|
||||
/** Seeds a @c linear_feedback_shift_engine with @c s0. */
|
||||
BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(linear_feedback_shift_engine,
|
||||
UIntType, s0)
|
||||
{
|
||||
value = s0 & wordmask();
|
||||
if(value < (1 << (w-k))) {
|
||||
value += 1 << (w-k);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Seeds a @c linear_feedback_shift_engine with values
|
||||
* produced by @c seq.generate().
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_SEED_SEQ_SEED(linear_feedback_shift_engine,
|
||||
SeedSeq, seq)
|
||||
{ seed(detail::seed_one_int<UIntType, (UIntType(2) << (w - 1))>(seq)); }
|
||||
|
||||
/**
|
||||
* Seeds a @c linear_feedback_shift_engine with values
|
||||
* from the range [first, last).
|
||||
*/
|
||||
template<class It> void seed(It& first, It last)
|
||||
{
|
||||
seed(detail::get_one_int<UIntType, (UIntType(2) << (w - 1))>(first, last));
|
||||
}
|
||||
|
||||
/** Returns the next value of the generator. */
|
||||
result_type operator()()
|
||||
{
|
||||
const UIntType b = (((value << q) ^ value) & wordmask()) >> (k-s);
|
||||
const UIntType mask = (wordmask() << (w-k)) & wordmask();
|
||||
value = ((value & mask) << s) ^ b;
|
||||
return value;
|
||||
}
|
||||
|
||||
/** Fills a range with random values */
|
||||
template<class Iter>
|
||||
void generate(Iter first, Iter last)
|
||||
{ detail::generate_from_int(*this, first, last); }
|
||||
|
||||
/** Advances the state of the generator by @c z. */
|
||||
void discard(boost::uintmax_t z)
|
||||
{
|
||||
for(boost::uintmax_t j = 0; j < z; ++j) {
|
||||
(*this)();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the textual representation of the generator to a @c std::ostream.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, linear_feedback_shift_engine, x)
|
||||
{
|
||||
os << x.value;
|
||||
return os;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the textual representation of the generator from a @c std::istream.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, linear_feedback_shift_engine, x)
|
||||
{
|
||||
is >> x.value;
|
||||
return is;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the two generators will produce identical
|
||||
* sequences of outputs.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(linear_feedback_shift_engine, x, y)
|
||||
{ return x.value == y.value; }
|
||||
|
||||
/**
|
||||
* Returns true if the two generators will produce different
|
||||
* sequences of outputs.
|
||||
*/
|
||||
BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(linear_feedback_shift_engine)
|
||||
|
||||
private:
|
||||
/// \cond show_private
|
||||
static UIntType wordmask() { return boost::low_bits_mask_t<w>::sig_bits; }
|
||||
/// \endcond
|
||||
UIntType value;
|
||||
};
|
||||
|
||||
#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||
// A definition is required even for integral static constants
|
||||
template<class UIntType, int w, int k, int q, int s>
|
||||
const bool linear_feedback_shift_engine<UIntType, w, k, q, s>::has_fixed_range;
|
||||
template<class UIntType, int w, int k, int q, int s>
|
||||
const int linear_feedback_shift_engine<UIntType, w, k, q, s>::word_size;
|
||||
template<class UIntType, int w, int k, int q, int s>
|
||||
const int linear_feedback_shift_engine<UIntType, w, k, q, s>::exponent1;
|
||||
template<class UIntType, int w, int k, int q, int s>
|
||||
const int linear_feedback_shift_engine<UIntType, w, k, q, s>::exponent2;
|
||||
template<class UIntType, int w, int k, int q, int s>
|
||||
const int linear_feedback_shift_engine<UIntType, w, k, q, s>::step_size;
|
||||
template<class UIntType, int w, int k, int q, int s>
|
||||
const UIntType linear_feedback_shift_engine<UIntType, w, k, q, s>::default_seed;
|
||||
#endif
|
||||
|
||||
/// \cond show_deprecated
|
||||
|
||||
/** Provided for backwards compatibility. */
|
||||
template<class UIntType, int w, int k, int q, int s, UIntType v = 0>
|
||||
class linear_feedback_shift :
|
||||
public linear_feedback_shift_engine<UIntType, w, k, q, s>
|
||||
{
|
||||
typedef linear_feedback_shift_engine<UIntType, w, k, q, s> base_type;
|
||||
public:
|
||||
linear_feedback_shift() {}
|
||||
BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR(linear_feedback_shift,
|
||||
SeedSeq, seq)
|
||||
{ seed(seq); }
|
||||
BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(linear_feedback_shift,
|
||||
UIntType, val)
|
||||
{ seed(val); }
|
||||
template<class It>
|
||||
linear_feedback_shift(It& first, It last) : base_type(first, last) {}
|
||||
};
|
||||
|
||||
/// \endcond
|
||||
|
||||
} // namespace random
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_RANDOM_LINEAR_FEEDBACK_SHIFT_HPP
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,102 @@
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
// Preprocessed version of "boost/mpl/greater.hpp" header
|
||||
// -- DO NOT modify by hand!
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<
|
||||
typename Tag1
|
||||
, typename Tag2
|
||||
|
||||
, BOOST_MPL_AUX_NTTP_DECL(int, tag1_) = BOOST_MPL_AUX_MSVC_VALUE_WKND(Tag1)::value
|
||||
, BOOST_MPL_AUX_NTTP_DECL(int, tag2_) = BOOST_MPL_AUX_MSVC_VALUE_WKND(Tag2)::value
|
||||
>
|
||||
struct greater_impl
|
||||
: if_c<
|
||||
( tag1_ > tag2_ )
|
||||
, aux::cast2nd_impl< greater_impl< Tag1,Tag1 >,Tag1, Tag2 >
|
||||
, aux::cast1st_impl< greater_impl< Tag2,Tag2 >,Tag1, Tag2 >
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
/// for Digital Mars C++/compilers with no CTPS/TTP support
|
||||
template<> struct greater_impl< na,na >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct greater_impl< na,integral_c_tag >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template<> struct greater_impl< integral_c_tag,na >
|
||||
{
|
||||
template< typename U1, typename U2 > struct apply
|
||||
{
|
||||
typedef apply type;
|
||||
BOOST_STATIC_CONSTANT(int, value = 0);
|
||||
};
|
||||
};
|
||||
|
||||
template< typename T > struct greater_tag
|
||||
{
|
||||
typedef typename T::tag type;
|
||||
};
|
||||
|
||||
template<
|
||||
typename BOOST_MPL_AUX_NA_PARAM(N1)
|
||||
, typename BOOST_MPL_AUX_NA_PARAM(N2)
|
||||
>
|
||||
struct greater
|
||||
: aux::msvc_eti_base< typename apply_wrap2<
|
||||
greater_impl<
|
||||
typename greater_tag<N1>::type
|
||||
, typename greater_tag<N2>::type
|
||||
>
|
||||
, N1
|
||||
, N2
|
||||
>::type >::type
|
||||
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, greater, (N1, N2))
|
||||
|
||||
};
|
||||
|
||||
BOOST_MPL_AUX_NA_SPEC2(2, 2, greater)
|
||||
|
||||
}}
|
||||
|
||||
namespace boost { namespace mpl {
|
||||
|
||||
template<>
|
||||
struct greater_impl< integral_c_tag,integral_c_tag >
|
||||
{
|
||||
template< typename N1, typename N2 > struct apply
|
||||
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
( BOOST_MPL_AUX_VALUE_WKND(N1)::value >
|
||||
BOOST_MPL_AUX_VALUE_WKND(N2)::value )
|
||||
);
|
||||
typedef bool_<value> type;
|
||||
};
|
||||
};
|
||||
|
||||
}}
|
||||
@@ -0,0 +1,188 @@
|
||||
// Copyright 2009-2014 Neil Groves.
|
||||
// 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)
|
||||
//
|
||||
// Copyright 2006 Thorsten Ottosen.
|
||||
// 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)
|
||||
//
|
||||
// Copyright 2004 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)
|
||||
//
|
||||
// Contains range-based versions of the numeric std algorithms
|
||||
//
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_RANGE_NUMERIC_HPP
|
||||
#define BOOST_RANGE_NUMERIC_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/category.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
#include <boost/range/distance.hpp>
|
||||
#include <boost/range/size.hpp>
|
||||
#include <numeric>
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<class SinglePassRange, class Value>
|
||||
inline Value accumulate(const SinglePassRange& rng, Value init)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
return std::accumulate(boost::begin(rng), boost::end(rng), init);
|
||||
}
|
||||
|
||||
template<class SinglePassRange, class Value, class BinaryOperation>
|
||||
inline Value accumulate(const SinglePassRange& rng, Value init,
|
||||
BinaryOperation op)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange> ));
|
||||
|
||||
return std::accumulate(boost::begin(rng), boost::end(rng), init, op);
|
||||
}
|
||||
|
||||
namespace range_detail
|
||||
{
|
||||
template<class SinglePassRange1, class SinglePassRange2>
|
||||
inline bool inner_product_precondition(
|
||||
const SinglePassRange1&,
|
||||
const SinglePassRange2&,
|
||||
std::input_iterator_tag,
|
||||
std::input_iterator_tag)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
template<class SinglePassRange1, class SinglePassRange2>
|
||||
inline bool inner_product_precondition(
|
||||
const SinglePassRange1& rng1,
|
||||
const SinglePassRange2& rng2,
|
||||
std::forward_iterator_tag,
|
||||
std::forward_iterator_tag)
|
||||
{
|
||||
return boost::size(rng2) >= boost::size(rng1);
|
||||
}
|
||||
|
||||
} // namespace range_detail
|
||||
|
||||
template<
|
||||
class SinglePassRange1,
|
||||
class SinglePassRange2,
|
||||
class Value
|
||||
>
|
||||
inline Value inner_product(
|
||||
const SinglePassRange1& rng1,
|
||||
const SinglePassRange2& rng2,
|
||||
Value init)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange1>));
|
||||
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange2>));
|
||||
|
||||
BOOST_ASSERT(
|
||||
range_detail::inner_product_precondition(
|
||||
rng1, rng2,
|
||||
typename range_category<const SinglePassRange1>::type(),
|
||||
typename range_category<const SinglePassRange2>::type()));
|
||||
|
||||
return std::inner_product(
|
||||
boost::begin(rng1), boost::end(rng1),
|
||||
boost::begin(rng2), init);
|
||||
}
|
||||
|
||||
template<
|
||||
class SinglePassRange1,
|
||||
class SinglePassRange2,
|
||||
class Value,
|
||||
class BinaryOperation1,
|
||||
class BinaryOperation2
|
||||
>
|
||||
inline Value inner_product(
|
||||
const SinglePassRange1& rng1,
|
||||
const SinglePassRange2& rng2,
|
||||
Value init,
|
||||
BinaryOperation1 op1,
|
||||
BinaryOperation2 op2)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange1>));
|
||||
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange2>));
|
||||
|
||||
BOOST_ASSERT(
|
||||
range_detail::inner_product_precondition(
|
||||
rng1, rng2,
|
||||
typename range_category<const SinglePassRange1>::type(),
|
||||
typename range_category<const SinglePassRange2>::type()));
|
||||
|
||||
return std::inner_product(
|
||||
boost::begin(rng1), boost::end(rng1),
|
||||
boost::begin(rng2), init, op1, op2);
|
||||
}
|
||||
|
||||
template<class SinglePassRange, class OutputIterator>
|
||||
inline OutputIterator partial_sum(const SinglePassRange& rng,
|
||||
OutputIterator result)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
return std::partial_sum(boost::begin(rng), boost::end(rng), result);
|
||||
}
|
||||
|
||||
template<class SinglePassRange, class OutputIterator, class BinaryOperation>
|
||||
inline OutputIterator partial_sum(
|
||||
const SinglePassRange& rng,
|
||||
OutputIterator result,
|
||||
BinaryOperation op)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
return std::partial_sum(boost::begin(rng), boost::end(rng), result, op);
|
||||
}
|
||||
|
||||
template<class SinglePassRange, class OutputIterator>
|
||||
inline OutputIterator adjacent_difference(
|
||||
const SinglePassRange& rng,
|
||||
OutputIterator result)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
return std::adjacent_difference(boost::begin(rng), boost::end(rng),
|
||||
result);
|
||||
}
|
||||
|
||||
template<class SinglePassRange, class OutputIterator, class BinaryOperation>
|
||||
inline OutputIterator adjacent_difference(
|
||||
const SinglePassRange& rng,
|
||||
OutputIterator result,
|
||||
BinaryOperation op)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
return std::adjacent_difference(boost::begin(rng), boost::end(rng),
|
||||
result, op);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,96 @@
|
||||
// (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 some trivial global typedefs
|
||||
// ***************************************************************************
|
||||
|
||||
#ifndef BOOST_TEST_GLOBAL_TYPEDEF_HPP_021005GER
|
||||
#define BOOST_TEST_GLOBAL_TYPEDEF_HPP_021005GER
|
||||
|
||||
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
|
||||
#include <boost/test/detail/workaround.hpp>
|
||||
|
||||
#define BOOST_TEST_L( s ) ::boost::unit_test::const_string( s, sizeof( s ) - 1 )
|
||||
#define BOOST_TEST_STRINGIZE( s ) BOOST_TEST_L( BOOST_STRINGIZE( s ) )
|
||||
#define BOOST_TEST_EMPTY_STRING BOOST_TEST_L( "" )
|
||||
|
||||
#include <boost/test/detail/suppress_warnings.hpp>
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
namespace boost {
|
||||
namespace unit_test {
|
||||
|
||||
typedef unsigned long counter_t;
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
enum report_level { INV_REPORT_LEVEL, CONFIRMATION_REPORT, SHORT_REPORT, DETAILED_REPORT, NO_REPORT };
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
//! Indicates the output format for the loggers or the test tree printing
|
||||
enum output_format { OF_INVALID,
|
||||
OF_CLF, ///< compiler log format
|
||||
OF_XML, ///< XML format for report and log,
|
||||
OF_JUNIT, ///< JUNIT format for report and log,
|
||||
OF_CUSTOM_LOGGER, ///< User specified logger.
|
||||
OF_DOT ///< dot format for output content
|
||||
};
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
enum test_unit_type { TUT_CASE = 0x01, TUT_SUITE = 0x10, TUT_ANY = 0x11 };
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
enum assertion_result { AR_FAILED, AR_PASSED, AR_TRIGGERED };
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
typedef unsigned long test_unit_id;
|
||||
|
||||
const test_unit_id INV_TEST_UNIT_ID = 0xFFFFFFFF;
|
||||
const test_unit_id MAX_TEST_CASE_ID = 0xFFFFFFFE;
|
||||
const test_unit_id MIN_TEST_CASE_ID = 0x00010000;
|
||||
const test_unit_id MAX_TEST_SUITE_ID = 0x0000FF00;
|
||||
const test_unit_id MIN_TEST_SUITE_ID = 0x00000001;
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
namespace ut_detail {
|
||||
|
||||
inline test_unit_type
|
||||
test_id_2_unit_type( test_unit_id id )
|
||||
{
|
||||
return (id & 0xFFFF0000) != 0 ? TUT_CASE : TUT_SUITE;
|
||||
}
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
} // namespace ut_detail
|
||||
|
||||
// helper templates to prevent ODR violations
|
||||
template<class T>
|
||||
struct static_constant {
|
||||
static T value;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
T static_constant<T>::value;
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
} // namespace unit_test
|
||||
} // namespace boost
|
||||
|
||||
//____________________________________________________________________________//
|
||||
|
||||
#include <boost/test/detail/enable_warnings.hpp>
|
||||
|
||||
#endif // BOOST_TEST_GLOBAL_TYPEDEF_HPP_021005GER
|
||||
@@ -0,0 +1,223 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2007-2013
|
||||
//
|
||||
// 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_GENERIC_HOOK_HPP
|
||||
#define BOOST_INTRUSIVE_GENERIC_HOOK_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/link_mode.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <boost/intrusive/detail/assert.hpp>
|
||||
#include <boost/intrusive/detail/node_holder.hpp>
|
||||
#include <boost/intrusive/detail/algo_type.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
|
||||
/// @cond
|
||||
|
||||
namespace detail {
|
||||
|
||||
template <link_mode_type LinkMode>
|
||||
struct link_dispatch
|
||||
{};
|
||||
|
||||
template<class Hook>
|
||||
void destructor_impl(Hook &hook, detail::link_dispatch<safe_link>)
|
||||
{ //If this assertion raises, you might have destroyed an object
|
||||
//while it was still inserted in a container that is alive.
|
||||
//If so, remove the object from the container before destroying it.
|
||||
(void)hook; BOOST_INTRUSIVE_SAFE_HOOK_DESTRUCTOR_ASSERT(!hook.is_linked());
|
||||
}
|
||||
|
||||
template<class Hook>
|
||||
void destructor_impl(Hook &hook, detail::link_dispatch<auto_unlink>)
|
||||
{ hook.unlink(); }
|
||||
|
||||
template<class Hook>
|
||||
void destructor_impl(Hook &, detail::link_dispatch<normal_link>)
|
||||
{}
|
||||
|
||||
} //namespace detail {
|
||||
|
||||
enum base_hook_type
|
||||
{ NoBaseHookId
|
||||
, ListBaseHookId
|
||||
, SlistBaseHookId
|
||||
, RbTreeBaseHookId
|
||||
, HashBaseHookId
|
||||
, AvlTreeBaseHookId
|
||||
, BsTreeBaseHookId
|
||||
, TreapTreeBaseHookId
|
||||
, AnyBaseHookId
|
||||
};
|
||||
|
||||
|
||||
template <class HookTags, unsigned int>
|
||||
struct hook_tags_definer{};
|
||||
|
||||
template <class HookTags>
|
||||
struct hook_tags_definer<HookTags, ListBaseHookId>
|
||||
{ typedef HookTags default_list_hook; };
|
||||
|
||||
template <class HookTags>
|
||||
struct hook_tags_definer<HookTags, SlistBaseHookId>
|
||||
{ typedef HookTags default_slist_hook; };
|
||||
|
||||
template <class HookTags>
|
||||
struct hook_tags_definer<HookTags, RbTreeBaseHookId>
|
||||
{ typedef HookTags default_rbtree_hook; };
|
||||
|
||||
template <class HookTags>
|
||||
struct hook_tags_definer<HookTags, HashBaseHookId>
|
||||
{ typedef HookTags default_hashtable_hook; };
|
||||
|
||||
template <class HookTags>
|
||||
struct hook_tags_definer<HookTags, AvlTreeBaseHookId>
|
||||
{ typedef HookTags default_avltree_hook; };
|
||||
|
||||
template <class HookTags>
|
||||
struct hook_tags_definer<HookTags, BsTreeBaseHookId>
|
||||
{ typedef HookTags default_bstree_hook; };
|
||||
|
||||
template <class HookTags>
|
||||
struct hook_tags_definer<HookTags, AnyBaseHookId>
|
||||
{ typedef HookTags default_any_hook; };
|
||||
|
||||
template
|
||||
< class NodeTraits
|
||||
, class Tag
|
||||
, link_mode_type LinkMode
|
||||
, base_hook_type BaseHookType
|
||||
>
|
||||
struct hooktags_impl
|
||||
{
|
||||
static const link_mode_type link_mode = LinkMode;
|
||||
typedef Tag tag;
|
||||
typedef NodeTraits node_traits;
|
||||
static const bool is_base_hook = !detail::is_same<Tag, member_tag>::value;
|
||||
static const bool safemode_or_autounlink = is_safe_autounlink<link_mode>::value;
|
||||
static const unsigned int type = BaseHookType;
|
||||
};
|
||||
|
||||
/// @endcond
|
||||
|
||||
template
|
||||
< boost::intrusive::algo_types Algo
|
||||
, class NodeTraits
|
||||
, class Tag
|
||||
, link_mode_type LinkMode
|
||||
, base_hook_type BaseHookType
|
||||
>
|
||||
class generic_hook
|
||||
/// @cond
|
||||
//If the hook is a base hook, derive generic hook from node_holder
|
||||
//so that a unique base class is created to convert from the node
|
||||
//to the type. This mechanism will be used by bhtraits.
|
||||
//
|
||||
//If the hook is a member hook, generic hook will directly derive
|
||||
//from the hook.
|
||||
: public detail::if_c
|
||||
< detail::is_same<Tag, member_tag>::value
|
||||
, typename NodeTraits::node
|
||||
, node_holder<typename NodeTraits::node, Tag, BaseHookType>
|
||||
>::type
|
||||
//If this is the a default-tagged base hook derive from a class that
|
||||
//will define an special internal typedef. Containers will be able to detect this
|
||||
//special typedef and obtain generic_hook's internal types in order to deduce
|
||||
//value_traits for this hook.
|
||||
, public hook_tags_definer
|
||||
< generic_hook<Algo, NodeTraits, Tag, LinkMode, BaseHookType>
|
||||
, detail::is_same<Tag, dft_tag>::value ? BaseHookType : NoBaseHookId>
|
||||
/// @endcond
|
||||
{
|
||||
/// @cond
|
||||
typedef typename get_algo<Algo, NodeTraits>::type node_algorithms;
|
||||
typedef typename node_algorithms::node node;
|
||||
typedef typename node_algorithms::node_ptr node_ptr;
|
||||
typedef typename node_algorithms::const_node_ptr const_node_ptr;
|
||||
|
||||
public:
|
||||
|
||||
typedef hooktags_impl
|
||||
< NodeTraits
|
||||
, Tag, LinkMode, BaseHookType> hooktags;
|
||||
|
||||
node_ptr this_ptr()
|
||||
{ return pointer_traits<node_ptr>::pointer_to(static_cast<node&>(*this)); }
|
||||
|
||||
const_node_ptr this_ptr() const
|
||||
{ return pointer_traits<const_node_ptr>::pointer_to(static_cast<const node&>(*this)); }
|
||||
|
||||
public:
|
||||
/// @endcond
|
||||
|
||||
generic_hook()
|
||||
{
|
||||
if(hooktags::safemode_or_autounlink){
|
||||
node_algorithms::init(this->this_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
generic_hook(const generic_hook& )
|
||||
{
|
||||
if(hooktags::safemode_or_autounlink){
|
||||
node_algorithms::init(this->this_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
generic_hook& operator=(const generic_hook& )
|
||||
{ return *this; }
|
||||
|
||||
~generic_hook()
|
||||
{
|
||||
destructor_impl
|
||||
(*this, detail::link_dispatch<hooktags::link_mode>());
|
||||
}
|
||||
|
||||
void swap_nodes(generic_hook &other)
|
||||
{
|
||||
node_algorithms::swap_nodes
|
||||
(this->this_ptr(), other.this_ptr());
|
||||
}
|
||||
|
||||
bool is_linked() const
|
||||
{
|
||||
//is_linked() can be only used in safe-mode or auto-unlink
|
||||
BOOST_STATIC_ASSERT(( hooktags::safemode_or_autounlink ));
|
||||
return !node_algorithms::unique(this->this_ptr());
|
||||
}
|
||||
|
||||
void unlink()
|
||||
{
|
||||
BOOST_STATIC_ASSERT(( (int)hooktags::link_mode == (int)auto_unlink ));
|
||||
node_ptr n(this->this_ptr());
|
||||
if(!node_algorithms::inited(n)){
|
||||
node_algorithms::unlink(n);
|
||||
node_algorithms::init(n);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} //namespace intrusive
|
||||
} //namespace boost
|
||||
|
||||
#endif //BOOST_INTRUSIVE_GENERIC_HOOK_HPP
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
Copyright Charly Chevalier 2015
|
||||
Copyright Joel Falcou 2015
|
||||
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_PREDEF_HARDWARE_SIMD_PPC_VERSIONS_H
|
||||
#define BOOST_PREDEF_HARDWARE_SIMD_PPC_VERSIONS_H
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
|
||||
/*`
|
||||
Those defines represent Power PC SIMD extensions versions.
|
||||
|
||||
[note You *MUST* compare them with the predef `BOOST_HW_SIMD_PPC`.]
|
||||
*/
|
||||
|
||||
// ---------------------------------
|
||||
|
||||
/*`
|
||||
[heading `BOOST_HW_SIMD_PPC_VMX_VERSION`]
|
||||
|
||||
The [@https://en.wikipedia.org/wiki/AltiVec#VMX128 VMX] powerpc extension
|
||||
version number.
|
||||
|
||||
Version number is: *1.0.0*.
|
||||
*/
|
||||
#define BOOST_HW_SIMD_PPC_VMX_VERSION BOOST_VERSION_NUMBER(1, 0, 0)
|
||||
|
||||
/*`
|
||||
[heading `BOOST_HW_SIMD_PPC_VSX_VERSION`]
|
||||
|
||||
The [@https://en.wikipedia.org/wiki/AltiVec#VSX VSX] powerpc extension version
|
||||
number.
|
||||
|
||||
Version number is: *1.1.0*.
|
||||
*/
|
||||
#define BOOST_HW_SIMD_PPC_VSX_VERSION BOOST_VERSION_NUMBER(1, 1, 0)
|
||||
|
||||
/*`
|
||||
[heading `BOOST_HW_SIMD_PPC_QPX_VERSION`]
|
||||
|
||||
The QPX powerpc extension version number.
|
||||
|
||||
Version number is: *2.0.0*.
|
||||
*/
|
||||
#define BOOST_HW_SIMD_PPC_QPX_VERSION BOOST_VERSION_NUMBER(2, 0, 0)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
#ifndef BOOST_MPL_MODULUS_HPP_INCLUDED
|
||||
#define BOOST_MPL_MODULUS_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2000-2004
|
||||
//
|
||||
// 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.
|
||||
|
||||
// $Id$
|
||||
// $Date$
|
||||
// $Revision$
|
||||
|
||||
#define AUX778076_OP_NAME modulus
|
||||
#define AUX778076_OP_TOKEN %
|
||||
#define AUX778076_OP_ARITY 2
|
||||
#include <boost/mpl/aux_/arithmetic_op.hpp>
|
||||
|
||||
#endif // BOOST_MPL_MODULUS_HPP_INCLUDED
|
||||
@@ -0,0 +1,70 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// free_funcs.hpp : implementation of the free functions of boost::format
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Copyright Samuel Krempp 2003. 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/format for library home page
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifndef BOOST_FORMAT_FUNCS_HPP
|
||||
#define BOOST_FORMAT_FUNCS_HPP
|
||||
|
||||
#include <boost/format/format_class.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template<class Ch, class Tr, class Alloc> inline
|
||||
std::basic_string<Ch, Tr, Alloc> str(const basic_format<Ch, Tr, Alloc>& f) {
|
||||
// adds up all pieces of strings and converted items, and return the formatted string
|
||||
return f.str();
|
||||
}
|
||||
namespace io {
|
||||
using ::boost::str; // keep compatibility with when it was defined in this N.S.
|
||||
} // - namespace io
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_STD_STREAM
|
||||
template<class Ch, class Tr, class Alloc>
|
||||
std::basic_ostream<Ch, Tr> &
|
||||
operator<<( std::basic_ostream<Ch, Tr> & os,
|
||||
const basic_format<Ch, Tr, Alloc>& f)
|
||||
#else
|
||||
template<class Ch, class Tr, class Alloc>
|
||||
std::ostream &
|
||||
operator<<( std::ostream & os,
|
||||
const basic_format<Ch, Tr, Alloc>& f)
|
||||
#endif
|
||||
// effect: "return os << str(f);" but we can do it faster
|
||||
{
|
||||
typedef boost::basic_format<Ch, Tr, Alloc> format_t;
|
||||
if(f.items_.size()==0)
|
||||
os << f.prefix_;
|
||||
else {
|
||||
if(f.cur_arg_ < f.num_args_)
|
||||
if( f.exceptions() & io::too_few_args_bit )
|
||||
// not enough variables supplied
|
||||
boost::throw_exception(io::too_few_args(f.cur_arg_, f.num_args_));
|
||||
if(f.style_ & format_t::special_needs)
|
||||
os << f.str();
|
||||
else {
|
||||
// else we dont have to count chars output, so we dump directly to os :
|
||||
os << f.prefix_;
|
||||
for(unsigned long i=0; i<f.items_.size(); ++i) {
|
||||
const typename format_t::format_item_t& item = f.items_[i];
|
||||
os << item.res_;
|
||||
os << item.appendix_;
|
||||
}
|
||||
}
|
||||
}
|
||||
f.dumped_=true;
|
||||
return os;
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_FORMAT_FUNCS_HPP
|
||||
@@ -0,0 +1,15 @@
|
||||
// (C) Copyright John Maddock 2002.
|
||||
// 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 for most recent version.
|
||||
|
||||
#define BOOST_PLATFORM "AmigaOS"
|
||||
|
||||
#define BOOST_DISABLE_THREADS
|
||||
#define BOOST_NO_CWCHAR
|
||||
#define BOOST_NO_STD_WSTRING
|
||||
#define BOOST_NO_INTRINSIC_WCHAR_T
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
[auto_generated]
|
||||
boost/numeric/odeint/external/vexcl/vexcl_same_instance.hpp
|
||||
|
||||
[begin_description]
|
||||
Check if two VexCL containers are the same instance.
|
||||
[end_description]
|
||||
|
||||
Copyright 2009-2011 Karsten Ahnert
|
||||
Copyright 2009-2011 Mario Mulansky
|
||||
|
||||
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_ODEINT_EXTERNAL_VEXCL_VEXCL_SAME_INSTANCE_HPP_INCLUDED
|
||||
#define BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_SAME_INSTANCE_HPP_INCLUDED
|
||||
|
||||
#include <vexcl/vector.hpp>
|
||||
#include <vexcl/multivector.hpp>
|
||||
|
||||
#include <boost/numeric/odeint/util/same_instance.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace odeint {
|
||||
|
||||
template <typename T>
|
||||
struct same_instance_impl< vex::vector<T> , vex::vector<T> >
|
||||
{
|
||||
static bool same_instance( const vex::vector<T> &x1 , const vex::vector<T> &x2 )
|
||||
{
|
||||
return
|
||||
static_cast<const vex::vector<T>*>(&x1) ==
|
||||
static_cast<const vex::vector<T>*>(&x2);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, size_t N>
|
||||
struct same_instance_impl< vex::multivector<T, N> , vex::multivector<T, N> >
|
||||
{
|
||||
static bool same_instance( const vex::multivector<T, N> &x1 , const vex::multivector<T, N> &x2 )
|
||||
{
|
||||
return
|
||||
static_cast<const vex::multivector<T, N>*>(&x1) ==
|
||||
static_cast<const vex::multivector<T, N>*>(&x2);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace odeint
|
||||
} // namespace numeric
|
||||
} // namespace boost
|
||||
|
||||
|
||||
|
||||
#endif // BOOST_NUMERIC_ODEINT_EXTERNAL_VEXCL_VEXCL_SAME_INSTANCE_HPP_INCLUDED
|
||||
@@ -0,0 +1,168 @@
|
||||
/* ALIST-TO-PCHK.C - Convert a parity check matrix from alist format. */
|
||||
|
||||
/* Copyright (c) 1995-2012 by Radford M. Neal.
|
||||
*
|
||||
* Permission is granted for anyone to copy, use, modify, and distribute
|
||||
* these programs and accompanying documents for any purpose, provided
|
||||
* this copyright notice is retained and prominently displayed, and note
|
||||
* is made of any changes made to these programs. These programs and
|
||||
* documents are distributed without any warranty, express or implied.
|
||||
* As the programs were written for research purposes only, they have not
|
||||
* been tested to the degree that would be advisable in any important
|
||||
* application. All use of these programs is entirely at the user's own
|
||||
* risk.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "alloc.h"
|
||||
#include "intio.h"
|
||||
#include "open.h"
|
||||
#include "mod2sparse.h"
|
||||
#include "mod2dense.h"
|
||||
#include "mod2convert.h"
|
||||
#include "rcode.h"
|
||||
|
||||
|
||||
void bad_alist_file(void);
|
||||
void usage(void);
|
||||
|
||||
|
||||
/* MAIN PROGRAM. */
|
||||
|
||||
int main
|
||||
( int argc,
|
||||
char **argv
|
||||
)
|
||||
{
|
||||
char *alist_file, *pchk_file;
|
||||
FILE *af, *pf;
|
||||
int mxrw, mxcw;
|
||||
int *rw, *cw;
|
||||
int i, j, k;
|
||||
int tot, trans;
|
||||
int nxt;
|
||||
|
||||
trans = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (argc>1 && strcmp(argv[1],"-t")==0)
|
||||
{ trans = 1;
|
||||
argc -= 1;
|
||||
argv += 1;
|
||||
}
|
||||
else
|
||||
{ break;
|
||||
}
|
||||
}
|
||||
|
||||
if (argc!=3)
|
||||
{ usage();
|
||||
}
|
||||
|
||||
pchk_file = argv[2];
|
||||
alist_file = argv[1];
|
||||
|
||||
af = open_file_std(alist_file,"r");
|
||||
|
||||
if (af==NULL)
|
||||
{ fprintf(stderr,"Can't open alist file: %s\n",alist_file);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (fscanf(af,"%d",&M)!=1 || M<1
|
||||
|| fscanf(af,"%d",&N)!=1 || N<1
|
||||
|| fscanf(af,"%d",&mxrw)!=1 || mxrw<0 || mxrw>N
|
||||
|| fscanf(af,"%d",&mxcw)!=1 || mxcw<0 || mxcw>M)
|
||||
{ bad_alist_file();
|
||||
}
|
||||
|
||||
rw = (int *) chk_alloc (M, sizeof *rw);
|
||||
|
||||
for (i = 0; i<M; i++)
|
||||
{ if (fscanf(af,"%d",&rw[i])!=1 || rw[i]<0 || rw[i]>N)
|
||||
{ bad_alist_file();
|
||||
}
|
||||
}
|
||||
|
||||
cw = (int *) chk_alloc (N, sizeof *cw);
|
||||
|
||||
for (j = 0; j<N; j++)
|
||||
{ if (fscanf(af,"%d",&cw[j])!=1 || cw[j]<0 || cw[j]>M)
|
||||
{ bad_alist_file();
|
||||
}
|
||||
}
|
||||
|
||||
H = mod2sparse_allocate(M,N);
|
||||
|
||||
do { if (fscanf(af,"%d",&nxt)!=1) nxt = -1; } while (nxt==0);
|
||||
|
||||
tot = 0;
|
||||
|
||||
for (i = 0; i<M; i++)
|
||||
{ for (k = 0; k<rw[i]; k++)
|
||||
{ if (nxt<=0 || nxt>N || mod2sparse_find(H,i,nxt-1))
|
||||
{ bad_alist_file();
|
||||
}
|
||||
mod2sparse_insert(H,i,nxt-1);
|
||||
tot += 1;
|
||||
do { if (fscanf(af,"%d",&nxt)!=1) nxt = -1; } while (nxt==0);
|
||||
}
|
||||
}
|
||||
|
||||
for (j = 0; j<N; j++)
|
||||
{ for (k = 0; k<cw[j]; k++)
|
||||
{ if (nxt<=0 || nxt>M || !mod2sparse_find(H,nxt-1,j))
|
||||
{ bad_alist_file();
|
||||
}
|
||||
tot -= 1;
|
||||
do { if (fscanf(af,"%d",&nxt)!=1) nxt = -1; } while (nxt==0);
|
||||
}
|
||||
}
|
||||
|
||||
if (tot!=0 || nxt!=-1 || !feof(af))
|
||||
{ bad_alist_file();
|
||||
}
|
||||
|
||||
if (trans)
|
||||
{ mod2sparse *HT;
|
||||
HT = H;
|
||||
H = mod2sparse_allocate(N,M);
|
||||
mod2sparse_transpose(HT,H);
|
||||
}
|
||||
|
||||
pf = open_file_std(pchk_file,"wb");
|
||||
if (pf==NULL)
|
||||
{ fprintf(stderr,"Can't create parity check file: %s\n",pchk_file);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
intio_write(pf,('P'<<8)+0x80);
|
||||
|
||||
if (ferror(pf) || !mod2sparse_write(pf,H) || fclose(pf)!=0)
|
||||
{ fprintf(stderr,"Error writing to parity check file %s\n",pchk_file);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* COMPLAIN THAT ALIST FILE IS BAD. */
|
||||
|
||||
void bad_alist_file()
|
||||
{ fprintf(stderr,"Alist file doesn't have the right format\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* PRINT USAGE MESSAGE AND EXIT. */
|
||||
|
||||
void usage(void)
|
||||
{ fprintf(stderr,"Usage: alist-to-pchk [ -t ] alist-file pchk-file\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
|
||||
// (C) Copyright John Maddock 2015.
|
||||
// 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_DESTRUCTIBLE_HPP_INCLUDED
|
||||
#define BOOST_TT_IS_DESTRUCTIBLE_HPP_INCLUDED
|
||||
|
||||
#include <cstddef> // size_t
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800)
|
||||
|
||||
#include <boost/type_traits/detail/yes_no_type.hpp>
|
||||
#include <boost/type_traits/declval.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace detail{
|
||||
|
||||
struct is_destructible_imp
|
||||
{
|
||||
template<typename T, typename = decltype(boost::declval<T&>().~T())>
|
||||
static boost::type_traits::yes_type test(int);
|
||||
template<typename>
|
||||
static boost::type_traits::no_type test(...);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
template <class T> struct is_destructible : public integral_constant<bool, sizeof(detail::is_destructible_imp::test<T>(0)) == sizeof(boost::type_traits::yes_type)>{};
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/type_traits/is_pod.hpp>
|
||||
#include <boost/type_traits/is_class.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
||||
// We don't know how to implement this:
|
||||
template <class T> struct is_destructible : public integral_constant<bool, is_pod<T>::value || is_class<T>::value>{};
|
||||
#endif
|
||||
|
||||
template <> struct is_destructible<void> : public false_type{};
|
||||
template <> struct is_destructible<void const> : public false_type{};
|
||||
template <> struct is_destructible<void volatile> : public false_type{};
|
||||
template <> struct is_destructible<void const volatile> : public false_type{};
|
||||
template <class T> struct is_destructible<T&> : public is_destructible<T>{};
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
template <class T> struct is_destructible<T&&> : public is_destructible<T>{};
|
||||
#endif
|
||||
template <class T, std::size_t N> struct is_destructible<T[N]> : public is_destructible<T>{};
|
||||
template <class T> struct is_destructible<T[]> : public is_destructible<T>{};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_TT_IS_DESTRUCTIBLE_HPP_INCLUDED
|
||||
@@ -0,0 +1,377 @@
|
||||
#ifndef DATE_TIME_PERIOD_HPP___
|
||||
#define DATE_TIME_PERIOD_HPP___
|
||||
|
||||
/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
|
||||
* Use, modification and distribution is subject to the
|
||||
* Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
|
||||
* Author: Jeff Garland, Bart Garst
|
||||
* $Date$
|
||||
*/
|
||||
|
||||
/*! \file period.hpp
|
||||
This file contain the implementation of the period abstraction. This is
|
||||
basically the same idea as a range. Although this class is intended for
|
||||
use in the time library, it is pretty close to general enough for other
|
||||
numeric uses.
|
||||
|
||||
*/
|
||||
|
||||
#include "boost/operators.hpp"
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace date_time {
|
||||
//!Provides generalized period type useful in date-time systems
|
||||
/*!This template uses a class to represent a time point within the period
|
||||
and another class to represent a duration. As a result, this class is
|
||||
not appropriate for use when the number and duration representation
|
||||
are the same (eg: in the regular number domain).
|
||||
|
||||
A period can be specified by providing either the begining point and
|
||||
a duration or the begining point and the end point( end is NOT part
|
||||
of the period but 1 unit past it. A period will be "invalid" if either
|
||||
end_point <= begin_point or the given duration is <= 0. Any valid period
|
||||
will return false for is_null().
|
||||
|
||||
Zero length periods are also considered invalid. Zero length periods are
|
||||
periods where the begining and end points are the same, or, the given
|
||||
duration is zero. For a zero length period, the last point will be one
|
||||
unit less than the begining point.
|
||||
|
||||
In the case that the begin and last are the same, the period has a
|
||||
length of one unit.
|
||||
|
||||
The best way to handle periods is usually to provide a begining point and
|
||||
a duration. So, day1 + 7 days is a week period which includes all of the
|
||||
first day and 6 more days (eg: Sun to Sat).
|
||||
|
||||
*/
|
||||
template<class point_rep, class duration_rep>
|
||||
class period : private
|
||||
boost::less_than_comparable<period<point_rep, duration_rep>
|
||||
, boost::equality_comparable< period<point_rep, duration_rep>
|
||||
> >
|
||||
{
|
||||
public:
|
||||
typedef point_rep point_type;
|
||||
typedef duration_rep duration_type;
|
||||
|
||||
period(point_rep first_point, point_rep end_point);
|
||||
period(point_rep first_point, duration_rep len);
|
||||
point_rep begin() const;
|
||||
point_rep end() const;
|
||||
point_rep last() const;
|
||||
duration_rep length() const;
|
||||
bool is_null() const;
|
||||
bool operator==(const period& rhs) const;
|
||||
bool operator<(const period& rhs) const;
|
||||
void shift(const duration_rep& d);
|
||||
void expand(const duration_rep& d);
|
||||
bool contains(const point_rep& point) const;
|
||||
bool contains(const period& other) const;
|
||||
bool intersects(const period& other) const;
|
||||
bool is_adjacent(const period& other) const;
|
||||
bool is_before(const point_rep& point) const;
|
||||
bool is_after(const point_rep& point) const;
|
||||
period intersection(const period& other) const;
|
||||
period merge(const period& other) const;
|
||||
period span(const period& other) const;
|
||||
private:
|
||||
point_rep begin_;
|
||||
point_rep last_;
|
||||
};
|
||||
|
||||
//! create a period from begin to last eg: [begin,end)
|
||||
/*! If end <= begin then the period will be invalid
|
||||
*/
|
||||
template<class point_rep, class duration_rep>
|
||||
inline
|
||||
period<point_rep,duration_rep>::period(point_rep first_point,
|
||||
point_rep end_point) :
|
||||
begin_(first_point),
|
||||
last_(end_point - duration_rep::unit())
|
||||
{}
|
||||
|
||||
//! create a period as [begin, begin+len)
|
||||
/*! If len is <= 0 then the period will be invalid
|
||||
*/
|
||||
template<class point_rep, class duration_rep>
|
||||
inline
|
||||
period<point_rep,duration_rep>::period(point_rep first_point, duration_rep len) :
|
||||
begin_(first_point),
|
||||
last_(first_point + len-duration_rep::unit())
|
||||
{ }
|
||||
|
||||
|
||||
//! Return the first element in the period
|
||||
template<class point_rep, class duration_rep>
|
||||
inline
|
||||
point_rep period<point_rep,duration_rep>::begin() const
|
||||
{
|
||||
return begin_;
|
||||
}
|
||||
|
||||
//! Return one past the last element
|
||||
template<class point_rep, class duration_rep>
|
||||
inline
|
||||
point_rep period<point_rep,duration_rep>::end() const
|
||||
{
|
||||
return last_ + duration_rep::unit();
|
||||
}
|
||||
|
||||
//! Return the last item in the period
|
||||
template<class point_rep, class duration_rep>
|
||||
inline
|
||||
point_rep period<point_rep,duration_rep>::last() const
|
||||
{
|
||||
return last_;
|
||||
}
|
||||
|
||||
//! True if period is ill formed (length is zero or less)
|
||||
template<class point_rep, class duration_rep>
|
||||
inline
|
||||
bool period<point_rep,duration_rep>::is_null() const
|
||||
{
|
||||
return end() <= begin_;
|
||||
}
|
||||
|
||||
//! Return the length of the period
|
||||
template<class point_rep, class duration_rep>
|
||||
inline
|
||||
duration_rep period<point_rep,duration_rep>::length() const
|
||||
{
|
||||
if(last_ < begin_){ // invalid period
|
||||
return last_+duration_rep::unit() - begin_;
|
||||
}
|
||||
else{
|
||||
return end() - begin_; // normal case
|
||||
}
|
||||
}
|
||||
|
||||
//! Equality operator
|
||||
template<class point_rep, class duration_rep>
|
||||
inline
|
||||
bool period<point_rep,duration_rep>::operator==(const period& rhs) const
|
||||
{
|
||||
return ((begin_ == rhs.begin_) &&
|
||||
(last_ == rhs.last_));
|
||||
}
|
||||
|
||||
//! Strict as defined by rhs.last <= lhs.last
|
||||
template<class point_rep, class duration_rep>
|
||||
inline
|
||||
bool period<point_rep,duration_rep>::operator<(const period& rhs) const
|
||||
{
|
||||
return (last_ < rhs.begin_);
|
||||
}
|
||||
|
||||
|
||||
//! Shift the start and end by the specified amount
|
||||
template<class point_rep, class duration_rep>
|
||||
inline
|
||||
void period<point_rep,duration_rep>::shift(const duration_rep& d)
|
||||
{
|
||||
begin_ = begin_ + d;
|
||||
last_ = last_ + d;
|
||||
}
|
||||
|
||||
/** Expands the size of the period by the duration on both ends.
|
||||
*
|
||||
*So before expand
|
||||
*@code
|
||||
*
|
||||
* [-------]
|
||||
* ^ ^ ^ ^ ^ ^ ^
|
||||
* 1 2 3 4 5 6 7
|
||||
*
|
||||
*@endcode
|
||||
* After expand(2)
|
||||
*@code
|
||||
*
|
||||
* [----------------------]
|
||||
* ^ ^ ^ ^ ^ ^ ^
|
||||
* 1 2 3 4 5 6 7
|
||||
*
|
||||
*@endcode
|
||||
*/
|
||||
template<class point_rep, class duration_rep>
|
||||
inline
|
||||
void period<point_rep,duration_rep>::expand(const duration_rep& d)
|
||||
{
|
||||
begin_ = begin_ - d;
|
||||
last_ = last_ + d;
|
||||
}
|
||||
|
||||
//! True if the point is inside the period, zero length periods contain no points
|
||||
template<class point_rep, class duration_rep>
|
||||
inline
|
||||
bool period<point_rep,duration_rep>::contains(const point_rep& point) const
|
||||
{
|
||||
return ((point >= begin_) &&
|
||||
(point <= last_));
|
||||
}
|
||||
|
||||
|
||||
//! True if this period fully contains (or equals) the other period
|
||||
template<class point_rep, class duration_rep>
|
||||
inline
|
||||
bool period<point_rep,duration_rep>::contains(const period<point_rep,duration_rep>& other) const
|
||||
{
|
||||
return ((begin_ <= other.begin_) && (last_ >= other.last_));
|
||||
}
|
||||
|
||||
|
||||
//! True if periods are next to each other without a gap.
|
||||
/* In the example below, p1 and p2 are adjacent, but p3 is not adjacent
|
||||
* with either of p1 or p2.
|
||||
*@code
|
||||
* [-p1-)
|
||||
* [-p2-)
|
||||
* [-p3-)
|
||||
*@endcode
|
||||
*/
|
||||
template<class point_rep, class duration_rep>
|
||||
inline
|
||||
bool
|
||||
period<point_rep,duration_rep>::is_adjacent(const period<point_rep,duration_rep>& other) const
|
||||
{
|
||||
return (other.begin() == end() ||
|
||||
begin_ == other.end());
|
||||
}
|
||||
|
||||
|
||||
//! True if all of the period is prior or t < start
|
||||
/* In the example below only point 1 would evaluate to true.
|
||||
*@code
|
||||
* [---------])
|
||||
* ^ ^ ^ ^ ^
|
||||
* 1 2 3 4 5
|
||||
*
|
||||
*@endcode
|
||||
*/
|
||||
template<class point_rep, class duration_rep>
|
||||
inline
|
||||
bool
|
||||
period<point_rep,duration_rep>::is_after(const point_rep& t) const
|
||||
{
|
||||
if (is_null())
|
||||
{
|
||||
return false; //null period isn't after
|
||||
}
|
||||
|
||||
return t < begin_;
|
||||
}
|
||||
|
||||
//! True if all of the period is prior to the passed point or end <= t
|
||||
/* In the example below points 4 and 5 return true.
|
||||
*@code
|
||||
* [---------])
|
||||
* ^ ^ ^ ^ ^
|
||||
* 1 2 3 4 5
|
||||
*
|
||||
*@endcode
|
||||
*/
|
||||
template<class point_rep, class duration_rep>
|
||||
inline
|
||||
bool
|
||||
period<point_rep,duration_rep>::is_before(const point_rep& t) const
|
||||
{
|
||||
if (is_null())
|
||||
{
|
||||
return false; //null period isn't before anything
|
||||
}
|
||||
|
||||
return last_ < t;
|
||||
}
|
||||
|
||||
|
||||
//! True if the periods overlap in any way
|
||||
/* In the example below p1 intersects with p2, p4, and p6.
|
||||
*@code
|
||||
* [---p1---)
|
||||
* [---p2---)
|
||||
* [---p3---)
|
||||
* [---p4---)
|
||||
* [-p5-)
|
||||
* [-p6-)
|
||||
*@endcode
|
||||
*/
|
||||
template<class point_rep, class duration_rep>
|
||||
inline
|
||||
bool period<point_rep,duration_rep>::intersects(const period<point_rep,duration_rep>& other) const
|
||||
{
|
||||
return ( contains(other.begin_) ||
|
||||
other.contains(begin_) ||
|
||||
((other.begin_ < begin_) && (other.last_ >= begin_)));
|
||||
}
|
||||
|
||||
//! Returns the period of intersection or invalid range no intersection
|
||||
template<class point_rep, class duration_rep>
|
||||
inline
|
||||
period<point_rep,duration_rep>
|
||||
period<point_rep,duration_rep>::intersection(const period<point_rep,duration_rep>& other) const
|
||||
{
|
||||
if (begin_ > other.begin_) {
|
||||
if (last_ <= other.last_) { //case2
|
||||
return *this;
|
||||
}
|
||||
//case 1
|
||||
return period<point_rep,duration_rep>(begin_, other.end());
|
||||
}
|
||||
else {
|
||||
if (last_ <= other.last_) { //case3
|
||||
return period<point_rep,duration_rep>(other.begin_, this->end());
|
||||
}
|
||||
//case4
|
||||
return other;
|
||||
}
|
||||
//unreachable
|
||||
}
|
||||
|
||||
//! Returns the union of intersecting periods -- or null period
|
||||
/*!
|
||||
*/
|
||||
template<class point_rep, class duration_rep>
|
||||
inline
|
||||
period<point_rep,duration_rep>
|
||||
period<point_rep,duration_rep>::merge(const period<point_rep,duration_rep>& other) const
|
||||
{
|
||||
if (this->intersects(other)) {
|
||||
if (begin_ < other.begin_) {
|
||||
return period<point_rep,duration_rep>(begin_, last_ > other.last_ ? this->end() : other.end());
|
||||
}
|
||||
|
||||
return period<point_rep,duration_rep>(other.begin_, last_ > other.last_ ? this->end() : other.end());
|
||||
|
||||
}
|
||||
return period<point_rep,duration_rep>(begin_,begin_); // no intersect return null
|
||||
}
|
||||
|
||||
//! Combine two periods with earliest start and latest end.
|
||||
/*! Combines two periods and any gap between them such that
|
||||
* start = min(p1.start, p2.start)
|
||||
* end = max(p1.end , p2.end)
|
||||
*@code
|
||||
* [---p1---)
|
||||
* [---p2---)
|
||||
* result:
|
||||
* [-----------p3----------)
|
||||
*@endcode
|
||||
*/
|
||||
template<class point_rep, class duration_rep>
|
||||
inline
|
||||
period<point_rep,duration_rep>
|
||||
period<point_rep,duration_rep>::span(const period<point_rep,duration_rep>& other) const
|
||||
{
|
||||
point_rep start((begin_ < other.begin_) ? begin() : other.begin());
|
||||
point_rep newend((last_ < other.last_) ? other.end() : this->end());
|
||||
return period<point_rep,duration_rep>(start, newend);
|
||||
}
|
||||
|
||||
|
||||
} } //namespace date_time
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user