Added missing files [#CLICKHOUSE-3276].

This commit is contained in:
Alexey Milovidov 2017-09-04 22:30:52 +03:00
parent 6901e80c4c
commit b4d7d8f1de
18 changed files with 2561 additions and 0 deletions

View File

@ -0,0 +1,274 @@
/*
Copyright (C) 2002 Brad King (brad.king@kitware.com)
Douglas Gregor (gregod@cs.rpi.edu)
Copyright (C) 2002, 2008, 2013 Peter Dimov
Copyright (C) 2017 Glen Joseph Fernandes (glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_CORE_ADDRESSOF_HPP
#define BOOST_CORE_ADDRESSOF_HPP
#include <boost/config.hpp>
#if defined(BOOST_MSVC_FULL_VER) && BOOST_MSVC_FULL_VER >= 190024215
#define BOOST_CORE_HAS_BUILTIN_ADDRESSOF
#elif defined(BOOST_GCC) && BOOST_GCC >= 70000
#define BOOST_CORE_HAS_BUILTIN_ADDRESSOF
#elif defined(__has_builtin)
#if __has_builtin(__builtin_addressof)
#define BOOST_CORE_HAS_BUILTIN_ADDRESSOF
#endif
#endif
#if defined(BOOST_CORE_HAS_BUILTIN_ADDRESSOF)
#if defined(BOOST_NO_CXX11_CONSTEXPR)
#define BOOST_CORE_NO_CONSTEXPR_ADDRESSOF
#endif
namespace boost {
template<class T>
BOOST_CONSTEXPR inline T*
addressof(T& o) BOOST_NOEXCEPT
{
return __builtin_addressof(o);
}
} /* boost */
#else
#include <boost/config/workaround.hpp>
#include <cstddef>
namespace boost {
namespace detail {
template<class T>
class addressof_ref {
public:
BOOST_FORCEINLINE addressof_ref(T& o) BOOST_NOEXCEPT
: o_(o) { }
BOOST_FORCEINLINE operator T&() const BOOST_NOEXCEPT {
return o_;
}
private:
addressof_ref& operator=(const addressof_ref&);
T& o_;
};
template<class T>
struct address_of {
static BOOST_FORCEINLINE T* get(T& o, long) BOOST_NOEXCEPT {
return reinterpret_cast<T*>(&
const_cast<char&>(reinterpret_cast<const volatile char&>(o)));
}
static BOOST_FORCEINLINE T* get(T* p, int) BOOST_NOEXCEPT {
return p;
}
};
#if !defined(BOOST_NO_CXX11_NULLPTR)
#if !defined(BOOST_NO_CXX11_DECLTYPE) && \
(defined(__INTEL_COMPILER) || \
(defined(__clang__) && !defined(_LIBCPP_VERSION)))
typedef decltype(nullptr) addressof_null_t;
#else
typedef std::nullptr_t addressof_null_t;
#endif
template<>
struct address_of<addressof_null_t> {
typedef addressof_null_t type;
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
return &o;
}
};
template<>
struct address_of<const addressof_null_t> {
typedef const addressof_null_t type;
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
return &o;
}
};
template<>
struct address_of<volatile addressof_null_t> {
typedef volatile addressof_null_t type;
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
return &o;
}
};
template<>
struct address_of<const volatile addressof_null_t> {
typedef const volatile addressof_null_t type;
static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT {
return &o;
}
};
#endif
} /* detail */
#if defined(BOOST_NO_CXX11_SFINAE_EXPR) || \
defined(BOOST_NO_CXX11_CONSTEXPR) || \
defined(BOOST_NO_CXX11_DECLTYPE)
#define BOOST_CORE_NO_CONSTEXPR_ADDRESSOF
template<class T>
BOOST_FORCEINLINE T*
addressof(T& o) BOOST_NOEXCEPT
{
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) || \
BOOST_WORKAROUND(__SUNPRO_CC, <= 0x5120)
return detail::address_of<T>::get(o, 0);
#else
return detail::address_of<T>::get(detail::addressof_ref<T>(o), 0);
#endif
}
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590))
namespace detail {
template<class T>
struct addressof_result {
typedef T* type;
};
} /* detail */
template<class T, std::size_t N>
BOOST_FORCEINLINE typename detail::addressof_result<T[N]>::type
addressof(T (&o)[N]) BOOST_NOEXCEPT
{
return &o;
}
#endif
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
template<class T, std::size_t N>
BOOST_FORCEINLINE
T (*addressof(T (&o)[N]) BOOST_NOEXCEPT)[N]
{
return reinterpret_cast<T(*)[N]>(&o);
}
template<class T, std::size_t N>
BOOST_FORCEINLINE
const T (*addressof(const T (&o)[N]) BOOST_NOEXCEPT)[N]
{
return reinterpret_cast<const T(*)[N]>(&o);
}
#endif
#else
namespace detail {
template<class T>
T addressof_declval() BOOST_NOEXCEPT;
template<class>
struct addressof_void {
typedef void type;
};
template<class T, class E = void>
struct addressof_member_operator {
static constexpr bool value = false;
};
template<class T>
struct addressof_member_operator<T, typename
addressof_void<decltype(addressof_declval<T&>().operator&())>::type> {
static constexpr bool value = true;
};
#if BOOST_WORKAROUND(BOOST_INTEL, < 1600)
struct addressof_addressable { };
addressof_addressable*
operator&(addressof_addressable&) BOOST_NOEXCEPT;
#endif
template<class T, class E = void>
struct addressof_non_member_operator {
static constexpr bool value = false;
};
template<class T>
struct addressof_non_member_operator<T, typename
addressof_void<decltype(operator&(addressof_declval<T&>()))>::type> {
static constexpr bool value = true;
};
template<class T, class E = void>
struct addressof_expression {
static constexpr bool value = false;
};
template<class T>
struct addressof_expression<T,
typename addressof_void<decltype(&addressof_declval<T&>())>::type> {
static constexpr bool value = true;
};
template<class T>
struct addressof_is_constexpr {
static constexpr bool value = addressof_expression<T>::value &&
!addressof_member_operator<T>::value &&
!addressof_non_member_operator<T>::value;
};
template<bool E, class T>
struct addressof_if { };
template<class T>
struct addressof_if<true, T> {
typedef T* type;
};
template<class T>
BOOST_FORCEINLINE
typename addressof_if<!addressof_is_constexpr<T>::value, T>::type
addressof(T& o) BOOST_NOEXCEPT
{
return address_of<T>::get(addressof_ref<T>(o), 0);
}
template<class T>
constexpr BOOST_FORCEINLINE
typename addressof_if<addressof_is_constexpr<T>::value, T>::type
addressof(T& o) BOOST_NOEXCEPT
{
return &o;
}
} /* detail */
template<class T>
constexpr BOOST_FORCEINLINE T*
addressof(T& o) BOOST_NOEXCEPT
{
return detail::addressof(o);
}
#endif
} /* boost */
#endif
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \
!defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
namespace boost {
template<class T>
const T* addressof(const T&&) = delete;
} /* boost */
#endif
#endif

View File

@ -0,0 +1,69 @@
#ifndef BOOST_CORE_CHECKED_DELETE_HPP
#define BOOST_CORE_CHECKED_DELETE_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
//
// boost/checked_delete.hpp
//
// Copyright (c) 2002, 2003 Peter Dimov
// Copyright (c) 2003 Daniel Frey
// Copyright (c) 2003 Howard Hinnant
//
// 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/core/doc/html/core/checked_delete.html for documentation.
//
namespace boost
{
// verify that types are complete for increased safety
template<class T> inline void checked_delete(T * x)
{
// intentionally complex - simplification causes regressions
typedef char type_must_be_complete[ sizeof(T)? 1: -1 ];
(void) sizeof(type_must_be_complete);
delete x;
}
template<class T> inline void checked_array_delete(T * x)
{
typedef char type_must_be_complete[ sizeof(T)? 1: -1 ];
(void) sizeof(type_must_be_complete);
delete [] x;
}
template<class T> struct checked_deleter
{
typedef void result_type;
typedef T * argument_type;
void operator()(T * x) const
{
// boost:: disables ADL
boost::checked_delete(x);
}
};
template<class T> struct checked_array_deleter
{
typedef void result_type;
typedef T * argument_type;
void operator()(T * x) const
{
boost::checked_array_delete(x);
}
};
} // namespace boost
#endif // #ifndef BOOST_CORE_CHECKED_DELETE_HPP

