update boost
This commit is contained in:
61
linx64/include/boost/move/detail/addressof.hpp
Normal file
61
linx64/include/boost/move/detail/addressof.hpp
Normal file
@@ -0,0 +1,61 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2014-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)
|
||||
//
|
||||
// See http://www.boost.org/libs/container for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef BOOST_MOVE_DETAIL_ADDRESSOF_HPP
|
||||
#define BOOST_MOVE_DETAIL_ADDRESSOF_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/move/detail/workaround.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace move_detail {
|
||||
|
||||
#if defined(BOOST_MSVC_FULL_VER) && BOOST_MSVC_FULL_VER >= 190024215
|
||||
#define BOOST_MOVE_HAS_BUILTIN_ADDRESSOF
|
||||
#elif defined(BOOST_GCC) && BOOST_GCC >= 70000
|
||||
#define BOOST_MOVE_HAS_BUILTIN_ADDRESSOF
|
||||
#elif defined(__has_builtin)
|
||||
#if __has_builtin(__builtin_addressof)
|
||||
#define BOOST_MOVE_HAS_BUILTIN_ADDRESSOF
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MOVE_HAS_BUILTIN_ADDRESSOF
|
||||
|
||||
template<class T>
|
||||
BOOST_MOVE_FORCEINLINE T *addressof( T & v ) BOOST_NOEXCEPT
|
||||
{
|
||||
return __builtin_addressof(v);
|
||||
}
|
||||
|
||||
#else //BOOST_MOVE_HAS_BUILTIN_ADDRESSOF
|
||||
|
||||
template <typename T>
|
||||
BOOST_MOVE_FORCEINLINE T* addressof(T& obj)
|
||||
{
|
||||
return static_cast<T*>(
|
||||
static_cast<void*>(
|
||||
const_cast<char*>(
|
||||
&reinterpret_cast<const volatile char&>(obj)
|
||||
)));
|
||||
}
|
||||
|
||||
#endif //BOOST_MOVE_HAS_BUILTIN_ADDRESSOF
|
||||
|
||||
} //namespace move_detail {
|
||||
} //namespace boost {
|
||||
|
||||
#endif //#ifndef BOOST_MOVE_DETAIL_ADDRESSOF_HPP
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning (push)
|
||||
# pragma warning (disable : 4619) // there is no warning number 'XXXX'
|
||||
# pragma warning (disable : 4324) // structure was padded due to __declspec(align())
|
||||
# pragma warning (disable : 4675) // "function": resolved overload was found by argument-dependent lookup
|
||||
# pragma warning (disable : 4996) // "function": was declared deprecated (_CRT_SECURE_NO_DEPRECATE/_SCL_SECURE_NO_WARNINGS)
|
||||
|
||||
36
linx64/include/boost/move/detail/force_ptr.hpp
Normal file
36
linx64/include/boost/move/detail/force_ptr.hpp
Normal file
@@ -0,0 +1,36 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2014-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)
|
||||
//
|
||||
// See http://www.boost.org/libs/container for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef BOOST_MOVE_DETAIL_FORCE_CAST_HPP
|
||||
#define BOOST_MOVE_DETAIL_FORCE_CAST_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/move/detail/workaround.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace move_detail {
|
||||
|
||||
|
||||
template <typename T>
|
||||
BOOST_MOVE_FORCEINLINE T force_ptr(const volatile void *p)
|
||||
{
|
||||
return static_cast<T>(const_cast<void*>(p));
|
||||
}
|
||||
|
||||
} //namespace move_detail {
|
||||
} //namespace boost {
|
||||
|
||||
#endif //#ifndef BOOST_MOVE_DETAIL_FORCE_CAST_HPP
|
||||
@@ -336,6 +336,18 @@ namespace move_detail {
|
||||
#define BOOST_MOVE_VAL_INITQ8 BOOST_MOVE_VAL_INITQ7, m_q7(q7)
|
||||
#define BOOST_MOVE_VAL_INITQ9 BOOST_MOVE_VAL_INITQ8, m_q8(q8)
|
||||
|
||||
//BOOST_MOVE_UREFANONN
|
||||
#define BOOST_MOVE_UREFANON0
|
||||
#define BOOST_MOVE_UREFANON1 BOOST_FWD_REF(P0)
|
||||
#define BOOST_MOVE_UREFANON2 BOOST_MOVE_UREFANON1, BOOST_FWD_REF(P1)
|
||||
#define BOOST_MOVE_UREFANON3 BOOST_MOVE_UREFANON2, BOOST_FWD_REF(P2)
|
||||
#define BOOST_MOVE_UREFANON4 BOOST_MOVE_UREFANON3, BOOST_FWD_REF(P3)
|
||||
#define BOOST_MOVE_UREFANON5 BOOST_MOVE_UREFANON4, BOOST_FWD_REF(P4)
|
||||
#define BOOST_MOVE_UREFANON6 BOOST_MOVE_UREFANON5, BOOST_FWD_REF(P5)
|
||||
#define BOOST_MOVE_UREFANON7 BOOST_MOVE_UREFANON6, BOOST_FWD_REF(P6)
|
||||
#define BOOST_MOVE_UREFANON8 BOOST_MOVE_UREFANON7, BOOST_FWD_REF(P7)
|
||||
#define BOOST_MOVE_UREFANON9 BOOST_MOVE_UREFANON8, BOOST_FWD_REF(P8)
|
||||
|
||||
//BOOST_MOVE_UREFN
|
||||
#define BOOST_MOVE_UREF0
|
||||
#define BOOST_MOVE_UREF1 BOOST_FWD_REF(P0) p0
|
||||
|
||||
@@ -27,11 +27,11 @@ namespace movelib {
|
||||
namespace detail {
|
||||
|
||||
template <class T>
|
||||
inline T* iterator_to_pointer(T* i)
|
||||
BOOST_MOVE_FORCEINLINE T* iterator_to_pointer(T* i)
|
||||
{ return i; }
|
||||
|
||||
template <class Iterator>
|
||||
inline typename boost::movelib::iterator_traits<Iterator>::pointer
|
||||
BOOST_MOVE_FORCEINLINE typename boost::movelib::iterator_traits<Iterator>::pointer
|
||||
iterator_to_pointer(const Iterator &i)
|
||||
{ return i.operator->(); }
|
||||
|
||||
@@ -46,7 +46,7 @@ struct iterator_to_element_ptr
|
||||
} //namespace detail {
|
||||
|
||||
template <class Iterator>
|
||||
inline typename boost::movelib::detail::iterator_to_element_ptr<Iterator>::type
|
||||
BOOST_MOVE_FORCEINLINE typename boost::movelib::detail::iterator_to_element_ptr<Iterator>::type
|
||||
iterator_to_raw_pointer(const Iterator &i)
|
||||
{
|
||||
return ::boost::movelib::to_raw_pointer
|
||||
|
||||
@@ -22,10 +22,44 @@
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#if (BOOST_CXX_VERSION > 201703L) && defined(__cpp_lib_concepts)
|
||||
|
||||
#include <iterator>
|
||||
|
||||
#define BOOST_MOVE_CONTIGUOUS_ITERATOR_TAG
|
||||
|
||||
namespace boost {
|
||||
namespace movelib {
|
||||
|
||||
using std::iterator_traits;
|
||||
|
||||
template<class T>
|
||||
struct iter_difference
|
||||
{
|
||||
typedef typename std::iterator_traits<T>::difference_type type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct iter_value
|
||||
{
|
||||
typedef typename std::iterator_traits<T>::value_type type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct iter_category
|
||||
{
|
||||
typedef typename std::iterator_traits<T>::iterator_category type;
|
||||
};
|
||||
|
||||
}} //namespace boost::movelib
|
||||
|
||||
#else
|
||||
|
||||
#include <cstddef>
|
||||
#include <boost/move/detail/type_traits.hpp>
|
||||
|
||||
#include <boost/move/detail/std_ns_begin.hpp>
|
||||
|
||||
BOOST_MOVE_STD_NS_BEG
|
||||
|
||||
struct input_iterator_tag;
|
||||
@@ -34,20 +68,73 @@ struct bidirectional_iterator_tag;
|
||||
struct random_access_iterator_tag;
|
||||
struct output_iterator_tag;
|
||||
|
||||
#if ( (defined(BOOST_GNU_STDLIB) && (__cplusplus > 201703L))\
|
||||
|| (defined(_LIBCPP_VERSION) && (_LIBCPP_STD_VER > 17))\
|
||||
|| (defined(_YVALS) && defined(_CPPLIB_VER) && defined(__cpp_lib_concepts))\
|
||||
|| (__cplusplus >= 202002L)\
|
||||
)
|
||||
# define BOOST_MOVE_CONTIGUOUS_ITERATOR_TAG
|
||||
struct contiguous_iterator_tag;
|
||||
|
||||
#endif
|
||||
|
||||
BOOST_MOVE_STD_NS_END
|
||||
|
||||
#include <boost/move/detail/std_ns_end.hpp>
|
||||
|
||||
namespace boost{ namespace movelib{
|
||||
|
||||
template<class T>
|
||||
struct iter_difference
|
||||
{
|
||||
typedef typename T::difference_type type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct iter_difference<T*>
|
||||
{
|
||||
typedef std::ptrdiff_t type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct iter_value
|
||||
{
|
||||
typedef typename T::value_type type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct iter_value<T*>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct iter_value<const T*>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct iter_category
|
||||
{
|
||||
typedef typename T::iterator_category type;
|
||||
};
|
||||
|
||||
|
||||
template<class T>
|
||||
struct iter_category<T*>
|
||||
{
|
||||
typedef std::random_access_iterator_tag type;
|
||||
};
|
||||
|
||||
template<class Iterator>
|
||||
struct iterator_traits
|
||||
{
|
||||
typedef typename Iterator::difference_type difference_type;
|
||||
typedef typename Iterator::value_type value_type;
|
||||
typedef typename Iterator::pointer pointer;
|
||||
typedef typename Iterator::reference reference;
|
||||
typedef typename Iterator::iterator_category iterator_category;
|
||||
typedef typename boost::move_detail::make_unsigned<difference_type>::type size_type;
|
||||
typedef typename iter_difference<Iterator>::type difference_type;
|
||||
typedef typename iter_value<Iterator>::type value_type;
|
||||
typedef typename Iterator::pointer pointer;
|
||||
typedef typename Iterator::reference reference;
|
||||
typedef typename iter_category<Iterator>::type iterator_category;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
@@ -58,7 +145,6 @@ struct iterator_traits<T*>
|
||||
typedef T* pointer;
|
||||
typedef T& reference;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
typedef typename boost::move_detail::make_unsigned<difference_type>::type size_type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
@@ -69,9 +155,23 @@ struct iterator_traits<const T*>
|
||||
typedef const T* pointer;
|
||||
typedef const T& reference;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
typedef typename boost::move_detail::make_unsigned<difference_type>::type size_type;
|
||||
};
|
||||
|
||||
}} //namespace boost { namespace movelib{
|
||||
}} //namespace boost::movelib
|
||||
|
||||
#endif //
|
||||
|
||||
#include <boost/move/detail/type_traits.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace movelib {
|
||||
|
||||
template<class T>
|
||||
struct iter_size
|
||||
: boost::move_detail::
|
||||
make_unsigned<typename iter_difference<T>::type >
|
||||
{};
|
||||
|
||||
}} //namespace boost move_detail {
|
||||
|
||||
#endif //#ifndef BOOST_MOVE_DETAIL_ITERATOR_TRAITS_HPP
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <boost/move/detail/workaround.hpp> //forceinline
|
||||
#include <boost/move/detail/meta_utils_core.hpp>
|
||||
#include <cstddef> //for std::size_t
|
||||
#include <boost/move/detail/addressof.hpp>
|
||||
|
||||
//Small meta-typetraits to support move
|
||||
|
||||
@@ -56,8 +57,8 @@ struct apply
|
||||
template< bool C_ >
|
||||
struct bool_ : integral_constant<bool, C_>
|
||||
{
|
||||
operator bool() const { return C_; }
|
||||
bool operator()() const { return C_; }
|
||||
BOOST_MOVE_FORCEINLINE operator bool() const { return C_; }
|
||||
BOOST_MOVE_FORCEINLINE bool operator()() const { return C_; }
|
||||
};
|
||||
|
||||
typedef bool_<true> true_;
|
||||
@@ -70,6 +71,10 @@ struct nat{};
|
||||
struct nat2{};
|
||||
struct nat3{};
|
||||
|
||||
template <unsigned N>
|
||||
struct natN
|
||||
{};
|
||||
|
||||
//////////////////////////////////////
|
||||
// yes_type/no_type
|
||||
//////////////////////////////////////
|
||||
@@ -220,7 +225,7 @@ struct identity
|
||||
{
|
||||
typedef T type;
|
||||
typedef typename add_const_lvalue_reference<T>::type reference;
|
||||
reference operator()(reference t)
|
||||
BOOST_MOVE_FORCEINLINE reference operator()(reference t) const
|
||||
{ return t; }
|
||||
};
|
||||
|
||||
@@ -241,36 +246,7 @@ struct is_class_or_union
|
||||
//////////////////////////////////////
|
||||
// addressof
|
||||
//////////////////////////////////////
|
||||
template<class T>
|
||||
struct addr_impl_ref
|
||||
{
|
||||
T & v_;
|
||||
BOOST_MOVE_FORCEINLINE addr_impl_ref( T & v ): v_( v ) {}
|
||||
BOOST_MOVE_FORCEINLINE operator T& () const { return v_; }
|
||||
|
||||
private:
|
||||
addr_impl_ref & operator=(const addr_impl_ref &);
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct addressof_impl
|
||||
{
|
||||
BOOST_MOVE_FORCEINLINE static T * f( T & v, long )
|
||||
{
|
||||
return reinterpret_cast<T*>(
|
||||
&const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
|
||||
}
|
||||
|
||||
BOOST_MOVE_FORCEINLINE static T * f( T * v, int )
|
||||
{ return v; }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
BOOST_MOVE_FORCEINLINE T * addressof( T & v )
|
||||
{
|
||||
return ::boost::move_detail::addressof_impl<T>::f
|
||||
( ::boost::move_detail::addr_impl_ref<T>( v ), 0 );
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// has_pointer_type
|
||||
|
||||
268
linx64/include/boost/move/detail/nsec_clock.hpp
Normal file
268
linx64/include/boost/move/detail/nsec_clock.hpp
Normal file
@@ -0,0 +1,268 @@
|
||||
// This code is based on Timer and Chrono code. Thanks to authors:
|
||||
//
|
||||
// Boost.Timer:
|
||||
// Copyright Beman Dawes 1994-2007, 2011
|
||||
//
|
||||
// Boost.Chrono:
|
||||
// Copyright Beman Dawes 2008
|
||||
// Copyright 2009-2010 Vicente J. Botet Escriba
|
||||
//
|
||||
// Simplified and modified to be able to support exceptionless (-fno-exceptions).
|
||||
// Boost.Timer depends on Boost.Chorno wich uses boost::throw_exception.
|
||||
// And Boost.Chrono DLLs don't build in Win32 as there is no
|
||||
// boost::throw_exception(std::exception const&) implementation
|
||||
// in Boost.Chrono:
|
||||
//
|
||||
// Copyright 2020 Ion Gaztanaga
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
// Windows //
|
||||
//----------------------------------------------------------------------------//
|
||||
#ifndef BOOST_MOVE_DETAIL_NSEC_CLOCK_HPP
|
||||
#define BOOST_MOVE_DETAIL_NSEC_CLOCK_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/move/detail/workaround.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
# if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32))
|
||||
# define BOOST_MOVE_DETAIL_WINDOWS_API
|
||||
# elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
|
||||
# define BOOST_MOVE_DETAIL_MAC_API
|
||||
# else
|
||||
# define BOOST_MOVE_DETAIL_POSIX_API
|
||||
# endif
|
||||
|
||||
#if defined(BOOST_MOVE_DETAIL_WINDOWS_API)
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
#include <Windows.h>
|
||||
#else
|
||||
|
||||
#if defined (WIN32_PLATFORM_PSPC)
|
||||
#define BOOST_MOVE_WINAPI_IMPORT BOOST_SYMBOL_IMPORT
|
||||
#define BOOST_MOVE_WINAPI_IMPORT_EXCEPT_WM
|
||||
#elif defined (_WIN32_WCE)
|
||||
#define BOOST_MOVE_WINAPI_IMPORT
|
||||
#define BOOST_MOVE_WINAPI_IMPORT_EXCEPT_WM
|
||||
#else
|
||||
#define BOOST_MOVE_WINAPI_IMPORT BOOST_SYMBOL_IMPORT
|
||||
#define BOOST_MOVE_WINAPI_IMPORT_EXCEPT_WM BOOST_SYMBOL_IMPORT
|
||||
#endif
|
||||
|
||||
#if defined(WINAPI)
|
||||
#define BOOST_MOVE_WINAPI_CC WINAPI
|
||||
#else
|
||||
#if defined(_M_IX86) || defined(__i386__)
|
||||
#define BOOST_MOVE_WINAPI_CC __stdcall
|
||||
#else
|
||||
// On architectures other than 32-bit x86 __stdcall is ignored. Clang also issues a warning.
|
||||
#define BOOST_MOVE_WINAPI_CC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
union _LARGE_INTEGER;
|
||||
typedef long long QuadPart;
|
||||
|
||||
BOOST_MOVE_WINAPI_IMPORT_EXCEPT_WM int BOOST_MOVE_WINAPI_CC
|
||||
QueryPerformanceCounter(::_LARGE_INTEGER* lpPerformanceCount);
|
||||
|
||||
BOOST_MOVE_WINAPI_IMPORT_EXCEPT_WM int BOOST_MOVE_WINAPI_CC
|
||||
QueryPerformanceFrequency(::_LARGE_INTEGER* lpFrequency);
|
||||
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
|
||||
namespace boost { namespace move_detail {
|
||||
|
||||
BOOST_FORCEINLINE int QueryPerformanceCounter(long long* lpPerformanceCount)
|
||||
{
|
||||
return ::QueryPerformanceCounter(reinterpret_cast< ::_LARGE_INTEGER* >(lpPerformanceCount));
|
||||
}
|
||||
|
||||
BOOST_FORCEINLINE int QueryPerformanceFrequency(long long* lpFrequency)
|
||||
{
|
||||
return ::QueryPerformanceFrequency(reinterpret_cast< ::_LARGE_INTEGER* >(lpFrequency));
|
||||
}
|
||||
|
||||
|
||||
template<int Dummy>
|
||||
struct QPFHolder
|
||||
{
|
||||
static inline double get_nsec_per_tic()
|
||||
{
|
||||
long long freq;
|
||||
//According to MS documentation:
|
||||
//"On systems that run Windows XP or later, the function will always succeed and will thus never return zero"
|
||||
(void)boost::move_detail::QueryPerformanceFrequency(&freq);
|
||||
return double(1000000000.0L / double(freq));
|
||||
}
|
||||
|
||||
static const double nanosecs_per_tic;
|
||||
};
|
||||
|
||||
template<int Dummy>
|
||||
const double QPFHolder<Dummy>::nanosecs_per_tic = get_nsec_per_tic();
|
||||
|
||||
inline boost::uint64_t nsec_clock() BOOST_NOEXCEPT
|
||||
{
|
||||
double nanosecs_per_tic = QPFHolder<0>::nanosecs_per_tic;
|
||||
|
||||
long long pcount;
|
||||
//According to MS documentation:
|
||||
//"On systems that run Windows XP or later, the function will always succeed and will thus never return zero"
|
||||
(void)boost::move_detail::QueryPerformanceCounter( &pcount );
|
||||
return static_cast<boost::uint64_t>(nanosecs_per_tic * double(pcount));
|
||||
}
|
||||
|
||||
}} //namespace boost { namespace move_detail {
|
||||
|
||||
#elif defined(BOOST_MOVE_DETAIL_MAC_API)
|
||||
|
||||
#include <mach/mach_time.h> // mach_absolute_time, mach_timebase_info_data_t
|
||||
|
||||
inline boost::uint64_t nsec_clock() BOOST_NOEXCEPT
|
||||
{
|
||||
boost::uint64_t count = ::mach_absolute_time();
|
||||
|
||||
mach_timebase_info_data_t info;
|
||||
mach_timebase_info(&info);
|
||||
return static_cast<boost::uint64_t>
|
||||
( static_cast<double>(count)*(static_cast<double>(info.numer) / info.denom) );
|
||||
}
|
||||
|
||||
#elif defined(BOOST_MOVE_DETAIL_POSIX_API)
|
||||
|
||||
#include <time.h>
|
||||
|
||||
# if defined(CLOCK_MONOTONIC_PRECISE) //BSD
|
||||
# define BOOST_MOVE_DETAIL_CLOCK_MONOTONIC CLOCK_MONOTONIC_PRECISE
|
||||
# elif defined(CLOCK_MONOTONIC_RAW) //Linux
|
||||
# define BOOST_MOVE_DETAIL_CLOCK_MONOTONIC CLOCK_MONOTONIC_RAW
|
||||
# elif defined(CLOCK_HIGHRES) //Solaris
|
||||
# define BOOST_MOVE_DETAIL_CLOCK_MONOTONIC CLOCK_HIGHRES
|
||||
# elif defined(CLOCK_MONOTONIC) //POSIX (AIX, BSD, Linux, Solaris)
|
||||
# define BOOST_MOVE_DETAIL_CLOCK_MONOTONIC CLOCK_MONOTONIC
|
||||
# else
|
||||
# error "No high resolution steady clock in your system, please provide a patch"
|
||||
# endif
|
||||
|
||||
inline boost::uint64_t nsec_clock() BOOST_NOEXCEPT
|
||||
{
|
||||
struct timespec count;
|
||||
::clock_gettime(BOOST_MOVE_DETAIL_CLOCK_MONOTONIC, &count);
|
||||
boost::uint64_t r = static_cast<boost::uint64_t>(count.tv_sec);
|
||||
r *= 1000000000U;
|
||||
r += static_cast<boost::uint64_t>(count.tv_nsec);
|
||||
return r;
|
||||
}
|
||||
|
||||
#endif // POSIX
|
||||
|
||||
namespace boost { namespace move_detail {
|
||||
|
||||
typedef boost::uint64_t nanosecond_type;
|
||||
|
||||
struct cpu_times
|
||||
{
|
||||
nanosecond_type wall;
|
||||
nanosecond_type user;
|
||||
nanosecond_type system;
|
||||
|
||||
void clear() { wall = user = system = 0; }
|
||||
|
||||
cpu_times()
|
||||
{ this->clear(); }
|
||||
};
|
||||
|
||||
|
||||
inline void get_cpu_times(boost::move_detail::cpu_times& current)
|
||||
{
|
||||
current.wall = nsec_clock();
|
||||
}
|
||||
|
||||
|
||||
class cpu_timer
|
||||
{
|
||||
public:
|
||||
|
||||
// constructor
|
||||
cpu_timer() BOOST_NOEXCEPT { start(); }
|
||||
|
||||
// observers
|
||||
bool is_stopped() const BOOST_NOEXCEPT { return m_is_stopped; }
|
||||
cpu_times elapsed() const BOOST_NOEXCEPT; // does not stop()
|
||||
|
||||
// actions
|
||||
void start() BOOST_NOEXCEPT;
|
||||
void stop() BOOST_NOEXCEPT;
|
||||
void resume() BOOST_NOEXCEPT;
|
||||
|
||||
private:
|
||||
cpu_times m_times;
|
||||
bool m_is_stopped;
|
||||
};
|
||||
|
||||
|
||||
// cpu_timer ---------------------------------------------------------------------//
|
||||
|
||||
inline void cpu_timer::start() BOOST_NOEXCEPT
|
||||
{
|
||||
m_is_stopped = false;
|
||||
get_cpu_times(m_times);
|
||||
}
|
||||
|
||||
inline void cpu_timer::stop() BOOST_NOEXCEPT
|
||||
{
|
||||
if (is_stopped())
|
||||
return;
|
||||
m_is_stopped = true;
|
||||
|
||||
cpu_times current;
|
||||
get_cpu_times(current);
|
||||
m_times.wall = (current.wall - m_times.wall);
|
||||
m_times.user = (current.user - m_times.user);
|
||||
m_times.system = (current.system - m_times.system);
|
||||
}
|
||||
|
||||
inline cpu_times cpu_timer::elapsed() const BOOST_NOEXCEPT
|
||||
{
|
||||
if (is_stopped())
|
||||
return m_times;
|
||||
cpu_times current;
|
||||
get_cpu_times(current);
|
||||
current.wall -= m_times.wall;
|
||||
current.user -= m_times.user;
|
||||
current.system -= m_times.system;
|
||||
return current;
|
||||
}
|
||||
|
||||
inline void cpu_timer::resume() BOOST_NOEXCEPT
|
||||
{
|
||||
if (is_stopped())
|
||||
{
|
||||
cpu_times current (m_times);
|
||||
start();
|
||||
m_times.wall -= current.wall;
|
||||
m_times.user -= current.user;
|
||||
m_times.system -= current.system;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace move_detail
|
||||
} // namespace boost
|
||||
|
||||
#endif //BOOST_MOVE_DETAIL_NSEC_CLOCK_HPP
|
||||
@@ -28,6 +28,14 @@
|
||||
namespace boost {
|
||||
namespace movelib {
|
||||
|
||||
template<class I>
|
||||
BOOST_MOVE_FORCEINLINE typename iterator_traits<I>::pointer iterator_arrow_result(const I &i)
|
||||
{ return i.operator->(); }
|
||||
|
||||
template<class T>
|
||||
BOOST_MOVE_FORCEINLINE T * iterator_arrow_result(T *p)
|
||||
{ return p; }
|
||||
|
||||
template<class It>
|
||||
class reverse_iterator
|
||||
{
|
||||
@@ -41,37 +49,38 @@ class reverse_iterator
|
||||
|
||||
typedef It iterator_type;
|
||||
|
||||
reverse_iterator()
|
||||
BOOST_MOVE_FORCEINLINE reverse_iterator()
|
||||
: m_current() //Value initialization to achieve "null iterators" (N3644)
|
||||
{}
|
||||
|
||||
explicit reverse_iterator(It r)
|
||||
BOOST_MOVE_FORCEINLINE explicit reverse_iterator(It r)
|
||||
: m_current(r)
|
||||
{}
|
||||
|
||||
reverse_iterator(const reverse_iterator& r)
|
||||
BOOST_MOVE_FORCEINLINE reverse_iterator(const reverse_iterator& r)
|
||||
: m_current(r.base())
|
||||
{}
|
||||
|
||||
template<class OtherIt>
|
||||
reverse_iterator( const reverse_iterator<OtherIt>& r
|
||||
, typename boost::move_detail::enable_if_convertible<OtherIt, It>::type* =0
|
||||
BOOST_MOVE_FORCEINLINE
|
||||
reverse_iterator( const reverse_iterator<OtherIt>& r
|
||||
, typename boost::move_detail::enable_if_convertible<OtherIt, It>::type* =0
|
||||
)
|
||||
: m_current(r.base())
|
||||
{}
|
||||
|
||||
reverse_iterator & operator=( const reverse_iterator& r)
|
||||
BOOST_MOVE_FORCEINLINE reverse_iterator & operator=( const reverse_iterator& r)
|
||||
{ m_current = r.base(); return *this; }
|
||||
|
||||
template<class OtherIt>
|
||||
typename boost::move_detail::enable_if_convertible<OtherIt, It, reverse_iterator &>::type
|
||||
BOOST_MOVE_FORCEINLINE typename boost::move_detail::enable_if_convertible<OtherIt, It, reverse_iterator &>::type
|
||||
operator=( const reverse_iterator<OtherIt>& r)
|
||||
{ m_current = r.base(); return *this; }
|
||||
|
||||
It base() const
|
||||
BOOST_MOVE_FORCEINLINE It base() const
|
||||
{ return m_current; }
|
||||
|
||||
reference operator*() const
|
||||
BOOST_MOVE_FORCEINLINE reference operator*() const
|
||||
{
|
||||
It temp(m_current);
|
||||
--temp;
|
||||
@@ -79,78 +88,78 @@ class reverse_iterator
|
||||
return r;
|
||||
}
|
||||
|
||||
pointer operator->() const
|
||||
BOOST_MOVE_FORCEINLINE pointer operator->() const
|
||||
{
|
||||
It temp(m_current);
|
||||
--temp;
|
||||
return iterator_arrow_result(temp);
|
||||
return (iterator_arrow_result)(temp);
|
||||
}
|
||||
|
||||
reference operator[](difference_type off) const
|
||||
BOOST_MOVE_FORCEINLINE reference operator[](difference_type off) const
|
||||
{
|
||||
return this->m_current[-off - 1];
|
||||
return this->m_current[difference_type(-off - 1)];
|
||||
}
|
||||
|
||||
reverse_iterator& operator++()
|
||||
BOOST_MOVE_FORCEINLINE reverse_iterator& operator++()
|
||||
{
|
||||
--m_current;
|
||||
return *this;
|
||||
}
|
||||
|
||||
reverse_iterator operator++(int)
|
||||
BOOST_MOVE_FORCEINLINE reverse_iterator operator++(int)
|
||||
{
|
||||
reverse_iterator temp((*this));
|
||||
--m_current;
|
||||
return temp;
|
||||
}
|
||||
|
||||
reverse_iterator& operator--()
|
||||
BOOST_MOVE_FORCEINLINE reverse_iterator& operator--()
|
||||
{
|
||||
++m_current;
|
||||
return *this;
|
||||
}
|
||||
|
||||
reverse_iterator operator--(int)
|
||||
BOOST_MOVE_FORCEINLINE reverse_iterator operator--(int)
|
||||
{
|
||||
reverse_iterator temp((*this));
|
||||
++m_current;
|
||||
return temp;
|
||||
}
|
||||
|
||||
friend bool operator==(const reverse_iterator& l, const reverse_iterator& r)
|
||||
BOOST_MOVE_FORCEINLINE friend bool operator==(const reverse_iterator& l, const reverse_iterator& r)
|
||||
{ return l.m_current == r.m_current; }
|
||||
|
||||
friend bool operator!=(const reverse_iterator& l, const reverse_iterator& r)
|
||||
BOOST_MOVE_FORCEINLINE friend bool operator!=(const reverse_iterator& l, const reverse_iterator& r)
|
||||
{ return l.m_current != r.m_current; }
|
||||
|
||||
friend bool operator<(const reverse_iterator& l, const reverse_iterator& r)
|
||||
BOOST_MOVE_FORCEINLINE friend bool operator<(const reverse_iterator& l, const reverse_iterator& r)
|
||||
{ return l.m_current > r.m_current; }
|
||||
|
||||
friend bool operator<=(const reverse_iterator& l, const reverse_iterator& r)
|
||||
BOOST_MOVE_FORCEINLINE friend bool operator<=(const reverse_iterator& l, const reverse_iterator& r)
|
||||
{ return l.m_current >= r.m_current; }
|
||||
|
||||
friend bool operator>(const reverse_iterator& l, const reverse_iterator& r)
|
||||
BOOST_MOVE_FORCEINLINE friend bool operator>(const reverse_iterator& l, const reverse_iterator& r)
|
||||
{ return l.m_current < r.m_current; }
|
||||
|
||||
friend bool operator>=(const reverse_iterator& l, const reverse_iterator& r)
|
||||
BOOST_MOVE_FORCEINLINE friend bool operator>=(const reverse_iterator& l, const reverse_iterator& r)
|
||||
{ return l.m_current <= r.m_current; }
|
||||
|
||||
reverse_iterator& operator+=(difference_type off)
|
||||
BOOST_MOVE_FORCEINLINE reverse_iterator& operator+=(difference_type off)
|
||||
{ m_current -= off; return *this; }
|
||||
|
||||
reverse_iterator& operator-=(difference_type off)
|
||||
BOOST_MOVE_FORCEINLINE reverse_iterator& operator-=(difference_type off)
|
||||
{ m_current += off; return *this; }
|
||||
|
||||
friend reverse_iterator operator+(reverse_iterator l, difference_type off)
|
||||
BOOST_MOVE_FORCEINLINE friend reverse_iterator operator+(reverse_iterator l, difference_type off)
|
||||
{ return (l += off); }
|
||||
|
||||
friend reverse_iterator operator+(difference_type off, reverse_iterator r)
|
||||
BOOST_MOVE_FORCEINLINE friend reverse_iterator operator+(difference_type off, reverse_iterator r)
|
||||
{ return (r += off); }
|
||||
|
||||
friend reverse_iterator operator-(reverse_iterator l, difference_type off)
|
||||
BOOST_MOVE_FORCEINLINE friend reverse_iterator operator-(reverse_iterator l, difference_type off)
|
||||
{ return (l-= off); }
|
||||
|
||||
friend difference_type operator-(const reverse_iterator& l, const reverse_iterator& r)
|
||||
BOOST_MOVE_FORCEINLINE friend difference_type operator-(const reverse_iterator& l, const reverse_iterator& r)
|
||||
{ return r.m_current - l.m_current; }
|
||||
|
||||
private:
|
||||
@@ -158,10 +167,8 @@ class reverse_iterator
|
||||
};
|
||||
|
||||
template< class Iterator >
|
||||
reverse_iterator<Iterator> make_reverse_iterator( Iterator i )
|
||||
{
|
||||
return reverse_iterator<Iterator>(i);
|
||||
}
|
||||
BOOST_MOVE_FORCEINLINE reverse_iterator<Iterator> make_reverse_iterator( Iterator i )
|
||||
{ return reverse_iterator<Iterator>(i); }
|
||||
|
||||
} //namespace movelib {
|
||||
} //namespace boost {
|
||||
|
||||
@@ -24,7 +24,11 @@
|
||||
#define BOOST_MOVE_STD_NS_BEG _GLIBCXX_BEGIN_NAMESPACE(std)
|
||||
#define BOOST_MOVE_STD_NS_END _GLIBCXX_END_NAMESPACE
|
||||
#else
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1915)
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable : 4643) // Forward declaring 'X' in namespace std is not permitted by the C++ Standard
|
||||
#endif
|
||||
|
||||
#define BOOST_MOVE_STD_NS_BEG namespace std{
|
||||
#define BOOST_MOVE_STD_NS_END }
|
||||
#endif
|
||||
|
||||
|
||||
@@ -11,4 +11,6 @@
|
||||
#ifdef BOOST_MOVE_STD_NS_GCC_DIAGNOSTIC_PUSH
|
||||
#pragma GCC diagnostic pop
|
||||
#undef BOOST_MOVE_STD_NS_GCC_DIAGNOSTIC_PUSH
|
||||
#elif defined(_MSC_VER) && (_MSC_VER >= 1915)
|
||||
#pragma warning (pop)
|
||||
#endif //BOOST_MOVE_STD_NS_GCC_DIAGNOSTIC_PUSH
|
||||
|
||||
@@ -30,8 +30,7 @@
|
||||
// move/detail
|
||||
#include <boost/move/detail/meta_utils.hpp>
|
||||
// other
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <cassert>
|
||||
// std
|
||||
#include <cstddef>
|
||||
|
||||
@@ -65,6 +64,8 @@
|
||||
// BOOST_MOVE_HAS_NOTHROW_COPY(T) should evaluate to true if T(t) can not throw
|
||||
// BOOST_MOVE_HAS_NOTHROW_ASSIGN(T) should evaluate to true if t = u can not throw
|
||||
// BOOST_MOVE_IS_ENUM(T) should evaluate to true it t is a union type.
|
||||
// BOOST_MOVE_HAS_NOTHROW_MOVE_CONSTRUCTOR(T) should evaluate to true if T has a non-throwing move constructor.
|
||||
// BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN(T) should evaluate to true if T has a non-throwing move assignment operator.
|
||||
//
|
||||
// The following can also be defined: when detected our implementation is greatly simplified.
|
||||
//
|
||||
@@ -102,51 +103,127 @@
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) (__has_trivial_move_constructor(T) || ::boost::move_detail::is_pod<T>::value)
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_MOVE_ASSIGN(T) (__has_trivial_move_assign(T) || ::boost::move_detail::is_pod<T>::value)
|
||||
# endif
|
||||
# if _MSC_FULL_VER >= 180020827
|
||||
# define BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN(T) (__is_nothrow_assignable(T&, T&&))
|
||||
# define BOOST_MOVE_HAS_NOTHROW_MOVE_CONSTRUCTOR(T) (__is_nothrow_constructible(T, T&&))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_CLANG) && defined(__has_feature)
|
||||
#if defined(BOOST_CLANG)
|
||||
// BOOST_MOVE_HAS_TRAIT
|
||||
# if defined __is_identifier
|
||||
# define BOOST_MOVE_HAS_TRAIT(T) (__has_extension(T) || !__is_identifier(__##T))
|
||||
# elif defined(__has_extension)
|
||||
# define BOOST_MOVE_HAS_TRAIT(T) __has_extension(T)
|
||||
# else
|
||||
# define BOOST_MOVE_HAS_TRAIT(T) 0
|
||||
# endif
|
||||
|
||||
# if __has_feature(is_union)
|
||||
// BOOST_MOVE_IS_UNION
|
||||
# if BOOST_MOVE_HAS_TRAIT(is_union)
|
||||
# define BOOST_MOVE_IS_UNION(T) __is_union(T)
|
||||
# endif
|
||||
# if (!defined(__GLIBCXX__) || (__GLIBCXX__ >= 20080306 && __GLIBCXX__ != 20080519)) && __has_feature(is_pod)
|
||||
# define BOOST_MOVE_IS_POD(T) __is_pod(T)
|
||||
# endif
|
||||
# if (!defined(__GLIBCXX__) || (__GLIBCXX__ >= 20080306 && __GLIBCXX__ != 20080519)) && __has_feature(is_empty)
|
||||
# define BOOST_MOVE_IS_EMPTY(T) __is_empty(T)
|
||||
# endif
|
||||
# if __has_feature(has_trivial_constructor)
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T)
|
||||
# endif
|
||||
# if __has_feature(has_trivial_copy)
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_COPY(T) __has_trivial_copy(T)
|
||||
# endif
|
||||
# if __has_feature(has_trivial_assign)
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) )
|
||||
# endif
|
||||
# if __has_feature(has_trivial_destructor)
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
|
||||
# endif
|
||||
# if __has_feature(has_nothrow_constructor)
|
||||
# define BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T)
|
||||
# endif
|
||||
# if __has_feature(has_nothrow_copy)
|
||||
# define BOOST_MOVE_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T))
|
||||
# endif
|
||||
# if __has_feature(is_nothrow_copy_assignable)
|
||||
# define BOOST_MOVE_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T))
|
||||
# endif
|
||||
# if __has_feature(is_enum)
|
||||
|
||||
// BOOST_MOVE_IS_ENUM
|
||||
# if BOOST_MOVE_HAS_TRAIT(is_enum)
|
||||
# define BOOST_MOVE_IS_ENUM(T) __is_enum(T)
|
||||
# endif
|
||||
# if __has_feature(has_trivial_move_constructor)
|
||||
|
||||
// BOOST_MOVE_IS_POD
|
||||
# if (!defined(__GLIBCXX__) || (__GLIBCXX__ >= 20080306 && __GLIBCXX__ != 20080519)) && BOOST_MOVE_HAS_TRAIT(is_pod)
|
||||
# define BOOST_MOVE_IS_POD(T) __is_pod(T)
|
||||
# endif
|
||||
|
||||
// BOOST_MOVE_IS_EMPTY
|
||||
# if (!defined(__GLIBCXX__) || (__GLIBCXX__ >= 20080306 && __GLIBCXX__ != 20080519)) && BOOST_MOVE_HAS_TRAIT(is_empty)
|
||||
# define BOOST_MOVE_IS_EMPTY(T) __is_empty(T)
|
||||
# endif
|
||||
|
||||
// BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR
|
||||
# if BOOST_MOVE_HAS_TRAIT(is_constructible) && BOOST_MOVE_HAS_TRAIT(is_trivially_constructible)
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) __is_trivially_constructible(T)
|
||||
# elif BOOST_MOVE_HAS_TRAIT(has_trivial_constructor)
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T)
|
||||
# endif
|
||||
|
||||
// BOOST_MOVE_HAS_TRIVIAL_COPY
|
||||
# if BOOST_MOVE_HAS_TRAIT(is_constructible) && BOOST_MOVE_HAS_TRAIT(is_trivially_constructible)
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_COPY(T) (__is_constructible(T, const T &) && __is_trivially_constructible(T, const T &))
|
||||
# elif BOOST_MOVE_HAS_TRAIT(has_trivial_copy)
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_COPY(T) __has_trivial_copy(T)
|
||||
# endif
|
||||
|
||||
// BOOST_MOVE_HAS_TRIVIAL_ASSIGN
|
||||
# if BOOST_MOVE_HAS_TRAIT(is_assignable) && BOOST_MOVE_HAS_TRAIT(is_trivially_assignable)
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) (__is_assignable(T, const T &) && __is_trivially_assignable(T, const T &))
|
||||
# elif BOOST_MOVE_HAS_TRAIT(has_trivial_copy)
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) __has_trivial_assign(T)
|
||||
# endif
|
||||
|
||||
// BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR
|
||||
# if BOOST_MOVE_HAS_TRAIT(is_trivially_destructible)
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T) __is_trivially_destructible(T)
|
||||
# elif BOOST_MOVE_HAS_TRAIT(has_trivial_destructor)
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T)
|
||||
# endif
|
||||
|
||||
// BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR
|
||||
# if BOOST_MOVE_HAS_TRAIT(is_nothrow_constructible)
|
||||
# define BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR(T) __is_nothrow_constructible(T)
|
||||
# elif BOOST_MOVE_HAS_TRAIT(has_nothrow_constructor)
|
||||
# define BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T)
|
||||
# endif
|
||||
|
||||
// BOOST_MOVE_HAS_NOTHROW_COPY
|
||||
# if BOOST_MOVE_HAS_TRAIT(is_constructible) && BOOST_MOVE_HAS_TRAIT(is_nothrow_constructible)
|
||||
# define BOOST_MOVE_HAS_NOTHROW_COPY(T) (__is_constructible(T, const T &) && __is_nothrow_constructible(T, const T &))
|
||||
# elif BOOST_MOVE_HAS_TRAIT(has_nothrow_copy)
|
||||
# define BOOST_MOVE_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T))
|
||||
# endif
|
||||
|
||||
// BOOST_MOVE_HAS_NOTHROW_ASSIGN
|
||||
# if BOOST_MOVE_HAS_TRAIT(is_assignable) && BOOST_MOVE_HAS_TRAIT(is_nothrow_assignable)
|
||||
# define BOOST_MOVE_HAS_NOTHROW_ASSIGN(T) (__is_assignable(T, const T &) && __is_nothrow_assignable(T, const T &))
|
||||
# elif BOOST_MOVE_HAS_TRAIT(has_nothrow_assign)
|
||||
# define BOOST_MOVE_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T))
|
||||
# endif
|
||||
|
||||
// BOOST_MOVE_HAS_TRIVIAL_MOVE_CONSTRUCTOR
|
||||
# if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
|
||||
# if BOOST_MOVE_HAS_TRAIT(is_constructible) && BOOST_MOVE_HAS_TRAIT(is_trivially_constructible)
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) (__is_constructible(T, T&&) && __is_trivially_constructible(T, T&&))
|
||||
# elif BOOST_MOVE_HAS_TRAIT(has_trivial_move_constructor)
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) __has_trivial_move_constructor(T)
|
||||
# endif
|
||||
# if __has_feature(has_trivial_move_assign)
|
||||
|
||||
// BOOST_MOVE_HAS_TRIVIAL_MOVE_ASSIGN
|
||||
# if BOOST_MOVE_HAS_TRAIT(is_assignable) && BOOST_MOVE_HAS_TRAIT(is_trivially_assignable)
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_MOVE_ASSIGN(T) (__is_assignable(T, T&&) && __is_trivially_assignable(T, T&&))
|
||||
# elif BOOST_MOVE_HAS_TRAIT(has_trivial_move_assign)
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_MOVE_ASSIGN(T) __has_trivial_move_assign(T)
|
||||
# endif
|
||||
|
||||
// BOOST_MOVE_HAS_NOTHROW_MOVE_CONSTRUCTOR
|
||||
# if BOOST_MOVE_HAS_TRAIT(is_constructible) && BOOST_MOVE_HAS_TRAIT(is_nothrow_constructible)
|
||||
# define BOOST_MOVE_HAS_NOTHROW_MOVE_CONSTRUCTOR(T) (__is_constructible(T, T&&) && __is_nothrow_constructible(T, T&&))
|
||||
# elif BOOST_MOVE_HAS_TRAIT(has_nothrow_move_constructor)
|
||||
# define BOOST_MOVE_HAS_NOTHROW_MOVE_CONSTRUCTOR(T) __has_nothrow_move_constructor(T)
|
||||
# endif
|
||||
|
||||
// BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN
|
||||
# if BOOST_MOVE_HAS_TRAIT(is_assignable) && BOOST_MOVE_HAS_TRAIT(is_nothrow_assignable)
|
||||
# define BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN(T) (__is_assignable(T, T&&) && __is_nothrow_assignable(T, T&&))
|
||||
# elif BOOST_MOVE_HAS_TRAIT(has_nothrow_move_assign)
|
||||
# define BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN(T) __has_nothrow_move_assign(T)
|
||||
# endif
|
||||
|
||||
# endif //BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
|
||||
// BOOST_MOVE_ALIGNMENT_OF
|
||||
# define BOOST_MOVE_ALIGNMENT_OF(T) __alignof(T)
|
||||
#endif
|
||||
|
||||
#endif //#if defined(BOOST_CLANG)
|
||||
|
||||
#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) && !defined(__GCCXML__))) && !defined(BOOST_CLANG)
|
||||
|
||||
@@ -160,14 +237,106 @@
|
||||
# define BOOST_MOVE_IS_POD(T) __is_pod(T)
|
||||
# define BOOST_MOVE_IS_EMPTY(T) __is_empty(T)
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) ((__has_trivial_constructor(T) BOOST_MOVE_INTEL_TT_OPTS))
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_COPY(T) ((__has_trivial_copy(T) BOOST_MOVE_INTEL_TT_OPTS))
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) ((__has_trivial_assign(T) BOOST_MOVE_INTEL_TT_OPTS) )
|
||||
|
||||
# if defined(BOOST_GCC) && (BOOST_GCC > 50000)
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_COPY(T) (__is_trivially_constructible(T, const T &))
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) (__is_trivially_assignable(T, const T &))
|
||||
# else
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_COPY(T) ((__has_trivial_copy(T) BOOST_MOVE_INTEL_TT_OPTS))
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_ASSIGN(T) ((__has_trivial_assign(T) BOOST_MOVE_INTEL_TT_OPTS) )
|
||||
# endif
|
||||
|
||||
# define BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) BOOST_MOVE_INTEL_TT_OPTS)
|
||||
# define BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) BOOST_MOVE_INTEL_TT_OPTS)
|
||||
# define BOOST_MOVE_HAS_NOTHROW_COPY(T) ((__has_nothrow_copy(T) BOOST_MOVE_INTEL_TT_OPTS))
|
||||
# define BOOST_MOVE_HAS_NOTHROW_ASSIGN(T) ((__has_nothrow_assign(T) BOOST_MOVE_INTEL_TT_OPTS))
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_SFINAE_EXPR)
|
||||
|
||||
template <typename T>
|
||||
T && boost_move_tt_declval() BOOST_NOEXCEPT;
|
||||
|
||||
# if defined(BOOST_GCC) && (BOOST_GCC >= 80000)
|
||||
// __is_assignable / __is_constructible implemented
|
||||
# define BOOST_MOVE_IS_ASSIGNABLE(T, U) __is_assignable(T, U)
|
||||
# define BOOST_MOVE_IS_CONSTRUCTIBLE(T, U) __is_constructible(T, U)
|
||||
# else
|
||||
|
||||
template<typename Tt, typename Ut>
|
||||
class boost_move_tt_is_assignable
|
||||
{
|
||||
struct twochar { char dummy[2]; };
|
||||
template < class T
|
||||
, class U
|
||||
, class = decltype(boost_move_tt_declval<T>() = boost_move_tt_declval<U>())
|
||||
> static char test(int);
|
||||
|
||||
template<class, class> static twochar test(...);
|
||||
|
||||
public:
|
||||
static const bool value = sizeof(test<Tt, Ut>(0)) == sizeof(char);
|
||||
};
|
||||
|
||||
template<typename Tt, typename Ut>
|
||||
class boost_move_tt_is_constructible
|
||||
{
|
||||
struct twochar { char dummy[2]; };
|
||||
template < class T
|
||||
, class U
|
||||
, class = decltype(T(boost_move_tt_declval<U>()))
|
||||
> static char test(int);
|
||||
|
||||
template<class, class> static twochar test(...);
|
||||
|
||||
public:
|
||||
static const bool value = sizeof(test<Tt, Ut>(0)) == sizeof(char);
|
||||
};
|
||||
|
||||
# define BOOST_MOVE_IS_ASSIGNABLE(T, U) boost_move_tt_is_assignable<T,U>::value
|
||||
# define BOOST_MOVE_IS_CONSTRUCTIBLE(T, U) boost_move_tt_is_constructible<T, U>::value
|
||||
|
||||
# endif
|
||||
|
||||
template <typename T, typename U, bool = BOOST_MOVE_IS_ASSIGNABLE(T, U)>
|
||||
struct boost_move_tt_is_nothrow_assignable
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template <typename T, typename U>
|
||||
struct boost_move_tt_is_nothrow_assignable<T, U, true>
|
||||
{
|
||||
#if !defined(BOOST_NO_CXX11_NOEXCEPT)
|
||||
static const bool value = noexcept(boost_move_tt_declval<T>() = boost_move_tt_declval<U>());
|
||||
#else
|
||||
static const bool value = false;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <typename T, typename U, bool = BOOST_MOVE_IS_CONSTRUCTIBLE(T, U)>
|
||||
struct boost_move_tt_is_nothrow_constructible
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template <typename T, typename U>
|
||||
struct boost_move_tt_is_nothrow_constructible<T, U, true>
|
||||
{
|
||||
#if !defined(BOOST_NO_CXX11_NOEXCEPT)
|
||||
static const bool value = noexcept(T(boost_move_tt_declval<U>()));
|
||||
#else
|
||||
static const bool value = false;
|
||||
#endif
|
||||
};
|
||||
|
||||
# define BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN(T) boost_move_tt_is_nothrow_assignable<T, T&&>::value
|
||||
# define BOOST_MOVE_HAS_NOTHROW_MOVE_CONSTRUCTOR(T) boost_move_tt_is_nothrow_constructible<T, T&&>::value
|
||||
|
||||
# endif
|
||||
|
||||
# define BOOST_MOVE_IS_ENUM(T) __is_enum(T)
|
||||
|
||||
// BOOST_MOVE_ALIGNMENT_OF
|
||||
# if (!defined(unix) && !defined(__unix__)) || defined(__LP64__)
|
||||
// GCC sometimes lies about alignment requirements
|
||||
// of type double on 32-bit unix platforms, use the
|
||||
@@ -193,7 +362,7 @@
|
||||
# define BOOST_MOVE_ALIGNMENT_OF(T) __alignof__(T)
|
||||
#endif
|
||||
|
||||
# if defined(__CODEGEARC__)
|
||||
# if defined(BOOST_CODEGEARC)
|
||||
# define BOOST_MOVE_IS_UNION(T) __is_union(T)
|
||||
# define BOOST_MOVE_IS_POD(T) __is_pod(T)
|
||||
# define BOOST_MOVE_IS_EMPTY(T) __is_empty(T)
|
||||
@@ -243,13 +412,13 @@
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR
|
||||
#define BOOST_MOVE_IS_TRIVIALLY_DEFAULT_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T)
|
||||
#define BOOST_MOVE_IS_TRIVIALLY_DEFAULT_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_TRIVIAL_CONSTRUCTOR(T) || ::boost::move_detail::is_pod<T>::value
|
||||
#else
|
||||
#define BOOST_MOVE_IS_TRIVIALLY_DEFAULT_CONSTRUCTIBLE(T) ::boost::move_detail::is_pod<T>::value
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MOVE_HAS_TRIVIAL_MOVE_CONSTRUCTOR
|
||||
#define BOOST_MOVE_IS_TRIVIALLY_MOVE_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T)
|
||||
#define BOOST_MOVE_IS_TRIVIALLY_MOVE_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) || ::boost::move_detail::is_pod<T>::value
|
||||
#else
|
||||
#define BOOST_MOVE_IS_TRIVIALLY_MOVE_CONSTRUCTIBLE(T) ::boost::move_detail::is_pod<T>::value
|
||||
#endif
|
||||
@@ -263,45 +432,45 @@
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MOVE_HAS_TRIVIAL_MOVE_ASSIGN
|
||||
#define BOOST_MOVE_IS_TRIVIALLY_MOVE_ASSIGNABLE(T) BOOST_MOVE_HAS_TRIVIAL_MOVE_ASSIGN(T)
|
||||
#define BOOST_MOVE_IS_TRIVIALLY_MOVE_ASSIGNABLE(T) BOOST_MOVE_HAS_TRIVIAL_MOVE_ASSIGN(T) || ::boost::move_detail::is_pod<T>::value
|
||||
#else
|
||||
#define BOOST_MOVE_IS_TRIVIALLY_MOVE_ASSIGNABLE(T) ::boost::move_detail::is_pod<T>::value
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR
|
||||
#define BOOST_MOVE_IS_TRIVIALLY_DESTRUCTIBLE(T) BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T)
|
||||
#define BOOST_MOVE_IS_TRIVIALLY_DESTRUCTIBLE(T) BOOST_MOVE_HAS_TRIVIAL_DESTRUCTOR(T) || ::boost::move_detail::is_pod<T>::value
|
||||
#else
|
||||
#define BOOST_MOVE_IS_TRIVIALLY_DESTRUCTIBLE(T) ::boost::move_detail::is_pod<T>::value
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR
|
||||
#define BOOST_MOVE_IS_NOTHROW_DEFAULT_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR(T)
|
||||
#define BOOST_MOVE_IS_NOTHROW_DEFAULT_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_NOTHROW_CONSTRUCTOR(T) || ::boost::move_detail::is_pod<T>::value
|
||||
#else
|
||||
#define BOOST_MOVE_IS_NOTHROW_DEFAULT_CONSTRUCTIBLE(T) ::boost::move_detail::is_pod<T>::value
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MOVE_HAS_NOTHROW_COPY
|
||||
#define BOOST_MOVE_IS_NOTHROW_COPY_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_NOTHROW_COPY(T)
|
||||
#define BOOST_MOVE_IS_NOTHROW_COPY_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_NOTHROW_COPY(T) || ::boost::move_detail::is_pod<T>::value
|
||||
#else
|
||||
#define BOOST_MOVE_IS_NOTHROW_COPY_CONSTRUCTIBLE(T) ::boost::move_detail::is_pod<T>::value
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MOVE_HAS_NOTHROW_MOVE
|
||||
#define BOOST_MOVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_NOTHROW_MOVE(T)
|
||||
#else
|
||||
#define BOOST_MOVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE(T) ::boost::move_detail::is_pod<T>::value
|
||||
#define BOOST_MOVE_IS_NOTHROW_COPY_CONSTRUCTIBLE(T) BOOST_MOVE_IS_TRIVIALLY_COPY_ASSIGNABLE(T)
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MOVE_HAS_NOTHROW_ASSIGN
|
||||
#define BOOST_MOVE_IS_NOTHROW_COPY_ASSIGNABLE(T) BOOST_MOVE_HAS_NOTHROW_ASSIGN(T)
|
||||
#define BOOST_MOVE_IS_NOTHROW_COPY_ASSIGNABLE(T) BOOST_MOVE_HAS_NOTHROW_ASSIGN(T) || ::boost::move_detail::is_pod<T>::value
|
||||
#else
|
||||
#define BOOST_MOVE_IS_NOTHROW_COPY_ASSIGNABLE(T) ::boost::move_detail::is_pod<T>::value
|
||||
#define BOOST_MOVE_IS_NOTHROW_COPY_ASSIGNABLE(T) BOOST_MOVE_IS_TRIVIALLY_COPY_ASSIGNABLE(T)
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MOVE_HAS_NOTHROW_MOVE_CONSTRUCTOR
|
||||
#define BOOST_MOVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE(T) BOOST_MOVE_HAS_NOTHROW_MOVE_CONSTRUCTOR(T) || ::boost::move_detail::is_pod<T>::value
|
||||
#else
|
||||
#define BOOST_MOVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE(T) BOOST_MOVE_IS_TRIVIALLY_MOVE_ASSIGNABLE(T)
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN
|
||||
#define BOOST_MOVE_IS_NOTHROW_MOVE_ASSIGNABLE(T) BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN(T)
|
||||
#define BOOST_MOVE_IS_NOTHROW_MOVE_ASSIGNABLE(T) BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN(T) || ::boost::move_detail::is_pod<T>::value
|
||||
#else
|
||||
#define BOOST_MOVE_IS_NOTHROW_MOVE_ASSIGNABLE(T) ::boost::move_detail::is_pod<T>::value
|
||||
#define BOOST_MOVE_IS_NOTHROW_MOVE_ASSIGNABLE(T) BOOST_MOVE_IS_TRIVIALLY_MOVE_ASSIGNABLE(T)
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MOVE_IS_ENUM
|
||||
@@ -403,6 +572,15 @@ template<typename T> struct remove_cv<const T> { typedef T type; };
|
||||
template<typename T> struct remove_cv<const volatile T> { typedef T type; };
|
||||
template<typename T> struct remove_cv<volatile T> { typedef T type; };
|
||||
|
||||
//////////////////////////
|
||||
// remove_cvref
|
||||
//////////////////////////
|
||||
template<class T>
|
||||
struct remove_cvref
|
||||
: remove_cv<typename remove_reference<T>::type>
|
||||
{
|
||||
};
|
||||
|
||||
//////////////////////////
|
||||
// make_unsigned
|
||||
//////////////////////////
|
||||
@@ -817,8 +995,6 @@ struct is_trivially_default_constructible
|
||||
template<class T>
|
||||
struct is_trivially_copy_constructible
|
||||
{
|
||||
//In several compilers BOOST_MOVE_IS_TRIVIALLY_COPY_CONSTRUCTIBLE return true even with
|
||||
//deleted copy constructors so make sure the type is copy constructible.
|
||||
static const bool value = BOOST_MOVE_IS_TRIVIALLY_COPY_CONSTRUCTIBLE(T);
|
||||
};
|
||||
|
||||
@@ -835,8 +1011,6 @@ struct is_trivially_move_constructible
|
||||
template<class T>
|
||||
struct is_trivially_copy_assignable
|
||||
{
|
||||
//In several compilers BOOST_MOVE_IS_TRIVIALLY_COPY_CONSTRUCTIBLE return true even with
|
||||
//deleted copy constructors so make sure the type is copy constructible.
|
||||
static const bool value = BOOST_MOVE_IS_TRIVIALLY_COPY_ASSIGNABLE(T);
|
||||
};
|
||||
|
||||
@@ -852,7 +1026,6 @@ struct is_trivially_move_assignable
|
||||
//////////////////////////////////////
|
||||
template<class T>
|
||||
struct is_nothrow_default_constructible
|
||||
: is_pod<T>
|
||||
{ static const bool value = BOOST_MOVE_IS_NOTHROW_DEFAULT_CONSTRUCTIBLE(T); };
|
||||
|
||||
//////////////////////////////////////
|
||||
@@ -902,6 +1075,7 @@ struct alignment_of_hack
|
||||
char c;
|
||||
T t2;
|
||||
alignment_of_hack();
|
||||
~alignment_of_hack();
|
||||
};
|
||||
|
||||
template <unsigned A, unsigned S>
|
||||
@@ -931,7 +1105,7 @@ struct alignment_of
|
||||
class alignment_dummy;
|
||||
typedef void (*function_ptr)();
|
||||
typedef int (alignment_dummy::*member_ptr);
|
||||
typedef int (alignment_dummy::*member_function_ptr)();
|
||||
|
||||
struct alignment_struct
|
||||
{ long double dummy[4]; };
|
||||
|
||||
@@ -954,7 +1128,6 @@ union max_align
|
||||
long double long_double_[4];
|
||||
alignment_dummy *unknown_class_ptr_;
|
||||
function_ptr function_ptr_;
|
||||
member_function_ptr member_function_ptr_;
|
||||
alignment_struct alignment_struct_;
|
||||
};
|
||||
|
||||
@@ -964,7 +1137,46 @@ typedef union max_align max_align_t;
|
||||
// aligned_storage
|
||||
/////////////////////////////
|
||||
|
||||
#if !defined(BOOST_NO_ALIGNMENT)
|
||||
#if defined(_MSC_VER) && defined(_M_IX86)
|
||||
|
||||
// Special version for usual alignments on x86 MSVC because it might crash
|
||||
// when passsing aligned types by value even for 8 byte alignment.
|
||||
template<std::size_t Align>
|
||||
struct aligned_struct;
|
||||
|
||||
template <> struct aligned_struct<1> { char data; };
|
||||
template <> struct aligned_struct<2> { short data; };
|
||||
template <> struct aligned_struct<4> { int data; };
|
||||
template <> struct aligned_struct<8> { double data; };
|
||||
|
||||
#define BOOST_MOVE_ALIGNED_STRUCT(x) \
|
||||
template <> struct aligned_struct<x> { \
|
||||
__declspec(align(x)) char data; \
|
||||
}
|
||||
BOOST_MOVE_ALIGNED_STRUCT(16);
|
||||
BOOST_MOVE_ALIGNED_STRUCT(32);
|
||||
BOOST_MOVE_ALIGNED_STRUCT(64);
|
||||
BOOST_MOVE_ALIGNED_STRUCT(128);
|
||||
BOOST_MOVE_ALIGNED_STRUCT(512);
|
||||
BOOST_MOVE_ALIGNED_STRUCT(1024);
|
||||
BOOST_MOVE_ALIGNED_STRUCT(2048);
|
||||
BOOST_MOVE_ALIGNED_STRUCT(4096);
|
||||
|
||||
template<std::size_t Len, std::size_t Align>
|
||||
union aligned_union
|
||||
{
|
||||
typedef aligned_struct<Align> aligner_t;
|
||||
aligner_t aligner;
|
||||
unsigned char data[Len > sizeof(aligner_t) ? Len : sizeof(aligner_t)];
|
||||
};
|
||||
|
||||
template<std::size_t Len, std::size_t Align>
|
||||
struct aligned_storage_impl
|
||||
{
|
||||
typedef aligned_union<Len, Align> type;
|
||||
};
|
||||
|
||||
#elif !defined(BOOST_NO_ALIGNMENT)
|
||||
|
||||
template<std::size_t Len, std::size_t Align>
|
||||
struct aligned_struct;
|
||||
@@ -999,8 +1211,9 @@ BOOST_MOVE_ALIGNED_STORAGE_WITH_BOOST_ALIGNMENT(0x1000)
|
||||
template<std::size_t Len, std::size_t Align>
|
||||
union aligned_struct_wrapper
|
||||
{
|
||||
typedef aligned_struct<Len, Align> aligner_t;
|
||||
aligned_struct<Len, Align> aligner;
|
||||
unsigned char data[sizeof(aligned_struct<Len, Align>)];
|
||||
unsigned char data[Len > sizeof(aligner_t) ? Len : sizeof(aligner_t)];
|
||||
};
|
||||
|
||||
template<std::size_t Len, std::size_t Align>
|
||||
@@ -1015,7 +1228,7 @@ template<class T, std::size_t Len>
|
||||
union aligned_union
|
||||
{
|
||||
T aligner;
|
||||
unsigned char data[Len];
|
||||
unsigned char data[Len > sizeof(T) ? Len : sizeof(T)];
|
||||
};
|
||||
|
||||
template<std::size_t Len, std::size_t Align, class T, bool Ok>
|
||||
@@ -1024,7 +1237,7 @@ struct aligned_next;
|
||||
template<std::size_t Len, std::size_t Align, class T>
|
||||
struct aligned_next<Len, Align, T, true>
|
||||
{
|
||||
BOOST_STATIC_ASSERT((alignment_of<T>::value == Align));
|
||||
BOOST_MOVE_STATIC_ASSERT((alignment_of<T>::value == Align));
|
||||
typedef aligned_union<T, Len> type;
|
||||
};
|
||||
|
||||
@@ -1064,13 +1277,13 @@ template<std::size_t Len, std::size_t Align = alignment_of<max_align_t>::value>
|
||||
struct aligned_storage
|
||||
{
|
||||
//Sanity checks for input parameters
|
||||
BOOST_STATIC_ASSERT(Align > 0);
|
||||
BOOST_MOVE_STATIC_ASSERT(Align > 0);
|
||||
|
||||
//Sanity checks for output type
|
||||
typedef typename aligned_storage_impl<Len ? Len : 1, Align>::type type;
|
||||
static const std::size_t value = alignment_of<type>::value;
|
||||
BOOST_STATIC_ASSERT(value >= Align);
|
||||
BOOST_STATIC_ASSERT((value % Align) == 0);
|
||||
BOOST_MOVE_STATIC_ASSERT(value >= Align);
|
||||
BOOST_MOVE_STATIC_ASSERT((value % Align) == 0);
|
||||
|
||||
//Just in case someone instantiates aligned_storage
|
||||
//instead of aligned_storage::type (typical error).
|
||||
|
||||
@@ -546,7 +546,7 @@ struct is_unary_function
|
||||
# define BOOST_MOVEUP_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
|
||||
#elif defined(__ghs__) && (__GHS_VERSION_NUMBER >= 600)
|
||||
# define BOOST_MOVEUP_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
|
||||
#elif defined(__CODEGEARC__)
|
||||
#elif defined(BOOST_CODEGEARC)
|
||||
# define BOOST_MOVEUP_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T)
|
||||
#endif
|
||||
|
||||
@@ -559,32 +559,6 @@ struct is_unary_function
|
||||
struct has_virtual_destructor{ static const bool value = true; };
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// missing_virtual_destructor
|
||||
//////////////////////////////////////
|
||||
|
||||
template< class T, class U
|
||||
, bool enable = is_convertible< U*, T*>::value &&
|
||||
!is_array<T>::value &&
|
||||
!is_same<typename remove_cv<T>::type, void>::value &&
|
||||
!is_same<typename remove_cv<U>::type, typename remove_cv<T>::type>::value
|
||||
>
|
||||
struct missing_virtual_destructor_default_delete
|
||||
{ static const bool value = !has_virtual_destructor<T>::value; };
|
||||
|
||||
template<class T, class U>
|
||||
struct missing_virtual_destructor_default_delete<T, U, false>
|
||||
{ static const bool value = false; };
|
||||
|
||||
template<class Deleter, class U>
|
||||
struct missing_virtual_destructor
|
||||
{ static const bool value = false; };
|
||||
|
||||
template<class T, class U>
|
||||
struct missing_virtual_destructor< ::boost::movelib::default_delete<T>, U >
|
||||
: missing_virtual_destructor_default_delete<T, U>
|
||||
{};
|
||||
|
||||
} //namespace move_upmu {
|
||||
} //namespace boost {
|
||||
|
||||
|
||||
@@ -52,18 +52,97 @@
|
||||
#define BOOST_MOVE_MSVC_AUTO_MOVE_RETURN_BUG
|
||||
#endif
|
||||
|
||||
//#define BOOST_MOVE_DISABLE_FORCEINLINE
|
||||
|
||||
#if defined(BOOST_MOVE_DISABLE_FORCEINLINE)
|
||||
#define BOOST_MOVE_FORCEINLINE inline
|
||||
#elif defined(BOOST_MOVE_FORCEINLINE_IS_BOOST_FORCELINE)
|
||||
#define BOOST_MOVE_FORCEINLINE BOOST_FORCEINLINE
|
||||
#elif defined(BOOST_MSVC) && defined(_DEBUG)
|
||||
//"__forceinline" and MSVC seems to have some bugs in debug mode
|
||||
#elif defined(BOOST_MSVC) && (_MSC_VER < 1900 || defined(_DEBUG))
|
||||
//"__forceinline" and MSVC seems to have some bugs in old versions and in debug mode
|
||||
#define BOOST_MOVE_FORCEINLINE inline
|
||||
#elif defined(__GNUC__) && ((__GNUC__ < 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ < 5)))
|
||||
#elif defined(BOOST_GCC) && (__GNUC__ <= 5)
|
||||
//Older GCCs have problems with forceinline
|
||||
#define BOOST_MOVE_FORCEINLINE inline
|
||||
#else
|
||||
#define BOOST_MOVE_FORCEINLINE BOOST_FORCEINLINE
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace movelib {
|
||||
|
||||
template <typename T1>
|
||||
BOOST_FORCEINLINE BOOST_CXX14_CONSTEXPR void ignore(T1 const&)
|
||||
{}
|
||||
|
||||
}} //namespace boost::movelib {
|
||||
|
||||
#if !(defined BOOST_NO_EXCEPTIONS)
|
||||
# define BOOST_MOVE_TRY { try
|
||||
# define BOOST_MOVE_CATCH(x) catch(x)
|
||||
# define BOOST_MOVE_RETHROW throw;
|
||||
# define BOOST_MOVE_CATCH_END }
|
||||
#else
|
||||
# if !defined(BOOST_MSVC) || BOOST_MSVC >= 1900
|
||||
# define BOOST_MOVE_TRY { if (true)
|
||||
# define BOOST_MOVE_CATCH(x) else if (false)
|
||||
# else
|
||||
// warning C4127: conditional expression is constant
|
||||
# define BOOST_MOVE_TRY { \
|
||||
__pragma(warning(push)) \
|
||||
__pragma(warning(disable: 4127)) \
|
||||
if (true) \
|
||||
__pragma(warning(pop))
|
||||
# define BOOST_MOVE_CATCH(x) else \
|
||||
__pragma(warning(push)) \
|
||||
__pragma(warning(disable: 4127)) \
|
||||
if (false) \
|
||||
__pragma(warning(pop))
|
||||
# endif
|
||||
# define BOOST_MOVE_RETHROW
|
||||
# define BOOST_MOVE_CATCH_END }
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_CXX11_STATIC_ASSERT
|
||||
# ifndef BOOST_NO_CXX11_VARIADIC_MACROS
|
||||
# define BOOST_MOVE_STATIC_ASSERT( ... ) static_assert(__VA_ARGS__, #__VA_ARGS__)
|
||||
# else
|
||||
# define BOOST_MOVE_STATIC_ASSERT( B ) static_assert(B, #B)
|
||||
# endif
|
||||
#else
|
||||
namespace boost {
|
||||
namespace move_detail {
|
||||
|
||||
template<bool B>
|
||||
struct STATIC_ASSERTION_FAILURE;
|
||||
|
||||
template<>
|
||||
struct STATIC_ASSERTION_FAILURE<true>{};
|
||||
|
||||
template<unsigned> struct static_assert_test {};
|
||||
|
||||
}}
|
||||
|
||||
#define BOOST_MOVE_STATIC_ASSERT(B) \
|
||||
typedef ::boost::move_detail::static_assert_test<\
|
||||
(unsigned)sizeof(::boost::move_detail::STATIC_ASSERTION_FAILURE<bool(B)>)>\
|
||||
BOOST_JOIN(boost_static_assert_typedef_, __LINE__) BOOST_ATTRIBUTE_UNUSED
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(__has_cpp_attribute) || defined(__CUDACC__)
|
||||
#define BOOST_MOVE_HAS_MSVC_ATTRIBUTE(ATTR) 0
|
||||
#else
|
||||
#define BOOST_MOVE_HAS_MSVC_ATTRIBUTE(ATTR) __has_cpp_attribute(msvc::ATTR)
|
||||
#endif
|
||||
|
||||
// See https://devblogs.microsoft.com/cppblog/improving-the-state-of-debug-performance-in-c/
|
||||
// for details on how MSVC has improved debug experience, specifically for move/forward-like utilities
|
||||
#if BOOST_MOVE_HAS_MSVC_ATTRIBUTE(intrinsic)
|
||||
#define BOOST_MOVE_INTRINSIC_CAST [[msvc::intrinsic]]
|
||||
#else
|
||||
#define BOOST_MOVE_INTRINSIC_CAST BOOST_MOVE_FORCEINLINE
|
||||
#endif
|
||||
|
||||
#endif //#ifndef BOOST_MOVE_DETAIL_WORKAROUND_HPP
|
||||
|
||||
|
||||
Reference in New Issue
Block a user