Initial Commit
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
Copyright Rene Rivera 2008-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_COMPILER_CLANG_H
|
||||
#define BOOST_PREDEF_COMPILER_CLANG_H
|
||||
|
||||
#include <boost/predef/version_number.h>
|
||||
#include <boost/predef/make.h>
|
||||
|
||||
/*`
|
||||
[heading `BOOST_COMP_CLANG`]
|
||||
|
||||
[@http://en.wikipedia.org/wiki/Clang Clang] compiler.
|
||||
Version number available as major, minor, and patch.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`__clang__`] [__predef_detection__]]
|
||||
|
||||
[[`__clang_major__`, `__clang_minor__`, `__clang_patchlevel__`] [V.R.P]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define BOOST_COMP_CLANG BOOST_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if defined(__clang__)
|
||||
# define BOOST_COMP_CLANG_DETECTION BOOST_VERSION_NUMBER(__clang_major__,__clang_minor__,__clang_patchlevel__)
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_COMP_CLANG_DETECTION
|
||||
# if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED)
|
||||
# define BOOST_COMP_CLANG_EMULATED BOOST_COMP_CLANG_DETECTION
|
||||
# else
|
||||
# undef BOOST_COMP_CLANG
|
||||
# define BOOST_COMP_CLANG BOOST_COMP_CLANG_DETECTION
|
||||
# endif
|
||||
# define BOOST_COMP_CLANG_AVAILABLE
|
||||
# include <boost/predef/detail/comp_detected.h>
|
||||
#endif
|
||||
|
||||
#define BOOST_COMP_CLANG_NAME "Clang"
|
||||
|
||||
#endif
|
||||
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_CLANG,BOOST_COMP_CLANG_NAME)
|
||||
|
||||
#ifdef BOOST_COMP_CLANG_EMULATED
|
||||
#include <boost/predef/detail/test.h>
|
||||
BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_CLANG_EMULATED,BOOST_COMP_CLANG_NAME)
|
||||
#endif
|
||||
@@ -0,0 +1,34 @@
|
||||
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
|
||||
// unit/quantity manipulation and conversion
|
||||
//
|
||||
// Copyright (C) 2003-2008 Matthias Christian Schabel
|
||||
// Copyright (C) 2008 Steven Watanabe
|
||||
//
|
||||
// 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_UNITS_SI_MAGNETIC_FLUX_DENSITY_HPP
|
||||
#define BOOST_UNITS_SI_MAGNETIC_FLUX_DENSITY_HPP
|
||||
|
||||
#include <boost/units/systems/si/base.hpp>
|
||||
#include <boost/units/physical_dimensions/magnetic_flux_density.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
namespace si {
|
||||
|
||||
typedef unit<magnetic_flux_density_dimension,si::system> magnetic_flux_density;
|
||||
|
||||
BOOST_UNITS_STATIC_CONSTANT(tesla,magnetic_flux_density);
|
||||
BOOST_UNITS_STATIC_CONSTANT(teslas,magnetic_flux_density);
|
||||
|
||||
} // namespace si
|
||||
|
||||
} // namespace units
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_UNITS_SI_MAGNETIC_FLUX_DENSITY_HPP
|
||||
@@ -0,0 +1,91 @@
|
||||
#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED
|
||||
#define BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// boost/detail/spinlock_pool.hpp
|
||||
//
|
||||
// Copyright (c) 2008 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)
|
||||
//
|
||||
// spinlock_pool<0> is reserved for atomic<>, when/if it arrives
|
||||
// spinlock_pool<1> is reserved for shared_ptr reference counts
|
||||
// spinlock_pool<2> is reserved for shared_ptr atomic access
|
||||
//
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/smart_ptr/detail/spinlock.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template< int M > class spinlock_pool
|
||||
{
|
||||
private:
|
||||
|
||||
static spinlock pool_[ 41 ];
|
||||
|
||||
public:
|
||||
|
||||
static spinlock & spinlock_for( void const * pv )
|
||||
{
|
||||
#if defined(__VMS) && __INITIAL_POINTER_SIZE == 64
|
||||
std::size_t i = reinterpret_cast< unsigned long long >( pv ) % 41;
|
||||
#else
|
||||
std::size_t i = reinterpret_cast< std::size_t >( pv ) % 41;
|
||||
#endif
|
||||
return pool_[ i ];
|
||||
}
|
||||
|
||||
class scoped_lock
|
||||
{
|
||||
private:
|
||||
|
||||
spinlock & sp_;
|
||||
|
||||
scoped_lock( scoped_lock const & );
|
||||
scoped_lock & operator=( scoped_lock const & );
|
||||
|
||||
public:
|
||||
|
||||
explicit scoped_lock( void const * pv ): sp_( spinlock_for( pv ) )
|
||||
{
|
||||
sp_.lock();
|
||||
}
|
||||
|
||||
~scoped_lock()
|
||||
{
|
||||
sp_.unlock();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template< int M > spinlock spinlock_pool< M >::pool_[ 41 ] =
|
||||
{
|
||||
BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
|
||||
BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
|
||||
BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
|
||||
BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
|
||||
BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
|
||||
BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
|
||||
BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
|
||||
BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
|
||||
BOOST_DETAIL_SPINLOCK_INIT
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED
|
||||
@@ -0,0 +1,318 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Pablo Halpern 2009. 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)
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2011-2014. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/intrusive for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_INTRUSIVE_POINTER_TRAITS_HPP
|
||||
#define BOOST_INTRUSIVE_POINTER_TRAITS_HPP
|
||||
|
||||
#include <boost/intrusive/detail/config_begin.hpp>
|
||||
#include <boost/intrusive/detail/workaround.hpp>
|
||||
#include <boost/intrusive/pointer_rebind.hpp>
|
||||
#include <boost/intrusive/detail/pointer_element.hpp>
|
||||
#include <boost/intrusive/detail/mpl.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace intrusive {
|
||||
namespace detail {
|
||||
|
||||
#if !defined(BOOST_MSVC) || (BOOST_MSVC > 1310)
|
||||
BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_member_function_callable_with_pointer_to, pointer_to)
|
||||
BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_member_function_callable_with_dynamic_cast_from, dynamic_cast_from)
|
||||
BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_member_function_callable_with_static_cast_from, static_cast_from)
|
||||
BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_member_function_callable_with_const_cast_from, const_cast_from)
|
||||
#else
|
||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNC_CALLED_IGNORE_SIGNATURE(has_member_function_callable_with_pointer_to, pointer_to)
|
||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNC_CALLED_IGNORE_SIGNATURE(has_member_function_callable_with_dynamic_cast_from, dynamic_cast_from)
|
||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNC_CALLED_IGNORE_SIGNATURE(has_member_function_callable_with_static_cast_from, static_cast_from)
|
||||
BOOST_INTRUSIVE_HAS_MEMBER_FUNC_CALLED_IGNORE_SIGNATURE(has_member_function_callable_with_const_cast_from, const_cast_from)
|
||||
#endif
|
||||
|
||||
BOOST_INTRUSIVE_INSTANTIATE_EVAL_DEFAULT_TYPE_TMPLT(element_type)
|
||||
BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(difference_type)
|
||||
BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(reference)
|
||||
BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(value_traits_ptr)
|
||||
|
||||
} //namespace detail {
|
||||
|
||||
|
||||
//! pointer_traits is the implementation of C++11 std::pointer_traits class with some
|
||||
//! extensions like castings.
|
||||
//!
|
||||
//! pointer_traits supplies a uniform interface to certain attributes of pointer-like types.
|
||||
//!
|
||||
//! <b>Note</b>: When defining a custom family of pointers or references to be used with BI
|
||||
//! library, make sure the public static conversion functions accessed through
|
||||
//! the `pointer_traits` interface (`*_cast_from` and `pointer_to`) can
|
||||
//! properly convert between const and nonconst referred member types
|
||||
//! <b>without the use of implicit constructor calls</b>. It is suggested these
|
||||
//! conversions be implemented as function templates, where the template
|
||||
//! argument is the type of the object being converted from.
|
||||
template <typename Ptr>
|
||||
struct pointer_traits
|
||||
{
|
||||
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
//!The pointer type
|
||||
//!queried by this pointer_traits instantiation
|
||||
typedef Ptr pointer;
|
||||
|
||||
//!Ptr::element_type if such a type exists; otherwise, T if Ptr is a class
|
||||
//!template instantiation of the form SomePointer<T, Args>, where Args is zero or
|
||||
//!more type arguments ; otherwise , the specialization is ill-formed.
|
||||
typedef unspecified_type element_type;
|
||||
|
||||
//!Ptr::difference_type if such a type exists; otherwise,
|
||||
//!std::ptrdiff_t.
|
||||
typedef unspecified_type difference_type;
|
||||
|
||||
//!Ptr::rebind<U> if such a type exists; otherwise, SomePointer<U, Args> if Ptr is
|
||||
//!a class template instantiation of the form SomePointer<T, Args>, where Args is zero or
|
||||
//!more type arguments ; otherwise, the instantiation of rebind is ill-formed.
|
||||
//!
|
||||
//!For portable code for C++03 and C++11, <pre>typename rebind_pointer<U>::type</pre>
|
||||
//!shall be used instead of rebind<U> to obtain a pointer to U.
|
||||
template <class U> using rebind = unspecified;
|
||||
|
||||
//!Ptr::reference if such a type exists (non-standard extension); otherwise, element_type &
|
||||
//!
|
||||
typedef unspecified_type reference;
|
||||
#else
|
||||
typedef Ptr pointer;
|
||||
//
|
||||
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT
|
||||
( boost::intrusive::detail::, Ptr, element_type
|
||||
, boost::intrusive::detail::first_param<Ptr>) element_type;
|
||||
//
|
||||
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT
|
||||
(boost::intrusive::detail::, Ptr, difference_type, std::ptrdiff_t) difference_type;
|
||||
|
||||
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT
|
||||
(boost::intrusive::detail::, Ptr, reference, typename boost::intrusive::detail::unvoid_ref<element_type>::type) reference;
|
||||
//
|
||||
template <class U> struct rebind_pointer
|
||||
{
|
||||
typedef typename boost::intrusive::pointer_rebind<Ptr, U>::type type;
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
template <class U> using rebind = typename boost::intrusive::pointer_rebind<Ptr, U>::type;
|
||||
#endif
|
||||
#endif //#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
|
||||
//! <b>Remark</b>: If element_type is (possibly cv-qualified) void, r type is unspecified; otherwise,
|
||||
//! it is element_type &.
|
||||
//!
|
||||
//! <b>Returns</b>: A dereferenceable pointer to r obtained by calling Ptr::pointer_to(reference).
|
||||
//! Non-standard extension: If such function does not exist, returns pointer(addressof(r));
|
||||
//!
|
||||
//! <b>Note</b>: For non-conforming compilers only the existence of a member function called
|
||||
//! <code>pointer_to</code> is checked.
|
||||
static pointer pointer_to(reference r)
|
||||
{
|
||||
//Non-standard extension, it does not require Ptr::pointer_to. If not present
|
||||
//tries to converts &r to pointer.
|
||||
const bool value = boost::intrusive::detail::
|
||||
has_member_function_callable_with_pointer_to
|
||||
<Ptr, Ptr (*)(reference)>::value;
|
||||
boost::intrusive::detail::bool_<value> flag;
|
||||
return pointer_traits::priv_pointer_to(flag, r);
|
||||
}
|
||||
|
||||
//! <b>Remark</b>: Non-standard extension.
|
||||
//!
|
||||
//! <b>Returns</b>: A dereferenceable pointer to r obtained by calling the static template function
|
||||
//! Ptr::static_cast_from(UPpr/const UPpr &).
|
||||
//! If such function does not exist, returns pointer_to(static_cast<element_type&>(*uptr))
|
||||
//!
|
||||
//! <b>Note</b>: For non-conforming compilers only the existence of a member function called
|
||||
//! <code>static_cast_from</code> is checked.
|
||||
template<class UPtr>
|
||||
static pointer static_cast_from(const UPtr &uptr)
|
||||
{
|
||||
typedef const UPtr &RefArg;
|
||||
const bool value = boost::intrusive::detail::
|
||||
has_member_function_callable_with_static_cast_from
|
||||
<pointer, pointer(*)(RefArg)>::value
|
||||
|| boost::intrusive::detail::
|
||||
has_member_function_callable_with_static_cast_from
|
||||
<pointer, pointer(*)(UPtr)>::value;
|
||||
return pointer_traits::priv_static_cast_from(boost::intrusive::detail::bool_<value>(), uptr);
|
||||
}
|
||||
|
||||
//! <b>Remark</b>: Non-standard extension.
|
||||
//!
|
||||
//! <b>Returns</b>: A dereferenceable pointer to r obtained by calling the static template function
|
||||
//! Ptr::const_cast_from<UPtr>(UPpr/const UPpr &).
|
||||
//! If such function does not exist, returns pointer_to(const_cast<element_type&>(*uptr))
|
||||
//!
|
||||
//! <b>Note</b>: For non-conforming compilers only the existence of a member function called
|
||||
//! <code>const_cast_from</code> is checked.
|
||||
template<class UPtr>
|
||||
static pointer const_cast_from(const UPtr &uptr)
|
||||
{
|
||||
typedef const UPtr &RefArg;
|
||||
const bool value = boost::intrusive::detail::
|
||||
has_member_function_callable_with_const_cast_from
|
||||
<pointer, pointer(*)(RefArg)>::value
|
||||
|| boost::intrusive::detail::
|
||||
has_member_function_callable_with_const_cast_from
|
||||
<pointer, pointer(*)(UPtr)>::value;
|
||||
return pointer_traits::priv_const_cast_from(boost::intrusive::detail::bool_<value>(), uptr);
|
||||
}
|
||||
|
||||
//! <b>Remark</b>: Non-standard extension.
|
||||
//!
|
||||
//! <b>Returns</b>: A dereferenceable pointer to r obtained by calling the static template function
|
||||
//! Ptr::dynamic_cast_from<UPtr>(UPpr/const UPpr &).
|
||||
//! If such function does not exist, returns pointer_to(*dynamic_cast<element_type*>(&*uptr))
|
||||
//!
|
||||
//! <b>Note</b>: For non-conforming compilers only the existence of a member function called
|
||||
//! <code>dynamic_cast_from</code> is checked.
|
||||
template<class UPtr>
|
||||
static pointer dynamic_cast_from(const UPtr &uptr)
|
||||
{
|
||||
typedef const UPtr &RefArg;
|
||||
const bool value = boost::intrusive::detail::
|
||||
has_member_function_callable_with_dynamic_cast_from
|
||||
<pointer, pointer(*)(RefArg)>::value
|
||||
|| boost::intrusive::detail::
|
||||
has_member_function_callable_with_dynamic_cast_from
|
||||
<pointer, pointer(*)(UPtr)>::value;
|
||||
return pointer_traits::priv_dynamic_cast_from(boost::intrusive::detail::bool_<value>(), uptr);
|
||||
}
|
||||
|
||||
///@cond
|
||||
private:
|
||||
//priv_to_raw_pointer
|
||||
template <class T>
|
||||
static T* to_raw_pointer(T* p)
|
||||
{ return p; }
|
||||
|
||||
template <class Pointer>
|
||||
static typename pointer_traits<Pointer>::element_type*
|
||||
to_raw_pointer(const Pointer &p)
|
||||
{ return pointer_traits::to_raw_pointer(p.operator->()); }
|
||||
|
||||
//priv_pointer_to
|
||||
static pointer priv_pointer_to(boost::intrusive::detail::true_, reference r)
|
||||
{ return Ptr::pointer_to(r); }
|
||||
|
||||
static pointer priv_pointer_to(boost::intrusive::detail::false_, reference r)
|
||||
{ return pointer(boost::intrusive::detail::addressof(r)); }
|
||||
|
||||
//priv_static_cast_from
|
||||
template<class UPtr>
|
||||
static pointer priv_static_cast_from(boost::intrusive::detail::true_, const UPtr &uptr)
|
||||
{ return Ptr::static_cast_from(uptr); }
|
||||
|
||||
template<class UPtr>
|
||||
static pointer priv_static_cast_from(boost::intrusive::detail::false_, const UPtr &uptr)
|
||||
{ return uptr ? pointer_to(*static_cast<element_type*>(to_raw_pointer(uptr))) : pointer(); }
|
||||
|
||||
//priv_const_cast_from
|
||||
template<class UPtr>
|
||||
static pointer priv_const_cast_from(boost::intrusive::detail::true_, const UPtr &uptr)
|
||||
{ return Ptr::const_cast_from(uptr); }
|
||||
|
||||
template<class UPtr>
|
||||
static pointer priv_const_cast_from(boost::intrusive::detail::false_, const UPtr &uptr)
|
||||
{ return uptr ? pointer_to(const_cast<element_type&>(*uptr)) : pointer(); }
|
||||
|
||||
//priv_dynamic_cast_from
|
||||
template<class UPtr>
|
||||
static pointer priv_dynamic_cast_from(boost::intrusive::detail::true_, const UPtr &uptr)
|
||||
{ return Ptr::dynamic_cast_from(uptr); }
|
||||
|
||||
template<class UPtr>
|
||||
static pointer priv_dynamic_cast_from(boost::intrusive::detail::false_, const UPtr &uptr)
|
||||
{ return uptr ? pointer_to(dynamic_cast<element_type&>(*uptr)) : pointer(); }
|
||||
///@endcond
|
||||
};
|
||||
|
||||
///@cond
|
||||
|
||||
// Remove cv qualification from Ptr parameter to pointer_traits:
|
||||
template <typename Ptr>
|
||||
struct pointer_traits<const Ptr> : pointer_traits<Ptr> {};
|
||||
template <typename Ptr>
|
||||
struct pointer_traits<volatile Ptr> : pointer_traits<Ptr> { };
|
||||
template <typename Ptr>
|
||||
struct pointer_traits<const volatile Ptr> : pointer_traits<Ptr> { };
|
||||
// Remove reference from Ptr parameter to pointer_traits:
|
||||
template <typename Ptr>
|
||||
struct pointer_traits<Ptr&> : pointer_traits<Ptr> { };
|
||||
|
||||
///@endcond
|
||||
|
||||
//! Specialization of pointer_traits for raw pointers
|
||||
//!
|
||||
template <typename T>
|
||||
struct pointer_traits<T*>
|
||||
{
|
||||
typedef T element_type;
|
||||
typedef T* pointer;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
#ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED
|
||||
typedef T & reference;
|
||||
//!typedef for <pre>U *</pre>
|
||||
//!
|
||||
//!For portable code for C++03 and C++11, <pre>typename rebind_pointer<U>::type</pre>
|
||||
//!shall be used instead of rebind<U> to obtain a pointer to U.
|
||||
template <class U> using rebind = U*;
|
||||
#else
|
||||
typedef typename boost::intrusive::detail::unvoid_ref<element_type>::type reference;
|
||||
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
|
||||
template <class U> using rebind = U*;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
template <class U> struct rebind_pointer
|
||||
{ typedef U* type; };
|
||||
|
||||
//! <b>Returns</b>: addressof(r)
|
||||
//!
|
||||
BOOST_INTRUSIVE_FORCEINLINE static pointer pointer_to(reference r)
|
||||
{ return boost::intrusive::detail::addressof(r); }
|
||||
|
||||
//! <b>Returns</b>: static_cast<pointer>(uptr)
|
||||
//!
|
||||
template<class U>
|
||||
BOOST_INTRUSIVE_FORCEINLINE static pointer static_cast_from(U *uptr)
|
||||
{ return static_cast<pointer>(uptr); }
|
||||
|
||||
//! <b>Returns</b>: const_cast<pointer>(uptr)
|
||||
//!
|
||||
template<class U>
|
||||
BOOST_INTRUSIVE_FORCEINLINE static pointer const_cast_from(U *uptr)
|
||||
{ return const_cast<pointer>(uptr); }
|
||||
|
||||
//! <b>Returns</b>: dynamic_cast<pointer>(uptr)
|
||||
//!
|
||||
template<class U>
|
||||
BOOST_INTRUSIVE_FORCEINLINE static pointer dynamic_cast_from(U *uptr)
|
||||
{ return dynamic_cast<pointer>(uptr); }
|
||||
};
|
||||
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
#include <boost/intrusive/detail/config_end.hpp>
|
||||
|
||||
#endif // ! defined(BOOST_INTRUSIVE_POINTER_TRAITS_HPP)
|
||||
@@ -0,0 +1,82 @@
|
||||
// Copyright Neil Groves 2009. Use, modification and
|
||||
// distribution is subject to the Boost Software License, Version
|
||||
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range/
|
||||
//
|
||||
#ifndef BOOST_RANGE_ALGORITHM_PARTIAL_SORT_COPY_HPP_INCLUDED
|
||||
#define BOOST_RANGE_ALGORITHM_PARTIAL_SORT_COPY_HPP_INCLUDED
|
||||
|
||||
#include <boost/concept_check.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range
|
||||
{
|
||||
|
||||
/// \brief template function partial_sort_copy
|
||||
///
|
||||
/// range-based version of the partial_sort_copy std algorithm
|
||||
///
|
||||
/// \pre SinglePassRange is a model of the SinglePassRangeConcept
|
||||
/// \pre RandomAccessRange is a model of the Mutable_RandomAccessRangeConcept
|
||||
/// \pre BinaryPredicate is a model of the BinaryPredicateConcept
|
||||
template<class SinglePassRange, class RandomAccessRange>
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<RandomAccessRange>::type
|
||||
partial_sort_copy(const SinglePassRange& rng1, RandomAccessRange& rng2)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
return std::partial_sort_copy(boost::begin(rng1), boost::end(rng1),
|
||||
boost::begin(rng2), boost::end(rng2));
|
||||
}
|
||||
|
||||
/// \overload
|
||||
template<class SinglePassRange, class RandomAccessRange>
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<RandomAccessRange>::type
|
||||
partial_sort_copy(const SinglePassRange& rng1, const RandomAccessRange& rng2)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
return std::partial_sort_copy(boost::begin(rng1), boost::end(rng1),
|
||||
boost::begin(rng2), boost::end(rng2));
|
||||
}
|
||||
|
||||
/// \overload
|
||||
template<class SinglePassRange, class RandomAccessRange,
|
||||
class BinaryPredicate>
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<RandomAccessRange>::type
|
||||
partial_sort_copy(const SinglePassRange& rng1, RandomAccessRange& rng2,
|
||||
BinaryPredicate pred)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
return std::partial_sort_copy(boost::begin(rng1), boost::end(rng1),
|
||||
boost::begin(rng2), boost::end(rng2), pred);
|
||||
}
|
||||
|
||||
/// \overload
|
||||
template<class SinglePassRange, class RandomAccessRange,
|
||||
class BinaryPredicate>
|
||||
inline BOOST_DEDUCED_TYPENAME range_iterator<const RandomAccessRange>::type
|
||||
partial_sort_copy(const SinglePassRange& rng1, const RandomAccessRange& rng2,
|
||||
BinaryPredicate pred)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
return std::partial_sort_copy(boost::begin(rng1), boost::end(rng1),
|
||||
boost::begin(rng2), boost::end(rng2), pred);
|
||||
}
|
||||
|
||||
} // namespace range
|
||||
using range::partial_sort_copy;
|
||||
} // namespace boost
|
||||
|
||||
#endif // include guard
|
||||
@@ -0,0 +1,61 @@
|
||||
// (C) Copyright 2008-10 Anthony Williams
|
||||
// (C) Copyright 2011-2012,2015 Vicente J. Botet Escriba
|
||||
//
|
||||
// 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_THREAD_FUTURES_FUTURE_ERROR_CODE_HPP
|
||||
#define BOOST_THREAD_FUTURES_FUTURE_ERROR_CODE_HPP
|
||||
|
||||
#include <boost/thread/detail/config.hpp>
|
||||
#include <boost/core/scoped_enum.hpp>
|
||||
#include <boost/system/error_code.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
//enum class future_errc
|
||||
BOOST_SCOPED_ENUM_DECLARE_BEGIN(future_errc)
|
||||
{
|
||||
broken_promise = 1,
|
||||
future_already_retrieved,
|
||||
promise_already_satisfied,
|
||||
no_state
|
||||
}
|
||||
BOOST_SCOPED_ENUM_DECLARE_END(future_errc)
|
||||
|
||||
namespace system
|
||||
{
|
||||
template <>
|
||||
struct BOOST_SYMBOL_VISIBLE is_error_code_enum< ::boost::future_errc> : public true_type {};
|
||||
|
||||
#ifdef BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
template <>
|
||||
struct BOOST_SYMBOL_VISIBLE is_error_code_enum< ::boost::future_errc::enum_type> : public true_type { };
|
||||
#endif
|
||||
} // system
|
||||
|
||||
BOOST_THREAD_DECL
|
||||
const system::error_category& future_category() BOOST_NOEXCEPT;
|
||||
|
||||
namespace system
|
||||
{
|
||||
inline
|
||||
error_code
|
||||
make_error_code(future_errc e) BOOST_NOEXCEPT
|
||||
{
|
||||
return error_code(underlying_cast<int>(e), boost::future_category());
|
||||
}
|
||||
|
||||
inline
|
||||
error_condition
|
||||
make_error_condition(future_errc e) BOOST_NOEXCEPT
|
||||
{
|
||||
return error_condition(underlying_cast<int>(e), boost::future_category());
|
||||
}
|
||||
} // system
|
||||
} // boost
|
||||
|
||||
#endif // header
|
||||
@@ -0,0 +1,39 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Edward Diener 2011. *
|
||||
# * (C) Copyright Paul Mensonides 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. */
|
||||
#
|
||||
# ifndef BOOST_PREPROCESSOR_TUPLE_TO_ARRAY_HPP
|
||||
# define BOOST_PREPROCESSOR_TUPLE_TO_ARRAY_HPP
|
||||
#
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/config/config.hpp>
|
||||
# include <boost/preprocessor/facilities/overload.hpp>
|
||||
# include <boost/preprocessor/tuple/size.hpp>
|
||||
# include <boost/preprocessor/variadic/size.hpp>
|
||||
#
|
||||
# /* BOOST_PP_TUPLE_TO_ARRAY */
|
||||
#
|
||||
# if BOOST_PP_VARIADICS
|
||||
# if BOOST_PP_VARIADICS_MSVC
|
||||
# define BOOST_PP_TUPLE_TO_ARRAY(...) BOOST_PP_TUPLE_TO_ARRAY_I(BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_TO_ARRAY_, __VA_ARGS__), (__VA_ARGS__))
|
||||
# define BOOST_PP_TUPLE_TO_ARRAY_I(m, args) BOOST_PP_TUPLE_TO_ARRAY_II(m, args)
|
||||
# define BOOST_PP_TUPLE_TO_ARRAY_II(m, args) BOOST_PP_CAT(m ## args,)
|
||||
# define BOOST_PP_TUPLE_TO_ARRAY_1(tuple) (BOOST_PP_TUPLE_SIZE(tuple), tuple)
|
||||
# else
|
||||
# define BOOST_PP_TUPLE_TO_ARRAY(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_TO_ARRAY_, __VA_ARGS__)(__VA_ARGS__)
|
||||
# define BOOST_PP_TUPLE_TO_ARRAY_1(tuple) (BOOST_PP_VARIADIC_SIZE tuple, tuple)
|
||||
# endif
|
||||
# define BOOST_PP_TUPLE_TO_ARRAY_2(size, tuple) (size, tuple)
|
||||
# else
|
||||
# define BOOST_PP_TUPLE_TO_ARRAY(size, tuple) (size, tuple)
|
||||
# endif
|
||||
#
|
||||
# endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,162 @@
|
||||
#ifndef GREGORIAN_FORMATTERS_HPP___
|
||||
#define GREGORIAN_FORMATTERS_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$
|
||||
*/
|
||||
|
||||
#include "boost/date_time/compiler_config.hpp"
|
||||
#include "boost/date_time/gregorian/gregorian_types.hpp"
|
||||
#if defined(BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS)
|
||||
#include "boost/date_time/date_formatting_limited.hpp"
|
||||
#else
|
||||
#include "boost/date_time/date_formatting.hpp"
|
||||
#endif
|
||||
#include "boost/date_time/iso_format.hpp"
|
||||
#include "boost/date_time/date_format_simple.hpp"
|
||||
|
||||
/* NOTE: "to_*_string" code for older compilers, ones that define
|
||||
* BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS, is located in
|
||||
* formatters_limited.hpp
|
||||
*/
|
||||
|
||||
namespace boost {
|
||||
namespace gregorian {
|
||||
|
||||
// wrapper function for to_simple_(w)string(date)
|
||||
template<class charT>
|
||||
inline
|
||||
std::basic_string<charT> to_simple_string_type(const date& d) {
|
||||
return date_time::date_formatter<date,date_time::simple_format<charT>,charT>::date_to_string(d);
|
||||
}
|
||||
//! To YYYY-mmm-DD string where mmm 3 char month name. Example: 2002-Jan-01
|
||||
/*!\ingroup date_format
|
||||
*/
|
||||
inline std::string to_simple_string(const date& d) {
|
||||
return to_simple_string_type<char>(d);
|
||||
}
|
||||
|
||||
|
||||
// wrapper function for to_simple_(w)string(date_period)
|
||||
template<class charT>
|
||||
inline std::basic_string<charT> to_simple_string_type(const date_period& d) {
|
||||
typedef std::basic_string<charT> string_type;
|
||||
charT b = '[', m = '/', e=']';
|
||||
|
||||
string_type d1(date_time::date_formatter<date,date_time::simple_format<charT>,charT>::date_to_string(d.begin()));
|
||||
string_type d2(date_time::date_formatter<date,date_time::simple_format<charT>,charT>::date_to_string(d.last()));
|
||||
return string_type(b + d1 + m + d2 + e);
|
||||
}
|
||||
//! Convert date period to simple string. Example: [2002-Jan-01/2002-Jan-02]
|
||||
/*!\ingroup date_format
|
||||
*/
|
||||
inline std::string to_simple_string(const date_period& d) {
|
||||
return to_simple_string_type<char>(d);
|
||||
}
|
||||
|
||||
// wrapper function for to_iso_(w)string(date_period)
|
||||
template<class charT>
|
||||
inline std::basic_string<charT> to_iso_string_type(const date_period& d) {
|
||||
charT sep = '/';
|
||||
std::basic_string<charT> s(date_time::date_formatter<date,date_time::iso_format<charT>,charT>::date_to_string(d.begin()));
|
||||
return s + sep + date_time::date_formatter<date,date_time::iso_format<charT>,charT>::date_to_string(d.last());
|
||||
}
|
||||
//! Date period to iso standard format CCYYMMDD/CCYYMMDD. Example: 20021225/20021231
|
||||
/*!\ingroup date_format
|
||||
*/
|
||||
inline std::string to_iso_string(const date_period& d) {
|
||||
return to_iso_string_type<char>(d);
|
||||
}
|
||||
|
||||
|
||||
// wrapper function for to_iso_extended_(w)string(date)
|
||||
template<class charT>
|
||||
inline std::basic_string<charT> to_iso_extended_string_type(const date& d) {
|
||||
return date_time::date_formatter<date,date_time::iso_extended_format<charT>,charT>::date_to_string(d);
|
||||
}
|
||||
//! Convert to iso extended format string CCYY-MM-DD. Example 2002-12-31
|
||||
/*!\ingroup date_format
|
||||
*/
|
||||
inline std::string to_iso_extended_string(const date& d) {
|
||||
return to_iso_extended_string_type<char>(d);
|
||||
}
|
||||
|
||||
// wrapper function for to_iso_(w)string(date)
|
||||
template<class charT>
|
||||
inline std::basic_string<charT> to_iso_string_type(const date& d) {
|
||||
return date_time::date_formatter<date,date_time::iso_format<charT>,charT>::date_to_string(d);
|
||||
}
|
||||
//! Convert to iso standard string YYYYMMDD. Example: 20021231
|
||||
/*!\ingroup date_format
|
||||
*/
|
||||
inline std::string to_iso_string(const date& d) {
|
||||
return to_iso_string_type<char>(d);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// wrapper function for to_sql_(w)string(date)
|
||||
template<class charT>
|
||||
inline std::basic_string<charT> to_sql_string_type(const date& d)
|
||||
{
|
||||
date::ymd_type ymd = d.year_month_day();
|
||||
std::basic_ostringstream<charT> ss;
|
||||
ss << ymd.year << "-"
|
||||
<< std::setw(2) << std::setfill(ss.widen('0'))
|
||||
<< ymd.month.as_number() //solves problem with gcc 3.1 hanging
|
||||
<< "-"
|
||||
<< std::setw(2) << std::setfill(ss.widen('0'))
|
||||
<< ymd.day;
|
||||
return ss.str();
|
||||
}
|
||||
inline std::string to_sql_string(const date& d) {
|
||||
return to_sql_string_type<char>(d);
|
||||
}
|
||||
|
||||
|
||||
#if !defined(BOOST_NO_STD_WSTRING)
|
||||
//! Convert date period to simple string. Example: [2002-Jan-01/2002-Jan-02]
|
||||
/*!\ingroup date_format
|
||||
*/
|
||||
inline std::wstring to_simple_wstring(const date_period& d) {
|
||||
return to_simple_string_type<wchar_t>(d);
|
||||
}
|
||||
//! To YYYY-mmm-DD string where mmm 3 char month name. Example: 2002-Jan-01
|
||||
/*!\ingroup date_format
|
||||
*/
|
||||
inline std::wstring to_simple_wstring(const date& d) {
|
||||
return to_simple_string_type<wchar_t>(d);
|
||||
}
|
||||
//! Date period to iso standard format CCYYMMDD/CCYYMMDD. Example: 20021225/20021231
|
||||
/*!\ingroup date_format
|
||||
*/
|
||||
inline std::wstring to_iso_wstring(const date_period& d) {
|
||||
return to_iso_string_type<wchar_t>(d);
|
||||
}
|
||||
//! Convert to iso extended format string CCYY-MM-DD. Example 2002-12-31
|
||||
/*!\ingroup date_format
|
||||
*/
|
||||
inline std::wstring to_iso_extended_wstring(const date& d) {
|
||||
return to_iso_extended_string_type<wchar_t>(d);
|
||||
}
|
||||
//! Convert to iso standard string YYYYMMDD. Example: 20021231
|
||||
/*!\ingroup date_format
|
||||
*/
|
||||
inline std::wstring to_iso_wstring(const date& d) {
|
||||
return to_iso_string_type<wchar_t>(d);
|
||||
}
|
||||
inline std::wstring to_sql_wstring(const date& d) {
|
||||
return to_sql_string_type<wchar_t>(d);
|
||||
}
|
||||
#endif // BOOST_NO_STD_WSTRING
|
||||
|
||||
} } //namespace gregorian
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,50 @@
|
||||
// (C) Copyright 2005 Matthias Troyer
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Authors: Matthias Troyer
|
||||
|
||||
#ifndef BOOST_MPI_TEXT_SKELETON_OARCHIVE_HPP
|
||||
#define BOOST_MPI_TEXT_SKELETON_OARCHIVE_HPP
|
||||
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/text_oarchive.hpp>
|
||||
#include <boost/mpi/detail/forward_skeleton_oarchive.hpp>
|
||||
#include <boost/mpi/detail/ignore_oprimitive.hpp>
|
||||
#include <boost/archive/detail/register_archive.hpp>
|
||||
|
||||
namespace boost { namespace mpi {
|
||||
|
||||
// an archive that writes a text skeleton into a stream
|
||||
|
||||
class text_skeleton_oarchive
|
||||
: public detail::ignore_oprimitive,
|
||||
public detail::forward_skeleton_oarchive<text_skeleton_oarchive,boost::archive::text_oarchive>
|
||||
{
|
||||
public:
|
||||
text_skeleton_oarchive(std::ostream & s, unsigned int flags = 0)
|
||||
: detail::forward_skeleton_oarchive<text_skeleton_oarchive,boost::archive::text_oarchive>(skeleton_archive_)
|
||||
, skeleton_archive_(s,flags)
|
||||
{}
|
||||
|
||||
private:
|
||||
boost::archive::text_oarchive skeleton_archive_;
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
typedef boost::mpi::detail::forward_skeleton_oarchive<boost::mpi::text_skeleton_oarchive,boost::archive::text_oarchive> type3;
|
||||
|
||||
}
|
||||
|
||||
|
||||
} } // end namespace boost::mpi
|
||||
|
||||
// required by export
|
||||
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::mpi::text_skeleton_oarchive)
|
||||
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::mpi::detail::type3)
|
||||
|
||||
|
||||
#endif // BOOST_MPI_TEXT_SKELETON_OARCHIVE_HPP
|
||||
@@ -0,0 +1,50 @@
|
||||
// Copyright David Abrahams 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)
|
||||
#ifndef BASES_DWA2002321_HPP
|
||||
# define BASES_DWA2002321_HPP
|
||||
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
# include <boost/type_traits/object_traits.hpp>
|
||||
# include <boost/python/detail/type_list.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/mpl/bool.hpp>
|
||||
# include <boost/preprocessor/enum_params_with_a_default.hpp>
|
||||
# include <boost/preprocessor/enum_params.hpp>
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
# define BOOST_PYTHON_BASE_PARAMS BOOST_PP_ENUM_PARAMS_Z(1, BOOST_PYTHON_MAX_BASES, Base)
|
||||
|
||||
// A type list for specifying bases
|
||||
template < BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PYTHON_MAX_BASES, typename Base, mpl::void_) >
|
||||
struct bases : detail::type_list< BOOST_PYTHON_BASE_PARAMS >::type
|
||||
{};
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <class T> struct specifies_bases
|
||||
: mpl::false_
|
||||
{
|
||||
};
|
||||
|
||||
template < BOOST_PP_ENUM_PARAMS_Z(1, BOOST_PYTHON_MAX_BASES, class Base) >
|
||||
struct specifies_bases< bases< BOOST_PYTHON_BASE_PARAMS > >
|
||||
: mpl::true_
|
||||
{
|
||||
};
|
||||
template <class T, class Prev = bases<> >
|
||||
struct select_bases
|
||||
: mpl::if_<
|
||||
specifies_bases<T>
|
||||
, T
|
||||
, Prev
|
||||
>
|
||||
{
|
||||
};
|
||||
}
|
||||
# undef BOOST_PYTHON_BASE_PARAMS
|
||||
}} // namespace boost::python
|
||||
|
||||
#endif // BASES_DWA2002321_HPP
|
||||
@@ -0,0 +1,360 @@
|
||||
// (C) Copyright David Abrahams 2002.
|
||||
// (C) Copyright Jeremy Siek 2002.
|
||||
// (C) Copyright Thomas Witt 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)
|
||||
#ifndef BOOST_ITERATOR_ADAPTOR_23022003THW_HPP
|
||||
#define BOOST_ITERATOR_ADAPTOR_23022003THW_HPP
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/iterator.hpp>
|
||||
#include <boost/detail/iterator.hpp>
|
||||
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/iterator/detail/enable_if.hpp>
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
|
||||
#ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
|
||||
# include <boost/type_traits/remove_reference.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/iterator/detail/config_def.hpp>
|
||||
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace iterators {
|
||||
|
||||
// Used as a default template argument internally, merely to
|
||||
// indicate "use the default", this can also be passed by users
|
||||
// explicitly in order to specify that the default should be used.
|
||||
struct use_default;
|
||||
|
||||
} // namespace iterators
|
||||
|
||||
using iterators::use_default;
|
||||
|
||||
// the incompleteness of use_default causes massive problems for
|
||||
// is_convertible (naturally). This workaround is fortunately not
|
||||
// needed for vc6/vc7.
|
||||
template<class To>
|
||||
struct is_convertible<use_default,To>
|
||||
: mpl::false_ {};
|
||||
|
||||
namespace iterators {
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
//
|
||||
// Result type used in enable_if_convertible meta function.
|
||||
// This can be an incomplete type, as only pointers to
|
||||
// enable_if_convertible< ... >::type are used.
|
||||
// We could have used void for this, but conversion to
|
||||
// void* is just to easy.
|
||||
//
|
||||
struct enable_type;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// enable_if for use in adapted iterators constructors.
|
||||
//
|
||||
// In order to provide interoperability between adapted constant and
|
||||
// mutable iterators, adapted iterators will usually provide templated
|
||||
// conversion constructors of the following form
|
||||
//
|
||||
// template <class BaseIterator>
|
||||
// class adapted_iterator :
|
||||
// public iterator_adaptor< adapted_iterator<Iterator>, Iterator >
|
||||
// {
|
||||
// public:
|
||||
//
|
||||
// ...
|
||||
//
|
||||
// template <class OtherIterator>
|
||||
// adapted_iterator(
|
||||
// OtherIterator const& it
|
||||
// , typename enable_if_convertible<OtherIterator, Iterator>::type* = 0);
|
||||
//
|
||||
// ...
|
||||
// };
|
||||
//
|
||||
// enable_if_convertible is used to remove those overloads from the overload
|
||||
// set that cannot be instantiated. For all practical purposes only overloads
|
||||
// for constant/mutable interaction will remain. This has the advantage that
|
||||
// meta functions like boost::is_convertible do not return false positives,
|
||||
// as they can only look at the signature of the conversion constructor
|
||||
// and not at the actual instantiation.
|
||||
//
|
||||
// enable_if_interoperable can be safely used in user code. It falls back to
|
||||
// always enabled for compilers that don't support enable_if or is_convertible.
|
||||
// There is no need for compiler specific workarounds in user code.
|
||||
//
|
||||
// The operators implementation relies on boost::is_convertible not returning
|
||||
// false positives for user/library defined iterator types. See comments
|
||||
// on operator implementation for consequences.
|
||||
//
|
||||
# if defined(BOOST_NO_IS_CONVERTIBLE) || defined(BOOST_NO_SFINAE)
|
||||
|
||||
template <class From, class To>
|
||||
struct enable_if_convertible
|
||||
{
|
||||
typedef boost::iterators::detail::enable_type type;
|
||||
};
|
||||
|
||||
# elif BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13102292))
|
||||
|
||||
// For some reason vc7.1 needs us to "cut off" instantiation
|
||||
// of is_convertible in a few cases.
|
||||
template<typename From, typename To>
|
||||
struct enable_if_convertible
|
||||
: iterators::enable_if<
|
||||
mpl::or_<
|
||||
is_same<From,To>
|
||||
, is_convertible<From, To>
|
||||
>
|
||||
, boost::iterators::detail::enable_type
|
||||
>
|
||||
{};
|
||||
|
||||
# else
|
||||
|
||||
template<typename From, typename To>
|
||||
struct enable_if_convertible
|
||||
: iterators::enable_if<
|
||||
is_convertible<From, To>
|
||||
, boost::iterators::detail::enable_type
|
||||
>
|
||||
{};
|
||||
|
||||
# endif
|
||||
|
||||
//
|
||||
// Default template argument handling for iterator_adaptor
|
||||
//
|
||||
namespace detail
|
||||
{
|
||||
// If T is use_default, return the result of invoking
|
||||
// DefaultNullaryFn, otherwise return T.
|
||||
template <class T, class DefaultNullaryFn>
|
||||
struct ia_dflt_help
|
||||
: mpl::eval_if<
|
||||
is_same<T, use_default>
|
||||
, DefaultNullaryFn
|
||||
, mpl::identity<T>
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
// A metafunction which computes an iterator_adaptor's base class,
|
||||
// a specialization of iterator_facade.
|
||||
template <
|
||||
class Derived
|
||||
, class Base
|
||||
, class Value
|
||||
, class Traversal
|
||||
, class Reference
|
||||
, class Difference
|
||||
>
|
||||
struct iterator_adaptor_base
|
||||
{
|
||||
typedef iterator_facade<
|
||||
Derived
|
||||
|
||||
# ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
|
||||
, typename boost::iterators::detail::ia_dflt_help<
|
||||
Value
|
||||
, mpl::eval_if<
|
||||
is_same<Reference,use_default>
|
||||
, iterator_value<Base>
|
||||
, remove_reference<Reference>
|
||||
>
|
||||
>::type
|
||||
# else
|
||||
, typename boost::iterators::detail::ia_dflt_help<
|
||||
Value, iterator_value<Base>
|
||||
>::type
|
||||
# endif
|
||||
|
||||
, typename boost::iterators::detail::ia_dflt_help<
|
||||
Traversal
|
||||
, iterator_traversal<Base>
|
||||
>::type
|
||||
|
||||
, typename boost::iterators::detail::ia_dflt_help<
|
||||
Reference
|
||||
, mpl::eval_if<
|
||||
is_same<Value,use_default>
|
||||
, iterator_reference<Base>
|
||||
, add_reference<Value>
|
||||
>
|
||||
>::type
|
||||
|
||||
, typename boost::iterators::detail::ia_dflt_help<
|
||||
Difference, iterator_difference<Base>
|
||||
>::type
|
||||
>
|
||||
type;
|
||||
};
|
||||
|
||||
// workaround for aC++ CR JAGaf33512
|
||||
template <class Tr1, class Tr2>
|
||||
inline void iterator_adaptor_assert_traversal ()
|
||||
{
|
||||
BOOST_STATIC_ASSERT((is_convertible<Tr1, Tr2>::value));
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Iterator Adaptor
|
||||
//
|
||||
// The parameter ordering changed slightly with respect to former
|
||||
// versions of iterator_adaptor The idea is that when the user needs
|
||||
// to fiddle with the reference type it is highly likely that the
|
||||
// iterator category has to be adjusted as well. Any of the
|
||||
// following four template arguments may be ommitted or explicitly
|
||||
// replaced by use_default.
|
||||
//
|
||||
// Value - if supplied, the value_type of the resulting iterator, unless
|
||||
// const. If const, a conforming compiler strips constness for the
|
||||
// value_type. If not supplied, iterator_traits<Base>::value_type is used
|
||||
//
|
||||
// Category - the traversal category of the resulting iterator. If not
|
||||
// supplied, iterator_traversal<Base>::type is used.
|
||||
//
|
||||
// Reference - the reference type of the resulting iterator, and in
|
||||
// particular, the result type of operator*(). If not supplied but
|
||||
// Value is supplied, Value& is used. Otherwise
|
||||
// iterator_traits<Base>::reference is used.
|
||||
//
|
||||
// Difference - the difference_type of the resulting iterator. If not
|
||||
// supplied, iterator_traits<Base>::difference_type is used.
|
||||
//
|
||||
template <
|
||||
class Derived
|
||||
, class Base
|
||||
, class Value = use_default
|
||||
, class Traversal = use_default
|
||||
, class Reference = use_default
|
||||
, class Difference = use_default
|
||||
>
|
||||
class iterator_adaptor
|
||||
: public boost::iterators::detail::iterator_adaptor_base<
|
||||
Derived, Base, Value, Traversal, Reference, Difference
|
||||
>::type
|
||||
{
|
||||
friend class iterator_core_access;
|
||||
|
||||
protected:
|
||||
typedef typename boost::iterators::detail::iterator_adaptor_base<
|
||||
Derived, Base, Value, Traversal, Reference, Difference
|
||||
>::type super_t;
|
||||
public:
|
||||
iterator_adaptor() {}
|
||||
|
||||
explicit iterator_adaptor(Base const &iter)
|
||||
: m_iterator(iter)
|
||||
{
|
||||
}
|
||||
|
||||
typedef Base base_type;
|
||||
|
||||
Base const& base() const
|
||||
{ return m_iterator; }
|
||||
|
||||
protected:
|
||||
// for convenience in derived classes
|
||||
typedef iterator_adaptor<Derived,Base,Value,Traversal,Reference,Difference> iterator_adaptor_;
|
||||
|
||||
//
|
||||
// lvalue access to the Base object for Derived
|
||||
//
|
||||
Base const& base_reference() const
|
||||
{ return m_iterator; }
|
||||
|
||||
Base& base_reference()
|
||||
{ return m_iterator; }
|
||||
|
||||
private:
|
||||
//
|
||||
// Core iterator interface for iterator_facade. This is private
|
||||
// to prevent temptation for Derived classes to use it, which
|
||||
// will often result in an error. Derived classes should use
|
||||
// base_reference(), above, to get direct access to m_iterator.
|
||||
//
|
||||
typename super_t::reference dereference() const
|
||||
{ return *m_iterator; }
|
||||
|
||||
template <
|
||||
class OtherDerived, class OtherIterator, class V, class C, class R, class D
|
||||
>
|
||||
bool equal(iterator_adaptor<OtherDerived, OtherIterator, V, C, R, D> const& x) const
|
||||
{
|
||||
// Maybe readd with same_distance
|
||||
// BOOST_STATIC_ASSERT(
|
||||
// (detail::same_category_and_difference<Derived,OtherDerived>::value)
|
||||
// );
|
||||
return m_iterator == x.base();
|
||||
}
|
||||
|
||||
typedef typename iterator_category_to_traversal<
|
||||
typename super_t::iterator_category
|
||||
>::type my_traversal;
|
||||
|
||||
# define BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(cat) \
|
||||
boost::iterators::detail::iterator_adaptor_assert_traversal<my_traversal, cat>();
|
||||
|
||||
void advance(typename super_t::difference_type n)
|
||||
{
|
||||
BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(random_access_traversal_tag)
|
||||
m_iterator += n;
|
||||
}
|
||||
|
||||
void increment() { ++m_iterator; }
|
||||
|
||||
void decrement()
|
||||
{
|
||||
BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(bidirectional_traversal_tag)
|
||||
--m_iterator;
|
||||
}
|
||||
|
||||
template <
|
||||
class OtherDerived, class OtherIterator, class V, class C, class R, class D
|
||||
>
|
||||
typename super_t::difference_type distance_to(
|
||||
iterator_adaptor<OtherDerived, OtherIterator, V, C, R, D> const& y) const
|
||||
{
|
||||
BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL(random_access_traversal_tag)
|
||||
// Maybe readd with same_distance
|
||||
// BOOST_STATIC_ASSERT(
|
||||
// (detail::same_category_and_difference<Derived,OtherDerived>::value)
|
||||
// );
|
||||
return y.base() - m_iterator;
|
||||
}
|
||||
|
||||
# undef BOOST_ITERATOR_ADAPTOR_ASSERT_TRAVERSAL
|
||||
|
||||
private: // data members
|
||||
Base m_iterator;
|
||||
};
|
||||
|
||||
} // namespace iterators
|
||||
|
||||
using iterators::iterator_adaptor;
|
||||
using iterators::enable_if_convertible;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/iterator/detail/config_undef.hpp>
|
||||
|
||||
#endif // BOOST_ITERATOR_ADAPTOR_23022003THW_HPP
|
||||
@@ -0,0 +1,251 @@
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Copyright 2012 John Maddock. 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_
|
||||
|
||||
#ifndef BOOST_MP_INTEGER_HPP
|
||||
#define BOOST_MP_INTEGER_HPP
|
||||
|
||||
#include <boost/multiprecision/cpp_int.hpp>
|
||||
#include <boost/multiprecision/detail/bitscan.hpp>
|
||||
|
||||
namespace boost{
|
||||
namespace multiprecision{
|
||||
|
||||
template <class Integer, class I2>
|
||||
typename enable_if_c<is_integral<Integer>::value && is_integral<I2>::value, Integer&>::type
|
||||
multiply(Integer& result, const I2& a, const I2& b)
|
||||
{
|
||||
return result = static_cast<Integer>(a) * static_cast<Integer>(b);
|
||||
}
|
||||
template <class Integer, class I2>
|
||||
typename enable_if_c<is_integral<Integer>::value && is_integral<I2>::value, Integer&>::type
|
||||
add(Integer& result, const I2& a, const I2& b)
|
||||
{
|
||||
return result = static_cast<Integer>(a) + static_cast<Integer>(b);
|
||||
}
|
||||
template <class Integer, class I2>
|
||||
typename enable_if_c<is_integral<Integer>::value && is_integral<I2>::value, Integer&>::type
|
||||
subtract(Integer& result, const I2& a, const I2& b)
|
||||
{
|
||||
return result = static_cast<Integer>(a) - static_cast<Integer>(b);
|
||||
}
|
||||
|
||||
template <class Integer>
|
||||
typename enable_if_c<is_integral<Integer>::value>::type divide_qr(const Integer& x, const Integer& y, Integer& q, Integer& r)
|
||||
{
|
||||
q = x / y;
|
||||
r = x % y;
|
||||
}
|
||||
|
||||
template <class I1, class I2>
|
||||
typename enable_if_c<is_integral<I1>::value && is_integral<I2>::value, I2>::type integer_modulus(const I1& x, I2 val)
|
||||
{
|
||||
return static_cast<I2>(x % val);
|
||||
}
|
||||
|
||||
namespace detail{
|
||||
//
|
||||
// Figure out the kind of integer that has twice as many bits as some builtin
|
||||
// integer type I. Use a native type if we can (including types which may not
|
||||
// be recognised by boost::int_t because they're larger than boost::long_long_type),
|
||||
// otherwise synthesize a cpp_int to do the job.
|
||||
//
|
||||
template <class I>
|
||||
struct double_integer
|
||||
{
|
||||
static const unsigned int_t_digits =
|
||||
2 * sizeof(I) <= sizeof(boost::long_long_type) ? std::numeric_limits<I>::digits * 2 : 1;
|
||||
|
||||
typedef typename mpl::if_c<
|
||||
2 * sizeof(I) <= sizeof(boost::long_long_type),
|
||||
typename mpl::if_c<
|
||||
is_signed<I>::value,
|
||||
typename boost::int_t<int_t_digits>::least,
|
||||
typename boost::uint_t<int_t_digits>::least
|
||||
>::type,
|
||||
typename mpl::if_c<
|
||||
2 * sizeof(I) <= sizeof(double_limb_type),
|
||||
typename mpl::if_c<
|
||||
is_signed<I>::value,
|
||||
signed_double_limb_type,
|
||||
double_limb_type
|
||||
>::type,
|
||||
number<cpp_int_backend<sizeof(I)*CHAR_BIT*2, sizeof(I)*CHAR_BIT*2, (is_signed<I>::value ? signed_magnitude : unsigned_magnitude), unchecked, void> >
|
||||
>::type
|
||||
>::type type;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
template <class I1, class I2, class I3>
|
||||
typename enable_if_c<is_integral<I1>::value && is_unsigned<I2>::value && is_integral<I3>::value, I1>::type
|
||||
powm(const I1& a, I2 b, I3 c)
|
||||
{
|
||||
typedef typename detail::double_integer<I1>::type double_type;
|
||||
|
||||
I1 x(1), y(a);
|
||||
double_type result;
|
||||
|
||||
while(b > 0)
|
||||
{
|
||||
if(b & 1)
|
||||
{
|
||||
multiply(result, x, y);
|
||||
x = integer_modulus(result, c);
|
||||
}
|
||||
multiply(result, y, y);
|
||||
y = integer_modulus(result, c);
|
||||
b >>= 1;
|
||||
}
|
||||
return x % c;
|
||||
}
|
||||
|
||||
template <class I1, class I2, class I3>
|
||||
inline typename enable_if_c<is_integral<I1>::value && is_signed<I2>::value && is_integral<I3>::value, I1>::type
|
||||
powm(const I1& a, I2 b, I3 c)
|
||||
{
|
||||
if(b < 0)
|
||||
{
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("powm requires a positive exponent."));
|
||||
}
|
||||
return powm(a, static_cast<typename make_unsigned<I2>::type>(b), c);
|
||||
}
|
||||
|
||||
template <class Integer>
|
||||
typename enable_if_c<is_integral<Integer>::value, unsigned>::type lsb(const Integer& val)
|
||||
{
|
||||
if(val <= 0)
|
||||
{
|
||||
if(val == 0)
|
||||
{
|
||||
BOOST_THROW_EXCEPTION(std::range_error("No bits were set in the operand."));
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_THROW_EXCEPTION(std::range_error("Testing individual bits in negative values is not supported - results are undefined."));
|
||||
}
|
||||
}
|
||||
return detail::find_lsb(val);
|
||||
}
|
||||
|
||||
template <class Integer>
|
||||
typename enable_if_c<is_integral<Integer>::value, unsigned>::type msb(Integer val)
|
||||
{
|
||||
if(val <= 0)
|
||||
{
|
||||
if(val == 0)
|
||||
{
|
||||
BOOST_THROW_EXCEPTION(std::range_error("No bits were set in the operand."));
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_THROW_EXCEPTION(std::range_error("Testing individual bits in negative values is not supported - results are undefined."));
|
||||
}
|
||||
}
|
||||
return detail::find_msb(val);
|
||||
}
|
||||
|
||||
template <class Integer>
|
||||
typename enable_if_c<is_integral<Integer>::value, bool>::type bit_test(const Integer& val, unsigned index)
|
||||
{
|
||||
Integer mask = 1;
|
||||
if(index >= sizeof(Integer) * CHAR_BIT)
|
||||
return 0;
|
||||
if(index)
|
||||
mask <<= index;
|
||||
return val & mask ? true : false;
|
||||
}
|
||||
|
||||
template <class Integer>
|
||||
typename enable_if_c<is_integral<Integer>::value, Integer&>::type bit_set(Integer& val, unsigned index)
|
||||
{
|
||||
Integer mask = 1;
|
||||
if(index >= sizeof(Integer) * CHAR_BIT)
|
||||
return val;
|
||||
if(index)
|
||||
mask <<= index;
|
||||
val |= mask;
|
||||
return val;
|
||||
}
|
||||
|
||||
template <class Integer>
|
||||
typename enable_if_c<is_integral<Integer>::value, Integer&>::type bit_unset(Integer& val, unsigned index)
|
||||
{
|
||||
Integer mask = 1;
|
||||
if(index >= sizeof(Integer) * CHAR_BIT)
|
||||
return val;
|
||||
if(index)
|
||||
mask <<= index;
|
||||
val &= ~mask;
|
||||
return val;
|
||||
}
|
||||
|
||||
template <class Integer>
|
||||
typename enable_if_c<is_integral<Integer>::value, Integer&>::type bit_flip(Integer& val, unsigned index)
|
||||
{
|
||||
Integer mask = 1;
|
||||
if(index >= sizeof(Integer) * CHAR_BIT)
|
||||
return val;
|
||||
if(index)
|
||||
mask <<= index;
|
||||
val ^= mask;
|
||||
return val;
|
||||
}
|
||||
|
||||
template <class Integer>
|
||||
typename enable_if_c<is_integral<Integer>::value, Integer>::type sqrt(const Integer& x, Integer& r)
|
||||
{
|
||||
//
|
||||
// This is slow bit-by-bit integer square root, see for example
|
||||
// http://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Binary_numeral_system_.28base_2.29
|
||||
// There are better methods such as http://hal.inria.fr/docs/00/07/28/54/PDF/RR-3805.pdf
|
||||
// and http://hal.inria.fr/docs/00/07/21/13/PDF/RR-4475.pdf which should be implemented
|
||||
// at some point.
|
||||
//
|
||||
Integer s = 0;
|
||||
if(x == 0)
|
||||
{
|
||||
r = 0;
|
||||
return s;
|
||||
}
|
||||
int g = msb(x);
|
||||
if(g == 0)
|
||||
{
|
||||
r = 1;
|
||||
return s;
|
||||
}
|
||||
|
||||
Integer t = 0;
|
||||
r = x;
|
||||
g /= 2;
|
||||
bit_set(s, g);
|
||||
bit_set(t, 2 * g);
|
||||
r = x - t;
|
||||
--g;
|
||||
do
|
||||
{
|
||||
t = s;
|
||||
t <<= g + 1;
|
||||
bit_set(t, 2 * g);
|
||||
if(t <= r)
|
||||
{
|
||||
bit_set(s, g);
|
||||
r -= t;
|
||||
}
|
||||
--g;
|
||||
}
|
||||
while(g >= 0);
|
||||
return s;
|
||||
}
|
||||
|
||||
template <class Integer>
|
||||
typename enable_if_c<is_integral<Integer>::value, Integer>::type sqrt(const Integer& x)
|
||||
{
|
||||
Integer r;
|
||||
return sqrt(x, r);
|
||||
}
|
||||
|
||||
}} // namespaces
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file as_lvalue.hpp
|
||||
/// Contains definition the as_lvalue() functions.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROTO_TRANSFORM_AS_LVALUE_HPP_EAN_12_27_2007
|
||||
#define BOOST_PROTO_TRANSFORM_AS_LVALUE_HPP_EAN_12_27_2007
|
||||
|
||||
#include <boost/proto/proto_fwd.hpp>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4714) // function 'xxx' marked as __forceinline not inlined
|
||||
#endif
|
||||
|
||||
namespace boost { namespace proto
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template<typename T>
|
||||
BOOST_FORCEINLINE
|
||||
T &as_lvalue(T &t)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
BOOST_FORCEINLINE
|
||||
T const &as_lvalue(T const &t)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,30 @@
|
||||
// (C) Copyright 2008-10 Anthony Williams
|
||||
// (C) Copyright 2011-2015 Vicente J. Botet Escriba
|
||||
//
|
||||
// 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_THREAD_FUTURES_FUTURE_STATUS_HPP
|
||||
#define BOOST_THREAD_FUTURES_FUTURE_STATUS_HPP
|
||||
|
||||
#include <boost/thread/detail/config.hpp>
|
||||
#include <boost/core/scoped_enum.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
//enum class future_status
|
||||
BOOST_SCOPED_ENUM_DECLARE_BEGIN(future_status)
|
||||
{
|
||||
ready,
|
||||
timeout,
|
||||
deferred
|
||||
}
|
||||
BOOST_SCOPED_ENUM_DECLARE_END(future_status)
|
||||
namespace future_state
|
||||
{
|
||||
enum state { uninitialized, waiting, ready, moved, deferred };
|
||||
}
|
||||
}
|
||||
|
||||
#endif // header
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -0,0 +1,23 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2003.
|
||||
# * 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_FACILITIES_IS_1_HPP
|
||||
# define BOOST_PREPROCESSOR_FACILITIES_IS_1_HPP
|
||||
#
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/facilities/is_empty.hpp>
|
||||
#
|
||||
# /* BOOST_PP_IS_1 */
|
||||
#
|
||||
# define BOOST_PP_IS_1(x) BOOST_PP_IS_EMPTY(BOOST_PP_CAT(BOOST_PP_IS_1_HELPER_, x))
|
||||
# define BOOST_PP_IS_1_HELPER_1
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,144 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#if !BOOST_PHOENIX_IS_ITERATING
|
||||
|
||||
#include <boost/phoenix/core/limits.hpp>
|
||||
#include <boost/phoenix/support/iterate.hpp>
|
||||
|
||||
namespace boost { namespace phoenix { namespace detail
|
||||
{
|
||||
template <int N>
|
||||
struct member_function_ptr_impl
|
||||
{
|
||||
template <typename RT, typename FP>
|
||||
struct impl;
|
||||
};
|
||||
|
||||
template <int N, typename RT, typename FP>
|
||||
struct member_function_ptr
|
||||
: member_function_ptr_impl<N>::template impl<RT, FP>
|
||||
{
|
||||
typedef typename member_function_ptr_impl<N>::
|
||||
template impl<RT, FP> base;
|
||||
member_function_ptr(FP fp_)
|
||||
: base(fp_) {}
|
||||
|
||||
using base::fp;
|
||||
|
||||
bool operator==(member_function_ptr const & rhs) const
|
||||
{
|
||||
return fp == rhs.fp;
|
||||
}
|
||||
|
||||
template <int M, typename RhsRT, typename RhsFP>
|
||||
bool operator==(member_function_ptr<M, RhsRT, RhsFP> const &) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct member_function_ptr_impl<0>
|
||||
{
|
||||
template <typename RT, typename FP>
|
||||
struct impl
|
||||
{
|
||||
typedef RT result_type;
|
||||
|
||||
impl(FP fp_)
|
||||
: fp(fp_) {}
|
||||
|
||||
template <typename Class>
|
||||
RT operator()(Class& obj) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
|
||||
typedef typename proto::detail::class_member_traits<FP>::class_type class_type;
|
||||
return (BOOST_PROTO_GET_POINTER(class_type, obj) ->*fp)();
|
||||
}
|
||||
|
||||
template <typename Class>
|
||||
RT operator()(Class* obj) const
|
||||
{
|
||||
return (obj->*fp)();
|
||||
}
|
||||
|
||||
FP fp;
|
||||
};
|
||||
};
|
||||
|
||||
#if !defined(BOOST_PHOENIX_DONT_USE_PREPROCESSED_FILES)
|
||||
#include <boost/phoenix/bind/detail/cpp03/preprocessed/member_function_ptr.hpp>
|
||||
#else
|
||||
|
||||
#if defined(__WAVE__) && defined (BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/member_function_ptr_" BOOST_PHOENIX_LIMIT_STR ".hpp")
|
||||
#endif
|
||||
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2007 Joel de Guzman
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
==============================================================================*/
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
#define BOOST_PHOENIX_ITERATION_PARAMS \
|
||||
(3, (1, BOOST_PHOENIX_COMPOSITE_LIMIT, \
|
||||
<boost/phoenix/bind/detail/cpp03/member_function_ptr.hpp>))
|
||||
#include BOOST_PHOENIX_ITERATE()
|
||||
|
||||
#if defined(__WAVE__) && defined (BOOST_PHOENIX_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
}}} // namespace boost::phoenix::detail
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Preprocessor vertical repetition code
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#else
|
||||
|
||||
template <>
|
||||
struct member_function_ptr_impl<BOOST_PHOENIX_ITERATION>
|
||||
{
|
||||
template <typename RT, typename FP>
|
||||
struct impl
|
||||
{
|
||||
typedef RT result_type;
|
||||
|
||||
impl(FP fp_)
|
||||
: fp(fp_) {}
|
||||
|
||||
template <typename Class, BOOST_PHOENIX_typename_A>
|
||||
RT operator()(Class& obj, BOOST_PHOENIX_A_ref_a) const
|
||||
{
|
||||
BOOST_PROTO_USE_GET_POINTER();
|
||||
|
||||
typedef typename proto::detail::class_member_traits<FP>::class_type class_type;
|
||||
return (BOOST_PROTO_GET_POINTER(class_type, obj)->*fp)(BOOST_PHOENIX_a);
|
||||
}
|
||||
|
||||
template <typename Class, BOOST_PHOENIX_typename_A>
|
||||
RT operator()(Class* obj, BOOST_PHOENIX_A_ref_a) const
|
||||
{
|
||||
return (obj->*fp)(BOOST_PHOENIX_a);
|
||||
}
|
||||
|
||||
FP fp;
|
||||
};
|
||||
};
|
||||
|
||||
#endif // defined(BOOST_PP_IS_ITERATING)
|
||||
@@ -0,0 +1,230 @@
|
||||
// Interface to WSPRnet website
|
||||
//
|
||||
// by Edson Pereira - PY2SDR
|
||||
|
||||
#include "wsprnet.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <QTimer>
|
||||
#include <QFile>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
#include <QUrl>
|
||||
#include <QDebug>
|
||||
|
||||
#include "moc_wsprnet.cpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
char const * const wsprNetUrl = "http://wsprnet.org/post?";
|
||||
// char const * const wsprNetUrl = "http://127.0.0.1/post?";
|
||||
};
|
||||
|
||||
WSPRNet::WSPRNet(QNetworkAccessManager * manager, QObject *parent)
|
||||
: QObject{parent}
|
||||
, networkManager {manager}
|
||||
, uploadTimer {new QTimer {this}}
|
||||
, m_urlQueueSize {0}
|
||||
{
|
||||
connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkReply(QNetworkReply*)));
|
||||
connect( uploadTimer, SIGNAL(timeout()), this, SLOT(work()));
|
||||
}
|
||||
|
||||
void WSPRNet::upload(QString const& call, QString const& grid, QString const& rfreq, QString const& tfreq,
|
||||
QString const& mode, QString const& tpct, QString const& dbm, QString const& version,
|
||||
QString const& fileName)
|
||||
{
|
||||
m_call = call;
|
||||
m_grid = grid;
|
||||
m_rfreq = rfreq;
|
||||
m_tfreq = tfreq;
|
||||
m_mode = mode;
|
||||
m_tpct = tpct;
|
||||
m_dbm = dbm;
|
||||
m_vers = version;
|
||||
m_file = fileName;
|
||||
|
||||
// Open the wsprd.out file
|
||||
QFile wsprdOutFile(fileName);
|
||||
if (!wsprdOutFile.open(QIODevice::ReadOnly | QIODevice::Text) ||
|
||||
wsprdOutFile.size() == 0) {
|
||||
urlQueue.enqueue( wsprNetUrl + urlEncodeNoSpot());
|
||||
m_uploadType = 1;
|
||||
uploadTimer->start(200);
|
||||
return;
|
||||
}
|
||||
|
||||
// Read the contents
|
||||
while (!wsprdOutFile.atEnd()) {
|
||||
QHash<QString,QString> query;
|
||||
if ( decodeLine(wsprdOutFile.readLine(), query) ) {
|
||||
// Prevent reporting data ouside of the current frequency band
|
||||
float f = fabs(m_rfreq.toFloat() - query["tqrg"].toFloat());
|
||||
if (f < 0.0002) {
|
||||
urlQueue.enqueue( wsprNetUrl + urlEncodeSpot(query));
|
||||
m_uploadType = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_urlQueueSize = urlQueue.size();
|
||||
uploadTimer->start(200);
|
||||
}
|
||||
|
||||
void WSPRNet::networkReply(QNetworkReply *reply)
|
||||
{
|
||||
// check if request was ours
|
||||
if (m_outstandingRequests.removeOne (reply)) {
|
||||
if (QNetworkReply::NoError != reply->error ()) {
|
||||
Q_EMIT uploadStatus (QString {"Error: %1"}.arg (reply->error ()));
|
||||
// not clearing queue or halting queuing as it may be a transient
|
||||
// one off request error
|
||||
}
|
||||
else {
|
||||
QString serverResponse = reply->readAll();
|
||||
if( m_uploadType == 2) {
|
||||
if (!serverResponse.contains(QRegExp("spot\\(s\\) added"))) {
|
||||
emit uploadStatus(QString {"Upload Failed: %1"}.arg (serverResponse));
|
||||
urlQueue.clear();
|
||||
uploadTimer->stop();
|
||||
}
|
||||
}
|
||||
|
||||
if (urlQueue.isEmpty()) {
|
||||
emit uploadStatus("done");
|
||||
QFile::remove(m_file);
|
||||
uploadTimer->stop();
|
||||
}
|
||||
}
|
||||
|
||||
qDebug () << QString {"WSPRnet.org %1 outstanding requests"}.arg (m_outstandingRequests.size ());
|
||||
|
||||
// delete request object instance on return to the event loop otherwise it is leaked
|
||||
reply->deleteLater ();
|
||||
}
|
||||
}
|
||||
|
||||
bool WSPRNet::decodeLine(QString const& line, QHash<QString,QString> &query)
|
||||
{
|
||||
// 130223 2256 7 -21 -0.3 14.097090 DU1MGA PK04 37 0 40 0
|
||||
// Date Time Sync dBm DT Freq Msg
|
||||
// 1 2 3 4 5 6 -------7------ 8 9 10
|
||||
QRegExp rx("^(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+([+-]?\\d+)\\s+([+-]?\\d+\\.\\d+)\\s+(\\d+\\.\\d+)\\s+(.*)\\s+([+-]?\\d+)\\s+([+-]?\\d+)\\s+([+-]?\\d+)");
|
||||
if (rx.indexIn(line) != -1) {
|
||||
int msgType = 0;
|
||||
QString msg = rx.cap(7);
|
||||
msg.remove(QRegExp("\\s+$"));
|
||||
msg.remove(QRegExp("^\\s+"));
|
||||
QString call, grid, dbm;
|
||||
QRegExp msgRx;
|
||||
|
||||
// Check for Message Type 1
|
||||
msgRx.setPattern("^([A-Z0-9]{3,6})\\s+([A-Z]{2}\\d{2})\\s+(\\d+)");
|
||||
if (msgRx.indexIn(msg) != -1) {
|
||||
msgType = 1;
|
||||
call = msgRx.cap(1);
|
||||
grid = msgRx.cap(2);
|
||||
dbm = msgRx.cap(3);
|
||||
}
|
||||
|
||||
// Check for Message Type 2
|
||||
msgRx.setPattern("^([A-Z0-9/]+)\\s+(\\d+)");
|
||||
if (msgRx.indexIn(msg) != -1) {
|
||||
msgType = 2;
|
||||
call = msgRx.cap(1);
|
||||
grid = "";
|
||||
dbm = msgRx.cap(2);
|
||||
}
|
||||
|
||||
// Check for Message Type 3
|
||||
msgRx.setPattern("^<([A-Z0-9/]+)>\\s+([A-Z]{2}\\d{2}[A-Z]{2})\\s+(\\d+)");
|
||||
if (msgRx.indexIn(msg) != -1) {
|
||||
msgType = 3;
|
||||
call = msgRx.cap(1);
|
||||
grid = msgRx.cap(2);
|
||||
dbm = msgRx.cap(3);
|
||||
}
|
||||
|
||||
// Unknown message format
|
||||
if (!msgType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
query["function"] = "wspr";
|
||||
query["date"] = rx.cap(1);
|
||||
query["time"] = rx.cap(2);
|
||||
query["sig"] = rx.cap(4);
|
||||
query["dt"] = rx.cap(5);
|
||||
query["drift"] = rx.cap(8);
|
||||
query["tqrg"] = rx.cap(6);
|
||||
query["tcall"] = call;
|
||||
query["tgrid"] = grid;
|
||||
query["dbm"] = dbm;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QString WSPRNet::urlEncodeNoSpot()
|
||||
{
|
||||
QString queryString;
|
||||
queryString += "function=wsprstat&";
|
||||
queryString += "rcall=" + m_call + "&";
|
||||
queryString += "rgrid=" + m_grid + "&";
|
||||
queryString += "rqrg=" + m_rfreq + "&";
|
||||
queryString += "tpct=" + m_tpct + "&";
|
||||
queryString += "tqrg=" + m_tfreq + "&";
|
||||
queryString += "dbm=" + m_dbm + "&";
|
||||
queryString += "version=" + m_vers;
|
||||
if(m_mode=="WSPR") queryString += "&mode=2";
|
||||
if(m_mode=="WSPR-15") queryString += "&mode=15";
|
||||
return queryString;;
|
||||
}
|
||||
|
||||
QString WSPRNet::urlEncodeSpot(QHash<QString,QString> const& query)
|
||||
{
|
||||
QString queryString;
|
||||
queryString += "function=" + query["function"] + "&";
|
||||
queryString += "rcall=" + m_call + "&";
|
||||
queryString += "rgrid=" + m_grid + "&";
|
||||
queryString += "rqrg=" + m_rfreq + "&";
|
||||
queryString += "date=" + query["date"] + "&";
|
||||
queryString += "time=" + query["time"] + "&";
|
||||
queryString += "sig=" + query["sig"] + "&";
|
||||
queryString += "dt=" + query["dt"] + "&";
|
||||
queryString += "drift=" + query["drift"] + "&";
|
||||
queryString += "tqrg=" + query["tqrg"] + "&";
|
||||
queryString += "tcall=" + query["tcall"] + "&";
|
||||
queryString += "tgrid=" + query["tgrid"] + "&";
|
||||
queryString += "dbm=" + query["dbm"] + "&";
|
||||
queryString += "version=" + m_vers;
|
||||
if(m_mode=="WSPR") queryString += "&mode=2";
|
||||
if(m_mode=="WSPR-15") queryString += "&mode=15";
|
||||
return queryString;
|
||||
}
|
||||
|
||||
void WSPRNet::work()
|
||||
{
|
||||
if (!urlQueue.isEmpty()) {
|
||||
if (QNetworkAccessManager::Accessible != networkManager->networkAccessible ()) {
|
||||
// try and recover network access for QNAM
|
||||
networkManager->setNetworkAccessible (QNetworkAccessManager::Accessible);
|
||||
}
|
||||
QUrl url(urlQueue.dequeue());
|
||||
QNetworkRequest request(url);
|
||||
m_outstandingRequests << networkManager->get(request);
|
||||
emit uploadStatus(QString {"Uploading Spot %1/%2"}.arg (m_urlQueueSize - urlQueue.size()).arg (m_urlQueueSize));
|
||||
} else {
|
||||
uploadTimer->stop();
|
||||
}
|
||||
}
|
||||
|
||||
void WSPRNet::abortOutstandingRequests () {
|
||||
urlQueue.clear ();
|
||||
for (auto& request : m_outstandingRequests) {
|
||||
request->abort ();
|
||||
}
|
||||
m_urlQueueSize = 0;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
|
||||
#ifndef BOOST_MPL_MAP_MAP0_HPP_INCLUDED
|
||||
#define BOOST_MPL_MAP_MAP0_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2003-2004
|
||||
// Copyright David Abrahams 2003-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$
|
||||
|
||||
#include <boost/mpl/map/aux_/contains_impl.hpp>
|
||||
#include <boost/mpl/map/aux_/at_impl.hpp>
|
||||
//#include <boost/mpl/map/aux_/O1_size.hpp>
|
||||
#include <boost/mpl/map/aux_/insert_impl.hpp>
|
||||
#include <boost/mpl/map/aux_/insert_range_impl.hpp>
|
||||
#include <boost/mpl/map/aux_/erase_impl.hpp>
|
||||
#include <boost/mpl/map/aux_/erase_key_impl.hpp>
|
||||
#include <boost/mpl/map/aux_/has_key_impl.hpp>
|
||||
#include <boost/mpl/map/aux_/key_type_impl.hpp>
|
||||
#include <boost/mpl/map/aux_/value_type_impl.hpp>
|
||||
#include <boost/mpl/map/aux_/clear_impl.hpp>
|
||||
#include <boost/mpl/map/aux_/size_impl.hpp>
|
||||
#include <boost/mpl/map/aux_/empty_impl.hpp>
|
||||
#include <boost/mpl/map/aux_/begin_end_impl.hpp>
|
||||
#include <boost/mpl/map/aux_/iterator.hpp>
|
||||
#include <boost/mpl/map/aux_/item.hpp>
|
||||
#include <boost/mpl/map/aux_/map0.hpp>
|
||||
#include <boost/mpl/map/aux_/tag.hpp>
|
||||
|
||||
#endif // BOOST_MPL_MAP_MAP0_HPP_INCLUDED
|
||||
@@ -0,0 +1,51 @@
|
||||
|
||||
#ifndef BOOST_MPL_AUX_PREPROCESSOR_REPEAT_HPP_INCLUDED
|
||||
#define BOOST_MPL_AUX_PREPROCESSOR_REPEAT_HPP_INCLUDED
|
||||
|
||||
// Copyright Aleksey Gurtovoy 2002-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$
|
||||
|
||||
#include <boost/mpl/aux_/config/preprocessor.hpp>
|
||||
|
||||
#if !defined(BOOST_MPL_CFG_NO_OWN_PP_PRIMITIVES)
|
||||
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
|
||||
# define BOOST_MPL_PP_REPEAT(n,f,param) \
|
||||
BOOST_PP_CAT(BOOST_MPL_PP_REPEAT_,n)(f,param) \
|
||||
/**/
|
||||
|
||||
# define BOOST_MPL_PP_REPEAT_0(f,p)
|
||||
# define BOOST_MPL_PP_REPEAT_1(f,p) f(0,0,p)
|
||||
# define BOOST_MPL_PP_REPEAT_2(f,p) f(0,0,p) f(0,1,p)
|
||||
# define BOOST_MPL_PP_REPEAT_3(f,p) f(0,0,p) f(0,1,p) f(0,2,p)
|
||||
# define BOOST_MPL_PP_REPEAT_4(f,p) f(0,0,p) f(0,1,p) f(0,2,p) f(0,3,p)
|
||||
# define BOOST_MPL_PP_REPEAT_5(f,p) f(0,0,p) f(0,1,p) f(0,2,p) f(0,3,p) f(0,4,p)
|
||||
# define BOOST_MPL_PP_REPEAT_6(f,p) f(0,0,p) f(0,1,p) f(0,2,p) f(0,3,p) f(0,4,p) f(0,5,p)
|
||||
# define BOOST_MPL_PP_REPEAT_7(f,p) f(0,0,p) f(0,1,p) f(0,2,p) f(0,3,p) f(0,4,p) f(0,5,p) f(0,6,p)
|
||||
# define BOOST_MPL_PP_REPEAT_8(f,p) f(0,0,p) f(0,1,p) f(0,2,p) f(0,3,p) f(0,4,p) f(0,5,p) f(0,6,p) f(0,7,p)
|
||||
# define BOOST_MPL_PP_REPEAT_9(f,p) f(0,0,p) f(0,1,p) f(0,2,p) f(0,3,p) f(0,4,p) f(0,5,p) f(0,6,p) f(0,7,p) f(0,8,p)
|
||||
# define BOOST_MPL_PP_REPEAT_10(f,p) f(0,0,p) f(0,1,p) f(0,2,p) f(0,3,p) f(0,4,p) f(0,5,p) f(0,6,p) f(0,7,p) f(0,8,p) f(0,9,p)
|
||||
|
||||
#else
|
||||
|
||||
# include <boost/preprocessor/repeat.hpp>
|
||||
|
||||
# define BOOST_MPL_PP_REPEAT(n,f,param) \
|
||||
BOOST_PP_REPEAT(n,f,param) \
|
||||
/**/
|
||||
|
||||
#endif
|
||||
|
||||
#define BOOST_MPL_PP_REPEAT_IDENTITY_FUNC(unused1, unused2, x) x
|
||||
|
||||
#endif // BOOST_MPL_AUX_PREPROCESSOR_REPEAT_HPP_INCLUDED
|
||||
Binary file not shown.
@@ -0,0 +1,47 @@
|
||||
|
||||
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
||||
|
||||
#ifndef BOOST_TT_HAS_NOTHROW_DESTRUCTOR_HPP_INCLUDED
|
||||
#define BOOST_TT_HAS_NOTHROW_DESTRUCTOR_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/has_trivial_destructor.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(__SUNPRO_CC) && !(defined(BOOST_MSVC) && (_MSC_FULL_VER < 190023506))
|
||||
|
||||
#include <boost/type_traits/declval.hpp>
|
||||
#include <boost/type_traits/is_destructible.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace detail{
|
||||
|
||||
template <class T, bool b>
|
||||
struct has_nothrow_destructor_imp : public boost::integral_constant<bool, false>{};
|
||||
template <class T>
|
||||
struct has_nothrow_destructor_imp<T, true> : public boost::integral_constant<bool, noexcept(boost::declval<T*&>()->~T())>{};
|
||||
|
||||
}
|
||||
|
||||
template <class T> struct has_nothrow_destructor : public detail::has_nothrow_destructor_imp<T, boost::is_destructible<T>::value>{};
|
||||
template <class T, std::size_t N> struct has_nothrow_destructor<T[N]> : public has_nothrow_destructor<T>{};
|
||||
template <class T> struct has_nothrow_destructor<T&> : public integral_constant<bool, false>{};
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
template <class T> struct has_nothrow_destructor<T&&> : public integral_constant<bool, false>{};
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <class T> struct has_nothrow_destructor : public ::boost::has_trivial_destructor<T> {};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BOOST_TT_HAS_NOTHROW_DESTRUCTOR_HPP_INCLUDED
|
||||
@@ -0,0 +1,237 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// \file deep_copy.hpp
|
||||
/// Replace all nodes stored by reference by nodes stored by value.
|
||||
//
|
||||
// Copyright 2008 Eric Niebler. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
template<typename Expr>
|
||||
struct deep_copy_impl<Expr, 1>
|
||||
{
|
||||
typedef
|
||||
typename base_expr<
|
||||
typename Expr::proto_domain
|
||||
, typename Expr::proto_tag
|
||||
, list1<
|
||||
typename deep_copy_impl< typename remove_reference< typename Expr::proto_child0 >::type::proto_derived_expr >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename Expr::proto_generator proto_generator;
|
||||
typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
|
||||
template<typename Expr2, typename S, typename D>
|
||||
result_type operator()(Expr2 const &e, S const &, D const &) const
|
||||
{
|
||||
expr_type const that = {
|
||||
proto::deep_copy(e.proto_base().child0)
|
||||
};
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Expr>
|
||||
struct deep_copy_impl<Expr, 2>
|
||||
{
|
||||
typedef
|
||||
typename base_expr<
|
||||
typename Expr::proto_domain
|
||||
, typename Expr::proto_tag
|
||||
, list2<
|
||||
typename deep_copy_impl< typename remove_reference< typename Expr::proto_child0 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child1 >::type::proto_derived_expr >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename Expr::proto_generator proto_generator;
|
||||
typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
|
||||
template<typename Expr2, typename S, typename D>
|
||||
result_type operator()(Expr2 const &e, S const &, D const &) const
|
||||
{
|
||||
expr_type const that = {
|
||||
proto::deep_copy(e.proto_base().child0) , proto::deep_copy(e.proto_base().child1)
|
||||
};
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Expr>
|
||||
struct deep_copy_impl<Expr, 3>
|
||||
{
|
||||
typedef
|
||||
typename base_expr<
|
||||
typename Expr::proto_domain
|
||||
, typename Expr::proto_tag
|
||||
, list3<
|
||||
typename deep_copy_impl< typename remove_reference< typename Expr::proto_child0 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child1 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child2 >::type::proto_derived_expr >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename Expr::proto_generator proto_generator;
|
||||
typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
|
||||
template<typename Expr2, typename S, typename D>
|
||||
result_type operator()(Expr2 const &e, S const &, D const &) const
|
||||
{
|
||||
expr_type const that = {
|
||||
proto::deep_copy(e.proto_base().child0) , proto::deep_copy(e.proto_base().child1) , proto::deep_copy(e.proto_base().child2)
|
||||
};
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Expr>
|
||||
struct deep_copy_impl<Expr, 4>
|
||||
{
|
||||
typedef
|
||||
typename base_expr<
|
||||
typename Expr::proto_domain
|
||||
, typename Expr::proto_tag
|
||||
, list4<
|
||||
typename deep_copy_impl< typename remove_reference< typename Expr::proto_child0 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child1 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child2 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child3 >::type::proto_derived_expr >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename Expr::proto_generator proto_generator;
|
||||
typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
|
||||
template<typename Expr2, typename S, typename D>
|
||||
result_type operator()(Expr2 const &e, S const &, D const &) const
|
||||
{
|
||||
expr_type const that = {
|
||||
proto::deep_copy(e.proto_base().child0) , proto::deep_copy(e.proto_base().child1) , proto::deep_copy(e.proto_base().child2) , proto::deep_copy(e.proto_base().child3)
|
||||
};
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Expr>
|
||||
struct deep_copy_impl<Expr, 5>
|
||||
{
|
||||
typedef
|
||||
typename base_expr<
|
||||
typename Expr::proto_domain
|
||||
, typename Expr::proto_tag
|
||||
, list5<
|
||||
typename deep_copy_impl< typename remove_reference< typename Expr::proto_child0 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child1 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child2 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child3 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child4 >::type::proto_derived_expr >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename Expr::proto_generator proto_generator;
|
||||
typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
|
||||
template<typename Expr2, typename S, typename D>
|
||||
result_type operator()(Expr2 const &e, S const &, D const &) const
|
||||
{
|
||||
expr_type const that = {
|
||||
proto::deep_copy(e.proto_base().child0) , proto::deep_copy(e.proto_base().child1) , proto::deep_copy(e.proto_base().child2) , proto::deep_copy(e.proto_base().child3) , proto::deep_copy(e.proto_base().child4)
|
||||
};
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Expr>
|
||||
struct deep_copy_impl<Expr, 6>
|
||||
{
|
||||
typedef
|
||||
typename base_expr<
|
||||
typename Expr::proto_domain
|
||||
, typename Expr::proto_tag
|
||||
, list6<
|
||||
typename deep_copy_impl< typename remove_reference< typename Expr::proto_child0 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child1 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child2 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child3 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child4 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child5 >::type::proto_derived_expr >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename Expr::proto_generator proto_generator;
|
||||
typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
|
||||
template<typename Expr2, typename S, typename D>
|
||||
result_type operator()(Expr2 const &e, S const &, D const &) const
|
||||
{
|
||||
expr_type const that = {
|
||||
proto::deep_copy(e.proto_base().child0) , proto::deep_copy(e.proto_base().child1) , proto::deep_copy(e.proto_base().child2) , proto::deep_copy(e.proto_base().child3) , proto::deep_copy(e.proto_base().child4) , proto::deep_copy(e.proto_base().child5)
|
||||
};
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Expr>
|
||||
struct deep_copy_impl<Expr, 7>
|
||||
{
|
||||
typedef
|
||||
typename base_expr<
|
||||
typename Expr::proto_domain
|
||||
, typename Expr::proto_tag
|
||||
, list7<
|
||||
typename deep_copy_impl< typename remove_reference< typename Expr::proto_child0 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child1 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child2 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child3 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child4 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child5 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child6 >::type::proto_derived_expr >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename Expr::proto_generator proto_generator;
|
||||
typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
|
||||
template<typename Expr2, typename S, typename D>
|
||||
result_type operator()(Expr2 const &e, S const &, D const &) const
|
||||
{
|
||||
expr_type const that = {
|
||||
proto::deep_copy(e.proto_base().child0) , proto::deep_copy(e.proto_base().child1) , proto::deep_copy(e.proto_base().child2) , proto::deep_copy(e.proto_base().child3) , proto::deep_copy(e.proto_base().child4) , proto::deep_copy(e.proto_base().child5) , proto::deep_copy(e.proto_base().child6)
|
||||
};
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Expr>
|
||||
struct deep_copy_impl<Expr, 8>
|
||||
{
|
||||
typedef
|
||||
typename base_expr<
|
||||
typename Expr::proto_domain
|
||||
, typename Expr::proto_tag
|
||||
, list8<
|
||||
typename deep_copy_impl< typename remove_reference< typename Expr::proto_child0 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child1 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child2 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child3 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child4 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child5 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child6 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child7 >::type::proto_derived_expr >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename Expr::proto_generator proto_generator;
|
||||
typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
|
||||
template<typename Expr2, typename S, typename D>
|
||||
result_type operator()(Expr2 const &e, S const &, D const &) const
|
||||
{
|
||||
expr_type const that = {
|
||||
proto::deep_copy(e.proto_base().child0) , proto::deep_copy(e.proto_base().child1) , proto::deep_copy(e.proto_base().child2) , proto::deep_copy(e.proto_base().child3) , proto::deep_copy(e.proto_base().child4) , proto::deep_copy(e.proto_base().child5) , proto::deep_copy(e.proto_base().child6) , proto::deep_copy(e.proto_base().child7)
|
||||
};
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Expr>
|
||||
struct deep_copy_impl<Expr, 9>
|
||||
{
|
||||
typedef
|
||||
typename base_expr<
|
||||
typename Expr::proto_domain
|
||||
, typename Expr::proto_tag
|
||||
, list9<
|
||||
typename deep_copy_impl< typename remove_reference< typename Expr::proto_child0 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child1 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child2 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child3 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child4 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child5 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child6 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child7 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child8 >::type::proto_derived_expr >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename Expr::proto_generator proto_generator;
|
||||
typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
|
||||
template<typename Expr2, typename S, typename D>
|
||||
result_type operator()(Expr2 const &e, S const &, D const &) const
|
||||
{
|
||||
expr_type const that = {
|
||||
proto::deep_copy(e.proto_base().child0) , proto::deep_copy(e.proto_base().child1) , proto::deep_copy(e.proto_base().child2) , proto::deep_copy(e.proto_base().child3) , proto::deep_copy(e.proto_base().child4) , proto::deep_copy(e.proto_base().child5) , proto::deep_copy(e.proto_base().child6) , proto::deep_copy(e.proto_base().child7) , proto::deep_copy(e.proto_base().child8)
|
||||
};
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
template<typename Expr>
|
||||
struct deep_copy_impl<Expr, 10>
|
||||
{
|
||||
typedef
|
||||
typename base_expr<
|
||||
typename Expr::proto_domain
|
||||
, typename Expr::proto_tag
|
||||
, list10<
|
||||
typename deep_copy_impl< typename remove_reference< typename Expr::proto_child0 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child1 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child2 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child3 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child4 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child5 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child6 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child7 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child8 >::type::proto_derived_expr >::result_type , typename deep_copy_impl< typename remove_reference< typename Expr::proto_child9 >::type::proto_derived_expr >::result_type
|
||||
>
|
||||
>::type
|
||||
expr_type;
|
||||
typedef typename Expr::proto_generator proto_generator;
|
||||
typedef typename proto_generator::template result<proto_generator(expr_type)>::type result_type;
|
||||
template<typename Expr2, typename S, typename D>
|
||||
result_type operator()(Expr2 const &e, S const &, D const &) const
|
||||
{
|
||||
expr_type const that = {
|
||||
proto::deep_copy(e.proto_base().child0) , proto::deep_copy(e.proto_base().child1) , proto::deep_copy(e.proto_base().child2) , proto::deep_copy(e.proto_base().child3) , proto::deep_copy(e.proto_base().child4) , proto::deep_copy(e.proto_base().child5) , proto::deep_copy(e.proto_base().child6) , proto::deep_copy(e.proto_base().child7) , proto::deep_copy(e.proto_base().child8) , proto::deep_copy(e.proto_base().child9)
|
||||
};
|
||||
return proto_generator()(that);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user