View File

@ -0,0 +1,126 @@
#ifndef BOOST_CORE_DEMANGLE_HPP_INCLUDED
#define BOOST_CORE_DEMANGLE_HPP_INCLUDED
// core::demangle
//
// Copyright 2014 Peter Dimov
// Copyright 2014 Andrey Semashev
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/config.hpp>
#include <string>
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
// __has_include is currently supported by GCC and Clang. However GCC 4.9 may have issues and
// returns 1 for 'defined( __has_include )', while '__has_include' is actually not supported:
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63662
#if defined( __has_include ) && (!defined( BOOST_GCC ) || (__GNUC__ + 0) >= 5)
# if __has_include(<cxxabi.h>)
# define BOOST_CORE_HAS_CXXABI_H
# endif
#elif defined( __GLIBCXX__ ) || defined( __GLIBCPP__ )
# define BOOST_CORE_HAS_CXXABI_H
#endif
#if defined( BOOST_CORE_HAS_CXXABI_H )
# include <cxxabi.h>
// For some archtectures (mips, mips64, x86, x86_64) cxxabi.h in Android NDK is implemented by gabi++ library
// (https://android.googlesource.com/platform/ndk/+/master/sources/cxx-stl/gabi++/), which does not implement
// abi::__cxa_demangle(). We detect this implementation by checking the include guard here.
# if defined( __GABIXX_CXXABI_H__ )
# undef BOOST_CORE_HAS_CXXABI_H
# else
# include <cstdlib>
# include <cstddef>
# endif
#endif
namespace boost
{
namespace core
{
inline char const * demangle_alloc( char const * name ) BOOST_NOEXCEPT;
inline void demangle_free( char const * name ) BOOST_NOEXCEPT;
class scoped_demangled_name
{
private:
char const * m_p;
public:
explicit scoped_demangled_name( char const * name ) BOOST_NOEXCEPT :
m_p( demangle_alloc( name ) )
{
}
~scoped_demangled_name() BOOST_NOEXCEPT
{
demangle_free( m_p );
}
char const * get() const BOOST_NOEXCEPT
{
return m_p;
}
BOOST_DELETED_FUNCTION(scoped_demangled_name( scoped_demangled_name const& ))
BOOST_DELETED_FUNCTION(scoped_demangled_name& operator= ( scoped_demangled_name const& ))
};
#if defined( BOOST_CORE_HAS_CXXABI_H )
inline char const * demangle_alloc( char const * name ) BOOST_NOEXCEPT
{
int status = 0;
std::size_t size = 0;
return abi::__cxa_demangle( name, NULL, &size, &status );
}
inline void demangle_free( char const * name ) BOOST_NOEXCEPT
{
std::free( const_cast< char* >( name ) );
}
inline std::string demangle( char const * name )
{
scoped_demangled_name demangled_name( name );
char const * p = demangled_name.get();
if( !p )
p = name;
return p;
}
#else
inline char const * demangle_alloc( char const * name ) BOOST_NOEXCEPT
{
return name;
}
inline void demangle_free( char const * ) BOOST_NOEXCEPT
{
}
inline std::string demangle( char const * name )
{
return name;
}
#endif
} // namespace core
} // namespace boost
#undef BOOST_CORE_HAS_CXXABI_H
#endif // #ifndef BOOST_CORE_DEMANGLE_HPP_INCLUDED

View File

@ -0,0 +1,128 @@
// Boost enable_if library
// Copyright 2003 (c) The Trustees of Indiana University.
// 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: Jaakko Jarvi (jajarvi at osl.iu.edu)
// Jeremiah Willcock (jewillco at osl.iu.edu)
// Andrew Lumsdaine (lums at osl.iu.edu)
#ifndef BOOST_CORE_ENABLE_IF_HPP
#define BOOST_CORE_ENABLE_IF_HPP
#include "boost/config.hpp"
// Even the definition of enable_if causes problems on some compilers,
// so it's macroed out for all compilers that do not support SFINAE
#ifndef BOOST_NO_SFINAE
namespace boost
{
template<typename T, typename R=void>
struct enable_if_has_type
{
typedef R type;
};
template <bool B, class T = void>
struct enable_if_c {
typedef T type;
};
template <class T>
struct enable_if_c<false, T> {};
template <class Cond, class T = void>
struct enable_if : public enable_if_c<Cond::value, T> {};
template <bool B, class T>
struct lazy_enable_if_c {
typedef typename T::type type;
};
template <class T>
struct lazy_enable_if_c<false, T> {};
template <class Cond, class T>
struct lazy_enable_if : public lazy_enable_if_c<Cond::value, T> {};
template <bool B, class T = void>
struct disable_if_c {
typedef T type;
};
template <class T>
struct disable_if_c<true, T> {};
template <class Cond, class T = void>
struct disable_if : public disable_if_c<Cond::value, T> {};
template <bool B, class T>
struct lazy_disable_if_c {
typedef typename T::type type;
};
template <class T>
struct lazy_disable_if_c<true, T> {};
template <class Cond, class T>
struct lazy_disable_if : public lazy_disable_if_c<Cond::value, T> {};
} // namespace boost
#else
namespace boost {
namespace detail { typedef void enable_if_default_T; }
template <typename T>
struct enable_if_does_not_work_on_this_compiler;
template<typename T, typename R=void>
struct enable_if_has_type : enable_if_does_not_work_on_this_compiler<T>
{ };
template <bool B, class T = detail::enable_if_default_T>
struct enable_if_c : enable_if_does_not_work_on_this_compiler<T>
{ };
template <bool B, class T = detail::enable_if_default_T>
struct disable_if_c : enable_if_does_not_work_on_this_compiler<T>
{ };
template <bool B, class T = detail::enable_if_default_T>
struct lazy_enable_if_c : enable_if_does_not_work_on_this_compiler<T>
{ };
template <bool B, class T = detail::enable_if_default_T>
struct lazy_disable_if_c : enable_if_does_not_work_on_this_compiler<T>
{ };
template <class Cond, class T = detail::enable_if_default_T>
struct enable_if : enable_if_does_not_work_on_this_compiler<T>
{ };
template <class Cond, class T = detail::enable_if_default_T>
struct disable_if : enable_if_does_not_work_on_this_compiler<T>
{ };
template <class Cond, class T = detail::enable_if_default_T>
struct lazy_enable_if : enable_if_does_not_work_on_this_compiler<T>
{ };
template <class Cond, class T = detail::enable_if_default_T>
struct lazy_disable_if : enable_if_does_not_work_on_this_compiler<T>
{ };
} // namespace boost
#endif // BOOST_NO_SFINAE
#endif

View File

@ -0,0 +1,154 @@
/*
* Copyright Andrey Semashev 2007 - 2013.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
/*!
* \file explicit_operator_bool.hpp
* \author Andrey Semashev
* \date 08.03.2009
*
* This header defines a compatibility macro that implements an unspecified
* \c bool operator idiom, which is superseded with explicit conversion operators in
* C++11.
*/
#ifndef BOOST_CORE_EXPLICIT_OPERATOR_BOOL_HPP
#define BOOST_CORE_EXPLICIT_OPERATOR_BOOL_HPP
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
#if !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
/*!
* \brief The macro defines an explicit operator of conversion to \c bool
*
* The macro should be used inside the definition of a class that has to
* support the conversion. The class should also implement <tt>operator!</tt>,
* in terms of which the conversion operator will be implemented.
*/
#define BOOST_EXPLICIT_OPERATOR_BOOL()\
BOOST_FORCEINLINE explicit operator bool () const\
{\
return !this->operator! ();\
}
/*!
* \brief The macro defines a noexcept explicit operator of conversion to \c bool
*
* The macro should be used inside the definition of a class that has to
* support the conversion. The class should also implement <tt>operator!</tt>,
* in terms of which the conversion operator will be implemented.
*/
#define BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()\
BOOST_FORCEINLINE explicit operator bool () const BOOST_NOEXCEPT\
{\
return !this->operator! ();\
}
/*!
* \brief The macro defines a constexpr explicit operator of conversion to \c bool
*
* The macro should be used inside the definition of a class that has to
* support the conversion. The class should also implement <tt>operator!</tt>,
* in terms of which the conversion operator will be implemented.
*/
#define BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL()\
BOOST_FORCEINLINE BOOST_CONSTEXPR explicit operator bool () const BOOST_NOEXCEPT\
{\
return !this->operator! ();\
}
#else // !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
#if (defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)) && !defined(BOOST_NO_COMPILER_CONFIG)
// Sun C++ 5.3 can't handle the safe_bool idiom, so don't use it
#define BOOST_NO_UNSPECIFIED_BOOL
#endif // (defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)) && !defined(BOOST_NO_COMPILER_CONFIG)
#if !defined(BOOST_NO_UNSPECIFIED_BOOL)
namespace boost {
namespace detail {
#if !defined(_MSC_VER) && !defined(__IBMCPP__)
struct unspecified_bool
{
// NOTE TO THE USER: If you see this in error messages then you tried
// to apply an unsupported operator on the object that supports
// explicit conversion to bool.
struct OPERATORS_NOT_ALLOWED;
static void true_value(OPERATORS_NOT_ALLOWED*) {}
};
typedef void (*unspecified_bool_type)(unspecified_bool::OPERATORS_NOT_ALLOWED*);
#else
// MSVC and VACPP are too eager to convert pointer to function to void* even though they shouldn't
struct unspecified_bool
{
// NOTE TO THE USER: If you see this in error messages then you tried
// to apply an unsupported operator on the object that supports
// explicit conversion to bool.
struct OPERATORS_NOT_ALLOWED;
void true_value(OPERATORS_NOT_ALLOWED*) {}
};
typedef void (unspecified_bool::*unspecified_bool_type)(unspecified_bool::OPERATORS_NOT_ALLOWED*);
#endif
} // namespace detail
} // namespace boost
#define BOOST_EXPLICIT_OPERATOR_BOOL()\
BOOST_FORCEINLINE operator boost::detail::unspecified_bool_type () const\
{\
return (!this->operator! () ? &boost::detail::unspecified_bool::true_value : (boost::detail::unspecified_bool_type)0);\
}
#define BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()\
BOOST_FORCEINLINE operator boost::detail::unspecified_bool_type () const BOOST_NOEXCEPT\
{\
return (!this->operator! () ? &boost::detail::unspecified_bool::true_value : (boost::detail::unspecified_bool_type)0);\
}
#define BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL()\
BOOST_FORCEINLINE BOOST_CONSTEXPR operator boost::detail::unspecified_bool_type () const BOOST_NOEXCEPT\
{\
return (!this->operator! () ? &boost::detail::unspecified_bool::true_value : (boost::detail::unspecified_bool_type)0);\
}
#else // !defined(BOOST_NO_UNSPECIFIED_BOOL)
#define BOOST_EXPLICIT_OPERATOR_BOOL()\
BOOST_FORCEINLINE operator bool () const\
{\
return !this->operator! ();\
}
#define BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()\
BOOST_FORCEINLINE operator bool () const BOOST_NOEXCEPT\
{\
return !this->operator! ();\
}
#define BOOST_CONSTEXPR_EXPLICIT_OPERATOR_BOOL()\
BOOST_FORCEINLINE BOOST_CONSTEXPR operator bool () const BOOST_NOEXCEPT\
{\
return !this->operator! ();\
}
#endif // !defined(BOOST_NO_UNSPECIFIED_BOOL)
#endif // !defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
#endif // BOOST_CORE_EXPLICIT_OPERATOR_BOOL_HPP

View File

@ -0,0 +1,70 @@
// Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
//
// 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)
#ifndef BOOST_CORE_IGNORE_UNUSED_HPP
#define BOOST_CORE_IGNORE_UNUSED_HPP
#include <boost/config.hpp>
namespace boost {
#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
template <typename... Ts>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(Ts const& ...)
{}
template <typename... Ts>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused()
{}
#else
template <typename T1>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&)
{}
template <typename T1, typename T2>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&, T2 const&)
{}
template <typename T1, typename T2, typename T3>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&, T2 const&, T3 const&)
{}
template <typename T1, typename T2, typename T3, typename T4>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&, T2 const&, T3 const&, T4 const&)
{}
template <typename T1, typename T2, typename T3, typename T4, typename T5>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused(T1 const&, T2 const&, T3 const&, T4 const&, T5 const&)
{}
template <typename T1>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused()
{}
template <typename T1, typename T2>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused()
{}
template <typename T1, typename T2, typename T3>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused()
{}
template <typename T1, typename T2, typename T3, typename T4>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused()
{}
template <typename T1, typename T2, typename T3, typename T4, typename T5>
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore_unused()
{}
#endif
} // namespace boost
#endif // BOOST_CORE_IGNORE_UNUSED_HPP

View File

@ -0,0 +1,40 @@
#ifndef BOOST_CORE_IS_SAME_HPP_INCLUDED
#define BOOST_CORE_IS_SAME_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
// is_same<T1,T2>::value is true when T1 == T2
//
// Copyright 2014 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
#include <boost/config.hpp>
namespace boost
{
namespace core
{
template< class T1, class T2 > struct is_same
{
BOOST_STATIC_CONSTANT( bool, value = false );
};
template< class T > struct is_same< T, T >
{
BOOST_STATIC_CONSTANT( bool, value = true );
};
} // namespace core
} // namespace boost
#endif // #ifndef BOOST_CORE_IS_SAME_HPP_INCLUDED

View File

@ -0,0 +1,465 @@
#ifndef BOOST_CORE_LIGHTWEIGHT_TEST_HPP
#define BOOST_CORE_LIGHTWEIGHT_TEST_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
//
// boost/core/lightweight_test.hpp - lightweight test library
//
// Copyright (c) 2002, 2009, 2014 Peter Dimov
// Copyright (2) Beman Dawes 2010, 2011
// Copyright (3) Ion Gaztanaga 2013
//
// Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
#include <boost/core/no_exceptions_support.hpp>
#include <boost/assert.hpp>
#include <boost/current_function.hpp>
#include <iostream>
#include <iterator>
#include <cstring>
#include <cstddef>
// IDE's like Visual Studio perform better if output goes to std::cout or
// some other stream, so allow user to configure output stream:
#ifndef BOOST_LIGHTWEIGHT_TEST_OSTREAM
# define BOOST_LIGHTWEIGHT_TEST_OSTREAM std::cerr
#endif
namespace boost
{
namespace detail
{
struct report_errors_reminder
{
bool called_report_errors_function;
report_errors_reminder() : called_report_errors_function(false) {}
~report_errors_reminder()
{
BOOST_ASSERT(called_report_errors_function); // verify report_errors() was called
}
};
inline report_errors_reminder& report_errors_remind()
{
static report_errors_reminder r;
return r;
}
inline int & test_errors()
{
static int x = 0;
report_errors_remind();
return x;
}
inline void test_failed_impl(char const * expr, char const * file, int line, char const * function)
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr << "' failed in function '"
<< function << "'" << std::endl;
++test_errors();
}
inline void error_impl(char const * msg, char const * file, int line, char const * function)
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): " << msg << " in function '"
<< function << "'" << std::endl;
++test_errors();
}
inline void throw_failed_impl(char const * excep, char const * file, int line, char const * function)
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): Exception '" << excep << "' not thrown in function '"
<< function << "'" << std::endl;
++test_errors();
}
// In the comparisons below, it is possible that T and U are signed and unsigned integer types, which generates warnings in some compilers.
// A cleaner fix would require common_type trait or some meta-programming, which would introduce a dependency on Boost.TypeTraits. To avoid
// the dependency we just disable the warnings.
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable: 4389)
#elif defined(__clang__) && defined(__has_warning)
# if __has_warning("-Wsign-compare")
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wsign-compare"
# endif
#elif defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wsign-compare"
#endif
// specialize test output for char pointers to avoid printing as cstring
template <class T> inline const T& test_output_impl(const T& v) { return v; }
inline const void* test_output_impl(const char* v) { return v; }
inline const void* test_output_impl(const unsigned char* v) { return v; }
inline const void* test_output_impl(const signed char* v) { return v; }
inline const void* test_output_impl(char* v) { return v; }
inline const void* test_output_impl(unsigned char* v) { return v; }
inline const void* test_output_impl(signed char* v) { return v; }
template<class T> inline const void* test_output_impl(T volatile* v) { return const_cast<T*>(v); }
#if !defined( BOOST_NO_CXX11_NULLPTR )
inline const void* test_output_impl(std::nullptr_t v) { return v; }
#endif
template<class T, class U> inline void test_eq_impl( char const * expr1, char const * expr2,
char const * file, int line, char const * function, T const & t, U const & u )
{
if( t == u )
{
report_errors_remind();
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr1 << " == " << expr2
<< "' failed in function '" << function << "': "
<< "'" << test_output_impl(t) << "' != '" << test_output_impl(u) << "'" << std::endl;
++test_errors();
}
}
template<class T, class U> inline void test_ne_impl( char const * expr1, char const * expr2,
char const * file, int line, char const * function, T const & t, U const & u )
{
if( t != u )
{
report_errors_remind();
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr1 << " != " << expr2
<< "' failed in function '" << function << "': "
<< "'" << test_output_impl(t) << "' == '" << test_output_impl(u) << "'" << std::endl;
++test_errors();
}
}
template<class T, class U> inline void test_lt_impl( char const * expr1, char const * expr2,
char const * file, int line, char const * function, T const & t, U const & u )
{
if( t < u )
{
report_errors_remind();
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr1 << " < " << expr2
<< "' failed in function '" << function << "': "
<< "'" << test_output_impl(t) << "' >= '" << test_output_impl(u) << "'" << std::endl;
++test_errors();
}
}
template<class T, class U> inline void test_le_impl( char const * expr1, char const * expr2,
char const * file, int line, char const * function, T const & t, U const & u )
{
if( t <= u )
{
report_errors_remind();
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr1 << " <= " << expr2
<< "' failed in function '" << function << "': "
<< "'" << test_output_impl(t) << "' > '" << test_output_impl(u) << "'" << std::endl;
++test_errors();
}
}
template<class T, class U> inline void test_gt_impl( char const * expr1, char const * expr2,
char const * file, int line, char const * function, T const & t, U const & u )
{
if( t > u )
{
report_errors_remind();
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr1 << " > " << expr2
<< "' failed in function '" << function << "': "
<< "'" << test_output_impl(t) << "' <= '" << test_output_impl(u) << "'" << std::endl;
++test_errors();
}
}
template<class T, class U> inline void test_ge_impl( char const * expr1, char const * expr2,
char const * file, int line, char const * function, T const & t, U const & u )
{
if( t >= u )
{
report_errors_remind();
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr1 << " >= " << expr2
<< "' failed in function '" << function << "': "
<< "'" << test_output_impl(t) << "' < '" << test_output_impl(u) << "'" << std::endl;
++test_errors();
}
}
inline void test_cstr_eq_impl( char const * expr1, char const * expr2,
char const * file, int line, char const * function, char const * const t, char const * const u )
{
if( std::strcmp(t, u) == 0 )
{
report_errors_remind();
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr1 << " == " << expr2
<< "' failed in function '" << function << "': "
<< "'" << t << "' != '" << u << "'" << std::endl;
++test_errors();
}
}
inline void test_cstr_ne_impl( char const * expr1, char const * expr2,
char const * file, int line, char const * function, char const * const t, char const * const u )
{
if( std::strcmp(t, u) != 0 )
{
report_errors_remind();
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): test '" << expr1 << " == " << expr2
<< "' failed in function '" << function << "': "
<< "'" << t << "' == '" << u << "'" << std::endl;
++test_errors();
}
}
template<class FormattedOutputFunction, class InputIterator1, class InputIterator2>
void test_all_eq_impl(FormattedOutputFunction& output,
char const * file, int line, char const * function,
InputIterator1 first_begin, InputIterator1 first_end,
InputIterator2 second_begin, InputIterator2 second_end)
{
InputIterator1 first_it = first_begin;
InputIterator2 second_it = second_begin;
typename std::iterator_traits<InputIterator1>::difference_type first_index = 0;
typename std::iterator_traits<InputIterator2>::difference_type second_index = 0;
std::size_t error_count = 0;
const std::size_t max_count = 8;
do
{
while ((first_it != first_end) && (second_it != second_end) && (*first_it == *second_it))
{
++first_it;
++second_it;
++first_index;
++second_index;
}
if ((first_it == first_end) || (second_it == second_end))
{
break; // do-while
}
if (error_count == 0)
{
output << file << "(" << line << "): Container contents differ in function '" << function << "':";
}
else if (error_count >= max_count)
{
output << " ...";
break;
}
output << " [" << first_index << "] '" << test_output_impl(*first_it) << "' != '" << test_output_impl(*second_it) << "'";
++first_it;
++second_it;
++first_index;
++second_index;
++error_count;
} while (first_it != first_end);
first_index += std::distance(first_it, first_end);
second_index += std::distance(second_it, second_end);
if (first_index != second_index)
{
if (error_count == 0)
{
output << file << "(" << line << "): Container sizes differ in function '" << function << "': size(" << first_index << ") != size(" << second_index << ")";
}
else
{
output << " [*] size(" << first_index << ") != size(" << second_index << ")";
}
++error_count;
}
if (error_count == 0)
{
boost::detail::report_errors_remind();
}
else
{
output << std::endl;
++boost::detail::test_errors();
}
}
template<class FormattedOutputFunction, class InputIterator1, class InputIterator2, typename BinaryPredicate>
void test_all_with_impl(FormattedOutputFunction& output,
char const * file, int line, char const * function,
InputIterator1 first_begin, InputIterator1 first_end,
InputIterator2 second_begin, InputIterator2 second_end,
BinaryPredicate predicate)
{
InputIterator1 first_it = first_begin;
InputIterator2 second_it = second_begin;
typename std::iterator_traits<InputIterator1>::difference_type first_index = 0;
typename std::iterator_traits<InputIterator2>::difference_type second_index = 0;
std::size_t error_count = 0;
const std::size_t max_count = 8;
do
{
while ((first_it != first_end) && (second_it != second_end) && predicate(*first_it, *second_it))
{
++first_it;
++second_it;
++first_index;
++second_index;
}
if ((first_it == first_end) || (second_it == second_end))
{
break; // do-while
}
if (error_count == 0)
{
output << file << "(" << line << "): Container contents differ in function '" << function << "':";
}
else if (error_count >= max_count)
{
output << " ...";
break;
}
output << " [" << first_index << "]";
++first_it;
++second_it;
++first_index;
++second_index;
++error_count;
} while (first_it != first_end);
first_index += std::distance(first_it, first_end);
second_index += std::distance(second_it, second_end);
if (first_index != second_index)
{
if (error_count == 0)
{
output << file << "(" << line << "): Container sizes differ in function '" << function << "': size(" << first_index << ") != size(" << second_index << ")";
}
else
{
output << " [*] size(" << first_index << ") != size(" << second_index << ")";
}
++error_count;
}
if (error_count == 0)
{
report_errors_remind();
}
else
{
output << std::endl;
++test_errors();
}
}
#if defined(_MSC_VER)
# pragma warning(pop)
#elif defined(__clang__) && defined(__has_warning)
# if __has_warning("-Wsign-compare")
# pragma clang diagnostic pop
# endif
#elif defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
# pragma GCC diagnostic pop
#endif
} // namespace detail
inline int report_errors()
{
boost::detail::report_errors_remind().called_report_errors_function = true;
int errors = boost::detail::test_errors();
if( errors == 0 )
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< "No errors detected." << std::endl;
return 0;
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< errors << " error" << (errors == 1? "": "s") << " detected." << std::endl;
return 1;
}
}
} // namespace boost
#define BOOST_TEST(expr) ((expr)? (void)0: ::boost::detail::test_failed_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION))
#define BOOST_TEST_NOT(expr) BOOST_TEST(!(expr))
#define BOOST_ERROR(msg) ( ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) )
#define BOOST_TEST_EQ(expr1,expr2) ( ::boost::detail::test_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_NE(expr1,expr2) ( ::boost::detail::test_ne_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_LT(expr1,expr2) ( ::boost::detail::test_lt_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_LE(expr1,expr2) ( ::boost::detail::test_le_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_GT(expr1,expr2) ( ::boost::detail::test_gt_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_GE(expr1,expr2) ( ::boost::detail::test_ge_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_CSTR_EQ(expr1,expr2) ( ::boost::detail::test_cstr_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_CSTR_NE(expr1,expr2) ( ::boost::detail::test_cstr_ne_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
#define BOOST_TEST_ALL_EQ(begin1, end1, begin2, end2) ( ::boost::detail::test_all_eq_impl(BOOST_LIGHTWEIGHT_TEST_OSTREAM, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, begin1, end1, begin2, end2) )
#define BOOST_TEST_ALL_WITH(begin1, end1, begin2, end2, predicate) ( ::boost::detail::test_all_with_impl(BOOST_LIGHTWEIGHT_TEST_OSTREAM, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, begin1, end1, begin2, end2, predicate) )
#ifndef BOOST_NO_EXCEPTIONS
#define BOOST_TEST_THROWS( EXPR, EXCEP ) \
try { \
EXPR; \
::boost::detail::throw_failed_impl \
(#EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \
} \
catch(EXCEP const&) { \
} \
catch(...) { \
::boost::detail::throw_failed_impl \
(#EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \
} \
//
#else
#define BOOST_TEST_THROWS( EXPR, EXCEP )
#endif
#endif // #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_HPP

View File

@ -0,0 +1,56 @@
#ifndef BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_HPP
#define BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
// boost/core/lightweight_test_trait.hpp
//
// BOOST_TEST_TRAIT_TRUE, BOOST_TEST_TRAIT_FALSE
//
// Copyright 2014 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
#include <boost/core/lightweight_test.hpp>
#include <boost/core/typeinfo.hpp>
namespace boost
{
namespace detail
{
template< class T > inline void test_trait_impl( char const * trait, void (*)( T ),
bool expected, char const * file, int line, char const * function )
{
if( T::value == expected )
{
report_errors_remind();
}
else
{
BOOST_LIGHTWEIGHT_TEST_OSTREAM
<< file << "(" << line << "): predicate '" << trait << "' ["
<< boost::core::demangled_name( BOOST_CORE_TYPEID(T) ) << "]"
<< " test failed in function '" << function
<< "' (should have been " << ( expected? "true": "false" ) << ")"
<< std::endl;
++test_errors();
}
}
} // namespace detail
} // namespace boost
#define BOOST_TEST_TRAIT_TRUE(type) ( ::boost::detail::test_trait_impl(#type, (void(*)type)0, true, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) )
#define BOOST_TEST_TRAIT_FALSE(type) ( ::boost::detail::test_trait_impl(#type, (void(*)type)0, false, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) )
#endif // #ifndef BOOST_CORE_LIGHTWEIGHT_TEST_TRAIT_HPP

View File

@ -0,0 +1,44 @@
#ifndef BOOST_CORE_NO_EXCEPTIONS_SUPPORT_HPP
#define BOOST_CORE_NO_EXCEPTIONS_SUPPORT_HPP
#if defined(_MSC_VER)
# pragma once
#endif
//----------------------------------------------------------------------
// (C) Copyright 2004 Pavel Vozenilek.
// 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)
//
//
// This file contains helper macros used when exception support may be
// disabled (as indicated by macro BOOST_NO_EXCEPTIONS).
//
// Before picking up these macros you may consider using RAII techniques
// to deal with exceptions - their syntax can be always the same with
// or without exception support enabled.
//----------------------------------------------------------------------
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#if !(defined BOOST_NO_EXCEPTIONS)
# define BOOST_TRY { try
# define BOOST_CATCH(x) catch(x)
# define BOOST_RETHROW throw;
# define BOOST_CATCH_END }
#else
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
# define BOOST_TRY { if ("")
# define BOOST_CATCH(x) else if (!"")
# else
# define BOOST_TRY { if (true)
# define BOOST_CATCH(x) else if (false)
# endif
# define BOOST_RETHROW
# define BOOST_CATCH_END }
#endif
#endif

View File

@ -0,0 +1,48 @@
// Boost noncopyable.hpp header file --------------------------------------//
// (C) Copyright Beman Dawes 1999-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/libs/utility for documentation.
#ifndef BOOST_CORE_NONCOPYABLE_HPP
#define BOOST_CORE_NONCOPYABLE_HPP
#include <boost/config.hpp>
namespace boost {
// Private copy constructor and copy assignment ensure classes derived from
// class noncopyable cannot be copied.
// Contributed by Dave Abrahams
namespace noncopyable_ // protection from unintended ADL
{
class noncopyable
{
protected:
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) && !defined(BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS)
BOOST_CONSTEXPR noncopyable() = default;
~noncopyable() = default;
#else
noncopyable() {}
~noncopyable() {}
#endif
#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
noncopyable( const noncopyable& ) = delete;
noncopyable& operator=( const noncopyable& ) = delete;
#else
private: // emphasize the following members are private
noncopyable( const noncopyable& );
noncopyable& operator=( const noncopyable& );
#endif
};
}
typedef noncopyable_::noncopyable noncopyable;
} // namespace boost
#endif // BOOST_CORE_NONCOPYABLE_HPP

View File

@ -0,0 +1,44 @@
/*
* Copyright Andrey Semashev 2007 - 2014.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
/*!
* \file null_deleter.hpp
* \author Andrey Semashev
* \date 22.04.2007
*
* This header contains a \c null_deleter implementation. This is an empty
* function object that receives a pointer and does nothing with it.
* Such empty deletion strategy may be convenient, for example, when
* constructing <tt>shared_ptr</tt>s that point to some object that should not be
* deleted (i.e. a variable on the stack or some global singleton, like <tt>std::cout</tt>).
*/
#ifndef BOOST_CORE_NULL_DELETER_HPP
#define BOOST_CORE_NULL_DELETER_HPP
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
namespace boost {
//! A function object that does nothing and can be used as an empty deleter for \c shared_ptr
struct null_deleter
{
//! Function object result type
typedef void result_type;
/*!
* Does nothing
*/
template< typename T >
void operator() (T*) const BOOST_NOEXCEPT {}
};
} // namespace boost
#endif // BOOST_CORE_NULL_DELETER_HPP

View File

@ -0,0 +1,258 @@
/*
Copyright 2017 Glen Joseph Fernandes
(glenjofe@gmail.com)
Distributed under the Boost Software License, Version 1.0.
(http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_CORE_POINTER_TRAITS_HPP
#define BOOST_CORE_POINTER_TRAITS_HPP
#include <boost/config.hpp>
#if !defined(BOOST_NO_CXX11_POINTER_TRAITS)
#include <memory>
#else
#include <boost/core/addressof.hpp>
#endif
namespace boost {
template<class T>
struct pointer_traits;
namespace detail {
template<class U>
inline typename boost::pointer_traits<U>::element_type*
ptr_traits_address(const U& v) BOOST_NOEXCEPT
{
return boost::pointer_traits<U>::to_address(v);
}
} /* detail */
#if !defined(BOOST_NO_CXX11_POINTER_TRAITS)
template<class T>
struct pointer_traits
: std::pointer_traits<T> {
template<class U>
struct rebind_to {
typedef typename std::pointer_traits<T>::template rebind<U> type;
};
static typename std::pointer_traits<T>::element_type*
to_address(const T& v) BOOST_NOEXCEPT {
return detail::ptr_traits_address(v.operator->());
}
};
template<class T>
struct pointer_traits<T*>
: std::pointer_traits<T*> {
template<class U>
struct rebind_to {
typedef U* type;
};
static T* to_address(T* v) BOOST_NOEXCEPT {
return v;
}
};
#else
namespace detail {
struct ptr_traits_none { char first, second; };
template<class T>
struct ptr_traits_has_element {
private:
template<class U>
static ptr_traits_none call(...);
template<class U>
static char call(typename U::element_type* = 0);
public:
static const bool value = sizeof(call<T>(0)) == 1;
};
template<class T>
struct ptr_traits_first;
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<template<class, class...> class T, class U, class... Args>
struct ptr_traits_first<T<U, Args...> > {
typedef U type;
};
#else
template<template<class> class T, class U>
struct ptr_traits_first<T<U> > {
typedef U type;
};
template<template<class, class> class T, class U1, class U2>
struct ptr_traits_first<T<U1, U2> > {
typedef U1 type;
};
template<template<class, class, class> class T, class U1, class U2, class U3>
struct ptr_traits_first<T<U1, U2, U3> > {
typedef U1 type;
};
#endif
template<class T, bool = ptr_traits_has_element<T>::value>
struct ptr_traits_element {
typedef typename T::element_type type;
};
template<class T>
struct ptr_traits_element<T, false> {
typedef typename ptr_traits_first<T>::type type;
};
template<class T>
struct ptr_traits_has_difference {
private:
template<class U>
static ptr_traits_none call(...);
template<class U>
static char call(typename U::difference_type* = 0);
public:
static const bool value = sizeof(call<T>(0)) == 1;
};
template<class T, bool = ptr_traits_has_difference<T>::value>
struct ptr_traits_difference {
typedef typename T::difference_type type;
};
template<class T>
struct ptr_traits_difference<T, false> {
typedef std::ptrdiff_t type;
};
template<class T, class V>
struct ptr_traits_has_rebind {
private:
template<class U>
static ptr_traits_none call(...);
template<class U>
static char call(typename U::template rebind<V>* = 0);
public:
static const bool value = sizeof(call<T>(0)) == 1;
};
template<class T, class V>
struct ptr_traits_rebind_to;
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<template<class, class...> class T, class U, class... Args, class V>
struct ptr_traits_rebind_to<T<U, Args...>, V> {
typedef T<V, Args...> type;
};
#else
template<template<class> class T, class U, class V>
struct ptr_traits_rebind_to<T<U>, V> {
typedef T<V> type;
};
template<template<class, class> class T, class U1, class U2, class V>
struct ptr_traits_rebind_to<T<U1, U2>, V> {
typedef T<V, U2> type;
};
template<template<class, class, class> class T,
class U1, class U2, class U3, class V>
struct ptr_traits_rebind_to<T<U1, U2, U3>, V> {
typedef T<V, U2, U3> type;
};
#endif
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template<class T, class U, bool = ptr_traits_has_rebind<T, U>::value>
struct ptr_traits_rebind {
typedef typename T::template rebind<U> type;
};
template<class T, class U>
struct ptr_traits_rebind<T, U, false> {
typedef typename ptr_traits_rebind_to<T, U>::type type;
};
#else
template<class T, class U>
struct ptr_traits_rebind {
typedef typename ptr_traits_rebind_to<T, U>::type type;
};
#endif
template<class T>
struct ptr_traits_value {
typedef T type;
};
template<>
struct ptr_traits_value<void> {
typedef struct { } type;
};
} /* detail */
template<class T>
struct pointer_traits {
typedef T pointer;
typedef typename detail::ptr_traits_element<T>::type element_type;
typedef typename detail::ptr_traits_difference<T>::type difference_type;
template<class U>
struct rebind_to {
typedef typename detail::ptr_traits_rebind<T, U>::type type;
};
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template<class U>
using rebind = typename detail::ptr_traits_rebind<T, U>::type;
#endif
static pointer
pointer_to(typename detail::ptr_traits_value<element_type>::type& v) {
return pointer::pointer_to(v);
}
static element_type* to_address(const pointer& v) BOOST_NOEXCEPT {
return detail::ptr_traits_address(v.operator->());
}
};
template<class T>
struct pointer_traits<T*> {
typedef T* pointer;
typedef T element_type;
typedef std::ptrdiff_t difference_type;
template<class U>
struct rebind_to {
typedef U* type;
};
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template<class U>
using rebind = U*;
#endif
static T*
pointer_to(typename detail::ptr_traits_value<T>::type& v) BOOST_NOEXCEPT {
return addressof(v);
}
static T* to_address(T* v) BOOST_NOEXCEPT {
return v;
}
};
#endif
template<class T>
inline typename pointer_traits<T>::element_type*
to_address(const T& v) BOOST_NOEXCEPT
{
return pointer_traits<T>::to_address(v);
}
template<class T>
inline T*
to_address(T* v) BOOST_NOEXCEPT
{
return v;
}
} /* boost */
#endif

View File

@ -0,0 +1,301 @@
#ifndef BOOST_CORE_REF_HPP
#define BOOST_CORE_REF_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#include <boost/core/addressof.hpp>
//
// ref.hpp - ref/cref, useful helper functions
//
// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
// Copyright (C) 2001, 2002 Peter Dimov
// Copyright (C) 2002 David Abrahams
//
// Copyright (C) 2014 Glen Joseph Fernandes
// glenfe at live dot com
// Copyright (C) 2014 Agustin Berge
//
// 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/core/doc/html/core/ref.html for documentation.
//
/**
@file
*/
/**
Boost namespace.
*/
namespace boost
{
#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1600 )
struct ref_workaround_tag {};
#endif
// reference_wrapper
/**
@brief Contains a reference to an object of type `T`.
`reference_wrapper` is primarily used to "feed" references to
function templates (algorithms) that take their parameter by
value. It provides an implicit conversion to `T&`, which
usually allows the function templates to work on references
unmodified.
*/
template<class T> class reference_wrapper
{
public:
/**
Type `T`.
*/
typedef T type;
/**
Constructs a `reference_wrapper` object that stores a
reference to `t`.
@remark Does not throw.
*/
BOOST_FORCEINLINE explicit reference_wrapper(T& t): t_(boost::addressof(t)) {}
#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1600 )
BOOST_FORCEINLINE explicit reference_wrapper( T & t, ref_workaround_tag ): t_( boost::addressof( t ) ) {}
#endif
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
/**
@remark Construction from a temporary object is disabled.
*/
BOOST_DELETED_FUNCTION(reference_wrapper(T&& t))
public:
#endif
/**
@return The stored reference.
@remark Does not throw.
*/
BOOST_FORCEINLINE operator T& () const { return *t_; }
/**
@return The stored reference.
@remark Does not throw.
*/
BOOST_FORCEINLINE T& get() const { return *t_; }
/**
@return A pointer to the object referenced by the stored
reference.
@remark Does not throw.
*/
BOOST_FORCEINLINE T* get_pointer() const { return t_; }
private:
T* t_;
};
// ref
/**
@cond
*/
#if defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x581) )
# define BOOST_REF_CONST
#else
# define BOOST_REF_CONST const
#endif
/**
@endcond
*/
/**
@return `reference_wrapper<T>(t)`
@remark Does not throw.
*/
template<class T> BOOST_FORCEINLINE reference_wrapper<T> BOOST_REF_CONST ref( T & t )
{
#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1600 )
return reference_wrapper<T>( t, ref_workaround_tag() );
#else
return reference_wrapper<T>( t );
#endif
}
// cref
/**
@return `reference_wrapper<T const>(t)`
@remark Does not throw.
*/
template<class T> BOOST_FORCEINLINE reference_wrapper<T const> BOOST_REF_CONST cref( T const & t )
{
return reference_wrapper<T const>(t);
}
#undef BOOST_REF_CONST
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
/**
@cond
*/
#if defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
# define BOOST_REF_DELETE
#else
# define BOOST_REF_DELETE = delete
#endif
/**
@endcond
*/
/**
@remark Construction from a temporary object is disabled.
*/
template<class T> void ref(T const&&) BOOST_REF_DELETE;
/**
@remark Construction from a temporary object is disabled.
*/
template<class T> void cref(T const&&) BOOST_REF_DELETE;
#undef BOOST_REF_DELETE
#endif
// is_reference_wrapper
/**
@brief Determine if a type `T` is an instantiation of
`reference_wrapper`.
The value static constant will be true if the type `T` is a
specialization of `reference_wrapper`.
*/
template<typename T> struct is_reference_wrapper
{
BOOST_STATIC_CONSTANT( bool, value = false );
};
/**
@cond
*/
template<typename T> struct is_reference_wrapper< reference_wrapper<T> >
{
BOOST_STATIC_CONSTANT( bool, value = true );
};
#if !defined(BOOST_NO_CV_SPECIALIZATIONS)
template<typename T> struct is_reference_wrapper< reference_wrapper<T> const >
{
BOOST_STATIC_CONSTANT( bool, value = true );
};
template<typename T> struct is_reference_wrapper< reference_wrapper<T> volatile >
{
BOOST_STATIC_CONSTANT( bool, value = true );
};
template<typename T> struct is_reference_wrapper< reference_wrapper<T> const volatile >
{
BOOST_STATIC_CONSTANT( bool, value = true );
};
#endif // !defined(BOOST_NO_CV_SPECIALIZATIONS)
/**
@endcond
*/
// unwrap_reference
/**
@brief Find the type in a `reference_wrapper`.
The `typedef` type is `T::type` if `T` is a
`reference_wrapper`, `T` otherwise.
*/
template<typename T> struct unwrap_reference
{
typedef T type;
};
/**
@cond
*/
template<typename T> struct unwrap_reference< reference_wrapper<T> >
{
typedef T type;
};
#if !defined(BOOST_NO_CV_SPECIALIZATIONS)
template<typename T> struct unwrap_reference< reference_wrapper<T> const >
{
typedef T type;
};
template<typename T> struct unwrap_reference< reference_wrapper<T> volatile >
{
typedef T type;
};
template<typename T> struct unwrap_reference< reference_wrapper<T> const volatile >
{
typedef T type;
};
#endif // !defined(BOOST_NO_CV_SPECIALIZATIONS)
/**
@endcond
*/
// unwrap_ref
/**
@return `unwrap_reference<T>::type&(t)`
@remark Does not throw.
*/
template<class T> BOOST_FORCEINLINE typename unwrap_reference<T>::type& unwrap_ref( T & t )
{
return t;
}
// get_pointer
/**
@cond
*/
template<class T> BOOST_FORCEINLINE T* get_pointer( reference_wrapper<T> const & r )
{
return r.get_pointer();
}
/**
@endcond
*/
} // namespace boost
#endif // #ifndef BOOST_CORE_REF_HPP

View File

@ -0,0 +1,194 @@
// scoped_enum.hpp ---------------------------------------------------------//
// Copyright Beman Dawes, 2009
// Copyright (C) 2011-2012 Vicente J. Botet Escriba
// Copyright (C) 2012 Anthony Williams
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
#ifndef BOOST_CORE_SCOPED_ENUM_HPP
#define BOOST_CORE_SCOPED_ENUM_HPP
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
namespace boost
{
#ifdef BOOST_NO_CXX11_SCOPED_ENUMS
/**
* Meta-function to get the native enum type associated to an enum class or its emulation.
*/
template <typename EnumType>
struct native_type
{
/**
* The member typedef type names the native enum type associated to the scoped enum,
* which is it self if the compiler supports scoped enums or EnumType::enum_type if it is an emulated scoped enum.
*/
typedef typename EnumType::enum_type type;
};
/**
* Casts a scoped enum to its underlying type.
*
* This function is useful when working with scoped enum classes, which doens't implicitly convert to the underlying type.
* @param v A scoped enum.
* @returns The underlying type.
* @throws No-throws.
*/
template <typename UnderlyingType, typename EnumType>
inline
BOOST_CONSTEXPR UnderlyingType underlying_cast(EnumType v) BOOST_NOEXCEPT
{
return v.get_underlying_value_();
}
/**
* Casts a scoped enum to its native enum type.
*
* This function is useful to make programs portable when the scoped enum emulation can not be use where native enums can.
*
* EnumType the scoped enum type
*
* @param v A scoped enum.
* @returns The native enum value.
* @throws No-throws.
*/
template <typename EnumType>
inline
BOOST_CONSTEXPR typename EnumType::enum_type native_value(EnumType e) BOOST_NOEXCEPT
{
return e.get_native_value_();
}
#else // BOOST_NO_CXX11_SCOPED_ENUMS
template <typename EnumType>
struct native_type
{
typedef EnumType type;
};
template <typename UnderlyingType, typename EnumType>
inline
BOOST_CONSTEXPR UnderlyingType underlying_cast(EnumType v) BOOST_NOEXCEPT
{
return static_cast<UnderlyingType>(v);
}
template <typename EnumType>
inline
BOOST_CONSTEXPR EnumType native_value(EnumType e) BOOST_NOEXCEPT
{
return e;
}
#endif // BOOST_NO_CXX11_SCOPED_ENUMS
}
#ifdef BOOST_NO_CXX11_SCOPED_ENUMS
#ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
#define BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR \
explicit BOOST_CONSTEXPR operator underlying_type() const BOOST_NOEXCEPT { return get_underlying_value_(); }
#else
#define BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR
#endif
/**
* Start a declaration of a scoped enum.
*
* @param EnumType The new scoped enum.
* @param UnderlyingType The underlying type.
*/
#define BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(EnumType, UnderlyingType) \
struct EnumType { \
typedef void is_boost_scoped_enum_tag; \
typedef UnderlyingType underlying_type; \
EnumType() BOOST_NOEXCEPT {} \
explicit BOOST_CONSTEXPR EnumType(underlying_type v) BOOST_NOEXCEPT : v_(v) {} \
BOOST_CONSTEXPR underlying_type get_underlying_value_() const BOOST_NOEXCEPT { return v_; } \
BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR \
private: \
underlying_type v_; \
typedef EnumType self_type; \
public: \
enum enum_type
#define BOOST_SCOPED_ENUM_DECLARE_END2() \
BOOST_CONSTEXPR enum_type get_native_value_() const BOOST_NOEXCEPT { return enum_type(v_); } \
friend BOOST_CONSTEXPR bool operator ==(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==enum_type(rhs.v_); } \
friend BOOST_CONSTEXPR bool operator ==(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==rhs; } \
friend BOOST_CONSTEXPR bool operator ==(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs==enum_type(rhs.v_); } \
friend BOOST_CONSTEXPR bool operator !=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)!=enum_type(rhs.v_); } \
friend BOOST_CONSTEXPR bool operator !=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)!=rhs; } \
friend BOOST_CONSTEXPR bool operator !=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs!=enum_type(rhs.v_); } \
friend BOOST_CONSTEXPR bool operator <(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<enum_type(rhs.v_); } \
friend BOOST_CONSTEXPR bool operator <(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<rhs; } \
friend BOOST_CONSTEXPR bool operator <(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs<enum_type(rhs.v_); } \
friend BOOST_CONSTEXPR bool operator <=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<=enum_type(rhs.v_); } \
friend BOOST_CONSTEXPR bool operator <=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<=rhs; } \
friend BOOST_CONSTEXPR bool operator <=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs<=enum_type(rhs.v_); } \
friend BOOST_CONSTEXPR bool operator >(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>enum_type(rhs.v_); } \
friend BOOST_CONSTEXPR bool operator >(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>rhs; } \
friend BOOST_CONSTEXPR bool operator >(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs>enum_type(rhs.v_); } \
friend BOOST_CONSTEXPR bool operator >=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>=enum_type(rhs.v_); } \
friend BOOST_CONSTEXPR bool operator >=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>=rhs; } \
friend BOOST_CONSTEXPR bool operator >=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs>=enum_type(rhs.v_); } \
};
#define BOOST_SCOPED_ENUM_DECLARE_END(EnumType) \
; \
BOOST_CONSTEXPR EnumType(enum_type v) BOOST_NOEXCEPT : v_(v) {} \
BOOST_SCOPED_ENUM_DECLARE_END2()
/**
* Starts a declaration of a scoped enum with the default int underlying type.
*
* @param EnumType The new scoped enum.
*/
#define BOOST_SCOPED_ENUM_DECLARE_BEGIN(EnumType) \
BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(EnumType,int)
/**
* Name of the native enum type.
*
* @param EnumType The new scoped enum.
*/
#define BOOST_SCOPED_ENUM_NATIVE(EnumType) EnumType::enum_type
/**
* Forward declares an scoped enum.
*
* @param EnumType The scoped enum.
*/
#define BOOST_SCOPED_ENUM_FORWARD_DECLARE(EnumType) struct EnumType
#else // BOOST_NO_CXX11_SCOPED_ENUMS
#define BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(EnumType,UnderlyingType) enum class EnumType : UnderlyingType
#define BOOST_SCOPED_ENUM_DECLARE_BEGIN(EnumType) enum class EnumType
#define BOOST_SCOPED_ENUM_DECLARE_END2()
#define BOOST_SCOPED_ENUM_DECLARE_END(EnumType) ;
#define BOOST_SCOPED_ENUM_NATIVE(EnumType) EnumType
#define BOOST_SCOPED_ENUM_FORWARD_DECLARE(EnumType) enum class EnumType
#endif // BOOST_NO_CXX11_SCOPED_ENUMS
// Deprecated macros
#define BOOST_SCOPED_ENUM_START(name) BOOST_SCOPED_ENUM_DECLARE_BEGIN(name)
#define BOOST_SCOPED_ENUM_END BOOST_SCOPED_ENUM_DECLARE_END2()
#define BOOST_SCOPED_ENUM(name) BOOST_SCOPED_ENUM_NATIVE(name)
#endif // BOOST_CORE_SCOPED_ENUM_HPP

View File

@ -0,0 +1,60 @@
// Copyright (C) 2007, 2008 Steven Watanabe, Joseph Gauterin, Niels Dekker
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// For more information, see http://www.boost.org
#ifndef BOOST_CORE_SWAP_HPP
#define BOOST_CORE_SWAP_HPP
// Note: the implementation of this utility contains various workarounds:
// - swap_impl is put outside the boost namespace, to avoid infinite
// recursion (causing stack overflow) when swapping objects of a primitive
// type.
// - swap_impl has a using-directive, rather than a using-declaration,
// because some compilers (including MSVC 7.1, Borland 5.9.3, and
// Intel 8.1) don't do argument-dependent lookup when it has a
// using-declaration instead.
// - boost::swap has two template arguments, instead of one, to
// avoid ambiguity when swapping objects of a Boost type that does
// not have its own boost::swap overload.
#include <utility> //for std::swap (C++11)
#include <algorithm> //for std::swap (C++98)
#include <cstddef> //for std::size_t
#include <boost/config.hpp>
namespace boost_swap_impl
{
template<class T>
BOOST_GPU_ENABLED
void swap_impl(T& left, T& right)
{
using namespace std;//use std::swap if argument dependent lookup fails
swap(left,right);
}
template<class T, std::size_t N>
BOOST_GPU_ENABLED
void swap_impl(T (& left)[N], T (& right)[N])
{
for (std::size_t i = 0; i < N; ++i)
{
::boost_swap_impl::swap_impl(left[i], right[i]);
}
}
}
namespace boost
{
template<class T1, class T2>
BOOST_GPU_ENABLED
void swap(T1& left, T2& right)
{
::boost_swap_impl::swap_impl(left, right);
}
}
#endif

View File

@ -0,0 +1,151 @@
#ifndef BOOST_CORE_TYPEINFO_HPP_INCLUDED
#define BOOST_CORE_TYPEINFO_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
// core::typeinfo, BOOST_CORE_TYPEID
//
// Copyright 2007, 2014 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)
#include <boost/config.hpp>
#if defined( BOOST_NO_TYPEID )
#include <boost/current_function.hpp>
#include <functional>
namespace boost
{
namespace core
{
class typeinfo
{
private:
typeinfo( typeinfo const& );
typeinfo& operator=( typeinfo const& );
char const * name_;
public:
explicit typeinfo( char const * name ): name_( name )
{
}
bool operator==( typeinfo const& rhs ) const
{
return this == &rhs;
}
bool operator!=( typeinfo const& rhs ) const
{
return this != &rhs;
}
bool before( typeinfo const& rhs ) const
{
return std::less< typeinfo const* >()( this, &rhs );
}
char const* name() const
{
return name_;
}
};
inline char const * demangled_name( core::typeinfo const & ti )
{
return ti.name();
}
} // namespace core
namespace detail
{
template<class T> struct core_typeid_
{
static boost::core::typeinfo ti_;
static char const * name()
{
return BOOST_CURRENT_FUNCTION;
}
};
#if defined(__SUNPRO_CC)
// see #4199, the Sun Studio compiler gets confused about static initialization
// constructor arguments. But an assignment works just fine.
template<class T> boost::core::typeinfo core_typeid_< T >::ti_ = core_typeid_< T >::name();
#else
template<class T> boost::core::typeinfo core_typeid_< T >::ti_(core_typeid_< T >::name());
#endif
template<class T> struct core_typeid_< T & >: core_typeid_< T >
{
};
template<class T> struct core_typeid_< T const >: core_typeid_< T >
{
};
template<class T> struct core_typeid_< T volatile >: core_typeid_< T >
{
};
template<class T> struct core_typeid_< T const volatile >: core_typeid_< T >
{
};
} // namespace detail
} // namespace boost
#define BOOST_CORE_TYPEID(T) (boost::detail::core_typeid_<T>::ti_)
#else
#include <boost/core/demangle.hpp>
#include <typeinfo>
namespace boost
{
namespace core
{
#if defined( BOOST_NO_STD_TYPEINFO )
typedef ::type_info typeinfo;
#else
typedef std::type_info typeinfo;
#endif
inline std::string demangled_name( core::typeinfo const & ti )
{
return core::demangle( ti.name() );
}
} // namespace core
} // namespace boost
#define BOOST_CORE_TYPEID(T) typeid(T)
#endif
#endif // #ifndef BOOST_CORE_TYPEINFO_HPP_INCLUDED

View File

@ -0,0 +1,79 @@
// underlying_type.hpp ---------------------------------------------------------//
// Copyright Beman Dawes, 2009
// Copyright (C) 2011-2012 Vicente J. Botet Escriba
// Copyright (C) 2012 Anthony Williams
// Copyright (C) 2014 Andrey Semashev
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
#ifndef BOOST_CORE_UNDERLYING_TYPE_HPP
#define BOOST_CORE_UNDERLYING_TYPE_HPP
#include <boost/config.hpp>
// GCC 4.7 and later seem to provide std::underlying_type
#if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) || (defined(BOOST_GCC) && BOOST_GCC >= 40700 && defined(__GXX_EXPERIMENTAL_CXX0X__))
#include <type_traits>
#define BOOST_DETAIL_HAS_STD_UNDERLYING_TYPE
#endif
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
namespace boost {
namespace detail {
template< typename EnumType, typename Void = void >
struct underlying_type_impl;
#if defined(BOOST_NO_CXX11_SCOPED_ENUMS)
// Support for boost/core/scoped_enum.hpp
template< typename EnumType >
struct underlying_type_impl< EnumType, typename EnumType::is_boost_scoped_enum_tag >
{
/**
* The member typedef type names the underlying type of EnumType. It is EnumType::underlying_type when the EnumType is an emulated scoped enum,
*/
typedef typename EnumType::underlying_type type;
};
#endif
#if defined(BOOST_DETAIL_HAS_STD_UNDERLYING_TYPE)
template< typename EnumType, typename Void >
struct underlying_type_impl
{
typedef typename std::underlying_type< EnumType >::type type;
};
#endif
} // namespace detail
#if !defined(BOOST_NO_CXX11_SCOPED_ENUMS) && !defined(BOOST_DETAIL_HAS_STD_UNDERLYING_TYPE)
#define BOOST_NO_UNDERLYING_TYPE
#endif
/**
* Meta-function to get the underlying type of a scoped enum.
*
* Requires EnumType must be an enum type or the emulation of a scoped enum.
* If BOOST_NO_UNDERLYING_TYPE is defined, the implementation will not be able
* to deduce the underlying type of enums. The user is expected to specialize
* this trait in this case.
*/
template< typename EnumType >
struct underlying_type :
public detail::underlying_type_impl< EnumType >
{
};
} // namespace boost
#endif // BOOST_CORE_UNDERLYING_TYPE_HPP