Update to 1.71.0

This commit is contained in:
Hamish Milne 2020-03-28 14:36:17 +00:00
parent 6d7edc593b
commit 78d50f0db8
102 changed files with 2095 additions and 1658 deletions

View File

@ -140,10 +140,11 @@ import "class" : new ;
import property-set ;
import threadapi-feature ;
import option ;
import tools/boost_install/boost-install ;
# Backslash because of `bcp --namespace`
import tools/boost\_install/boost-install ;
path-constant BOOST_ROOT : . ;
constant BOOST_VERSION : 1.70.0 ;
constant BOOST_VERSION : 1.71.0 ;
constant BOOST_JAMROOT_MODULE : $(__name__) ;
boostcpp.set-version $(BOOST_VERSION) ;
@ -311,8 +312,8 @@ rule boost-install ( libraries * )
# stage and install targets via boost-install, above.
rule boost-lib ( name : sources * : requirements * : default-build * : usage-requirements * )
{
autolink = <link>shared:<define>BOOST_$(name:U)_DYN_LINK=1 ;
name = boost_$(name) ;
autolink = <link>shared:<define>$(name:U)_DYN_LINK=1 ;
lib $(name)
: $(sources)
: $(requirements) $(autolink)

View File

@ -1,7 +1,7 @@
Boost libraries - trimmed down for Citra
========================================
This is a subset of Boost v1.70.0 generated using the bcp tool. To get a list of boost modules guaranteed to exist, check the build script.
This is a subset of Boost v1.71.0 generated using the bcp tool. To get a list of boost modules guaranteed to exist, check the build script.
Updating this repo (on Windows)
===============================

View File

@ -1,553 +0,0 @@
// (C) Copyright Herve Bronnimann 2004.
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
/*
Revision history:
1 July 2004
Split the code into two headers to lessen dependence on
Boost.tuple. (Herve)
26 June 2004
Added the code for the boost minmax library. (Herve)
*/
#ifndef BOOST_ALGORITHM_MINMAX_ELEMENT_HPP
#define BOOST_ALGORITHM_MINMAX_ELEMENT_HPP
/* PROPOSED STANDARD EXTENSIONS:
*
* minmax_element(first, last)
* Effect: std::make_pair( std::min_element(first, last),
* std::max_element(first, last) );
*
* minmax_element(first, last, comp)
* Effect: std::make_pair( std::min_element(first, last, comp),
* std::max_element(first, last, comp) );
*/
#include <utility> // for std::pair and std::make_pair
namespace boost {
namespace detail { // for obtaining a uniform version of minmax_element
// that compiles with VC++ 6.0 -- avoid the iterator_traits by
// having comparison object over iterator, not over dereferenced value
template <typename Iterator>
struct less_over_iter {
bool operator()(Iterator const& it1,
Iterator const& it2) const { return *it1 < *it2; }
};
template <typename Iterator, class BinaryPredicate>
struct binary_pred_over_iter {
explicit binary_pred_over_iter(BinaryPredicate const& p ) : m_p( p ) {}
bool operator()(Iterator const& it1,
Iterator const& it2) const { return m_p(*it1, *it2); }
private:
BinaryPredicate m_p;
};
// common base for the two minmax_element overloads
template <typename ForwardIter, class Compare >
std::pair<ForwardIter,ForwardIter>
basic_minmax_element(ForwardIter first, ForwardIter last, Compare comp)
{
if (first == last)
return std::make_pair(last,last);
ForwardIter min_result = first;
ForwardIter max_result = first;
// if only one element
ForwardIter second = first; ++second;
if (second == last)
return std::make_pair(min_result, max_result);
// treat first pair separately (only one comparison for first two elements)
ForwardIter potential_min_result = last;
if (comp(first, second))
max_result = second;
else {
min_result = second;
potential_min_result = first;
}
// then each element by pairs, with at most 3 comparisons per pair
first = ++second; if (first != last) ++second;
while (second != last) {
if (comp(first, second)) {
if (comp(first, min_result)) {
min_result = first;
potential_min_result = last;
}
if (comp(max_result, second))
max_result = second;
} else {
if (comp(second, min_result)) {
min_result = second;
potential_min_result = first;
}
if (comp(max_result, first))
max_result = first;
}
first = ++second;
if (first != last) ++second;
}
// if odd number of elements, treat last element
if (first != last) { // odd number of elements
if (comp(first, min_result)) {
min_result = first;
potential_min_result = last;
}
else if (comp(max_result, first))
max_result = first;
}
// resolve min_result being incorrect with one extra comparison
// (in which case potential_min_result is necessarily the correct result)
if (potential_min_result != last
&& !comp(min_result, potential_min_result))
min_result = potential_min_result;
return std::make_pair(min_result,max_result);
}
} // namespace detail
template <typename ForwardIter>
std::pair<ForwardIter,ForwardIter>
minmax_element(ForwardIter first, ForwardIter last)
{
return detail::basic_minmax_element(first, last,
detail::less_over_iter<ForwardIter>() );
}
template <typename ForwardIter, class BinaryPredicate>
std::pair<ForwardIter,ForwardIter>
minmax_element(ForwardIter first, ForwardIter last, BinaryPredicate comp)
{
return detail::basic_minmax_element(first, last,
detail::binary_pred_over_iter<ForwardIter,BinaryPredicate>(comp) );
}
}
/* PROPOSED BOOST EXTENSIONS
* In the description below, [rfirst,rlast) denotes the reversed range
* of [first,last). Even though the iterator type of first and last may
* be only a Forward Iterator, it is possible to explain the semantics
* by assuming that it is a Bidirectional Iterator. In the sequel,
* reverse(ForwardIterator&) returns the reverse_iterator adaptor.
* This is not how the functions would be implemented!
*
* first_min_element(first, last)
* Effect: std::min_element(first, last);
*
* first_min_element(first, last, comp)
* Effect: std::min_element(first, last, comp);
*
* last_min_element(first, last)
* Effect: reverse( std::min_element(reverse(last), reverse(first)) );
*
* last_min_element(first, last, comp)
* Effect: reverse( std::min_element(reverse(last), reverse(first), comp) );
*
* first_max_element(first, last)
* Effect: std::max_element(first, last);
*
* first_max_element(first, last, comp)
* Effect: max_element(first, last);
*
* last_max_element(first, last)
* Effect: reverse( std::max_element(reverse(last), reverse(first)) );
*
* last_max_element(first, last, comp)
* Effect: reverse( std::max_element(reverse(last), reverse(first), comp) );
*
* first_min_first_max_element(first, last)
* Effect: std::make_pair( first_min_element(first, last),
* first_max_element(first, last) );
*
* first_min_first_max_element(first, last, comp)
* Effect: std::make_pair( first_min_element(first, last, comp),
* first_max_element(first, last, comp) );
*
* first_min_last_max_element(first, last)
* Effect: std::make_pair( first_min_element(first, last),
* last_max_element(first, last) );
*
* first_min_last_max_element(first, last, comp)
* Effect: std::make_pair( first_min_element(first, last, comp),
* last_max_element(first, last, comp) );
*
* last_min_first_max_element(first, last)
* Effect: std::make_pair( last_min_element(first, last),
* first_max_element(first, last) );
*
* last_min_first_max_element(first, last, comp)
* Effect: std::make_pair( last_min_element(first, last, comp),
* first_max_element(first, last, comp) );
*
* last_min_last_max_element(first, last)
* Effect: std::make_pair( last_min_element(first, last),
* last_max_element(first, last) );
*
* last_min_last_max_element(first, last, comp)
* Effect: std::make_pair( last_min_element(first, last, comp),
* last_max_element(first, last, comp) );
*/
namespace boost {
// Min_element and max_element variants
namespace detail { // common base for the overloads
template <typename ForwardIter, class BinaryPredicate>
ForwardIter
basic_first_min_element(ForwardIter first, ForwardIter last,
BinaryPredicate comp)
{
if (first == last) return last;
ForwardIter min_result = first;
while (++first != last)
if (comp(first, min_result))
min_result = first;
return min_result;
}
template <typename ForwardIter, class BinaryPredicate>
ForwardIter
basic_last_min_element(ForwardIter first, ForwardIter last,
BinaryPredicate comp)
{
if (first == last) return last;
ForwardIter min_result = first;
while (++first != last)
if (!comp(min_result, first))
min_result = first;
return min_result;
}
template <typename ForwardIter, class BinaryPredicate>
ForwardIter
basic_first_max_element(ForwardIter first, ForwardIter last,
BinaryPredicate comp)
{
if (first == last) return last;
ForwardIter max_result = first;
while (++first != last)
if (comp(max_result, first))
max_result = first;
return max_result;
}
template <typename ForwardIter, class BinaryPredicate>
ForwardIter
basic_last_max_element(ForwardIter first, ForwardIter last,
BinaryPredicate comp)
{
if (first == last) return last;
ForwardIter max_result = first;
while (++first != last)
if (!comp(first, max_result))
max_result = first;
return max_result;
}
} // namespace detail
template <typename ForwardIter>
ForwardIter
first_min_element(ForwardIter first, ForwardIter last)
{
return detail::basic_first_min_element(first, last,
detail::less_over_iter<ForwardIter>() );
}
template <typename ForwardIter, class BinaryPredicate>
ForwardIter
first_min_element(ForwardIter first, ForwardIter last, BinaryPredicate comp)
{
return detail::basic_first_min_element(first, last,
detail::binary_pred_over_iter<ForwardIter,BinaryPredicate>(comp) );
}
template <typename ForwardIter>
ForwardIter
last_min_element(ForwardIter first, ForwardIter last)
{
return detail::basic_last_min_element(first, last,
detail::less_over_iter<ForwardIter>() );
}
template <typename ForwardIter, class BinaryPredicate>
ForwardIter
last_min_element(ForwardIter first, ForwardIter last, BinaryPredicate comp)
{
return detail::basic_last_min_element(first, last,
detail::binary_pred_over_iter<ForwardIter,BinaryPredicate>(comp) );
}
template <typename ForwardIter>
ForwardIter
first_max_element(ForwardIter first, ForwardIter last)
{
return detail::basic_first_max_element(first, last,
detail::less_over_iter<ForwardIter>() );
}
template <typename ForwardIter, class BinaryPredicate>
ForwardIter
first_max_element(ForwardIter first, ForwardIter last, BinaryPredicate comp)
{
return detail::basic_first_max_element(first, last,
detail::binary_pred_over_iter<ForwardIter,BinaryPredicate>(comp) );
}
template <typename ForwardIter>
ForwardIter
last_max_element(ForwardIter first, ForwardIter last)
{
return detail::basic_last_max_element(first, last,
detail::less_over_iter<ForwardIter>() );
}
template <typename ForwardIter, class BinaryPredicate>
ForwardIter
last_max_element(ForwardIter first, ForwardIter last, BinaryPredicate comp)
{
return detail::basic_last_max_element(first, last,
detail::binary_pred_over_iter<ForwardIter,BinaryPredicate>(comp) );
}
// Minmax_element variants -- comments removed
namespace detail {
template <typename ForwardIter, class BinaryPredicate>
std::pair<ForwardIter,ForwardIter>
basic_first_min_last_max_element(ForwardIter first, ForwardIter last,
BinaryPredicate comp)
{
if (first == last)
return std::make_pair(last,last);
ForwardIter min_result = first;
ForwardIter max_result = first;
ForwardIter second = ++first;
if (second == last)
return std::make_pair(min_result, max_result);
if (comp(second, min_result))
min_result = second;
else
max_result = second;
first = ++second; if (first != last) ++second;
while (second != last) {
if (!comp(second, first)) {
if (comp(first, min_result))
min_result = first;
if (!comp(second, max_result))
max_result = second;
} else {
if (comp(second, min_result))
min_result = second;
if (!comp(first, max_result))
max_result = first;
}
first = ++second; if (first != last) ++second;
}
if (first != last) {
if (comp(first, min_result))
min_result = first;
else if (!comp(first, max_result))
max_result = first;
}
return std::make_pair(min_result, max_result);
}
template <typename ForwardIter, class BinaryPredicate>
std::pair<ForwardIter,ForwardIter>
basic_last_min_first_max_element(ForwardIter first, ForwardIter last,
BinaryPredicate comp)
{
if (first == last) return std::make_pair(last,last);
ForwardIter min_result = first;
ForwardIter max_result = first;
ForwardIter second = ++first;
if (second == last)
return std::make_pair(min_result, max_result);
if (comp(max_result, second))
max_result = second;
else
min_result = second;
first = ++second; if (first != last) ++second;
while (second != last) {
if (comp(first, second)) {
if (!comp(min_result, first))
min_result = first;
if (comp(max_result, second))
max_result = second;
} else {
if (!comp(min_result, second))
min_result = second;
if (comp(max_result, first))
max_result = first;
}
first = ++second; if (first != last) ++second;
}
if (first != last) {
if (!comp(min_result, first))
min_result = first;
else if (comp(max_result, first))
max_result = first;
}
return std::make_pair(min_result, max_result);
}
template <typename ForwardIter, class BinaryPredicate>
std::pair<ForwardIter,ForwardIter>
basic_last_min_last_max_element(ForwardIter first, ForwardIter last,
BinaryPredicate comp)
{
if (first == last) return std::make_pair(last,last);
ForwardIter min_result = first;
ForwardIter max_result = first;
ForwardIter second = first; ++second;
if (second == last)
return std::make_pair(min_result,max_result);
ForwardIter potential_max_result = last;
if (comp(first, second))
max_result = second;
else {
min_result = second;
potential_max_result = second;
}
first = ++second; if (first != last) ++second;
while (second != last) {
if (comp(first, second)) {
if (!comp(min_result, first))
min_result = first;
if (!comp(second, max_result)) {
max_result = second;
potential_max_result = last;
}
} else {
if (!comp(min_result, second))
min_result = second;
if (!comp(first, max_result)) {
max_result = first;
potential_max_result = second;
}
}
first = ++second;
if (first != last) ++second;
}
if (first != last) {
if (!comp(min_result, first))
min_result = first;
if (!comp(first, max_result)) {
max_result = first;
potential_max_result = last;
}
}
if (potential_max_result != last
&& !comp(potential_max_result, max_result))
max_result = potential_max_result;
return std::make_pair(min_result,max_result);
}
} // namespace detail
template <typename ForwardIter>
inline std::pair<ForwardIter,ForwardIter>
first_min_first_max_element(ForwardIter first, ForwardIter last)
{
return minmax_element(first, last);
}
template <typename ForwardIter, class BinaryPredicate>
inline std::pair<ForwardIter,ForwardIter>
first_min_first_max_element(ForwardIter first, ForwardIter last,
BinaryPredicate comp)
{
return minmax_element(first, last, comp);
}
template <typename ForwardIter>
std::pair<ForwardIter,ForwardIter>
first_min_last_max_element(ForwardIter first, ForwardIter last)
{
return detail::basic_first_min_last_max_element(first, last,
detail::less_over_iter<ForwardIter>() );
}
template <typename ForwardIter, class BinaryPredicate>
inline std::pair<ForwardIter,ForwardIter>
first_min_last_max_element(ForwardIter first, ForwardIter last,
BinaryPredicate comp)
{
return detail::basic_first_min_last_max_element(first, last,
detail::binary_pred_over_iter<ForwardIter,BinaryPredicate>(comp) );
}
template <typename ForwardIter>
std::pair<ForwardIter,ForwardIter>
last_min_first_max_element(ForwardIter first, ForwardIter last)
{
return detail::basic_last_min_first_max_element(first, last,
detail::less_over_iter<ForwardIter>() );
}
template <typename ForwardIter, class BinaryPredicate>
inline std::pair<ForwardIter,ForwardIter>
last_min_first_max_element(ForwardIter first, ForwardIter last,
BinaryPredicate comp)
{
return detail::basic_last_min_first_max_element(first, last,
detail::binary_pred_over_iter<ForwardIter,BinaryPredicate>(comp) );
}
template <typename ForwardIter>
std::pair<ForwardIter,ForwardIter>
last_min_last_max_element(ForwardIter first, ForwardIter last)
{
return detail::basic_last_min_last_max_element(first, last,
detail::less_over_iter<ForwardIter>() );
}
template <typename ForwardIter, class BinaryPredicate>
inline std::pair<ForwardIter,ForwardIter>
last_min_last_max_element(ForwardIter first, ForwardIter last,
BinaryPredicate comp)
{
return detail::basic_last_min_last_max_element(first, last,
detail::binary_pred_over_iter<ForwardIter,BinaryPredicate>(comp) );
}
} // namespace boost
#endif // BOOST_ALGORITHM_MINMAX_ELEMENT_HPP

View File

@ -554,7 +554,7 @@ public:
* boost::asio::serial_port_base::character_size
*/
template <typename GettableSerialPortOption>
void get_option(GettableSerialPortOption& option)
void get_option(GettableSerialPortOption& option) const
{
boost::system::error_code ec;
impl_.get_service().get_option(impl_.get_implementation(), option, ec);
@ -579,7 +579,7 @@ public:
*/
template <typename GettableSerialPortOption>
BOOST_ASIO_SYNC_OP_VOID get_option(GettableSerialPortOption& option,
boost::system::error_code& ec)
boost::system::error_code& ec) const
{
impl_.get_service().get_option(impl_.get_implementation(), option, ec);
BOOST_ASIO_SYNC_OP_VOID_RETURN(ec);

View File

@ -2476,7 +2476,7 @@ struct is_dynamic_buffer_v2
* If @c BOOST_ASIO_NO_DYNAMIC_BUFFER_V1 is not defined, determines whether the
* type satisfies the DynamicBuffer_v1 requirements. Otherwise, if @c
* BOOST_ASIO_NO_DYNAMIC_BUFFER_V1 is defined, determines whether the type
* satisfies the DynamicBuffer_v1 requirements.
* satisfies the DynamicBuffer_v2 requirements.
*/
template <typename T>
struct is_dynamic_buffer

View File

@ -341,7 +341,7 @@
// Compliant C++11 compilers put noexcept specifiers on error_category members.
#if !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT)
# if (BOOST_VERSION >= 105300)
# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 105300)
# define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT BOOST_NOEXCEPT
# elif defined(__clang__)
# if __has_feature(__cxx_noexcept__)
@ -508,9 +508,9 @@
// Boost support for chrono.
#if !defined(BOOST_ASIO_HAS_BOOST_CHRONO)
# if !defined(BOOST_ASIO_DISABLE_BOOST_CHRONO)
# if (BOOST_VERSION >= 104700)
# if defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 104700)
# define BOOST_ASIO_HAS_BOOST_CHRONO 1
# endif // (BOOST_VERSION >= 104700)
# endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && (BOOST_VERSION >= 104700)
# endif // !defined(BOOST_ASIO_DISABLE_BOOST_CHRONO)
#endif // !defined(BOOST_ASIO_HAS_BOOST_CHRONO)
@ -1232,6 +1232,8 @@
# define BOOST_ASIO_HAS_THREADS 1
# elif defined(__APPLE__)
# define BOOST_ASIO_HAS_THREADS 1
# elif defined(__HAIKU__)
# define BOOST_ASIO_HAS_THREADS 1
# elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
# define BOOST_ASIO_HAS_THREADS 1
# elif defined(_PTHREADS)
@ -1247,6 +1249,8 @@
# define BOOST_ASIO_HAS_PTHREADS 1
# elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
# define BOOST_ASIO_HAS_PTHREADS 1
# elif defined(__HAIKU__)
# define BOOST_ASIO_HAS_PTHREADS 1
# endif // defined(BOOST_ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
# endif // defined(BOOST_ASIO_HAS_THREADS)
#endif // !defined(BOOST_ASIO_HAS_PTHREADS)
@ -1427,11 +1431,11 @@
# endif // defined(BOOST_ASIO_MSVC)
# endif // !defined(BOOST_ASIO_DISABLE_CO_AWAIT)
# if defined(__clang__)
# if (__cpp_coroutines >= 201703)
# if (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
# if __has_include(<experimental/coroutine>)
# define BOOST_ASIO_HAS_CO_AWAIT 1
# endif // __has_include(<experimental/coroutine>)
# endif // (__cpp_coroutines >= 201703)
# endif // (__cplusplus >= 201703) && (__cpp_coroutines >= 201703)
# endif // defined(__clang__)
#endif // !defined(BOOST_ASIO_HAS_CO_AWAIT)

View File

@ -243,7 +243,8 @@ boost::system::error_code win_iocp_handle_service::cancel(
{
// The version of Windows supports cancellation from any thread.
typedef BOOL (WINAPI* cancel_io_ex_t)(HANDLE, LPOVERLAPPED);
cancel_io_ex_t cancel_io_ex = (cancel_io_ex_t)cancel_io_ex_ptr;
cancel_io_ex_t cancel_io_ex = reinterpret_cast<cancel_io_ex_t>(
reinterpret_cast<void*>(cancel_io_ex_ptr));
if (!cancel_io_ex(impl.handle_, 0))
{
DWORD last_error = ::GetLastError();

View File

@ -80,11 +80,22 @@ boost::system::error_code win_iocp_serial_port_service::open(
}
// Set some default serial port parameters. This implementation does not
// support changing these, so they might as well be in a known state.
// support changing all of these, so they might as well be in a known state.
dcb.fBinary = TRUE; // Win32 only supports binary mode.
dcb.fDsrSensitivity = FALSE;
dcb.fNull = FALSE; // Do not ignore NULL characters.
dcb.fAbortOnError = FALSE; // Ignore serial framing errors.
dcb.BaudRate = 0; // 0 baud by default
dcb.ByteSize = 8; // 8 bit bytes
dcb.fOutxCtsFlow = FALSE; // No flow control
dcb.fOutxDsrFlow = FALSE;
dcb.fDtrControl = DTR_CONTROL_DISABLE;
dcb.fDsrSensitivity = FALSE;
dcb.fOutX = FALSE;
dcb.fInX = FALSE;
dcb.fRtsControl = DTR_CONTROL_DISABLE;
dcb.fParity = FALSE; // No parity
dcb.Parity = NOPARITY;
dcb.StopBits = ONESTOPBIT; // One stop bit
if (!::SetCommState(handle, &dcb))
{
DWORD last_error = ::GetLastError();

View File

@ -250,7 +250,8 @@ boost::system::error_code win_iocp_socket_service_base::cancel(
{
// The version of Windows supports cancellation from any thread.
typedef BOOL (WINAPI* cancel_io_ex_t)(HANDLE, LPOVERLAPPED);
cancel_io_ex_t cancel_io_ex = (cancel_io_ex_t)cancel_io_ex_ptr;
cancel_io_ex_t cancel_io_ex = reinterpret_cast<cancel_io_ex_t>(
reinterpret_cast<void*>(cancel_io_ex_ptr));
socket_type sock = impl.socket_;
HANDLE sock_as_handle = reinterpret_cast<HANDLE>(sock);
if (!cancel_io_ex(sock_as_handle, 0))

View File

@ -113,6 +113,13 @@ public:
// When using a native implementation, I/O completion handlers are
// already dispatched according to the execution context's executor's
// rules. We can call the function directly.
#if defined(BOOST_ASIO_HAS_MOVE)
if (is_same<F, typename decay<F>::type>::value)
{
boost_asio_handler_invoke_helpers::invoke(f, f);
return;
}
#endif // defined(BOOST_ASIO_HAS_MOVE)
typename decay<F>::type function(BOOST_ASIO_MOVE_CAST(F)(f));
boost_asio_handler_invoke_helpers::invoke(function, function);
}

View File

@ -54,19 +54,22 @@ struct buffer_sequence_memfns_check
{
};
template <typename>
char (&buffer_sequence_begin_helper(...))[2];
#if defined(BOOST_ASIO_HAS_DECLTYPE)
template <typename>
char buffer_sequence_begin_helper(...);
template <typename T>
char buffer_sequence_begin_helper(T* t,
char (&buffer_sequence_begin_helper(T* t,
typename enable_if<!is_same<
decltype(boost::asio::buffer_sequence_begin(*t)),
void>::value>::type*);
void>::value>::type*))[2];
#else // defined(BOOST_ASIO_HAS_DECLTYPE)
template <typename>
char (&buffer_sequence_begin_helper(...))[2];
template <typename T>
char buffer_sequence_begin_helper(T* t,
buffer_sequence_memfns_check<
@ -75,19 +78,22 @@ char buffer_sequence_begin_helper(T* t,
#endif // defined(BOOST_ASIO_HAS_DECLTYPE)
template <typename>
char (&buffer_sequence_end_helper(...))[2];
#if defined(BOOST_ASIO_HAS_DECLTYPE)
template <typename>
char buffer_sequence_end_helper(...);
template <typename T>
char buffer_sequence_end_helper(T* t,
char (&buffer_sequence_end_helper(T* t,
typename enable_if<!is_same<
decltype(boost::asio::buffer_sequence_end(*t)),
void>::value>::type*);
void>::value>::type*))[2];
#else // defined(BOOST_ASIO_HAS_DECLTYPE)
template <typename>
char (&buffer_sequence_end_helper(...))[2];
template <typename T>
char buffer_sequence_end_helper(T* t,
buffer_sequence_memfns_check<
@ -215,8 +221,8 @@ char mutable_buffers_type_typedef_helper(
template <typename T, typename Buffer>
struct is_buffer_sequence_class
: integral_constant<bool,
sizeof(buffer_sequence_begin_helper<T>(0)) != 1 &&
sizeof(buffer_sequence_end_helper<T>(0)) != 1 &&
sizeof(buffer_sequence_begin_helper<T>(0, 0)) != 1 &&
sizeof(buffer_sequence_end_helper<T>(0, 0)) != 1 &&
sizeof(buffer_sequence_element_type_helper<T, Buffer>(0, 0)) == 1>
{
};

View File

@ -372,7 +372,7 @@ namespace detail
return;
}
default:
/* fall-through */ default:
if (iter == end)
break;
@ -542,7 +542,7 @@ namespace detail
return;
}
default:
/* fall-through */ default:
if (iter_ == end_)
break;

View File

@ -18,6 +18,6 @@
// BOOST_ASIO_VERSION % 100 is the sub-minor version
// BOOST_ASIO_VERSION / 100 % 1000 is the minor version
// BOOST_ASIO_VERSION / 100000 is the major version
#define BOOST_ASIO_VERSION 101400 // 1.14.0
#define BOOST_ASIO_VERSION 101401 // 1.14.1
#endif // BOOST_ASIO_VERSION_HPP

View File

@ -2136,7 +2136,7 @@ template<class F, class A1, class A2, class A3, class A4, class A5, class A6, cl
#undef BOOST_BIND_ST
#undef BOOST_BIND_NOEXCEPT
#ifdef BOOST_BIND_ENABLE_STDCALL
#if defined(BOOST_BIND_ENABLE_STDCALL) && !defined(_M_X64)
#define BOOST_BIND_CC __stdcall
#define BOOST_BIND_ST
@ -2150,7 +2150,7 @@ template<class F, class A1, class A2, class A3, class A4, class A5, class A6, cl
#endif
#ifdef BOOST_BIND_ENABLE_FASTCALL
#if defined(BOOST_BIND_ENABLE_FASTCALL) && !defined(_M_X64)
#define BOOST_BIND_CC __fastcall
#define BOOST_BIND_ST
@ -2197,7 +2197,7 @@ template<class F, class A1, class A2, class A3, class A4, class A5, class A6, cl
#undef BOOST_BIND_MF_CC
#undef BOOST_BIND_MF_NOEXCEPT
#ifdef BOOST_MEM_FN_ENABLE_CDECL
#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64)
#define BOOST_BIND_MF_NAME(X) X##_cdecl
#define BOOST_BIND_MF_CC __cdecl
@ -2212,7 +2212,7 @@ template<class F, class A1, class A2, class A3, class A4, class A5, class A6, cl
#endif
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
#if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64)
#define BOOST_BIND_MF_NAME(X) X##_stdcall
#define BOOST_BIND_MF_CC __stdcall
@ -2227,7 +2227,7 @@ template<class F, class A1, class A2, class A3, class A4, class A5, class A6, cl
#endif
#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
#if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64)
#define BOOST_BIND_MF_NAME(X) X##_fastcall
#define BOOST_BIND_MF_CC __fastcall

View File

@ -49,7 +49,7 @@ template<class V> struct mf
#undef BOOST_MEM_FN_CC
#undef BOOST_MEM_FN_NAME
#ifdef BOOST_MEM_FN_ENABLE_CDECL
#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64)
#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl
#define BOOST_MEM_FN_CC __cdecl
@ -61,7 +61,7 @@ template<class V> struct mf
#endif
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
#if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64)
#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall
#define BOOST_MEM_FN_CC __stdcall
@ -73,7 +73,7 @@ template<class V> struct mf
#endif
#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
#if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64)
#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall
#define BOOST_MEM_FN_CC __fastcall
@ -102,7 +102,7 @@ template<> struct mf<void>
#undef BOOST_MEM_FN_CC
#undef BOOST_MEM_FN_NAME
#ifdef BOOST_MEM_FN_ENABLE_CDECL
#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64)
#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl
#define BOOST_MEM_FN_CC __cdecl
@ -155,7 +155,7 @@ template<> struct mf<void>
#undef BOOST_MEM_FN_NAME2
#undef BOOST_MEM_FN_CC
#ifdef BOOST_MEM_FN_ENABLE_CDECL
#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64)
#define BOOST_MEM_FN_NAME(X) X##_cdecl
#define BOOST_MEM_FN_NAME2(X) inner_##X##_cdecl
@ -217,7 +217,7 @@ namespace _mfi
#undef BOOST_MEM_FN_CC
#undef BOOST_MEM_FN_NAME
#ifdef BOOST_MEM_FN_ENABLE_CDECL
#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64)
#define BOOST_MEM_FN_NAME(X) X##_cdecl
#define BOOST_MEM_FN_CC __cdecl
@ -229,7 +229,7 @@ namespace _mfi
#endif
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
#if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64)
#define BOOST_MEM_FN_NAME(X) X##_stdcall
#define BOOST_MEM_FN_CC __stdcall
@ -241,7 +241,7 @@ namespace _mfi
#endif
#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
#if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64)
#define BOOST_MEM_FN_NAME(X) X##_fastcall
#define BOOST_MEM_FN_CC __fastcall
@ -270,7 +270,7 @@ namespace _mfi
#undef BOOST_MEM_FN_NAME
#undef BOOST_MEM_FN_CC
#ifdef BOOST_MEM_FN_ENABLE_CDECL
#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64)
#define BOOST_MEM_FN_NAME(X) X##_cdecl
#define BOOST_MEM_FN_CC __cdecl
@ -282,7 +282,7 @@ namespace _mfi
#endif
#ifdef BOOST_MEM_FN_ENABLE_STDCALL
#if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64)
#define BOOST_MEM_FN_NAME(X) X##_stdcall
#define BOOST_MEM_FN_CC __stdcall
@ -294,7 +294,7 @@ namespace _mfi
#endif
#ifdef BOOST_MEM_FN_ENABLE_FASTCALL
#if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64)
#define BOOST_MEM_FN_NAME(X) X##_fastcall
#define BOOST_MEM_FN_CC __fastcall

View File

@ -99,7 +99,8 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
#if defined(BOOST_MSVC) \
|| defined(__BORLANDC__) \
|| (defined(__MWERKS__) && defined(_WIN32) && (__MWERKS__ >= 0x3000)) \
|| (defined(__ICL) && defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200))
|| (defined(__ICL) && defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200)) \
|| (defined(BOOST_CLANG) && defined(BOOST_WINDOWS) && defined(_MSC_VER) && (__clang_major__ >= 4))
#ifndef BOOST_VERSION_HPP
# include <boost/version.hpp>
@ -203,6 +204,11 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
// Metrowerks CodeWarrior 9.x
# define BOOST_LIB_TOOLSET "cw9"
# elif defined(BOOST_CLANG) && defined(BOOST_WINDOWS) && defined(_MSC_VER) && (__clang_major__ >= 4)
// Clang on Windows
# define BOOST_LIB_TOOLSET "clangw" BOOST_STRINGIZE(__clang_major__)
# endif
#endif // BOOST_LIB_TOOLSET

View File

@ -309,8 +309,8 @@
# define BOOST_FALLTHROUGH __attribute__((fallthrough))
#endif
#ifdef __MINGW32__
// Currently (June 2017) thread_local is broken on mingw for all current compiler releases, see
#if defined(__MINGW32__) && !defined(__MINGW64__)
// Currently (March 2019) thread_local is broken on mingw for all current 32bit compiler releases, see
// https://sourceforge.net/p/mingw-w64/bugs/527/
// Not setting this causes program termination on thread exit.
#define BOOST_NO_CXX11_THREAD_LOCAL
@ -327,7 +327,7 @@
//
// __builtin_unreachable:
#if BOOST_GCC_VERSION >= 40800
#if BOOST_GCC_VERSION >= 40500
#define BOOST_UNREACHABLE_RETURN(x) __builtin_unreachable();
#endif

View File

@ -43,6 +43,9 @@
# error "Compiler not supported or configured - please reconfigure"
#endif
// VS2005 (VC8) docs: __assume has been in Visual C++ for multiple releases
#define BOOST_UNREACHABLE_RETURN(x) __assume(0);
#if _MSC_FULL_VER < 180020827
# define BOOST_NO_FENV_H
#endif
@ -202,8 +205,9 @@
#if (_MSC_VER < 1911) || (_MSVC_LANG < 201703)
# define BOOST_NO_CXX17_STRUCTURED_BINDINGS
# define BOOST_NO_CXX17_IF_CONSTEXPR
# define BOOST_NO_CXX17_HDR_OPTIONAL
# define BOOST_NO_CXX17_HDR_STRING_VIEW
// Let the defaults handle these now:
//# define BOOST_NO_CXX17_HDR_OPTIONAL
//# define BOOST_NO_CXX17_HDR_STRING_VIEW
#endif
// MSVC including version 14 has not yet completely
@ -313,7 +317,7 @@
# endif
# else
# if _MSC_VER < 1200
// Note: Versions up to 7.0 aren't supported.
// Note: Versions up to 10.0 aren't supported.
# define BOOST_COMPILER_VERSION 5.0
# elif _MSC_VER < 1300
# define BOOST_COMPILER_VERSION 6.0
@ -335,6 +339,8 @@
# define BOOST_COMPILER_VERSION 14.0
# elif _MSC_VER < 1920
# define BOOST_COMPILER_VERSION 14.1
# elif _MSC_VER < 1930
# define BOOST_COMPILER_VERSION 14.2
# else
# define BOOST_COMPILER_VERSION _MSC_VER
# endif
@ -346,8 +352,8 @@
#include <boost/config/pragma_message.hpp>
//
// last known and checked version is 19.12.25830.2 (VC++ 2017.3):
#if (_MSC_VER > 1912)
// last known and checked version is 19.20.27508 (VC++ 2019 RC3):
#if (_MSC_VER > 1920)
# if defined(BOOST_ASSERT_CONFIG)
# error "Boost.Config is older than your current compiler version."
# elif !defined(BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE)

View File

@ -992,6 +992,23 @@ namespace std{ using ::type_info; }
#ifndef BOOST_ATTRIBUTE_UNUSED
# define BOOST_ATTRIBUTE_UNUSED
#endif
//
// [[nodiscard]]:
//
#ifdef __has_cpp_attribute
#if __has_cpp_attribute(nodiscard)
# define BOOST_ATTRIBUTE_NODISCARD [[nodiscard]]
#endif
#if __has_cpp_attribute(no_unique_address) && !(defined(__GNUC__) && (__cplusplus < 201100))
# define BOOST_ATTRIBUTE_NO_UNIQUE_ADDRESS [[no_unique_address]]
#endif
#endif
#ifndef BOOST_ATTRIBUTE_NODISCARD
# define BOOST_ATTRIBUTE_NODISCARD
#endif
#ifndef BOOST_ATTRIBUTE_NO_UNIQUE_ADDRESS
# define BOOST_ATTRIBUTE_NO_UNIQUE_ADDRESS
#endif
#define BOOST_STATIC_CONSTEXPR static BOOST_CONSTEXPR_OR_CONST
@ -1027,6 +1044,7 @@ namespace std{ using ::type_info; }
#if !defined(__has_include)
# define BOOST_NO_CXX17_HDR_OPTIONAL
# define BOOST_NO_CXX17_HDR_STRING_VIEW
# define BOOST_NO_CXX17_HDR_VARIANT
#else
#if !__has_include(<optional>)
# define BOOST_NO_CXX17_HDR_OPTIONAL
@ -1034,6 +1052,9 @@ namespace std{ using ::type_info; }
#if !__has_include(<string_view>)
# define BOOST_NO_CXX17_HDR_STRING_VIEW
#endif
#if !__has_include(<variant>)
# define BOOST_NO_CXX17_HDR_VARIANT
#endif
#endif
//

View File

@ -12,40 +12,17 @@
// like (GCC 2.96) . Do not even think of getting this to work,
// a miserable failure will be guaranteed!
//
// Equally, this file has been tested for RTPs (Real Time Processes)
// only, not for DKMs (Downloadable Kernel Modules). These two types
// of executables differ largely in the available functionality of
// the C-library, STL, and so on. A DKM uses a C89 library with no
// wide character support and no guarantee of ANSI C. The same Dinkum
// VxWorks supports C++ linkage in the kernel with
// DKMs (Downloadable Kernel Modules). But, until recently
// the kernel used a C89 library with no
// wide character support and no guarantee of ANSI C.
// Regardless of the C library the same Dinkum
// STL library is used in both contexts.
//
// Similarly the Dinkum abridged STL that supports the loosely specified
// embedded C++ standard has not been tested and is unlikely to work
// on anything but the simplest library.
// ====================================================================
//
// Additional Configuration
// -------------------------------------------------------------------
//
// Because of the ordering of include files and other issues the following
// additional definitions worked better outside this file.
//
// When building the log library add the following to the b2 invocation
// define=BOOST_LOG_WITHOUT_IPC
// and
// -DBOOST_LOG_WITHOUT_DEFAULT_FACTORIES
// to your compile options.
//
// When building the test library add
// -DBOOST_TEST_LIMITED_SIGNAL_DETAILS
// to your compile options
//
// When building containers library add
// -DHAVE_MORECORE=0
// to your c compile options so dlmalloc heap library is compiled
// without brk() calls
//
// ====================================================================
//
// Some important information regarding the usage of POSIX semaphores:
// -------------------------------------------------------------------
@ -112,30 +89,20 @@
// --------------------------------
#define BOOST_PLATFORM "vxWorks"
// Special behaviour for DKMs:
#ifdef _WRS_KERNEL
// DKMs do not have the <cwchar>-header,
// but apparently they do have an intrinsic wchar_t meanwhile!
# define BOOST_NO_CWCHAR
// Lots of wide-functions and -headers are unavailable for DKMs as well:
# define BOOST_NO_CWCTYPE
# define BOOST_NO_SWPRINTF
# define BOOST_NO_STD_WSTRING
# define BOOST_NO_STD_WSTREAMBUF
#endif
// Generally available headers:
#define BOOST_HAS_UNISTD_H
#define BOOST_HAS_STDINT_H
#define BOOST_HAS_DIRENT_H
#define BOOST_HAS_SLIST
//#define BOOST_HAS_SLIST
// vxWorks does not have installed an iconv-library by default,
// so unfortunately no Unicode support from scratch is available!
// Thus, instead it is suggested to switch to ICU, as this seems
// to be the most complete and portable option...
#define BOOST_LOCALE_WITH_ICU
#ifndef BOOST_LOCALE_WITH_ICU
#define BOOST_LOCALE_WITH_ICU
#endif
// Generally available functionality:
#define BOOST_HAS_THREADS
@ -170,16 +137,18 @@
# ifndef _POSIX_THREADS
# define _POSIX_THREADS 1
# endif
// no sysconf( _SC_PAGESIZE) in kernel
# define BOOST_THREAD_USES_GETPAGESIZE
#endif
#if (_WRS_VXWORKS_MAJOR < 7)
// vxWorks-around: <time.h> #defines CLOCKS_PER_SEC as sysClkRateGet() but
// miserably fails to #include the required <sysLib.h> to make
// sysClkRateGet() available! So we manually include it here.
#ifdef __RTP__
# include <time.h>
# include <sysLib.h>
#endif
# ifdef __RTP__
# include <time.h>
# include <sysLib.h>
# endif
// vxWorks-around: In <stdint.h> the macros INT32_C(), UINT32_C(), INT64_C() and
// UINT64_C() are defined erroneously, yielding not a signed/
@ -188,30 +157,47 @@
// when trying to define several constants which do not fit into a
// long type! We correct them here by redefining.
#include <cstdint>
# include <cstdint>
// Special behaviour for DKMs:
// Some macro-magic to do the job
#define VX_JOIN(X, Y) VX_DO_JOIN(X, Y)
#define VX_DO_JOIN(X, Y) VX_DO_JOIN2(X, Y)
#define VX_DO_JOIN2(X, Y) X##Y
# define VX_JOIN(X, Y) VX_DO_JOIN(X, Y)
# define VX_DO_JOIN(X, Y) VX_DO_JOIN2(X, Y)
# define VX_DO_JOIN2(X, Y) X##Y
// Correctly setup the macros
#undef INT32_C
#undef UINT32_C
#undef INT64_C
#undef UINT64_C
#define INT32_C(x) VX_JOIN(x, L)
#define UINT32_C(x) VX_JOIN(x, UL)
#define INT64_C(x) VX_JOIN(x, LL)
#define UINT64_C(x) VX_JOIN(x, ULL)
# undef INT32_C
# undef UINT32_C
# undef INT64_C
# undef UINT64_C
# define INT32_C(x) VX_JOIN(x, L)
# define UINT32_C(x) VX_JOIN(x, UL)
# define INT64_C(x) VX_JOIN(x, LL)
# define UINT64_C(x) VX_JOIN(x, ULL)
// #include Libraries required for the following function adaption
#include <sys/time.h>
# include <sys/time.h>
#endif // _WRS_VXWORKS_MAJOR < 7
#include <ioLib.h>
#include <tickLib.h>
#if defined(_WRS_KERNEL) && (_CPPLIB_VER < 700)
// recent kernels use Dinkum clib v7.00+
// with widechar but older kernels
// do not have the <cwchar>-header,
// but apparently they do have an intrinsic wchar_t meanwhile!
# define BOOST_NO_CWCHAR
// Lots of wide-functions and -headers are unavailable for DKMs as well:
# define BOOST_NO_CWCTYPE
# define BOOST_NO_SWPRINTF
# define BOOST_NO_STD_WSTRING
# define BOOST_NO_STD_WSTREAMBUF
#endif
// Use C-linkage for the following helper functions
#ifdef __cplusplus
extern "C" {
@ -253,9 +239,9 @@ inline int truncate(const char *p, off_t l){
}
#ifdef __GNUC__
#define ___unused __attribute__((unused))
# define ___unused __attribute__((unused))
#else
#define ___unused
# define ___unused
#endif
// Fake symlink handling by dummy functions:
@ -291,7 +277,7 @@ inline int gettimeofday(struct timeval *tv, void * /*tzv*/) {
* to avoid conflict with MPL operator times
*/
#if (_WRS_VXWORKS_MAJOR < 7)
#ifdef __cplusplus
# ifdef __cplusplus
// vxWorks provides neither struct tms nor function times()!
// We implement an empty dummy-function, simply setting the user
@ -327,7 +313,7 @@ struct tms{
namespace std {
using ::times;
}
#endif // __cplusplus
# endif // __cplusplus
#endif // _WRS_VXWORKS_MAJOR < 7
@ -336,16 +322,16 @@ extern "C" void bzero (void *, size_t); // FD_ZERO uses bzero() but does
// Put the selfmade functions into the std-namespace, just in case
namespace std {
# ifdef __RTP__
# ifdef __RTP__
using ::getrlimit;
using ::setrlimit;
# endif
# endif
using ::truncate;
using ::symlink;
using ::readlink;
#if (_WRS_VXWORKS_MAJOR < 7)
# if (_WRS_VXWORKS_MAJOR < 7)
using ::gettimeofday;
#endif
# endif
}
#endif // __cplusplus
@ -355,10 +341,12 @@ namespace std {
// Include signal.h which might contain a typo to be corrected here
#include <signal.h>
#if (_WRS_VXWORKS_MAJOR < 7)
#define getpagesize() sysconf(_SC_PAGESIZE) // getpagesize is deprecated anyway!
# define getpagesize() sysconf(_SC_PAGESIZE) // getpagesize is deprecated anyway!
inline int lstat(p, b) { return stat(p, b); } // lstat() == stat(), as vxWorks has no symlinks!
#endif
#ifndef S_ISSOCK
# define S_ISSOCK(mode) ((mode & S_IFMT) == S_IFSOCK) // Is file a socket?
#endif
@ -379,7 +367,7 @@ typedef int locale_t; // locale_t is a POSIX-ex
// vxWorks 7 adds C++11 support
// however it is optional, and does not match exactly the support determined
// by examining the Dinkum STL version and GCC version (or ICC and DCC)
#ifndef _WRS_CONFIG_LANG_LIB_CPLUS_CPLUS_USER_2011
#if !( defined( _WRS_CONFIG_LANG_LIB_CPLUS_CPLUS_USER_2011) || defined(_WRS_CONFIG_LIBCPLUS_STD))
# define BOOST_NO_CXX11_ADDRESSOF // C11 addressof operator on memory location
# define BOOST_NO_CXX11_ALLOCATOR
# define BOOST_NO_CXX11_ATOMIC_SMART_PTR
@ -408,9 +396,9 @@ typedef int locale_t; // locale_t is a POSIX-ex
# define BOOST_NO_CXX11_HDR_UNORDERED_MAP
# define BOOST_NO_CXX11_HDR_UNORDERED_SET
#else
#ifndef BOOST_SYSTEM_NO_DEPRECATED
# define BOOST_SYSTEM_NO_DEPRECATED // workaround link error in spirit
#endif
# ifndef BOOST_SYSTEM_NO_DEPRECATED
# define BOOST_SYSTEM_NO_DEPRECATED // workaround link error in spirit
# endif
#endif
@ -418,6 +406,8 @@ typedef int locale_t; // locale_t is a POSIX-ex
#undef NONE
// restrict is an iostreams class
#undef restrict
// affects some typeof tests
#undef V7
// use fake poll() from Unix layer in ASIO to get full functionality
// most libraries will use select() but this define allows 'iostream' functionality
@ -430,4 +420,3 @@ typedef int locale_t; // locale_t is a POSIX-ex
# define BOOST_ASIO_DISABLE_SERIAL_PORT
#endif

View File

@ -174,6 +174,9 @@
#if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) || !defined(BOOST_MSVC) || (BOOST_MSVC < 1910) || !defined(_HAS_CXX17) || (_HAS_CXX17 == 0)
# define BOOST_NO_CXX17_STD_APPLY
# define BOOST_NO_CXX17_ITERATOR_TRAITS
# define BOOST_NO_CXX17_HDR_STRING_VIEW
# define BOOST_NO_CXX17_HDR_OPTIONAL
# define BOOST_NO_CXX17_HDR_VARIANT
#endif
#if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) || !defined(_HAS_CXX17) || (_HAS_CXX17 == 0) || !defined(_MSVC_STL_UPDATE) || (_MSVC_STL_UPDATE < 201709)
# define BOOST_NO_CXX17_STD_INVOKE

View File

@ -91,6 +91,7 @@
# define BOOST_NO_CXX17_STD_APPLY
# define BOOST_NO_CXX17_HDR_OPTIONAL
# define BOOST_NO_CXX17_HDR_STRING_VIEW
# define BOOST_NO_CXX17_HDR_VARIANT
#endif
#if (_LIBCPP_VERSION > 4000) && (__cplusplus > 201402L) && !defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
# define BOOST_NO_AUTO_PTR

View File

@ -301,6 +301,7 @@ extern "C" char *gets (char *__s);
# define BOOST_NO_CXX17_STD_APPLY
# define BOOST_NO_CXX17_HDR_OPTIONAL
# define BOOST_NO_CXX17_HDR_STRING_VIEW
# define BOOST_NO_CXX17_HDR_VARIANT
#endif
#if defined(__has_include)

View File

@ -77,7 +77,7 @@ namespace container {
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
template<class T, class VoidAllocator>
template<class T, class VoidAllocator, class Options>
class small_vector_allocator;
namespace allocator_traits_detail {
@ -99,8 +99,8 @@ template<class T>
struct is_std_allocator< std::allocator<T> >
{ static const bool value = true; };
template<class T>
struct is_std_allocator< small_vector_allocator<T, std::allocator<T> > >
template<class T, class Options>
struct is_std_allocator< small_vector_allocator<T, std::allocator<T>, Options > >
{ static const bool value = true; };
template<class Allocator>

View File

@ -24,6 +24,7 @@
//! - boost::container::vector
//! - boost::container::stable_vector
//! - boost::container::static_vector
//! - boost::container::small_vector_base
//! - boost::container::small_vector
//! - boost::container::slist
//! - boost::container::list
@ -105,15 +106,25 @@ template <class T
,class Allocator = void >
class stable_vector;
template <class T, std::size_t Capacity>
template < class T
, std::size_t Capacity
, class Options = void>
class static_vector;
template < class T, std::size_t N
, class Allocator = void >
template < class T
, class Allocator = void
, class Options = void >
class small_vector_base;
template < class T
, std::size_t N
, class Allocator = void
, class Options = void >
class small_vector;
template <class T
,class Allocator = void >
,class Allocator = void
,class Options = void>
class deque;
template <class T

View File

@ -128,7 +128,7 @@ struct insert_value_initialized_n_proxy
void copy_n_and_update(Allocator &a, Iterator p, size_type n) const
{
for (; 0 < n; --n, ++p){
typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;
value_type *vp = reinterpret_cast<value_type *>(v.data);
alloc_traits::construct(a, vp);
value_destructor<Allocator> on_exit(a, *vp); (void)on_exit;
@ -151,7 +151,7 @@ struct insert_default_initialized_n_proxy
{
if(!is_pod<value_type>::value){
for (; 0 < n; --n, ++p){
typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;
value_type *vp = reinterpret_cast<value_type *>(v.data);
alloc_traits::construct(a, vp, default_init);
value_destructor<Allocator> on_exit(a, *vp); (void)on_exit;
@ -195,17 +195,17 @@ struct insert_move_proxy
typedef typename alloc_traits::size_type size_type;
typedef typename alloc_traits::value_type value_type;
explicit insert_move_proxy(value_type &v)
BOOST_CONTAINER_FORCEINLINE explicit insert_move_proxy(value_type &v)
: v_(v)
{}
void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n) const
BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n) const
{
BOOST_ASSERT(n == 1); (void)n;
alloc_traits::construct( a, boost::movelib::iterator_to_raw_pointer(p), ::boost::move(v_) );
}
void copy_n_and_update(Allocator &, Iterator p, size_type n) const
BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, size_type n) const
{
BOOST_ASSERT(n == 1); (void)n;
*p = ::boost::move(v_);
@ -288,7 +288,7 @@ struct insert_emplace_proxy
void priv_copy_some_and_update(Allocator &a, const index_tuple<IdxPack...>&, Iterator p, size_type n)
{
BOOST_ASSERT(n ==1); (void)n;
typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;
value_type *vp = reinterpret_cast<value_type *>(v.data);
alloc_traits::construct(a, vp,
::boost::forward<Args>(get<IdxPack>(this->args_))...);
@ -398,7 +398,7 @@ struct insert_emplace_proxy_arg##N\
void copy_n_and_update(Allocator &a, Iterator p, size_type n)\
{\
BOOST_ASSERT(n == 1); (void)n;\
typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;\
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;\
BOOST_ASSERT((((size_type)(&v)) % alignment_of<value_type>::value) == 0);\
value_type *vp = reinterpret_cast<value_type *>(v.data);\
alloc_traits::construct(a, vp BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\

View File

@ -19,6 +19,7 @@
#endif
#include <boost/container/allocator_traits.hpp>
#include <boost/container/container_fwd.hpp>
namespace boost {
@ -33,14 +34,14 @@ namespace dtl {
template <template <class, class, class...> class Cont, typename V, typename A, class... An, class U>
struct container_rebind<Cont<V, A, An...>, U>
{
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, An...> type;
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, An...> type;
};
//Needed for non-conforming compilers like GCC 4.3
template <template <class, class> class Cont, typename V, typename A, class U>
struct container_rebind<Cont<V, A>, U>
{
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type> type;
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type> type;
};
template <template <class> class Cont, typename V, class U>
@ -49,27 +50,6 @@ namespace dtl {
typedef Cont<U> type;
};
//for small_vector,static_vector
template <template <class, std::size_t, class, class...> class Cont, typename V, std::size_t N, typename A, class... An, class U>
struct container_rebind<Cont<V, N, A, An...>, U>
{
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, An...> type;
};
//Needed for non-conforming compilers like GCC 4.3
template <template <class, std::size_t, class> class Cont, typename V, std::size_t N, typename A, class U>
struct container_rebind<Cont<V, N, A>, U>
{
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type> type;
};
template <template <class, std::size_t> class Cont, typename V, std::size_t N, class U>
struct container_rebind<Cont<V, N>, U>
{
typedef Cont<U, N> type;
};
#else //C++03 compilers
template <template <class> class Cont //0arg
@ -85,7 +65,7 @@ namespace dtl {
, class U>
struct container_rebind<Cont<V, A>, U>
{
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type> type;
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type> type;
};
template <template <class, class, class> class Cont //1arg
@ -93,7 +73,7 @@ namespace dtl {
, class U>
struct container_rebind<Cont<V, A, P0>, U>
{
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0> type;
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0> type;
};
template <template <class, class, class, class> class Cont //2arg
@ -101,7 +81,7 @@ namespace dtl {
, class U>
struct container_rebind<Cont<V, A, P0, P1>, U>
{
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1> type;
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1> type;
};
template <template <class, class, class, class, class> class Cont //3arg
@ -109,7 +89,7 @@ namespace dtl {
, class U>
struct container_rebind<Cont<V, A, P0, P1, P2>, U>
{
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2> type;
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1, P2> type;
};
template <template <class, class, class, class, class, class> class Cont //4arg
@ -117,7 +97,7 @@ namespace dtl {
, class U>
struct container_rebind<Cont<V, A, P0, P1, P2, P3>, U>
{
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3> type;
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3> type;
};
template <template <class, class, class, class, class, class, class> class Cont //5arg
@ -125,7 +105,7 @@ namespace dtl {
, class U>
struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4>, U>
{
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4> type;
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4> type;
};
template <template <class, class, class, class, class, class, class, class> class Cont //6arg
@ -133,7 +113,7 @@ namespace dtl {
, class U>
struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5>, U>
{
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5> type;
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5> type;
};
template <template <class, class, class, class, class, class, class, class, class> class Cont //7arg
@ -141,7 +121,7 @@ namespace dtl {
, class U>
struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5, P6>, U>
{
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6> type;
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6> type;
};
template <template <class, class, class, class, class, class, class, class, class, class> class Cont //8arg
@ -149,7 +129,7 @@ namespace dtl {
, class U>
struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5, P6, P7>, U>
{
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6, P7> type;
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6, P7> type;
};
template <template <class, class, class, class, class, class, class, class, class, class, class> class Cont //9arg
@ -157,100 +137,25 @@ namespace dtl {
, class U>
struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5, P6, P7, P8>, U>
{
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6, P7, P8> type;
};
//For small_vector/static_vector
template <template <class, std::size_t> class Cont //0arg
, typename V, std::size_t N
, class U>
struct container_rebind<Cont<V, N>, U>
{
typedef Cont<U, N> type;
};
template <template <class, std::size_t, class> class Cont //0arg
, typename V, std::size_t N, typename A
, class U>
struct container_rebind<Cont<V, N, A>, U>
{
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type> type;
};
template <template <class, std::size_t, class, class> class Cont //1arg
, typename V, std::size_t N, typename A, class P0
, class U>
struct container_rebind<Cont<V, N, A, P0>, U>
{
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0> type;
};
template <template <class, std::size_t, class, class, class> class Cont //2arg
, typename V, std::size_t N, typename A, class P0, class P1
, class U>
struct container_rebind<Cont<V, N, A, P0, P1>, U>
{
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1> type;
};
template <template <class, std::size_t, class, class, class, class> class Cont //3arg
, typename V, std::size_t N, typename A, class P0, class P1, class P2
, class U>
struct container_rebind<Cont<V, N, A, P0, P1, P2>, U>
{
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2> type;
};
template <template <class, std::size_t, class, class, class, class, class> class Cont //4arg
, typename V, std::size_t N, typename A, class P0, class P1, class P2, class P3
, class U>
struct container_rebind<Cont<V, N, A, P0, P1, P2, P3>, U>
{
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3> type;
};
template <template <class, std::size_t, class, class, class, class, class, class> class Cont //5arg
, typename V, std::size_t N, typename A, class P0, class P1, class P2, class P3, class P4
, class U>
struct container_rebind<Cont<V, N, A, P0, P1, P2, P3, P4>, U>
{
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4> type;
};
template <template <class, std::size_t, class, class, class, class, class, class, class> class Cont //6arg
, typename V, std::size_t N, typename A, class P0, class P1, class P2, class P3, class P4, class P5
, class U>
struct container_rebind<Cont<V, N, A, P0, P1, P2, P3, P4, P5>, U>
{
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5> type;
};
template <template <class, std::size_t, class, class, class, class, class, class, class, class> class Cont //7arg
, typename V, std::size_t N, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6
, class U>
struct container_rebind<Cont<V, N, A, P0, P1, P2, P3, P4, P5, P6>, U>
{
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6> type;
};
template <template <class, std::size_t, class, class, class, class, class, class, class, class, class> class Cont //8arg
, typename V, std::size_t N, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7
, class U>
struct container_rebind<Cont<V, N, A, P0, P1, P2, P3, P4, P5, P6, P7>, U>
{
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6, P7> type;
};
template <template <class, std::size_t, class, class, class, class, class, class, class, class, class, class> class Cont //9arg
, typename V, std::size_t N, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8
, class U>
struct container_rebind<Cont<V, N, A, P0, P1, P2, P3, P4, P5, P6, P7, P8>, U>
{
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6, P7, P8> type;
typedef Cont<U, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6, P7, P8> type;
};
#endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
//for small_vector,static_vector
template <typename V, std::size_t N, typename A, class U>
struct container_rebind<small_vector<V, N, A>, U>
{
typedef small_vector<U, N, typename allocator_traits<typename real_allocator<V, A>::type>::template portable_rebind_alloc<U>::type> type;
};
template <typename V, std::size_t N, typename O, class U>
struct container_rebind<static_vector<V, N, O>, U>
{
typedef static_vector<U, N, O> type;
};
} //namespace dtl {
} //namespace container {
} //namespace boost {

View File

@ -177,8 +177,7 @@ inline F memmove(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW
value_type *const dest_raw = boost::movelib::iterator_to_raw_pointer(r);
const value_type *const beg_raw = boost::movelib::iterator_to_raw_pointer(f);
const value_type *const end_raw = boost::movelib::iterator_to_raw_pointer(l);
if(BOOST_LIKELY(beg_raw != end_raw)){
BOOST_ASSERT(beg_raw != 0);
if(BOOST_LIKELY(beg_raw != end_raw && dest_raw && beg_raw)){
const typename boost::container::iterator_traits<I>::difference_type n = end_raw - beg_raw;
std::memmove(dest_raw, beg_raw, sizeof(value_type)*n);
boost::container::iterator_advance(r, n);
@ -522,9 +521,9 @@ inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, I>::type
{
F back = r;
BOOST_TRY{
while (n--) {
while (n) {
boost::container::construct_in_place(a, boost::movelib::iterator_to_raw_pointer(r), f);
++f; ++r;
++f; ++r; --n;
}
}
BOOST_CATCH(...){

View File

@ -205,7 +205,7 @@ BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_unique //has_merge_unique == f
size_type const old_sz = dest.size();
iterator const first_new = dest.insert(dest.cend(), first, last );
iterator e = boost::movelib::inplace_set_difference(first_new, dest.end(), dest.begin(), first_new, comp);
iterator e = boost::movelib::inplace_set_unique_difference(first_new, dest.end(), dest.begin(), first_new, comp);
dest.erase(e, dest.end());
dtl::bool_<is_contiguous_container<SequenceContainer>::value> contiguous_tag;
(flat_tree_container_inplace_merge)(dest, dest.begin()+old_sz, comp, contiguous_tag);
@ -883,10 +883,14 @@ class flat_tree
//Step 3: only left unique values from the back not already present in the original range
typename container_type::iterator const e = boost::movelib::inplace_set_unique_difference
(it, seq.end(), seq.begin(), it, val_cmp);
seq.erase(e, seq.cend());
//Step 4: merge both ranges
(flat_tree_container_inplace_merge)(seq, it, this->priv_value_comp(), contiguous_tag);
seq.erase(e, seq.cend());
//it might be invalidated by erasing [e, seq.end) if e == it
if (it != e)
{
//Step 4: merge both ranges
(flat_tree_container_inplace_merge)(seq, it, this->priv_value_comp(), contiguous_tag);
}
}
template <class InIt>
@ -922,7 +926,7 @@ class flat_tree
template <class... Args>
std::pair<iterator, bool> emplace_unique(BOOST_FWD_REF(Args)... args)
{
typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;
value_type *pval = reinterpret_cast<value_type *>(v.data);
get_stored_allocator_noconst_return_t a = this->get_stored_allocator();
stored_allocator_traits::construct(a, pval, ::boost::forward<Args>(args)... );
@ -934,7 +938,7 @@ class flat_tree
iterator emplace_hint_unique(const_iterator hint, BOOST_FWD_REF(Args)... args)
{
//hint checked in insert_unique
typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;
value_type *pval = reinterpret_cast<value_type *>(v.data);
get_stored_allocator_noconst_return_t a = this->get_stored_allocator();
stored_allocator_traits::construct(a, pval, ::boost::forward<Args>(args)... );
@ -945,7 +949,7 @@ class flat_tree
template <class... Args>
iterator emplace_equal(BOOST_FWD_REF(Args)... args)
{
typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;
value_type *pval = reinterpret_cast<value_type *>(v.data);
get_stored_allocator_noconst_return_t a = this->get_stored_allocator();
stored_allocator_traits::construct(a, pval, ::boost::forward<Args>(args)... );
@ -957,7 +961,7 @@ class flat_tree
iterator emplace_hint_equal(const_iterator hint, BOOST_FWD_REF(Args)... args)
{
//hint checked in insert_equal
typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;
value_type *pval = reinterpret_cast<value_type *>(v.data);
get_stored_allocator_noconst_return_t a = this->get_stored_allocator();
stored_allocator_traits::construct(a, pval, ::boost::forward<Args>(args)... );
@ -994,7 +998,7 @@ class flat_tree
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
std::pair<iterator, bool> emplace_unique(BOOST_MOVE_UREF##N)\
{\
typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;\
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;\
value_type *pval = reinterpret_cast<value_type *>(v.data);\
get_stored_allocator_noconst_return_t a = this->get_stored_allocator();\
stored_allocator_traits::construct(a, pval BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
@ -1005,7 +1009,7 @@ class flat_tree
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
iterator emplace_hint_unique(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
{\
typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;\
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;\
value_type *pval = reinterpret_cast<value_type *>(v.data);\
get_stored_allocator_noconst_return_t a = this->get_stored_allocator();\
stored_allocator_traits::construct(a, pval BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
@ -1016,7 +1020,7 @@ class flat_tree
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
iterator emplace_equal(BOOST_MOVE_UREF##N)\
{\
typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;\
typename dtl::aligned_storage<sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;\
value_type *pval = reinterpret_cast<value_type *>(v.data);\
get_stored_allocator_noconst_return_t a = this->get_stored_allocator();\
stored_allocator_traits::construct(a, pval BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
@ -1027,7 +1031,7 @@ class flat_tree
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
iterator emplace_hint_equal(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
{\
typename aligned_storage <sizeof(value_type), alignment_of<value_type>::value>::type v;\
typename dtl::aligned_storage <sizeof(value_type), dtl::alignment_of<value_type>::value>::type v;\
value_type *pval = reinterpret_cast<value_type *>(v.data);\
get_stored_allocator_noconst_return_t a = this->get_stored_allocator();\
stored_allocator_traits::construct(a, pval BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
@ -1601,7 +1605,7 @@ class flat_tree
const Compare &key_cmp = this->m_data.get_comp();
KeyOfValue key_extract;
RanIt lb(this->priv_lower_bound(first, last, k)), ub(lb);
if(lb != last && static_cast<difference_type>(!key_cmp(k, key_extract(*lb)))){
if(lb != last && !key_cmp(k, key_extract(*lb))){
++ub;
}
return std::pair<RanIt, RanIt>(lb, ub);
@ -1618,11 +1622,11 @@ template <class T, class KeyOfValue,
class Compare, class AllocatorOrContainer>
struct has_trivial_destructor_after_move<boost::container::dtl::flat_tree<T, KeyOfValue, Compare, AllocatorOrContainer> >
{
typedef typename boost::container::dtl::select_container_type<T, AllocatorOrContainer>::type container_type;
typedef typename container_type::allocator_type allocator_t;
typedef typename ::boost::container::allocator_traits<allocator_t>::pointer pointer;
static const bool value = ::boost::has_trivial_destructor_after_move<allocator_t>::value &&
::boost::has_trivial_destructor_after_move<pointer>::value;
typedef boost::container::dtl::flat_tree<T, KeyOfValue, Compare, AllocatorOrContainer> flat_tree;
typedef typename flat_tree::container_type container_type;
typedef typename flat_tree::key_compare key_compare;
static const bool value = ::boost::has_trivial_destructor_after_move<container_type>::value &&
::boost::has_trivial_destructor_after_move<key_compare>::value;
};
} //namespace boost {

View File

@ -69,11 +69,11 @@ struct select1st
typedef FirstType type;
template<class T>
const type& operator()(const T& x) const
BOOST_CONTAINER_FORCEINLINE const type& operator()(const T& x) const
{ return x.first; }
template<class T>
type& operator()(T& x)
BOOST_CONTAINER_FORCEINLINE type& operator()(T& x)
{ return const_cast<type&>(x.first); }
};

View File

@ -788,7 +788,7 @@ class tree
tree& operator=(BOOST_COPY_ASSIGN_REF(tree) x)
{
if (&x != this){
if (BOOST_LIKELY(this != &x)) {
NodeAlloc &this_alloc = this->get_stored_allocator();
const NodeAlloc &x_alloc = x.get_stored_allocator();
dtl::bool_<allocator_traits<NodeAlloc>::
@ -822,39 +822,40 @@ class tree
allocator_traits_type::is_always_equal::value) &&
boost::container::dtl::is_nothrow_move_assignable<Compare>::value)
{
BOOST_ASSERT(this != &x);
NodeAlloc &this_alloc = this->node_alloc();
NodeAlloc &x_alloc = x.node_alloc();
const bool propagate_alloc = allocator_traits<NodeAlloc>::
propagate_on_container_move_assignment::value;
const bool allocators_equal = this_alloc == x_alloc; (void)allocators_equal;
//Resources can be transferred if both allocators are
//going to be equal after this function (either propagated or already equal)
if(propagate_alloc || allocators_equal){
//Destroy
this->clear();
//Move allocator if needed
this->AllocHolder::move_assign_alloc(x);
//Obtain resources
this->icont() = boost::move(x.icont());
}
//Else do a one by one move
else{
//Transfer all the nodes to a temporary tree
//If anything goes wrong, all the nodes will be destroyed
//automatically
Icont other_tree(::boost::move(this->icont()));
if (BOOST_LIKELY(this != &x)) {
NodeAlloc &this_alloc = this->node_alloc();
NodeAlloc &x_alloc = x.node_alloc();
const bool propagate_alloc = allocator_traits<NodeAlloc>::
propagate_on_container_move_assignment::value;
const bool allocators_equal = this_alloc == x_alloc; (void)allocators_equal;
//Resources can be transferred if both allocators are
//going to be equal after this function (either propagated or already equal)
if(propagate_alloc || allocators_equal){
//Destroy
this->clear();
//Move allocator if needed
this->AllocHolder::move_assign_alloc(x);
//Obtain resources
this->icont() = boost::move(x.icont());
}
//Else do a one by one move
else{
//Transfer all the nodes to a temporary tree
//If anything goes wrong, all the nodes will be destroyed
//automatically
Icont other_tree(::boost::move(this->icont()));
//Now recreate the source tree reusing nodes stored by other_tree
this->icont().clone_from
(::boost::move(x.icont())
, RecyclingCloner<AllocHolder, true>(*this, other_tree)
, Destroyer(this->node_alloc()));
//Now recreate the source tree reusing nodes stored by other_tree
this->icont().clone_from
(::boost::move(x.icont())
, RecyclingCloner<AllocHolder, true>(*this, other_tree)
, Destroyer(this->node_alloc()));
//If there are remaining nodes, destroy them
NodePtr p;
while((p = other_tree.unlink_leftmost_without_rebalance())){
AllocHolder::destroy_node(p);
//If there are remaining nodes, destroy them
NodePtr p;
while((p = other_tree.unlink_leftmost_without_rebalance())){
AllocHolder::destroy_node(p);
}
}
}
return *this;
@ -1515,8 +1516,9 @@ struct has_trivial_destructor_after_move
<T, KeyOfValue, Compare, Allocator, Options>
>
{
typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value &&
typedef typename ::boost::container::dtl::tree<T, KeyOfValue, Compare, Allocator, Options>::allocator_type allocator_type;
typedef typename ::boost::container::allocator_traits<allocator_type>::pointer pointer;
static const bool value = ::boost::has_trivial_destructor_after_move<allocator_type>::value &&
::boost::has_trivial_destructor_after_move<pointer>::value &&
::boost::has_trivial_destructor_after_move<Compare>::value;
};

View File

@ -45,8 +45,9 @@ namespace impl{
template <class T>
struct extract_version
: T::version
{};
{
typedef typename T::version type;
};
template <class T>
struct has_version
@ -69,7 +70,7 @@ struct version
template <class T>
struct version<T, true>
{
static const unsigned value = extract_version<T>::value;
static const unsigned value = extract_version<T>::type::value;
};
} //namespace impl

View File

@ -788,12 +788,12 @@ class flat_map
//! Complexity: Logarithmic in the size of the container in general, but amortized constant if
//! the new element is inserted just before hint.
template <class M>
BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> insert_or_assign(const_iterator hint, const key_type& k, BOOST_FWD_REF(M) obj)
BOOST_CONTAINER_FORCEINLINE iterator insert_or_assign(const_iterator hint, const key_type& k, BOOST_FWD_REF(M) obj)
{
return dtl::force_copy< std::pair<iterator, bool> >
return dtl::force_copy<iterator>
(this->m_flat_tree.insert_or_assign
( dtl::force_copy<impl_const_iterator>(hint)
, k, ::boost::forward<M>(obj))
, k, ::boost::forward<M>(obj)).first
);
}
@ -812,12 +812,12 @@ class flat_map
//! Complexity: Logarithmic in the size of the container in general, but amortized constant if
//! the new element is inserted just before hint.
template <class M>
BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> insert_or_assign(const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj)
BOOST_CONTAINER_FORCEINLINE iterator insert_or_assign(const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj)
{
return dtl::force_copy< std::pair<iterator, bool> >
return dtl::force_copy<iterator>
(this->m_flat_tree.insert_or_assign
( dtl::force_copy<impl_const_iterator>(hint)
, ::boost::move(k), ::boost::forward<M>(obj))
, ::boost::move(k), ::boost::forward<M>(obj)).first
);
}
@ -1353,7 +1353,9 @@ class flat_map
//! <b>Complexity</b>: log(size())+count(k)
template<class K>
BOOST_CONTAINER_FORCEINLINE size_type count(const K& x) const
{ return static_cast<size_type>(m_flat_tree.find(x) != m_flat_tree.end()); }
//Don't use find() != end optimization here as transparent comparators with key K might
//return a different range than key_type (which can only return a single element range)
{ return m_flat_tree.count(x); }
//! <b>Returns</b>: Returns true if there is an element with key
//! equivalent to key in the container, otherwise false.
@ -1465,7 +1467,9 @@ class flat_map
//! <b>Complexity</b>: Logarithmic.
template<class K>
BOOST_CONTAINER_FORCEINLINE std::pair<iterator,iterator> equal_range(const K& x)
{ return dtl::force_copy<std::pair<iterator,iterator> >(m_flat_tree.lower_bound_range(x)); }
//Don't use lower_bound_range optimization here as transparent comparators with key K might
//return a different range than key_type (which can only return a single element range)
{ return dtl::force_copy<std::pair<iterator,iterator> >(m_flat_tree.equal_range(x)); }
//! <b>Requires</b>: This overload is available only if
//! key_compare::is_transparent exists.
@ -1475,7 +1479,9 @@ class flat_map
//! <b>Complexity</b>: Logarithmic.
template<class K>
BOOST_CONTAINER_FORCEINLINE std::pair<const_iterator, const_iterator> equal_range(const K& x) const
{ return dtl::force_copy<std::pair<const_iterator,const_iterator> >(m_flat_tree.lower_bound_range(x)); }
//Don't use lower_bound_range optimization here as transparent comparators with key K might
//return a different range than key_type (which can only return a single element range)
{ return dtl::force_copy<std::pair<const_iterator,const_iterator> >(m_flat_tree.equal_range(x)); }
//! <b>Effects</b>: Extracts the internal sequence container.
//!
@ -1651,10 +1657,10 @@ flat_map(ordered_unique_range_t, InputIterator, InputIterator, Compare const&, A
template <class Key, class T, class Compare, class AllocatorOrContainer>
struct has_trivial_destructor_after_move<boost::container::flat_map<Key, T, Compare, AllocatorOrContainer> >
{
typedef typename ::boost::container::allocator_traits<AllocatorOrContainer>::pointer pointer;
static const bool value = ::boost::has_trivial_destructor_after_move<AllocatorOrContainer>::value &&
::boost::has_trivial_destructor_after_move<pointer>::value &&
::boost::has_trivial_destructor_after_move<Compare>::value;
typedef ::boost::container::dtl::pair<Key, T> value_t;
typedef typename ::boost::container::dtl::container_or_allocator_rebind<AllocatorOrContainer, value_t>::type alloc_or_cont_t;
typedef ::boost::container::dtl::flat_tree<value_t,::boost::container::dtl::select1st<Key>, Compare, alloc_or_cont_t> tree;
static const bool value = ::boost::has_trivial_destructor_after_move<tree>::value;
};
namespace container {
@ -2961,10 +2967,10 @@ namespace boost {
template <class Key, class T, class Compare, class AllocatorOrContainer>
struct has_trivial_destructor_after_move< boost::container::flat_multimap<Key, T, Compare, AllocatorOrContainer> >
{
typedef typename ::boost::container::allocator_traits<AllocatorOrContainer>::pointer pointer;
static const bool value = ::boost::has_trivial_destructor_after_move<AllocatorOrContainer>::value &&
::boost::has_trivial_destructor_after_move<pointer>::value &&
::boost::has_trivial_destructor_after_move<Compare>::value;
typedef ::boost::container::dtl::pair<Key, T> value_t;
typedef typename ::boost::container::dtl::container_or_allocator_rebind<AllocatorOrContainer, value_t>::type alloc_or_cont_t;
typedef ::boost::container::dtl::flat_tree<value_t,::boost::container::dtl::select1st<Key>, Compare, alloc_or_cont_t> tree;
static const bool value = ::boost::has_trivial_destructor_after_move<tree>::value;
};
} //namespace boost {

View File

@ -925,7 +925,9 @@ class flat_set
//! <b>Complexity</b>: log(size())+count(k)
template<typename K>
BOOST_CONTAINER_FORCEINLINE size_type count(const K& x) const
{ return static_cast<size_type>(this->tree_t::find(x) != this->tree_t::cend()); }
//Don't use find() != end optimization here as transparent comparators with key K might
//return a different range than key_type (which can only return a single element range)
{ return this->tree_t::count(x); }
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@ -1031,7 +1033,9 @@ class flat_set
//! <b>Complexity</b>: Logarithmic
template<typename K>
std::pair<iterator,iterator> equal_range(const K& x)
{ return this->tree_t::lower_bound_range(x); }
//Don't use lower_bound_range optimization here as transparent comparators with key K might
//return a different range than key_type (which can only return a single element range)
{ return this->tree_t::equal_range(x); }
//! <b>Requires</b>: This overload is available only if
//! key_compare::is_transparent exists.
@ -1041,7 +1045,9 @@ class flat_set
//! <b>Complexity</b>: Logarithmic
template<typename K>
std::pair<const_iterator,const_iterator> equal_range(const K& x) const
{ return this->tree_t::lower_bound_range(x); }
//Don't use lower_bound_range optimization here as transparent comparators with key K might
//return a different range than key_type (which can only return a single element range)
{ return this->tree_t::equal_range(x); }
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@ -1192,10 +1198,8 @@ flat_set(ordered_unique_range_t, InputIterator, InputIterator, Compare const&, A
template <class Key, class Compare, class AllocatorOrContainer>
struct has_trivial_destructor_after_move<boost::container::flat_set<Key, Compare, AllocatorOrContainer> >
{
typedef typename ::boost::container::allocator_traits<AllocatorOrContainer>::pointer pointer;
static const bool value = ::boost::has_trivial_destructor_after_move<AllocatorOrContainer>::value &&
::boost::has_trivial_destructor_after_move<pointer>::value &&
::boost::has_trivial_destructor_after_move<Compare>::value;
typedef ::boost::container::dtl::flat_tree<Key, ::boost::container::dtl::identity<Key>, Compare, AllocatorOrContainer> tree;
static const bool value = ::boost::has_trivial_destructor_after_move<tree>::value;
};
namespace container {
@ -1926,10 +1930,8 @@ flat_multiset(ordered_range_t, InputIterator, InputIterator, Compare const&, All
template <class Key, class Compare, class AllocatorOrContainer>
struct has_trivial_destructor_after_move<boost::container::flat_multiset<Key, Compare, AllocatorOrContainer> >
{
typedef typename ::boost::container::allocator_traits<AllocatorOrContainer>::pointer pointer;
static const bool value = ::boost::has_trivial_destructor_after_move<AllocatorOrContainer>::value &&
::boost::has_trivial_destructor_after_move<pointer>::value &&
::boost::has_trivial_destructor_after_move<Compare>::value;
typedef ::boost::container::dtl::flat_tree<Key, ::boost::container::dtl::identity<Key>, Compare, AllocatorOrContainer> tree;
static const bool value = ::boost::has_trivial_destructor_after_move<tree>::value;
};
namespace container {

View File

@ -629,7 +629,7 @@ class map
//! the new element is inserted just before hint.
template <class M>
BOOST_CONTAINER_FORCEINLINE iterator insert_or_assign(const_iterator hint, const key_type& k, BOOST_FWD_REF(M) obj)
{ return this->base_t::insert_or_assign(hint, k, ::boost::forward<M>(obj)); }
{ return this->base_t::insert_or_assign(hint, k, ::boost::forward<M>(obj)).first; }
//! <b>Effects</b>: If a key equivalent to k already exists in the container, assigns forward<M>(obj)
//! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value
@ -647,7 +647,7 @@ class map
//! the new element is inserted just before hint.
template <class M>
BOOST_CONTAINER_FORCEINLINE iterator insert_or_assign(const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj)
{ return this->base_t::insert_or_assign(hint, ::boost::move(k), ::boost::forward<M>(obj)); }
{ return this->base_t::insert_or_assign(hint, ::boost::move(k), ::boost::forward<M>(obj)).first; }
//! <b>Returns</b>: A reference to the element whose key is equivalent to x.
//! Throws: An exception object of type out_of_range if no such element is present.
@ -1366,13 +1366,11 @@ map(ordered_unique_range_t, InputIterator, InputIterator, Compare const&, Alloca
//!has_trivial_destructor_after_move<> == true_type
//!specialization for optimizations
template <class Key, class T, class Compare, class Allocator>
struct has_trivial_destructor_after_move<boost::container::map<Key, T, Compare, Allocator> >
template <class Key, class T, class Compare, class Allocator, class Options>
struct has_trivial_destructor_after_move<boost::container::map<Key, T, Compare, Allocator, Options> >
{
typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value &&
::boost::has_trivial_destructor_after_move<pointer>::value &&
::boost::has_trivial_destructor_after_move<Compare>::value;
typedef ::boost::container::dtl::tree<std::pair<const Key, T>, int, Compare, Allocator, Options> tree;
static const bool value = ::boost::has_trivial_destructor_after_move<tree>::value;
};
namespace container {
@ -2292,13 +2290,11 @@ multimap(ordered_range_t, InputIterator, InputIterator, Compare const&, Allocato
//!has_trivial_destructor_after_move<> == true_type
//!specialization for optimizations
template <class Key, class T, class Compare, class Allocator>
struct has_trivial_destructor_after_move<boost::container::multimap<Key, T, Compare, Allocator> >
template <class Key, class T, class Compare, class Allocator, class Options>
struct has_trivial_destructor_after_move<boost::container::multimap<Key, T, Compare, Allocator, Options> >
{
typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value &&
::boost::has_trivial_destructor_after_move<pointer>::value &&
::boost::has_trivial_destructor_after_move<Compare>::value;
typedef ::boost::container::dtl::tree<std::pair<const Key, T>, int, Compare, Allocator, Options> tree;
static const bool value = ::boost::has_trivial_destructor_after_move<tree>::value;
};
namespace container {

View File

@ -72,6 +72,13 @@ class new_allocator<void>
new_allocator(const new_allocator &) BOOST_NOEXCEPT_OR_NOTHROW
{}
//!Copy assignment operator from other new_allocator.
//!Never throws
new_allocator& operator=(const new_allocator &) BOOST_NOEXCEPT_OR_NOTHROW
{
return *this;
}
//!Constructor from related new_allocator.
//!Never throws
template<class T2>
@ -130,6 +137,13 @@ class new_allocator
new_allocator(const new_allocator &) BOOST_NOEXCEPT_OR_NOTHROW
{}
//!Copy assignment operator from other new_allocator.
//!Never throws
new_allocator& operator=(const new_allocator &) BOOST_NOEXCEPT_OR_NOTHROW
{
return *this;
}
//!Constructor from related new_allocator.
//!Never throws
template<class T2>
@ -140,7 +154,8 @@ class new_allocator
//!Throws std::bad_alloc if there is no enough memory
pointer allocate(size_type count)
{
if(BOOST_UNLIKELY(count > this->max_size()))
const std::size_t max_count = std::size_t(-1)/(2*sizeof(T));
if(BOOST_UNLIKELY(count > max_count))
throw_bad_alloc();
return static_cast<T*>(::operator new(count*sizeof(T)));
}
@ -153,7 +168,7 @@ class new_allocator
//!Returns the maximum number of elements that could be allocated.
//!Never throws
size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW
{ return size_type(-1)/sizeof(T); }
{ return std::size_t(-1)/(2*sizeof(T)); }
//!Swaps two allocators, does nothing
//!because this new_allocator is stateless

View File

@ -24,6 +24,7 @@
#include <boost/container/detail/config_begin.hpp>
#include <boost/container/container_fwd.hpp>
#include <boost/intrusive/pack_options.hpp>
#include <boost/static_assert.hpp>
namespace boost {
namespace container {
@ -101,6 +102,65 @@ using tree_assoc_options_t = typename boost::container::tree_assoc_options<Optio
#endif
////////////////////////////////////////////////////////////////
//
//
// OPTIONS FOR ASSOCIATIVE HASH-BASED CONTAINERS
//
//
////////////////////////////////////////////////////////////////
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
template<bool StoreHash>
struct hash_opt
{
static const bool store_hash = StoreHash;
};
typedef hash_opt<false> hash_assoc_defaults;
#endif //!defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//!This option setter specifies if node size is optimized
//!storing rebalancing data masked into pointers for ordered associative containers
BOOST_INTRUSIVE_OPTION_CONSTANT(store_hash, bool, Enabled, store_hash)
//! Helper metafunction to combine options into a single type to be used
//! by \c boost::container::hash_set, \c boost::container::hash_multiset
//! \c boost::container::hash_map and \c boost::container::hash_multimap.
//! Supported options are: \c boost::container::store_hash
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) || defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1 = void, class O2 = void, class O3 = void, class O4 = void>
#endif
struct hash_assoc_options
{
/// @cond
typedef typename ::boost::intrusive::pack_options
< hash_assoc_defaults,
#if !defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
Options...
#endif
>::type packed_options;
typedef hash_opt<packed_options::store_hash> implementation_defined;
/// @endcond
typedef implementation_defined type;
};
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
//! Helper alias metafunction to combine options into a single type to be used
//! by hash-based associative containers
template<class ...Options>
using hash_assoc_options_t = typename boost::container::hash_assoc_options<Options...>::type;
#endif
////////////////////////////////////////////////////////////////
//
//
@ -111,6 +171,22 @@ using tree_assoc_options_t = typename boost::container::tree_assoc_options<Optio
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
template<class T, class Default>
struct default_if_void
{
typedef T type;
};
template<class Default>
struct default_if_void<void, Default>
{
typedef Default type;
};
#endif
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
template<class AllocTraits, class StoredSizeType>
struct get_stored_size_type_with_alloctraits
{
@ -177,7 +253,7 @@ BOOST_INTRUSIVE_OPTION_TYPE(growth_factor, GrowthFactor, GrowthFactor, growth_fa
//!This option specifies the unsigned integer type that a user wants the container
//!to use to hold size-related information inside a container (e.g. current size, current capacity).
//!
//!\tparam StoredSizeType A unsigned integer type. It shall be smaller than than the size
//!\tparam StoredSizeType An unsigned integer type. It shall be smaller than than the size
//! of the size_type deduced from `allocator_traits<A>::size_type` or the same type.
//!
//!If the maximum capacity() to be used is limited, a user can try to use 8-bit, 16-bit
@ -185,7 +261,7 @@ BOOST_INTRUSIVE_OPTION_TYPE(growth_factor, GrowthFactor, GrowthFactor, growth_fa
//!memory can be saved for empty vectors. This could potentially performance benefits due to better
//!cache usage.
//!
//!Note that alignment requirements can disallow theoritical space savings. Example:
//!Note that alignment requirements can disallow theoretical space savings. Example:
//!\c vector holds a pointer and two size types (for size and capacity), in a 32 bit machine
//!a 8 bit size type (total size: 4 byte pointer + 2 x 1 byte sizes = 6 bytes)
//!will not save space when comparing two 16-bit size types because usually
@ -236,6 +312,206 @@ using vector_options_t = typename boost::container::vector_options<Options...>::
#endif
////////////////////////////////////////////////////////////////
//
//
// OPTIONS FOR SMALL-VECTOR CONTAINER
//
//
////////////////////////////////////////////////////////////////
//! This option specifies the desired alignment for the value_type stored
//! in the container.
//! A value zero represents the natural alignment.
//!
//!\tparam Alignment An unsigned integer value. Must be power of two.
BOOST_INTRUSIVE_OPTION_CONSTANT(inplace_alignment, std::size_t, Alignment, inplace_alignment)
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
template<class GrowthType, std::size_t InplaceAlignment>
struct small_vector_opt
{
typedef GrowthType growth_factor_type;
static const std::size_t inplace_alignment = InplaceAlignment;
};
typedef small_vector_opt<void, 0u> small_vector_null_opt;
#endif //!defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! Helper metafunction to combine options into a single type to be used
//! by \c boost::container::small_vector.
//! Supported options are: \c boost::container::growth_factor and \c boost::container::inplace_alignment
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) || defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1 = void, class O2 = void, class O3 = void, class O4 = void>
#endif
struct small_vector_options
{
/// @cond
typedef typename ::boost::intrusive::pack_options
< small_vector_null_opt,
#if !defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
Options...
#endif
>::type packed_options;
typedef small_vector_opt< typename packed_options::growth_factor_type
, packed_options::inplace_alignment> implementation_defined;
/// @endcond
typedef implementation_defined type;
};
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
//! Helper alias metafunction to combine options into a single type to be used
//! by \c boost::container::small_vector.
//! Supported options are: \c boost::container::growth_factor and \c boost::container::stored_size
template<class ...Options>
using small_vector_options_t = typename boost::container::small_vector_options<Options...>::type;
#endif
////////////////////////////////////////////////////////////////
//
//
// OPTIONS FOR STATIC-VECTOR CONTAINER
//
//
////////////////////////////////////////////////////////////////
//!This option specifies if the container will throw if in
//!the static capacity is not sufficient to hold the required
//!values. If false is specified, insufficient capacity will
//!lead to BOOST_ASSERT, and if this assertion returns, to undefined behaviour,
//!which potentially can lead to better static_vector performance.
//!The default value is true.
//!
//!\tparam ThrowOnExhaustion A boolean value. True if throw is required.
BOOST_INTRUSIVE_OPTION_CONSTANT(throw_on_overflow, bool, ThrowOnOverflow, throw_on_overflow)
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
template<bool ThrowOnOverflow, std::size_t InplaceAlignment>
struct static_vector_opt
{
static const bool throw_on_overflow = ThrowOnOverflow;
static const std::size_t inplace_alignment = InplaceAlignment;
};
typedef static_vector_opt<true, 0u> static_vector_null_opt;
#endif //!defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! Helper metafunction to combine options into a single type to be used
//! by \c boost::container::static_vector.
//! Supported options are: \c boost::container::throw_on_overflow and \c boost::container::inplace_alignment
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) || defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1 = void, class O2 = void, class O3 = void, class O4 = void>
#endif
struct static_vector_options
{
/// @cond
typedef typename ::boost::intrusive::pack_options
< static_vector_null_opt,
#if !defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
Options...
#endif
>::type packed_options;
typedef static_vector_opt< packed_options::throw_on_overflow
, packed_options::inplace_alignment> implementation_defined;
/// @endcond
typedef implementation_defined type;
};
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
//! Helper alias metafunction to combine options into a single type to be used
//! by \c boost::container::static_vector.
//! Supported options are: \c boost::container::growth_factor and \c boost::container::stored_size
template<class ...Options>
using static_vector_options_t = typename boost::container::static_vector_options<Options...>::type;
#endif
////////////////////////////////////////////////////////////////
//
//
// OPTIONS FOR DEQUE-BASED CONTAINERS
//
//
////////////////////////////////////////////////////////////////
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
template<std::size_t BlockBytes, std::size_t BlockSize>
struct deque_opt
{
static const std::size_t block_bytes = BlockBytes;
static const std::size_t block_size = BlockSize;
BOOST_STATIC_ASSERT_MSG(!(block_bytes && block_size), "block_bytes and block_size can't be specified at the same time");
};
typedef deque_opt<0u, 0u> deque_null_opt;
#endif
//! Helper metafunction to combine options into a single type to be used
//! by \c boost::container::deque.
//! Supported options are: \c boost::container::block_bytes
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) || defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
template<class ...Options>
#else
template<class O1 = void, class O2 = void, class O3 = void, class O4 = void>
#endif
struct deque_options
{
/// @cond
typedef typename ::boost::intrusive::pack_options
< deque_null_opt,
#if !defined(BOOST_CONTAINER_VARIADIC_TEMPLATES)
O1, O2, O3, O4
#else
Options...
#endif
>::type packed_options;
typedef deque_opt< packed_options::block_bytes, packed_options::block_size > implementation_defined;
/// @endcond
typedef implementation_defined type;
};
#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
//! Helper alias metafunction to combine options into a single type to be used
//! by \c boost::container::deque.
//! Supported options are: \c boost::container::block_bytes
template<class ...Options>
using deque_options_t = typename boost::container::deque_options<Options...>::type;
#endif
//!This option specifies the maximum size of a block in bytes: this delimites the number of contiguous elements
//!that will be allocated by deque as min(1u, BlockBytes/sizeof(value_type))
//!A value zero represents the default value.
//!
//!\tparam BlockBytes An unsigned integer value.
BOOST_INTRUSIVE_OPTION_CONSTANT(block_bytes, std::size_t, BlockBytes, block_bytes)
//!This option specifies the size of a block, delimites the number of contiguous elements
//!that will be allocated by deque as BlockSize.
//!A value zero represents the default value.
//!
//!\tparam BlockBytes An unsigned integer value.
BOOST_INTRUSIVE_OPTION_CONSTANT(block_size, std::size_t, BlockSize, block_size)
} //namespace container {
} //namespace boost {

View File

@ -1024,13 +1024,11 @@ set(ordered_unique_range_t, InputIterator, InputIterator, Compare const&, Alloca
//!has_trivial_destructor_after_move<> == true_type
//!specialization for optimizations
template <class Key, class Compare, class Options, class Allocator>
template <class Key, class Compare, class Allocator, class Options>
struct has_trivial_destructor_after_move<boost::container::set<Key, Compare, Allocator, Options> >
{
typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value &&
::boost::has_trivial_destructor_after_move<pointer>::value &&
::boost::has_trivial_destructor_after_move<Compare>::value;
typedef ::boost::container::dtl::tree<Key, void, Compare, Allocator, Options> tree;
static const bool value = ::boost::has_trivial_destructor_after_move<tree>::value;
};
namespace container {
@ -1693,10 +1691,8 @@ multiset(ordered_range_t, InputIterator, InputIterator, Compare const&, Allocato
template <class Key, class Compare, class Allocator, class Options>
struct has_trivial_destructor_after_move<boost::container::multiset<Key, Compare, Allocator, Options> >
{
typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value &&
::boost::has_trivial_destructor_after_move<pointer>::value &&
::boost::has_trivial_destructor_after_move<Compare>::value;
typedef ::boost::container::dtl::tree<Key, void, Compare, Allocator, Options> tree;
static const bool value = ::boost::has_trivial_destructor_after_move<tree>::value;
};
namespace container {

View File

@ -48,12 +48,48 @@
namespace boost {
namespace container {
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace dtl{
template <class T, class Allocator = void >
class small_vector_base;
template<class Options>
struct get_small_vector_opt
{
typedef Options type;
};
#endif
template<>
struct get_small_vector_opt<void>
{
typedef small_vector_null_opt type;
};
template<class Options>
struct get_vopt_from_svopt
: get_small_vector_opt<Options>::type
{
typedef typename get_small_vector_opt<Options>::type options_t;
typedef vector_opt< typename options_t::growth_factor_type, void> type;
};
template<>
struct get_vopt_from_svopt<void>
{
typedef void type;
};
template <class T, class SecondaryAllocator, class Options>
struct vector_for_small_vector
{
typedef vector
< T
, small_vector_allocator
< T
, typename allocator_traits<typename real_allocator<T, SecondaryAllocator>::type>::template portable_rebind_alloc<void>::type
, Options>
, typename dtl::get_vopt_from_svopt<Options>::type
> type;
};
} //namespace dtl
//! A non-standard allocator used to implement `small_vector`.
//! Users should never use it directly. It is described here
@ -81,7 +117,7 @@ class small_vector_base;
//! `boost::container::vector< T, small_vector_allocator<T, Allocator> >`
//! and internal storage can be obtained downcasting that vector
//! to `small_vector_base<T>`.
template<class T, class VoidAllocator>
template<class T, class VoidAllocator BOOST_CONTAINER_DOCONLY(= void), class Options BOOST_CONTAINER_DOCONLY(= void)>
class small_vector_allocator
: public allocator_traits<typename real_allocator<T, VoidAllocator>::type>::template portable_rebind_alloc<T>::type
{
@ -93,10 +129,10 @@ class small_vector_allocator
BOOST_COPYABLE_AND_MOVABLE(small_vector_allocator)
BOOST_CONTAINER_FORCEINLINE const allocator_type &as_base() const
BOOST_CONTAINER_FORCEINLINE const allocator_type &as_base() const BOOST_NOEXCEPT
{ return static_cast<const allocator_type&>(*this); }
BOOST_CONTAINER_FORCEINLINE allocator_type &as_base()
BOOST_CONTAINER_FORCEINLINE allocator_type &as_base() BOOST_NOEXCEPT
{ return static_cast<allocator_type&>(*this); }
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
@ -134,22 +170,8 @@ class small_vector_allocator
typedef typename allocator_traits<allocator_type>::template portable_rebind_alloc<T2>::type other;
};
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//!Constructor from arbitrary arguments
template<class ...Args>
BOOST_CONTAINER_FORCEINLINE explicit small_vector_allocator(BOOST_FWD_REF(Args) ...args)
: allocator_type(::boost::forward<Args>(args)...)
{}
#else
#define BOOST_CONTAINER_SMALL_VECTOR_ALLOCATOR_CTOR_CODE(N) \
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
BOOST_CONTAINER_FORCEINLINE explicit small_vector_allocator(BOOST_MOVE_UREF##N)\
: allocator_type(BOOST_MOVE_FWD##N)\
{}\
//
BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SMALL_VECTOR_ALLOCATOR_CTOR_CODE)
#undef BOOST_CONTAINER_SMALL_VECTOR_ALLOCATOR_CTOR_CODE
#endif
BOOST_CONTAINER_FORCEINLINE small_vector_allocator() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<allocator_type>::value)
{}
//!Constructor from other small_vector_allocator.
//!Never throws
@ -167,27 +189,34 @@ class small_vector_allocator
//!Constructor from related small_vector_allocator.
//!Never throws
template<class U, class OtherVoidAllocator>
template<class U, class OtherVoidAllocator, class OtherOptions>
BOOST_CONTAINER_FORCEINLINE small_vector_allocator
(const small_vector_allocator<U, OtherVoidAllocator> &other) BOOST_NOEXCEPT_OR_NOTHROW
(const small_vector_allocator<U, OtherVoidAllocator, OtherOptions> &other) BOOST_NOEXCEPT_OR_NOTHROW
: allocator_type(other.as_base())
{}
//!Move constructor from related small_vector_allocator.
//!Never throws
template<class U, class OtherVoidAllocator>
template<class U, class OtherVoidAllocator, class OtherOptions>
BOOST_CONTAINER_FORCEINLINE small_vector_allocator
(BOOST_RV_REF(small_vector_allocator<U BOOST_MOVE_I OtherVoidAllocator>) other) BOOST_NOEXCEPT_OR_NOTHROW
(BOOST_RV_REF(small_vector_allocator<U BOOST_MOVE_I OtherVoidAllocator BOOST_MOVE_I OtherOptions>) other) BOOST_NOEXCEPT_OR_NOTHROW
: allocator_type(::boost::move(other.as_base()))
{}
//!Constructor from allocator_type.
//!Never throws
BOOST_CONTAINER_FORCEINLINE explicit small_vector_allocator
(const allocator_type &other) BOOST_NOEXCEPT_OR_NOTHROW
: allocator_type(other)
{}
//!Assignment from other small_vector_allocator.
//!Never throws
BOOST_CONTAINER_FORCEINLINE small_vector_allocator &
operator=(BOOST_COPY_ASSIGN_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW
{ return static_cast<small_vector_allocator&>(this->allocator_type::operator=(other.as_base())); }
//!Move constructor from other small_vector_allocator.
//!Move assignment from other small_vector_allocator.
//!Never throws
BOOST_CONTAINER_FORCEINLINE small_vector_allocator &
operator=(BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW
@ -197,16 +226,22 @@ class small_vector_allocator
//!Never throws
template<class U, class OtherVoidAllocator>
BOOST_CONTAINER_FORCEINLINE small_vector_allocator &
operator=(BOOST_COPY_ASSIGN_REF(small_vector_allocator<U BOOST_MOVE_I OtherVoidAllocator>) other) BOOST_NOEXCEPT_OR_NOTHROW
operator=(BOOST_COPY_ASSIGN_REF(small_vector_allocator<U BOOST_MOVE_I OtherVoidAllocator BOOST_MOVE_I Options>) other) BOOST_NOEXCEPT_OR_NOTHROW
{ return static_cast<small_vector_allocator&>(this->allocator_type::operator=(other.as_base())); }
//!Move assignment from related small_vector_allocator.
//!Never throws
template<class U, class OtherVoidAllocator>
BOOST_CONTAINER_FORCEINLINE small_vector_allocator &
operator=(BOOST_RV_REF(small_vector_allocator<U BOOST_MOVE_I OtherVoidAllocator>) other) BOOST_NOEXCEPT_OR_NOTHROW
operator=(BOOST_RV_REF(small_vector_allocator<U BOOST_MOVE_I OtherVoidAllocator BOOST_MOVE_I Options>) other) BOOST_NOEXCEPT_OR_NOTHROW
{ return static_cast<small_vector_allocator&>(this->allocator_type::operator=(::boost::move(other.as_base()))); }
//!Move assignment from allocator_type.
//!Never throws
BOOST_CONTAINER_FORCEINLINE small_vector_allocator &
operator=(const allocator_type &other) BOOST_NOEXCEPT_OR_NOTHROW
{ return static_cast<small_vector_allocator&>(this->allocator_type::operator=(other)); }
//!Allocates storage from the standard-conforming allocator
BOOST_CONTAINER_FORCEINLINE pointer allocate(size_type count, const_void_pointer hint = const_void_pointer())
{ return allocator_traits_type::allocate(this->as_base(), count, hint); }
@ -279,8 +314,8 @@ class small_vector_allocator
using allocator_type::deallocate_many;*/
typedef vector_alloc_holder< small_vector_allocator, size_type > vector_alloc_holder_t;
typedef vector<value_type, small_vector_allocator> vector_base;
typedef small_vector_base<value_type, allocator_type> derived_type;
typedef typename dtl::vector_for_small_vector<T, allocator_type, Options>::type vector_base;
typedef small_vector_base<value_type, allocator_type, Options> derived_type;
BOOST_CONTAINER_FORCEINLINE bool is_internal_storage(const_pointer p) const
{ return this->internal_storage() == p; }
@ -330,33 +365,30 @@ class small_vector_allocator
//!
//! All `boost::container:vector` member functions are inherited. See `vector` documentation for details.
//!
template <class T, class SecondaryAllocator>
template <class T, class SecondaryAllocator, class Options>
class small_vector_base
: public vector
< T
, small_vector_allocator
< T
, typename allocator_traits<typename real_allocator<T, SecondaryAllocator>::type>::template portable_rebind_alloc<void>::type
>
>
: public dtl::vector_for_small_vector<T, SecondaryAllocator, Options>::type
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKEDVECTOR
public:
//Make it public as it will be inherited by small_vector and container
//must have this public member
typedef typename real_allocator<T, SecondaryAllocator>::type secondary_allocator_t;
typedef typename allocator_traits<secondary_allocator_t>::template portable_rebind_alloc<void>::type void_allocator_t;
typedef vector<T, small_vector_allocator<T, void_allocator_t> > base_type;
typedef typename allocator_traits<secondary_allocator_t>::pointer pointer;
typedef typename allocator_traits<secondary_allocator_t>::const_pointer const_pointer;
typedef typename allocator_traits<secondary_allocator_t>::void_pointer void_pointer;
typedef typename real_allocator<T, SecondaryAllocator>::type secondary_allocator_t;
typedef typename allocator_traits<secondary_allocator_t>::
template portable_rebind_alloc<void>::type void_allocator_t;
typedef typename dtl::get_small_vector_opt<Options>::type options_t;
typedef typename dtl::vector_for_small_vector
<T, SecondaryAllocator, Options>::type base_type;
typedef typename allocator_traits<secondary_allocator_t>::pointer pointer;
typedef typename allocator_traits<secondary_allocator_t>::const_pointer const_pointer;
typedef typename allocator_traits<secondary_allocator_t>::void_pointer void_pointer;
typedef typename allocator_traits<secondary_allocator_t>::const_void_pointer const_void_pointer;
typedef small_vector_allocator<T, void_allocator_t> allocator_type;
typedef small_vector_allocator<T, void_allocator_t, Options> allocator_type;
private:
BOOST_COPYABLE_AND_MOVABLE(small_vector_base)
friend class small_vector_allocator<T, void_allocator_t>;
friend class small_vector_allocator<T, void_allocator_t, Options>;
BOOST_CONTAINER_FORCEINLINE
const_pointer internal_storage() const BOOST_NOEXCEPT_OR_NOTHROW
@ -381,9 +413,12 @@ class small_vector_base
base_type &as_base() { return static_cast<base_type&>(*this); }
const base_type &as_base() const { return static_cast<const base_type&>(*this); }
static const std::size_t final_alignment =
options_t::inplace_alignment ? options_t::inplace_alignment : dtl::alignment_of<T>::value;
public:
typedef typename dtl::aligned_storage
<sizeof(T), dtl::alignment_of<T>::value>::type storage_type;
<sizeof(T), final_alignment>::type storage_type;
protected:
@ -449,13 +484,14 @@ struct small_vector_storage_calculator_helper<Needed, Hdr, SSize, true>
static const std::size_t value = 0u;
};
template<class Storage, class Allocator, class T, std::size_t N>
template<class Storage, class Allocator, class T, std::size_t N, class Options>
struct small_vector_storage_calculator
{
typedef small_vector_base<T, Allocator> svh_type;
typedef small_vector_base<T, Allocator, Options> svh_type;
typedef typename real_allocator<T, Allocator>::type value_allocator_t;
typedef typename allocator_traits<value_allocator_t>::template portable_rebind_alloc<void>::type void_allocator_t;
typedef vector<T, small_vector_allocator<T, void_allocator_t> > svhb_type;
typedef typename dtl::vector_for_small_vector<T, void_allocator_t, Options>::type svhb_type;
static const std::size_t s_align = dtl::alignment_of<Storage>::value;
static const std::size_t s_size = sizeof(Storage);
static const std::size_t svh_sizeof = sizeof(svh_type);
@ -482,13 +518,13 @@ template<class Storage>
struct small_vector_storage<Storage, 0>
{};
template<class T, class Allocator, std::size_t N>
template<class T, class Allocator, std::size_t N, class Options>
struct small_vector_storage_definer
{
typedef T value_type;
typedef typename small_vector_base<value_type, Allocator>::storage_type storage_type;
typedef typename small_vector_base<value_type, Allocator, Options>::storage_type storage_type;
static const std::size_t needed_extra_storages =
small_vector_storage_calculator<storage_type, Allocator, value_type, N>::needed_extra_storages;
small_vector_storage_calculator<storage_type, Allocator, value_type, N, Options>::needed_extra_storages;
typedef small_vector_storage<storage_type, needed_extra_storages> type;
};
@ -498,7 +534,7 @@ struct small_vector_storage_definer
//! It contains some preallocated elements in-place, which can avoid the use of dynamic storage allocation
//! when the actual number of elements is below that preallocated threshold.
//!
//! `small_vector<T, N, Allocator>` is convertible to `small_vector_base<T, Allocator>` that is independent
//! `small_vector<T, N, Allocator, Options>` is convertible to `small_vector_base<T, Allocator, Options>` that is independent
//! from the preallocated element capacity, so client code does not need to be templated on that N argument.
//!
//! All `boost::container::vector` member functions are inherited. See `vector` documentation for details.
@ -507,23 +543,26 @@ struct small_vector_storage_definer
//! \tparam N The number of preallocated elements stored inside small_vector. It shall be less than Allocator::max_size();
//! \tparam Allocator The allocator used for memory management when the number of elements exceeds N. Use void
//! for the default allocator
template <class T, std::size_t N, class Allocator BOOST_CONTAINER_DOCONLY(= void) >
class small_vector : public small_vector_base<T, Allocator>
//! |tparam Options A type produced from \c boost::container::small_vector_options.
template <class T, std::size_t N, class Allocator BOOST_CONTAINER_DOCONLY(= void), class Options BOOST_CONTAINER_DOCONLY(= void) >
class small_vector : public small_vector_base<T, Allocator, Options>
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
, private small_vector_storage_definer<T, Allocator, N>::type
, private small_vector_storage_definer<T, Allocator, N, Options>::type
#endif
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef small_vector_base<T, Allocator> base_type;
typedef typename small_vector_storage_definer<T, Allocator, N>::type remaining_storage_holder;
typedef small_vector_base<T, Allocator, Options> base_type;
typedef typename small_vector_storage_definer
<T, Allocator, N, Options>::type remaining_storage_holder;
BOOST_COPYABLE_AND_MOVABLE(small_vector)
typedef allocator_traits<typename base_type::allocator_type> allocator_traits_type;
public:
typedef small_vector_storage_calculator< typename small_vector_base<T, Allocator>
::storage_type, Allocator, T, N> storage_test;
typedef small_vector_storage_calculator
< typename small_vector_base<T, Allocator, Options>::storage_type
, Allocator, T, N, Options> storage_test;
static const std::size_t needed_extra_storages = storage_test::needed_extra_storages;
static const std::size_t needed_bytes = storage_test::needed_bytes;
@ -544,7 +583,7 @@ class small_vector : public small_vector_base<T, Allocator>
public:
BOOST_CONTAINER_FORCEINLINE small_vector()
BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<Allocator>::value)
BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<allocator_type>::value)
: base_type(initial_capacity_t(), internal_capacity())
{}

View File

@ -35,9 +35,21 @@ namespace boost { namespace container {
namespace dtl {
template<class T, std::size_t N>
template<class T, std::size_t N, std::size_t InplaceAlignment, bool ThrowOnOverflow>
class static_storage_allocator
{
typedef bool_<ThrowOnOverflow> throw_on_overflow_t;
static BOOST_NORETURN BOOST_CONTAINER_FORCEINLINE void on_capacity_overflow(true_type)
{
(throw_bad_alloc)();
}
static BOOST_CONTAINER_FORCEINLINE void on_capacity_overflow(false_type)
{
BOOST_ASSERT_MSG(false, "ERROR: static vector capacity overflow");
}
public:
typedef T value_type;
@ -61,6 +73,11 @@ class static_storage_allocator
std::size_t max_size() const
{ return N; }
static BOOST_CONTAINER_FORCEINLINE void on_capacity_overflow()
{
(on_capacity_overflow)(throw_on_overflow_t());
}
typedef boost::container::dtl::version_type<static_storage_allocator, 0> version;
BOOST_CONTAINER_FORCEINLINE friend bool operator==(const static_storage_allocator &, const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW
@ -70,9 +87,36 @@ class static_storage_allocator
{ return true; }
private:
typename aligned_storage<sizeof(T)*N, alignment_of<T>::value>::type storage;
BOOST_STATIC_ASSERT_MSG(!InplaceAlignment || (InplaceAlignment & (InplaceAlignment-1)) == 0, "Alignment option must be zero or power of two");
static const std::size_t final_alignment = InplaceAlignment ? InplaceAlignment : dtl::alignment_of<T>::value;
typename dtl::aligned_storage<sizeof(T)*N, final_alignment>::type storage;
};
template<class Options>
struct get_static_vector_opt
{
typedef Options type;
};
template<>
struct get_static_vector_opt<void>
{
typedef static_vector_null_opt type;
};
template <typename T, std::size_t Capacity, class Options>
struct get_static_vector_allocator
{
typedef typename get_static_vector_opt<Options>::type options_t;
typedef dtl::static_storage_allocator
< T
, Capacity
, options_t::inplace_alignment
, options_t::throw_on_overflow
> type;
};
} //namespace dtl {
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
@ -99,22 +143,24 @@ class static_storage_allocator
//! std::out_of_range is thrown if out of bounds access is performed in <code>at()</code> if exceptions are
//! enabled, throw_out_of_range() if not enabled.
//!
//!@tparam Value The type of element that will be stored.
//!@tparam T The type of element that will be stored.
//!@tparam Capacity The maximum number of elements static_vector can store, fixed at compile time.
template <typename Value, std::size_t Capacity>
//!@tparam Options A type produced from \c boost::container::static_vector_options.
template <typename T, std::size_t Capacity, class Options BOOST_CONTAINER_DOCONLY(= void) >
class static_vector
: public vector<Value, dtl::static_storage_allocator<Value, Capacity> >
: public vector<T, typename dtl::get_static_vector_allocator< T, Capacity, Options>::type>
{
public:
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef vector<Value, dtl::static_storage_allocator<Value, Capacity> > base_t;
typedef typename dtl::get_static_vector_allocator< T, Capacity, Options>::type allocator_type;
typedef vector<T, allocator_type > base_t;
BOOST_COPYABLE_AND_MOVABLE(static_vector)
template<class U, std::size_t OtherCapacity>
template<class U, std::size_t OtherCapacity, class OtherOptions>
friend class static_vector;
public:
typedef dtl::static_storage_allocator<Value, Capacity> allocator_type;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
@ -162,7 +208,7 @@ public:
//! @param count The number of values which will be contained in the container.
//!
//! @par Throws
//! If Value's value initialization throws.
//! If T's value initialization throws.
//!
//! @par Complexity
//! Linear O(N).
@ -177,7 +223,7 @@ public:
//! @param count The number of values which will be contained in the container.
//!
//! @par Throws
//! If Value's default initialization throws.
//! If T's default initialization throws.
//!
//! @par Complexity
//! Linear O(N).
@ -196,7 +242,7 @@ public:
//! @param value The value which will be used to copy construct values.
//!
//! @par Throws
//! If Value's copy constructor throws.
//! If T's copy constructor throws.
//!
//! @par Complexity
//! Linear O(N).
@ -214,7 +260,7 @@ public:
//! @param last The iterator to the one after the last element in range.
//!
//! @par Throws
//! If Value's constructor taking a dereferenced Iterator throws.
//! If T's constructor taking a dereferenced Iterator throws.
//!
//! @par Complexity
//! Linear O(N).
@ -232,7 +278,7 @@ public:
//! @param il std::initializer_list with values to initialize vector.
//!
//! @par Throws
//! If Value's constructor taking a dereferenced std::initializer_list throws.
//! If T's constructor taking a dereferenced std::initializer_list throws.
//!
//! @par Complexity
//! Linear O(N).
@ -246,7 +292,7 @@ public:
//! @param other The static_vector which content will be copied to this one.
//!
//! @par Throws
//! If Value's copy constructor throws.
//! If T's copy constructor throws.
//!
//! @par Complexity
//! Linear O(N).
@ -274,12 +320,12 @@ public:
//! @param other The static_vector which content will be copied to this one.
//!
//! @par Throws
//! If Value's copy constructor throws.
//! If T's copy constructor throws.
//!
//! @par Complexity
//! Linear O(N).
template <std::size_t C>
BOOST_CONTAINER_FORCEINLINE static_vector(static_vector<value_type, C> const& other)
template <std::size_t C, class O>
BOOST_CONTAINER_FORCEINLINE static_vector(static_vector<T, C, O> const& other)
: base_t(other)
{}
@ -288,8 +334,8 @@ public:
//! @param other The static_vector which content will be moved to this one.
//!
//! @par Throws
//! @li If \c has_nothrow_move<Value>::value is \c true and Value's move constructor throws.
//! @li If \c has_nothrow_move<Value>::value is \c false and Value's copy constructor throws.
//! @li If \c has_nothrow_move<T>::value is \c true and T's move constructor throws.
//! @li If \c has_nothrow_move<T>::value is \c false and T's copy constructor throws.
//!
//! @par Complexity
//! Linear O(N).
@ -305,14 +351,14 @@ public:
//! @param other The static_vector which content will be moved to this one.
//!
//! @par Throws
//! @li If \c has_nothrow_move<Value>::value is \c true and Value's move constructor throws.
//! @li If \c has_nothrow_move<Value>::value is \c false and Value's copy constructor throws.
//! @li If \c has_nothrow_move<T>::value is \c true and T's move constructor throws.
//! @li If \c has_nothrow_move<T>::value is \c false and T's copy constructor throws.
//!
//! @par Complexity
//! Linear O(N).
template <std::size_t C>
BOOST_CONTAINER_FORCEINLINE static_vector(BOOST_RV_REF_BEG static_vector<value_type, C> BOOST_RV_REF_END other)
: base_t(BOOST_MOVE_BASE(typename static_vector<value_type BOOST_MOVE_I C>::base_t, other))
template <std::size_t C, class O>
BOOST_CONTAINER_FORCEINLINE static_vector(BOOST_RV_REF_BEG static_vector<T, C, O> BOOST_RV_REF_END other)
: base_t(BOOST_MOVE_BASE(typename static_vector<T BOOST_MOVE_I C>::base_t, other))
{}
//! @brief Copy assigns Values stored in the other static_vector to this one.
@ -320,7 +366,7 @@ public:
//! @param other The static_vector which content will be copied to this one.
//!
//! @par Throws
//! If Value's copy constructor or copy assignment throws.
//! If T's copy constructor or copy assignment throws.
//!
//! @par Complexity
//! Linear O(N).
@ -335,7 +381,7 @@ public:
//! @param il The std::initializer_list which content will be copied to this one.
//!
//! @par Throws
//! If Value's copy constructor or copy assignment throws.
//! If T's copy constructor or copy assignment throws.
//!
//! @par Complexity
//! Linear O(N).
@ -350,15 +396,15 @@ public:
//! @param other The static_vector which content will be copied to this one.
//!
//! @par Throws
//! If Value's copy constructor or copy assignment throws.
//! If T's copy constructor or copy assignment throws.
//!
//! @par Complexity
//! Linear O(N).
template <std::size_t C>
BOOST_CONTAINER_FORCEINLINE static_vector & operator=(static_vector<value_type, C> const& other)
template <std::size_t C, class O>
BOOST_CONTAINER_FORCEINLINE static_vector & operator=(static_vector<T, C, O> const& other)
{
return static_cast<static_vector&>(base_t::operator=
(static_cast<typename static_vector<value_type, C>::base_t const&>(other)));
(static_cast<typename static_vector<T, C, O>::base_t const&>(other)));
}
//! @brief Move assignment. Moves Values stored in the other static_vector to this one.
@ -366,8 +412,8 @@ public:
//! @param other The static_vector which content will be moved to this one.
//!
//! @par Throws
//! @li If \c has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws.
//! @li If \c has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws.
//! @li If \c has_nothrow_move<T>::value is \c true and T's move constructor or move assignment throws.
//! @li If \c has_nothrow_move<T>::value is \c false and T's copy constructor or copy assignment throws.
//!
//! @par Complexity
//! Linear O(N).
@ -384,16 +430,16 @@ public:
//! @param other The static_vector which content will be moved to this one.
//!
//! @par Throws
//! @li If \c has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws.
//! @li If \c has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws.
//! @li If \c has_nothrow_move<T>::value is \c true and T's move constructor or move assignment throws.
//! @li If \c has_nothrow_move<T>::value is \c false and T's copy constructor or copy assignment throws.
//!
//! @par Complexity
//! Linear O(N).
template <std::size_t C>
BOOST_CONTAINER_FORCEINLINE static_vector & operator=(BOOST_RV_REF_BEG static_vector<value_type, C> BOOST_RV_REF_END other)
template <std::size_t C, class O>
BOOST_CONTAINER_FORCEINLINE static_vector & operator=(BOOST_RV_REF_BEG static_vector<T, C, O> BOOST_RV_REF_END other)
{
return static_cast<static_vector&>(base_t::operator=
(BOOST_MOVE_BASE(typename static_vector<value_type BOOST_MOVE_I C>::base_t, other)));
(BOOST_MOVE_BASE(typename static_vector<T BOOST_MOVE_I C>::base_t, other)));
}
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
@ -412,8 +458,8 @@ public:
//! @param other The static_vector which content will be swapped with this one's content.
//!
//! @par Throws
//! @li If \c has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws,
//! @li If \c has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws,
//! @li If \c has_nothrow_move<T>::value is \c true and T's move constructor or move assignment throws,
//! @li If \c has_nothrow_move<T>::value is \c false and T's copy constructor or copy assignment throws,
//!
//! @par Complexity
//! Linear O(N).
@ -426,13 +472,13 @@ public:
//! @param other The static_vector which content will be swapped with this one's content.
//!
//! @par Throws
//! @li If \c has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws,
//! @li If \c has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws,
//! @li If \c has_nothrow_move<T>::value is \c true and T's move constructor or move assignment throws,
//! @li If \c has_nothrow_move<T>::value is \c false and T's copy constructor or copy assignment throws,
//!
//! @par Complexity
//! Linear O(N).
template <std::size_t C>
void swap(static_vector<value_type, C> & other);
template <std::size_t C, class O>
void swap(static_vector<T, C, O> & other);
//! @pre <tt>count <= capacity()</tt>
//!
@ -442,7 +488,7 @@ public:
//! @param count The number of elements which will be stored in the container.
//!
//! @par Throws
//! If Value's value initialization throws.
//! If T's value initialization throws.
//!
//! @par Complexity
//! Linear O(N).
@ -456,7 +502,7 @@ public:
//! @param count The number of elements which will be stored in the container.
//!
//! @par Throws
//! If Value's default initialization throws.
//! If T's default initialization throws.
//!
//! @par Complexity
//! Linear O(N).
@ -474,7 +520,7 @@ public:
//! @param value The value used to copy construct the new element.
//!
//! @par Throws
//! If Value's copy constructor throws.
//! If T's copy constructor throws.
//!
//! @par Complexity
//! Linear O(N).
@ -500,7 +546,7 @@ public:
//! @param value The value used to copy construct the new element.
//!
//! @par Throws
//! If Value's copy constructor throws.
//! If T's copy constructor throws.
//!
//! @par Complexity
//! Constant O(1).
@ -513,7 +559,7 @@ public:
//! @param value The value to move construct the new element.
//!
//! @par Throws
//! If Value's move constructor throws.
//! If T's move constructor throws.
//!
//! @par Complexity
//! Constant O(1).
@ -540,8 +586,8 @@ public:
//! @param value The value used to copy construct the new element.
//!
//! @par Throws
//! @li If Value's copy constructor or copy assignment throws
//! @li If Value's move constructor or move assignment throws.
//! @li If T's copy constructor or copy assignment throws
//! @li If T's move constructor or move assignment throws.
//!
//! @par Complexity
//! Constant or linear.
@ -557,7 +603,7 @@ public:
//! @param value The value used to move construct the new element.
//!
//! @par Throws
//! If Value's move constructor or move assignment throws.
//! If T's move constructor or move assignment throws.
//!
//! @par Complexity
//! Constant or linear.
@ -574,8 +620,8 @@ public:
//! @param value The value used to copy construct new elements.
//!
//! @par Throws
//! @li If Value's copy constructor or copy assignment throws.
//! @li If Value's move constructor or move assignment throws.
//! @li If T's copy constructor or copy assignment throws.
//! @li If T's move constructor or move assignment throws.
//!
//! @par Complexity
//! Linear O(N).
@ -593,8 +639,8 @@ public:
//! @param last The iterator to the one after the last element of a range used to construct new elements.
//!
//! @par Throws
//! @li If Value's constructor and assignment taking a dereferenced \c Iterator.
//! @li If Value's move constructor or move assignment throws.
//! @li If T's constructor and assignment taking a dereferenced \c Iterator.
//! @li If T's move constructor or move assignment throws.
//!
//! @par Complexity
//! Linear O(N).
@ -611,7 +657,7 @@ public:
//! @param il The std::initializer_list which contains elements that will be inserted.
//!
//! @par Throws
//! @li If Value's constructor and assignment taking a dereferenced std::initializer_list iterator.
//! @li If T's constructor and assignment taking a dereferenced std::initializer_list iterator.
//!
//! @par Complexity
//! Linear O(N).
@ -619,12 +665,12 @@ public:
//! @pre \c p must be a valid iterator of \c *this in range <tt>[begin(), end())</tt>
//!
//! @brief Erases Value from p.
//! @brief Erases T from p.
//!
//! @param p The position of the element which will be erased from the container.
//!
//! @par Throws
//! If Value's move assignment throws.
//! If T's move assignment throws.
//!
//! @par Complexity
//! Linear O(N).
@ -640,7 +686,7 @@ public:
//! @param last The position of the one after the last element of a range which will be erased from the container.
//!
//! @par Throws
//! If Value's move assignment throws.
//! If T's move assignment throws.
//!
//! @par Complexity
//! Linear O(N).
@ -654,7 +700,7 @@ public:
//! @param last The iterator to the one after the last element of a range used to construct new content of this container.
//!
//! @par Throws
//! If Value's copy constructor or copy assignment throws,
//! If T's copy constructor or copy assignment throws,
//!
//! @par Complexity
//! Linear O(N).
@ -668,7 +714,7 @@ public:
//! @param il std::initializer_list with values used to construct new content of this container.
//!
//! @par Throws
//! If Value's copy constructor or copy assignment throws,
//! If T's copy constructor or copy assignment throws,
//!
//! @par Complexity
//! Linear O(N).
@ -682,7 +728,7 @@ public:
//! @param value The value which will be used to copy construct the new content.
//!
//! @par Throws
//! If Value's copy constructor or copy assignment throws.
//! If T's copy constructor or copy assignment throws.
//!
//! @par Complexity
//! Linear O(N).
@ -690,7 +736,7 @@ public:
//! @pre <tt>size() < capacity()</tt>
//!
//! @brief Inserts a Value constructed with
//! @brief Inserts a T constructed with
//! \c std::forward<Args>(args)... in the end of the container.
//!
//! @return A reference to the created object.
@ -698,7 +744,7 @@ public:
//! @param args The arguments of the constructor of the new element which will be created at the end of the container.
//!
//! @par Throws
//! If in-place constructor throws or Value's move constructor throws.
//! If in-place constructor throws or T's move constructor throws.
//!
//! @par Complexity
//! Constant O(1).
@ -709,14 +755,14 @@ public:
//! @li \c p must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>
//! @li <tt>size() < capacity()</tt>
//!
//! @brief Inserts a Value constructed with
//! @brief Inserts a T constructed with
//! \c std::forward<Args>(args)... before p
//!
//! @param p The position at which new elements will be inserted.
//! @param args The arguments of the constructor of the new element.
//!
//! @par Throws
//! If in-place constructor throws or if Value's move constructor or move assignment throws.
//! If in-place constructor throws or if T's move constructor or move assignment throws.
//!
//! @par Complexity
//! Constant or linear.
@ -920,7 +966,7 @@ public:
//!
//! @par Complexity
//! Constant O(1).
Value * data() BOOST_NOEXCEPT_OR_NOTHROW;
T * data() BOOST_NOEXCEPT_OR_NOTHROW;
//! @brief Const pointer such that <tt>[data(), data() + size())</tt> is a valid range.
//! For a non-empty vector <tt>data() == &front()</tt>.
@ -930,7 +976,7 @@ public:
//!
//! @par Complexity
//! Constant O(1).
const Value * data() const BOOST_NOEXCEPT_OR_NOTHROW;
const T * data() const BOOST_NOEXCEPT_OR_NOTHROW;
//! @brief Returns iterator to the first element.
//!
@ -1138,8 +1184,8 @@ public:
//!
//! @par Complexity
//! Linear O(N).
template<typename V, std::size_t C1, std::size_t C2>
bool operator== (static_vector<V, C1> const& x, static_vector<V, C2> const& y);
template<typename V, std::size_t C1, std::size_t C2, class O1, class O2>
bool operator== (static_vector<V, C1, O1> const& x, static_vector<V, C2, O2> const& y);
//! @brief Checks if contents of two static_vectors are not equal.
//!
@ -1152,8 +1198,8 @@ bool operator== (static_vector<V, C1> const& x, static_vector<V, C2> const& y);
//!
//! @par Complexity
//! Linear O(N).
template<typename V, std::size_t C1, std::size_t C2>
bool operator!= (static_vector<V, C1> const& x, static_vector<V, C2> const& y);
template<typename V, std::size_t C1, std::size_t C2, class O1, class O2>
bool operator!= (static_vector<V, C1, O1> const& x, static_vector<V, C2, O2> const& y);
//! @brief Lexicographically compares static_vectors.
//!
@ -1166,8 +1212,8 @@ bool operator!= (static_vector<V, C1> const& x, static_vector<V, C2> const& y);
//!
//! @par Complexity
//! Linear O(N).
template<typename V, std::size_t C1, std::size_t C2>
bool operator< (static_vector<V, C1> const& x, static_vector<V, C2> const& y);
template<typename V, std::size_t C1, std::size_t C2, class O1, class O2>
bool operator< (static_vector<V, C1, O1> const& x, static_vector<V, C2, O2> const& y);
//! @brief Lexicographically compares static_vectors.
//!
@ -1180,8 +1226,8 @@ bool operator< (static_vector<V, C1> const& x, static_vector<V, C2> const& y);
//!
//! @par Complexity
//! Linear O(N).
template<typename V, std::size_t C1, std::size_t C2>
bool operator> (static_vector<V, C1> const& x, static_vector<V, C2> const& y);
template<typename V, std::size_t C1, std::size_t C2, class O1, class O2>
bool operator> (static_vector<V, C1, O1> const& x, static_vector<V, C2, O2> const& y);
//! @brief Lexicographically compares static_vectors.
//!
@ -1194,8 +1240,8 @@ bool operator> (static_vector<V, C1> const& x, static_vector<V, C2> const& y);
//!
//! @par Complexity
//! Linear O(N).
template<typename V, std::size_t C1, std::size_t C2>
bool operator<= (static_vector<V, C1> const& x, static_vector<V, C2> const& y);
template<typename V, std::size_t C1, std::size_t C2, class O1, class O2>
bool operator<= (static_vector<V, C1, O1> const& x, static_vector<V, C2, O2> const& y);
//! @brief Lexicographically compares static_vectors.
//!
@ -1208,8 +1254,8 @@ bool operator<= (static_vector<V, C1> const& x, static_vector<V, C2> const& y);
//!
//! @par Complexity
//! Linear O(N).
template<typename V, std::size_t C1, std::size_t C2>
bool operator>= (static_vector<V, C1> const& x, static_vector<V, C2> const& y);
template<typename V, std::size_t C1, std::size_t C2, class O1, class O2>
bool operator>= (static_vector<V, C1, O1> const& x, static_vector<V, C2, O2> const& y);
//! @brief Swaps contents of two static_vectors.
//!
@ -1222,13 +1268,13 @@ bool operator>= (static_vector<V, C1> const& x, static_vector<V, C2> const& y);
//!
//! @par Complexity
//! Linear O(N).
template<typename V, std::size_t C1, std::size_t C2>
inline void swap(static_vector<V, C1> & x, static_vector<V, C2> & y);
template<typename V, std::size_t C1, std::size_t C2, class O1, class O2>
inline void swap(static_vector<V, C1, O1> & x, static_vector<V, C2, O2> & y);
#else
template<typename V, std::size_t C1, std::size_t C2>
inline void swap(static_vector<V, C1> & x, static_vector<V, C2> & y
template<typename V, std::size_t C1, std::size_t C2, class O1, class O2>
inline void swap(static_vector<V, C1, O1> & x, static_vector<V, C2, O2> & y
, typename dtl::enable_if_c< C1 != C2>::type * = 0)
{
x.swap(y);

View File

@ -501,6 +501,9 @@ struct vector_alloc_holder
BOOST_CONTAINER_FORCEINLINE void capacity(const size_type &c) BOOST_NOEXCEPT_OR_NOTHROW
{ BOOST_ASSERT( c <= stored_size_type(-1)); m_capacity = c; }
static BOOST_CONTAINER_FORCEINLINE void on_capacity_overflow()
{ }
private:
void priv_first_allocation(size_type cap)
{
@ -631,10 +634,13 @@ struct vector_alloc_holder<Allocator, StoredSizeType, version_0>
(this->alloc(), boost::movelib::to_raw_pointer(holder.start()), n, boost::movelib::to_raw_pointer(this->start()));
}
static BOOST_CONTAINER_FORCEINLINE void on_capacity_overflow()
{ allocator_type::on_capacity_overflow(); }
BOOST_CONTAINER_FORCEINLINE void priv_first_allocation(size_type cap)
{
if(cap > allocator_type::internal_capacity){
throw_bad_alloc();
on_capacity_overflow();
}
}
@ -648,20 +654,20 @@ struct vector_alloc_holder<Allocator, StoredSizeType, version_0>
{
typedef typename real_allocator<value_type, OtherAllocator>::type other_allocator_type;
if(this->m_size > other_allocator_type::internal_capacity || x.m_size > allocator_type::internal_capacity){
throw_bad_alloc();
on_capacity_overflow();
}
this->priv_deep_swap(x);
}
BOOST_CONTAINER_FORCEINLINE void swap_resources(vector_alloc_holder &) BOOST_NOEXCEPT_OR_NOTHROW
{ //Containers with version 0 allocators can't be moved without moving elements one by one
throw_bad_alloc();
on_capacity_overflow();
}
BOOST_CONTAINER_FORCEINLINE void steal_resources(vector_alloc_holder &)
{ //Containers with version 0 allocators can't be moved without moving elements one by one
throw_bad_alloc();
on_capacity_overflow();
}
BOOST_CONTAINER_FORCEINLINE allocator_type &alloc() BOOST_NOEXCEPT_OR_NOTHROW
@ -702,18 +708,6 @@ struct vector_alloc_holder<Allocator, StoredSizeType, version_0>
struct growth_factor_60;
template<class T, class Default>
struct default_if_void
{
typedef T type;
};
template<class Default>
struct default_if_void<void, Default>
{
typedef Default type;
};
template<class Options, class AllocatorSizeType>
struct get_vector_opt
{
@ -728,7 +722,6 @@ struct get_vector_opt<void, AllocatorSizeType>
typedef vector_opt<growth_factor_60, AllocatorSizeType> type;
};
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! A vector is a sequence that supports random access to elements, constant
@ -2340,7 +2333,7 @@ private:
template<class FwdIt, class Compare>
BOOST_CONTAINER_FORCEINLINE void priv_merge_in_new_buffer(FwdIt, size_type, Compare, version_0)
{
throw_bad_alloc();
alloc_holder_t::on_capacity_overflow();
}
template<class FwdIt, class Compare, class Version>
@ -2420,7 +2413,7 @@ private:
{
if(!dtl::is_same<typename real_allocator<T, OtherA>::type, allocator_type>::value &&
this->capacity() < x.size()){
throw_bad_alloc();
alloc_holder_t::on_capacity_overflow();
}
T* const this_start = this->priv_raw_begin();
T* const other_start = x.priv_raw_begin();
@ -2472,7 +2465,7 @@ private:
{
if(!dtl::is_same<typename real_allocator<T, OtherA>::type, allocator_type>::value &&
this->capacity() < x.size()){
throw_bad_alloc();
alloc_holder_t::on_capacity_overflow();
}
T* const this_start = this->priv_raw_begin();
T* const other_start = x.priv_raw_begin();
@ -2541,7 +2534,7 @@ private:
}
void priv_reserve_no_capacity(size_type, version_0)
{ throw_bad_alloc(); }
{ alloc_holder_t::on_capacity_overflow(); }
dtl::insert_range_proxy<allocator_type, boost::move_iterator<T*>, T*> priv_dummy_empty_proxy()
{
@ -2640,10 +2633,10 @@ private:
( vector_iterator_get_ptr(p), 1, dtl::get_insert_value_proxy<T*, allocator_type>(::boost::forward<U>(x)));
}
dtl::insert_copy_proxy<allocator_type, T*> priv_single_insert_proxy(const T &x)
BOOST_CONTAINER_FORCEINLINE dtl::insert_copy_proxy<allocator_type, T*> priv_single_insert_proxy(const T &x)
{ return dtl::insert_copy_proxy<allocator_type, T*> (x); }
dtl::insert_move_proxy<allocator_type, T*> priv_single_insert_proxy(BOOST_RV_REF(T) x)
BOOST_CONTAINER_FORCEINLINE dtl::insert_move_proxy<allocator_type, T*> priv_single_insert_proxy(BOOST_RV_REF(T) x)
{ return dtl::insert_move_proxy<allocator_type, T*> (x); }
template <class U>
@ -2744,7 +2737,7 @@ private:
iterator priv_forward_range_insert_no_capacity
(const pointer &pos, const size_type, const InsertionProxy , version_0)
{
throw_bad_alloc();
alloc_holder_t::on_capacity_overflow();
return iterator(pos);
}
@ -2844,7 +2837,7 @@ private:
if (n > remaining){
//This will trigger an error
throw_bad_alloc();
alloc_holder_t::on_capacity_overflow();
}
this->priv_forward_range_insert_at_end_expand_forward(n, insert_range_proxy);
return this->end();
@ -3420,9 +3413,9 @@ namespace boost {
template <class T, class Allocator, class Options>
struct has_trivial_destructor_after_move<boost::container::vector<T, Allocator, Options> >
{
typedef typename ::boost::container::allocator_traits
<typename boost::container::real_allocator<T, Allocator>::type>::pointer pointer;
static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value &&
typedef typename boost::container::vector<T, Allocator, Options>::allocator_type allocator_type;
typedef typename ::boost::container::allocator_traits<allocator_type>::pointer pointer;
static const bool value = ::boost::has_trivial_destructor_after_move<allocator_type>::value &&
::boost::has_trivial_destructor_after_move<pointer>::value;
};

View File

@ -0,0 +1,245 @@
/*
Copyright 2019 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_ALLOC_CONSTRUCT_HPP
#define BOOST_CORE_ALLOC_CONSTRUCT_HPP
#include <boost/core/noinit_adaptor.hpp>
namespace boost {
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
template<class A, class T>
inline void
alloc_destroy(A& a, T* p)
{
std::allocator_traits<A>::destroy(a, p);
}
template<class A, class T>
inline void
alloc_destroy_n(A& a, T* p, std::size_t n)
{
while (n > 0) {
std::allocator_traits<A>::destroy(a, p + --n);
}
}
#else
template<class A, class T>
inline void
alloc_destroy(A&, T* p)
{
p->~T();
}
template<class A, class T>
inline void
alloc_destroy_n(A&, T* p, std::size_t n)
{
while (n > 0) {
p[--n].~T();
}
}
#endif
namespace detail {
template<class A, class T>
class alloc_destroyer {
public:
alloc_destroyer(A& a, T* p) BOOST_NOEXCEPT
: a_(a),
p_(p),
n_(0) { }
~alloc_destroyer() {
boost::alloc_destroy_n(a_, p_, n_);
}
std::size_t& size() BOOST_NOEXCEPT {
return n_;
}
private:
alloc_destroyer(const alloc_destroyer&);
alloc_destroyer& operator=(const alloc_destroyer&);
A& a_;
T* p_;
std::size_t n_;
};
} /* detail */
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
template<class A, class T>
inline void
alloc_construct(A& a, T* p)
{
std::allocator_traits<A>::construct(a, p);
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<class A, class T, class U, class... V>
inline void
alloc_construct(A& a, T* p, U&& u, V&&... v)
{
std::allocator_traits<A>::construct(a, p, std::forward<U>(u),
std::forward<V>(v)...);
}
#else
template<class A, class T, class U>
inline void
alloc_construct(A& a, T* p, U&& u)
{
std::allocator_traits<A>::construct(a, p, std::forward<U>(u));
}
#endif
#else
template<class A, class T, class U>
inline void
alloc_construct(A& a, T* p, const U& u)
{
std::allocator_traits<A>::construct(a, p, u);
}
template<class A, class T, class U>
inline void
alloc_construct(A& a, T* p, U& u)
{
std::allocator_traits<A>::construct(a, p, u);
}
#endif
template<class A, class T>
inline void
alloc_construct_n(A& a, T* p, std::size_t n)
{
detail::alloc_destroyer<A, T> hold(a, p);
for (std::size_t& i = hold.size(); i < n; ++i) {
std::allocator_traits<A>::construct(a, p + i);
}
hold.size() = 0;
}
template<class A, class T>
inline void
alloc_construct_n(A& a, T* p, std::size_t n, const T* l, std::size_t m)
{
detail::alloc_destroyer<A, T> hold(a, p);
for (std::size_t& i = hold.size(); i < n; ++i) {
std::allocator_traits<A>::construct(a, p + i, l[i % m]);
}
hold.size() = 0;
}
template<class A, class T, class I>
inline void
alloc_construct_n(A& a, T* p, std::size_t n, I b)
{
detail::alloc_destroyer<A, T> hold(a, p);
for (std::size_t& i = hold.size(); i < n; void(++i), void(++b)) {
std::allocator_traits<A>::construct(a, p + i, *b);
}
hold.size() = 0;
}
#else
template<class A, class T>
inline void
alloc_construct(A&, T* p)
{
::new(static_cast<void*>(p)) T();
}
template<class A, class T>
inline void
alloc_construct(noinit_adaptor<A>&, T* p)
{
::new(static_cast<void*>(p)) T;
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<class A, class T, class U, class... V>
inline void
alloc_construct(A&, T* p, U&& u, V&&... v)
{
::new(static_cast<void*>(p)) T(std::forward<U>(u), std::forward<V>(v)...);
}
#else
template<class A, class T, class U>
inline void
alloc_construct(A& a, T* p, U&& u)
{
::new(static_cast<void*>(p)) T(std::forward<U>(u));
}
#endif
#else
template<class A, class T, class U>
inline void
alloc_construct(A&, T* p, const U& u)
{
::new(static_cast<void*>(p)) T(u);
}
template<class A, class T, class U>
inline void
alloc_construct(A&, T* p, U& u)
{
::new(static_cast<void*>(p)) T(u);
}
#endif
template<class A, class T>
inline void
alloc_construct_n(A& a, T* p, std::size_t n)
{
detail::alloc_destroyer<A, T> hold(a, p);
for (std::size_t& i = hold.size(); i < n; ++i) {
::new(static_cast<void*>(p + i)) T();
}
hold.size() = 0;
}
template<class A, class T>
inline void
alloc_construct_n(noinit_adaptor<A>& a, T* p, std::size_t n)
{
detail::alloc_destroyer<noinit_adaptor<A>, T> hold(a, p);
for (std::size_t& i = hold.size(); i < n; ++i) {
::new(static_cast<void*>(p + i)) T;
}
hold.size() = 0;
}
template<class A, class T>
inline void
alloc_construct_n(A& a, T* p, std::size_t n, const T* l, std::size_t m)
{
detail::alloc_destroyer<A, T> hold(a, p);
for (std::size_t& i = hold.size(); i < n; ++i) {
::new(static_cast<void*>(p + i)) T(l[i % m]);
}
hold.size() = 0;
}
template<class A, class T, class I>
inline void
alloc_construct_n(A& a, T* p, std::size_t n, I b)
{
detail::alloc_destroyer<A, T> hold(a, p);
for (std::size_t& i = hold.size(); i < n; void(++i), void(++b)) {
::new(static_cast<void*>(p + i)) T(*b);
}
hold.size() = 0;
}
#endif
} /* boost */
#endif

View File

@ -0,0 +1,158 @@
/*
Copyright 2019 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_DEFAULT_ALLOCATOR_HPP
#define BOOST_CORE_DEFAULT_ALLOCATOR_HPP
#include <boost/config.hpp>
#include <new>
#include <climits>
#if defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION < 60000
#define BOOST_CORE_NO_CXX11_ALLOCATOR
#endif
namespace boost {
#if defined(BOOST_NO_EXCEPTIONS)
void throw_exception(const std::exception&);
#endif
namespace default_ {
struct true_type {
typedef bool value_type;
typedef true_type type;
BOOST_STATIC_CONSTANT(bool, value = true);
BOOST_CONSTEXPR operator bool() const BOOST_NOEXCEPT {
return true;
}
BOOST_CONSTEXPR bool operator()() const BOOST_NOEXCEPT {
return true;
}
};
template<class T>
struct add_reference {
typedef T& type;
};
template<>
struct add_reference<void> {
typedef void type;
};
template<>
struct add_reference<const void> {
typedef const void type;
};
template<class T>
struct default_allocator {
typedef T value_type;
typedef T* pointer;
typedef const T* const_pointer;
typedef typename add_reference<T>::type reference;
typedef typename add_reference<const T>::type const_reference;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef true_type propagate_on_container_move_assignment;
typedef true_type is_always_equal;
template<class U>
struct rebind {
typedef default_allocator<U> other;
};
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
default_allocator() = default;
#else
BOOST_CONSTEXPR default_allocator() BOOST_NOEXCEPT { }
#endif
template<class U>
BOOST_CONSTEXPR default_allocator(const default_allocator<U>&)
BOOST_NOEXCEPT { }
#if defined(PTRDIFF_MAX) && defined(SIZE_MAX)
BOOST_CONSTEXPR std::size_t max_size() const BOOST_NOEXCEPT {
return PTRDIFF_MAX < SIZE_MAX / sizeof(T)
? PTRDIFF_MAX : SIZE_MAX / sizeof(T);
}
#else
BOOST_CONSTEXPR std::size_t max_size() const BOOST_NOEXCEPT {
return ~static_cast<std::size_t>(0) / sizeof(T);
}
#endif
#if !defined(BOOST_NO_EXCEPTIONS)
T* allocate(std::size_t n) {
if (n > max_size()) {
throw std::bad_alloc();
}
return static_cast<T*>(::operator new(sizeof(T) * n));
}
void deallocate(T* p, std::size_t) {
::operator delete(p);
}
#else
T* allocate(std::size_t n) {
if (n > max_size()) {
boost::throw_exception(std::bad_alloc());
}
void* p = ::operator new(sizeof(T) * n, std::nothrow);
if (!p) {
boost::throw_exception(std::bad_alloc());
}
return static_cast<T*>(p);
}
void deallocate(T* p, std::size_t) {
::operator delete(p, std::nothrow);
}
#endif
#if defined(BOOST_NO_CXX11_ALLOCATOR) || defined(BOOST_CORE_NO_CXX11_ALLOCATOR)
template<class U, class V>
void construct(U* p, const V& v) {
::new(p) U(v);
}
template<class U>
void destroy(U* p) {
p->~U();
}
#endif
};
template<class T, class U>
BOOST_CONSTEXPR inline bool
operator==(const default_allocator<T>&,
const default_allocator<U>&) BOOST_NOEXCEPT
{
return true;
}
template<class T, class U>
BOOST_CONSTEXPR inline bool
operator!=(const default_allocator<T>&,
const default_allocator<U>&) BOOST_NOEXCEPT
{
return false;
}
} /* default_ */
using default_::default_allocator;
} /* boost */
#endif

View File

@ -0,0 +1,45 @@
/*
Copyright 2019 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_FIRST_SCALAR_HPP
#define BOOST_CORE_FIRST_SCALAR_HPP
#include <boost/config.hpp>
#include <cstddef>
namespace boost {
namespace detail {
template<class T>
struct make_scalar {
typedef T type;
};
template<class T, std::size_t N>
struct make_scalar<T[N]> {
typedef typename make_scalar<T>::type type;
};
} /* detail */
template<class T>
BOOST_CONSTEXPR inline T*
first_scalar(T* p) BOOST_NOEXCEPT
{
return p;
}
template<class T, std::size_t N>
BOOST_CONSTEXPR inline typename detail::make_scalar<T>::type*
first_scalar(T (*p)[N]) BOOST_NOEXCEPT
{
return boost::first_scalar(&(*p)[0]);
}
} /* boost */
#endif

View File

@ -32,9 +32,21 @@
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
# define BOOST_TRY { if ("")
# define BOOST_CATCH(x) else if (!"")
# else
# elif !defined(BOOST_MSVC) || BOOST_MSVC >= 1900
# define BOOST_TRY { if (true)
# define BOOST_CATCH(x) else if (false)
# else
// warning C4127: conditional expression is constant
# define BOOST_TRY { \
__pragma(warning(push)) \
__pragma(warning(disable: 4127)) \
if (true) \
__pragma(warning(pop))
# define BOOST_CATCH(x) else \
__pragma(warning(push)) \
__pragma(warning(disable: 4127)) \
if (false) \
__pragma(warning(pop))
# endif
# define BOOST_RETHROW
# define BOOST_CATCH_END }

View File

@ -0,0 +1,112 @@
/*
Copyright 2019 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_NOINIT_ADAPTOR_HPP
#define BOOST_CORE_NOINIT_ADAPTOR_HPP
#include <boost/config.hpp>
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
#include <memory>
#endif
#include <new>
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#include <utility>
#endif
namespace boost {
template<class A>
struct noinit_adaptor
: A {
template<class U>
struct rebind {
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
typedef noinit_adaptor<typename std::allocator_traits<A>::template
rebind_alloc<U> > other;
#else
typedef noinit_adaptor<typename A::template rebind<U>::other> other;
#endif
};
noinit_adaptor()
: A() { }
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template<class U>
noinit_adaptor(U&& u) BOOST_NOEXCEPT
: A(std::forward<U>(u)) { }
#else
template<class U>
noinit_adaptor(const U& u) BOOST_NOEXCEPT
: A(u) { }
#endif
template<class U>
noinit_adaptor(const noinit_adaptor<U>& u) BOOST_NOEXCEPT
: A(static_cast<const U&>(u)) { }
template<class U>
void construct(U* p) {
::new((void*)p) U;
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<class U, class V, class... Args>
void construct(U* p, V&& v, Args&&... args) {
::new((void*)p) U(std::forward<V>(v), std::forward<Args>(args)...);
}
#else
template<class U, class V>
void construct(U* p, V&& v) {
::new((void*)p) U(std::forward<V>(v));
}
#endif
#else
template<class U, class V>
void construct(U* p, const V& v) {
::new((void*)p) U(v);
}
template<class U, class V>
void construct(U* p, V& v) {
::new((void*)p) U(v);
}
#endif
template<class U>
void destroy(U* p) {
p->~U();
}
};
template<class T, class U>
inline bool
operator==(const noinit_adaptor<T>& lhs,
const noinit_adaptor<U>& rhs) BOOST_NOEXCEPT
{
return static_cast<const T&>(lhs) == static_cast<const U&>(rhs);
}
template<class T, class U>
inline bool
operator!=(const noinit_adaptor<T>& lhs,
const noinit_adaptor<U>& rhs) BOOST_NOEXCEPT
{
return !(lhs == rhs);
}
template<class A>
inline noinit_adaptor<A>
noinit_adapt(const A& a) BOOST_NOEXCEPT
{
return noinit_adaptor<A>(a);
}
} /* boost */
#endif

View File

@ -47,7 +47,7 @@ public:
bool operator==( typeinfo const& rhs ) const
{
#if ( defined(_WIN32) || defined(__CYGWIN__) ) && defined(__GNUC__) && !defined(BOOST_DISABLE_CURRENT_FUNCTION)
#if ( defined(_WIN32) || defined(__CYGWIN__) ) && ( defined(__GNUC__) || defined(__clang__) ) && !defined(BOOST_DISABLE_CURRENT_FUNCTION)
return lib_id_ == rhs.lib_id_? this == &rhs: std::strcmp( name_, rhs.name_ ) == 0;
@ -65,7 +65,7 @@ public:
bool before( typeinfo const& rhs ) const
{
#if ( defined(_WIN32) || defined(__CYGWIN__) ) && defined(__GNUC__) && !defined(BOOST_DISABLE_CURRENT_FUNCTION)
#if ( defined(_WIN32) || defined(__CYGWIN__) ) && ( defined(__GNUC__) || defined(__clang__) ) && !defined(BOOST_DISABLE_CURRENT_FUNCTION)
return lib_id_ == rhs.lib_id_? std::less< typeinfo const* >()( this, &rhs ): std::strcmp( name_, rhs.name_ ) < 0;

View File

@ -120,7 +120,7 @@ namespace gregorian {
date end_of_month() const
{
ymd_type ymd = year_month_day();
short eom_day = gregorian_calendar::end_of_month_day(ymd.year, ymd.month);
unsigned short eom_day = gregorian_calendar::end_of_month_day(ymd.year, ymd.month);
return date(ymd.year, ymd.month, eom_day);
}

View File

@ -1,36 +0,0 @@
#ifndef BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED
#define BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
// detail/sp_typeinfo.hpp
//
// Deprecated, please use boost/core/typeinfo.hpp
//
// Copyright 2007 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/typeinfo.hpp>
namespace boost
{
namespace detail
{
typedef boost::core::typeinfo sp_typeinfo;
} // namespace detail
} // namespace boost
#define BOOST_SP_TYPEID(T) BOOST_CORE_TYPEID(T)
#endif // #ifndef BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED

View File

@ -165,7 +165,7 @@ boost
protected:
~error_info_container() throw()
~error_info_container() BOOST_NOEXCEPT_OR_NOTHROW
{
}
};
@ -233,7 +233,7 @@ boost
#ifdef __HP_aCC
//On HP aCC, this protected copy constructor prevents throwing boost::exception.
//On all other platforms, the same effect is achieved by the pure virtual destructor.
exception( exception const & x ) throw():
exception( exception const & x ) BOOST_NOEXCEPT_OR_NOTHROW:
data_(x.data_),
throw_function_(x.throw_function_),
throw_file_(x.throw_file_),
@ -242,7 +242,7 @@ boost
}
#endif
virtual ~exception() throw()
virtual ~exception() BOOST_NOEXCEPT_OR_NOTHROW
#ifndef __HP_aCC
= 0 //Workaround for HP aCC, =0 incorrectly leads to link errors.
#endif
@ -287,7 +287,7 @@ boost
inline
exception::
~exception() throw()
~exception() BOOST_NOEXCEPT_OR_NOTHROW
{
}
@ -337,7 +337,7 @@ boost
{
}
~error_info_injector() throw()
~error_info_injector() BOOST_NOEXCEPT_OR_NOTHROW
{
}
};
@ -398,7 +398,7 @@ boost
virtual void rethrow() const = 0;
virtual
~clone_base() throw()
~clone_base() BOOST_NOEXCEPT_OR_NOTHROW
{
}
};
@ -445,7 +445,7 @@ boost
copy_boost_exception(this,&x);
}
~clone_impl() throw()
~clone_impl() BOOST_NOEXCEPT_OR_NOTHROW
{
}
@ -487,7 +487,7 @@ boost
{
}
~wrapexcept() throw()
~wrapexcept() BOOST_NOEXCEPT_OR_NOTHROW
{
}
};

View File

@ -396,16 +396,12 @@ namespace boost {
functor_manager_operation_type op)
{
typedef typename get_function_tag<functor_type>::type tag_type;
switch (op) {
case get_functor_type_tag:
if (op == get_functor_type_tag) {
out_buffer.members.type.type = &boost::typeindex::type_id<functor_type>().type_info();
out_buffer.members.type.const_qualified = false;
out_buffer.members.type.volatile_qualified = false;
return;
default:
} else {
manager(in_buffer, out_buffer, op, tag_type());
return;
}
}
};
@ -510,16 +506,12 @@ namespace boost {
functor_manager_operation_type op)
{
typedef typename get_function_tag<functor_type>::type tag_type;
switch (op) {
case get_functor_type_tag:
if (op == get_functor_type_tag) {
out_buffer.members.type.type = &boost::typeindex::type_id<functor_type>().type_info();
out_buffer.members.type.const_qualified = false;
out_buffer.members.type.volatile_qualified = false;
return;
default:
} else {
manager(in_buffer, out_buffer, op, tag_type());
return;
}
}
};

View File

@ -23,6 +23,11 @@
#include <boost/config.hpp>
#endif
// MSVC-12 ICEs when variadic templates are enabled.
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && (!defined(BOOST_MSVC) || BOOST_MSVC >= 1900)
#define BOOST_INTRUSIVE_VARIADIC_TEMPLATES
#endif
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#define BOOST_INTRUSIVE_PERFECT_FORWARDING
#endif

View File

@ -209,6 +209,12 @@ struct do_pack<typelist<Prev, Last> >
typedef typename Prev::template pack<Last> type;
};
template<class ...Others>
struct do_pack<typelist<void, Others...> >
{
typedef typename do_pack<typelist<Others...> >::type type;
};
template<class Prev, class ...Others>
struct do_pack<typelist<Prev, Others...> >
{

View File

@ -180,7 +180,7 @@ void adaptive_sort_combine_blocks
size_type const max_i = n_reg_combined + (l_irreg_combined != 0);
if(merge_left || !use_buf) {
for( size_type combined_i = 0; combined_i != max_i; ++combined_i, combined_first += l_reg_combined) {
for( size_type combined_i = 0; combined_i != max_i; ) {
//Now merge blocks
bool const is_last = combined_i==n_reg_combined;
size_type const l_cur_combined = is_last ? l_irreg_combined : l_reg_combined;
@ -202,11 +202,15 @@ void adaptive_sort_combine_blocks
(keys, key_comp, combined_first, l_block, 0u, n_block_a, n_block_b, l_irreg2, comp, xbuf_used);
}
BOOST_MOVE_ADAPTIVE_SORT_PRINT_L2(" After merge_blocks_L: ", len + l_block);
++combined_i;
if(combined_i != max_i)
combined_first += l_reg_combined;
}
}
else{
combined_first += l_reg_combined*(max_i-1);
for( size_type combined_i = max_i; combined_i--; combined_first -= l_reg_combined) {
for( size_type combined_i = max_i; combined_i; ) {
--combined_i;
bool const is_last = combined_i==n_reg_combined;
size_type const l_cur_combined = is_last ? l_irreg_combined : l_reg_combined;
@ -222,6 +226,8 @@ void adaptive_sort_combine_blocks
merge_blocks_right
(keys, key_comp, combined_first, l_block, n_block_a, n_block_b, l_irreg2, comp, xbuf_used);
BOOST_MOVE_ADAPTIVE_SORT_PRINT_L2(" After merge_blocks_R: ", len + l_block);
if(combined_i)
combined_first -= l_reg_combined;
}
}
}

View File

@ -174,7 +174,7 @@ ForwardOutputIt1 inplace_set_unique_difference
++first2;
}
else if (comp(*first1, *first2)){
//skip any adjacent equivalent elementin range 1
//skip any adjacent equivalent element in range 1
ForwardOutputIt1 result = first1;
if (++first1 != last1 && !comp(*result, *first1)) {
//Some elements from range 1 must be skipped, no longer an inplace operation

View File

@ -46,7 +46,7 @@ struct if_c<false,T1,T2>
};
// agurt, 05/sep/04: nondescriptive parameter names for the sake of DigitalMars
// (and possibly MWCW < 8.0); see http://article.gmane.org/gmane.comp.lib.boost.devel/108959
// (and possibly MWCW < 8.0); see https://lists.boost.org/Archives/boost/2004/09/71383.php
template<
typename BOOST_MPL_AUX_NA_PARAM(T1)
, typename BOOST_MPL_AUX_NA_PARAM(T2)

View File

@ -12,6 +12,7 @@
#include <typeinfo> // for std::bad_cast
#include <boost/config.hpp>
#include <boost/config/no_tr1/cmath.hpp> // for std::floor and std::ceil
#include <boost/throw_exception.hpp>
@ -136,7 +137,7 @@ class bad_numeric_cast : public std::bad_cast
{
public:
virtual const char * what() const throw()
virtual const char * what() const BOOST_NOEXCEPT_OR_NOTHROW
{ return "bad numeric conversion: overflow"; }
};
@ -144,14 +145,14 @@ class negative_overflow : public bad_numeric_cast
{
public:
virtual const char * what() const throw()
virtual const char * what() const BOOST_NOEXCEPT_OR_NOTHROW
{ return "bad numeric conversion: negative overflow"; }
};
class positive_overflow : public bad_numeric_cast
{
public:
virtual const char * what() const throw()
virtual const char * what() const BOOST_NOEXCEPT_OR_NOTHROW
{ return "bad numeric conversion: positive overflow"; }
};

View File

@ -3,17 +3,18 @@
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Copyright 2019 Glen Joseph Fernandes (glenjofe@gmail.com)
//
// For more information, see http://www.boost.org/libs/range/
//
#ifndef BOOST_RANGE_ALGORITHM_MAX_ELEMENT_HPP_INCLUDED
#define BOOST_RANGE_ALGORITHM_MAX_ELEMENT_HPP_INCLUDED
#include <boost/algorithm/minmax_element.hpp>
#include <boost/concept_check.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/concepts.hpp>
#include <boost/range/detail/less.hpp>
#include <boost/range/detail/range_return.hpp>
namespace boost
@ -21,6 +22,27 @@ namespace boost
namespace range
{
namespace detail
{
template<typename Iterator, class Predicate>
inline Iterator
max_element(Iterator first, Iterator last, Predicate comp)
{
if (first == last) {
return last;
}
Iterator result = first;
while (++first != last) {
if (comp(*result, *first)) {
result = first;
}
}
return result;
}
} // namespace detail
/// \brief template function max_element
///
/// range-based version of the max_element std algorithm
@ -32,7 +54,7 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type
max_element(ForwardRange& rng)
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
return boost::first_max_element(boost::begin(rng), boost::end(rng));
return detail::max_element(boost::begin(rng), boost::end(rng), detail::less());
}
/// \overload
@ -41,7 +63,7 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
max_element(const ForwardRange& rng)
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
return boost::first_max_element(boost::begin(rng), boost::end(rng));
return detail::max_element(boost::begin(rng), boost::end(rng), detail::less());
}
/// \overload
@ -50,7 +72,7 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type
max_element(ForwardRange& rng, BinaryPredicate pred)
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
return boost::first_max_element(boost::begin(rng), boost::end(rng), pred);
return detail::max_element(boost::begin(rng), boost::end(rng), pred);
}
/// \overload
@ -59,7 +81,7 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
max_element(const ForwardRange& rng, BinaryPredicate pred)
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
return boost::first_max_element(boost::begin(rng), boost::end(rng), pred);
return detail::max_element(boost::begin(rng), boost::end(rng), pred);
}
// range_return overloads
@ -71,7 +93,7 @@ max_element(ForwardRange& rng)
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
return range_return<ForwardRange,re>::pack(
boost::first_max_element(boost::begin(rng), boost::end(rng)),
detail::max_element(boost::begin(rng), boost::end(rng), detail::less()),
rng);
}
@ -82,7 +104,7 @@ max_element(const ForwardRange& rng)
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
return range_return<const ForwardRange,re>::pack(
boost::first_max_element(boost::begin(rng), boost::end(rng)),
detail::max_element(boost::begin(rng), boost::end(rng), detail::less()),
rng);
}
@ -93,7 +115,7 @@ max_element(ForwardRange& rng, BinaryPredicate pred)
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
return range_return<ForwardRange,re>::pack(
boost::first_max_element(boost::begin(rng), boost::end(rng), pred),
detail::max_element(boost::begin(rng), boost::end(rng), pred),
rng);
}
@ -104,7 +126,7 @@ max_element(const ForwardRange& rng, BinaryPredicate pred)
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
return range_return<const ForwardRange,re>::pack(
boost::first_max_element(boost::begin(rng), boost::end(rng), pred),
detail::max_element(boost::begin(rng), boost::end(rng), pred),
rng);
}

View File

@ -3,17 +3,18 @@
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Copyright 2019 Glen Joseph Fernandes (glenjofe@gmail.com)
//
// For more information, see http://www.boost.org/libs/range/
//
#ifndef BOOST_RANGE_ALGORITHM_MIN_ELEMENT_HPP_INCLUDED
#define BOOST_RANGE_ALGORITHM_MIN_ELEMENT_HPP_INCLUDED
#include <boost/algorithm/minmax_element.hpp>
#include <boost/concept_check.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/concepts.hpp>
#include <boost/range/detail/less.hpp>
#include <boost/range/detail/range_return.hpp>
namespace boost
@ -21,6 +22,27 @@ namespace boost
namespace range
{
namespace detail
{
template<typename Iterator, class Predicate>
inline Iterator
min_element(Iterator first, Iterator last, Predicate comp)
{
if (first == last) {
return last;
}
Iterator result = first;
while (++first != last) {
if (comp(*first, *result)) {
result = first;
}
}
return result;
}
} // namespace detail
/// \brief template function min_element
///
/// range-based version of the min_element std algorithm
@ -32,7 +54,7 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type
min_element(ForwardRange& rng)
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
return boost::first_min_element(boost::begin(rng), boost::end(rng));
return detail::min_element(boost::begin(rng), boost::end(rng), detail::less());
}
/// \overload
@ -41,7 +63,7 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
min_element(const ForwardRange& rng)
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
return boost::first_min_element(boost::begin(rng), boost::end(rng));
return detail::min_element(boost::begin(rng), boost::end(rng), detail::less());
}
/// \overload
@ -50,7 +72,7 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type
min_element(ForwardRange& rng, BinaryPredicate pred)
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
return boost::first_min_element(boost::begin(rng), boost::end(rng), pred);
return detail::min_element(boost::begin(rng), boost::end(rng), pred);
}
/// \overload
@ -59,7 +81,7 @@ inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
min_element(const ForwardRange& rng, BinaryPredicate pred)
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
return boost::first_min_element(boost::begin(rng), boost::end(rng), pred);
return detail::min_element(boost::begin(rng), boost::end(rng), pred);
}
// range_return overloads
@ -71,7 +93,7 @@ min_element(ForwardRange& rng)
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
return range_return<ForwardRange,re>::pack(
boost::first_min_element(boost::begin(rng), boost::end(rng)),
detail::min_element(boost::begin(rng), boost::end(rng), detail::less()),
rng);
}
@ -82,7 +104,7 @@ min_element(const ForwardRange& rng)
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
return range_return<const ForwardRange,re>::pack(
boost::first_min_element(boost::begin(rng), boost::end(rng)),
detail::min_element(boost::begin(rng), boost::end(rng), detail::less()),
rng);
}
@ -93,7 +115,7 @@ min_element(ForwardRange& rng, BinaryPredicate pred)
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
return range_return<ForwardRange,re>::pack(
boost::first_min_element(boost::begin(rng), boost::end(rng), pred),
detail::min_element(boost::begin(rng), boost::end(rng), pred),
rng);
}
@ -104,7 +126,7 @@ min_element(const ForwardRange& rng, BinaryPredicate pred)
{
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
return range_return<const ForwardRange,re>::pack(
boost::first_min_element(boost::begin(rng), boost::end(rng), pred),
detail::min_element(boost::begin(rng), boost::end(rng), pred),
rng);
}

View File

@ -0,0 +1,26 @@
/*
Copyright 2019 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_RANGE_DETAIL_LESS
#define BOOST_RANGE_DETAIL_LESS
namespace boost {
namespace range {
namespace detail {
struct less {
template<class T, class U>
bool operator()(const T& lhs, const U& rhs) const {
return lhs < rhs;
}
};
} /* detail */
} /* range */
} /* boost */
#endif

View File

@ -87,6 +87,7 @@
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/is_class.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_array.hpp>
// Control whether depreciated GCD and LCM functions are included (default: yes)
#ifndef BOOST_CONTROL_RATIONAL_HAS_GCD
@ -113,8 +114,11 @@ IntType lcm(IntType n, IntType m)
namespace rational_detail{
template <class FromInt, class ToInt, typename Enable = void>
struct is_compatible_integer;
template <class FromInt, class ToInt>
struct is_compatible_integer
struct is_compatible_integer<FromInt, ToInt, typename enable_if_c<!is_array<FromInt>::value>::type>
{
BOOST_STATIC_CONSTANT(bool, value = ((std::numeric_limits<FromInt>::is_specialized && std::numeric_limits<FromInt>::is_integer
&& (std::numeric_limits<FromInt>::digits <= std::numeric_limits<ToInt>::digits)
@ -125,6 +129,29 @@ namespace rational_detail{
|| (is_class<ToInt>::value && is_class<FromInt>::value && is_convertible<FromInt, ToInt>::value));
};
template <class FromInt, class ToInt>
struct is_compatible_integer<FromInt, ToInt, typename enable_if_c<is_array<FromInt>::value>::type>
{
BOOST_STATIC_CONSTANT(bool, value = false);
};
template <class FromInt, class ToInt, typename Enable = void>
struct is_backward_compatible_integer;
template <class FromInt, class ToInt>
struct is_backward_compatible_integer<FromInt, ToInt, typename enable_if_c<!is_array<FromInt>::value>::type>
{
BOOST_STATIC_CONSTANT(bool, value = (std::numeric_limits<FromInt>::is_specialized && std::numeric_limits<FromInt>::is_integer
&& !is_compatible_integer<FromInt, ToInt>::value
&& (std::numeric_limits<FromInt>::radix == std::numeric_limits<ToInt>::radix)
&& is_convertible<FromInt, ToInt>::value));
};
template <class FromInt, class ToInt>
struct is_backward_compatible_integer<FromInt, ToInt, typename enable_if_c<is_array<FromInt>::value>::type>
{
BOOST_STATIC_CONSTANT(bool, value = false);
};
}
class bad_rational : public std::domain_error
@ -152,10 +179,12 @@ public:
BOOST_CONSTEXPR
rational() : num(0), den(1) {}
template <class T>
template <class T>//, typename enable_if_c<!is_array<T>::value>::type>
BOOST_CONSTEXPR rational(const T& n, typename enable_if_c<
rational_detail::is_compatible_integer<T, IntType>::value
>::type const* = 0) : num(n), den(1) {}
template <class T, class U>
BOOST_CXX14_CONSTEXPR rational(const T& n, const U& d, typename enable_if_c<
rational_detail::is_compatible_integer<T, IntType>::value && rational_detail::is_compatible_integer<U, IntType>::value
@ -200,12 +229,9 @@ public:
// conversion from T to IntType, they will throw a bad_rational
// if the conversion results in loss of precision or undefined behaviour.
//
template <class T>
template <class T>//, typename enable_if_c<!is_array<T>::value>::type>
BOOST_CXX14_CONSTEXPR rational(const T& n, typename enable_if_c<
std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::is_integer
&& !rational_detail::is_compatible_integer<T, IntType>::value
&& (std::numeric_limits<T>::radix == std::numeric_limits<IntType>::radix)
&& is_convertible<T, IntType>::value
rational_detail::is_backward_compatible_integer<T, IntType>::value
>::type const* = 0)
{
assign(n, static_cast<T>(1));

View File

@ -8,15 +8,14 @@ Distributed under the Boost Software License, Version 1.0.
#ifndef BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP
#define BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP
#include <boost/core/alloc_construct.hpp>
#include <boost/core/first_scalar.hpp>
#include <boost/smart_ptr/shared_ptr.hpp>
#include <boost/type_traits/alignment_of.hpp>
#include <boost/type_traits/enable_if.hpp>
#include <boost/type_traits/extent.hpp>
#include <boost/type_traits/is_bounded_array.hpp>
#include <boost/type_traits/is_unbounded_array.hpp>
#include <boost/type_traits/has_trivial_assign.hpp>
#include <boost/type_traits/has_trivial_constructor.hpp>
#include <boost/type_traits/has_trivial_destructor.hpp>
#include <boost/type_traits/remove_all_extents.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/remove_extent.hpp>
#include <boost/type_traits/type_with_alignment.hpp>
@ -25,15 +24,22 @@ namespace boost {
namespace detail {
template<class T>
struct sp_array_scalar {
struct sp_array_element {
typedef typename boost::remove_cv<typename
boost::remove_all_extents<T>::type>::type type;
boost::remove_extent<T>::type>::type type;
};
template<class T, class U>
template<class T>
struct sp_array_count {
enum {
value = sizeof(T) / sizeof(U)
value = 1
};
};
template<class T, std::size_t N>
struct sp_array_count<T[N]> {
enum {
value = N * sp_array_count<T>::value
};
};
@ -70,154 +76,6 @@ sp_objects(std::size_t size) BOOST_SP_NOEXCEPT
return (size + sizeof(T) - 1) / sizeof(T);
}
template<bool E, class A, class T>
inline typename boost::enable_if_<!E &&
boost::has_trivial_destructor<T>::value>::type
sp_array_destroy(A&, T*, std::size_t) BOOST_SP_NOEXCEPT { }
template<bool E, class A, class T>
inline typename boost::enable_if_<!E &&
!boost::has_trivial_destructor<T>::value>::type
sp_array_destroy(A&, T* ptr, std::size_t size)
{
while (size > 0) {
ptr[--size].~T();
}
}
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
template<bool E, class A, class T>
inline typename boost::enable_if_<E>::type
sp_array_destroy(A& allocator, T* ptr, std::size_t size)
{
while (size > 0) {
std::allocator_traits<A>::destroy(allocator, ptr + --size);
}
}
#endif
template<bool E, class A, class T>
class sp_destroyer {
public:
sp_destroyer(A& allocator, T* ptr) BOOST_SP_NOEXCEPT
: allocator_(allocator),
ptr_(ptr),
size_(0) { }
~sp_destroyer() {
sp_array_destroy<E>(allocator_, ptr_, size_);
}
std::size_t& size() BOOST_SP_NOEXCEPT {
return size_;
}
private:
sp_destroyer(const sp_destroyer&);
sp_destroyer& operator=(const sp_destroyer&);
A& allocator_;
T* ptr_;
std::size_t size_;
};
template<bool E, class A, class T>
inline typename boost::enable_if_<!E &&
boost::has_trivial_constructor<T>::value &&
boost::has_trivial_assign<T>::value &&
boost::has_trivial_destructor<T>::value>::type
sp_array_construct(A&, T* ptr, std::size_t size)
{
for (std::size_t i = 0; i < size; ++i) {
ptr[i] = T();
}
}
template<bool E, class A, class T>
inline typename boost::enable_if_<!E &&
boost::has_trivial_constructor<T>::value &&
boost::has_trivial_assign<T>::value &&
boost::has_trivial_destructor<T>::value>::type
sp_array_construct(A&, T* ptr, std::size_t size, const T* list,
std::size_t count)
{
for (std::size_t i = 0; i < size; ++i) {
ptr[i] = list[i % count];
}
}
template<bool E, class A, class T>
inline typename boost::enable_if_<!E &&
!(boost::has_trivial_constructor<T>::value &&
boost::has_trivial_assign<T>::value &&
boost::has_trivial_destructor<T>::value)>::type
sp_array_construct(A& none, T* ptr, std::size_t size)
{
sp_destroyer<E, A, T> hold(none, ptr);
for (std::size_t& i = hold.size(); i < size; ++i) {
::new(static_cast<void*>(ptr + i)) T();
}
hold.size() = 0;
}
template<bool E, class A, class T>
inline typename boost::enable_if_<!E &&
!(boost::has_trivial_constructor<T>::value &&
boost::has_trivial_assign<T>::value &&
boost::has_trivial_destructor<T>::value)>::type
sp_array_construct(A& none, T* ptr, std::size_t size, const T* list,
std::size_t count)
{
sp_destroyer<E, A, T> hold(none, ptr);
for (std::size_t& i = hold.size(); i < size; ++i) {
::new(static_cast<void*>(ptr + i)) T(list[i % count]);
}
hold.size() = 0;
}
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
template<bool E, class A, class T>
inline typename boost::enable_if_<E>::type
sp_array_construct(A& allocator, T* ptr, std::size_t size)
{
sp_destroyer<E, A, T> hold(allocator, ptr);
for (std::size_t& i = hold.size(); i < size; ++i) {
std::allocator_traits<A>::construct(allocator, ptr + i);
}
hold.size() = 0;
}
template<bool E, class A, class T>
inline typename boost::enable_if_<E>::type
sp_array_construct(A& allocator, T* ptr, std::size_t size, const T* list,
std::size_t count)
{
sp_destroyer<E, A, T> hold(allocator, ptr);
for (std::size_t& i = hold.size(); i < size; ++i) {
std::allocator_traits<A>::construct(allocator, ptr + i,
list[i % count]);
}
hold.size() = 0;
}
#endif
template<class A, class T>
inline typename
boost::enable_if_<boost::has_trivial_constructor<T>::value>::type
sp_array_default(A&, T*, std::size_t) BOOST_SP_NOEXCEPT { }
template<class A, class T>
inline typename
boost::enable_if_<!boost::has_trivial_constructor<T>::value>::type
sp_array_default(A& none, T* ptr, std::size_t size)
{
sp_destroyer<false, A, T> hold(none, ptr);
for (std::size_t& i = hold.size(); i < size; ++i) {
::new(static_cast<void*>(ptr + i)) T;
}
hold.size() = 0;
}
template<class A>
class sp_array_state {
public:
@ -262,29 +120,6 @@ private:
A allocator_;
};
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
template<class A>
struct sp_use_construct {
enum {
value = true
};
};
template<class T>
struct sp_use_construct<std::allocator<T> > {
enum {
value = false
};
};
#else
template<class>
struct sp_use_construct {
enum {
value = false
};
};
#endif
template<class T, class U>
struct sp_array_alignment {
enum {
@ -300,39 +135,32 @@ struct sp_array_offset {
};
};
template<class T, class U>
struct sp_array_storage {
enum {
value = sp_array_alignment<T, U>::value
};
typedef typename boost::type_with_alignment<value>::type type;
};
template<class T, class U>
template<class U, class T>
inline U*
sp_array_start(void* base) BOOST_SP_NOEXCEPT
sp_array_start(T* base) BOOST_SP_NOEXCEPT
{
enum {
size = sp_array_offset<T, U>::value
};
return reinterpret_cast<U*>(static_cast<char*>(base) + size);
return reinterpret_cast<U*>(reinterpret_cast<char*>(base) + size);
}
template<class A, class T>
class sp_array_creator {
typedef typename A::value_type scalar;
typedef typename A::value_type element;
enum {
offset = sp_array_offset<T, scalar>::value
offset = sp_array_offset<T, element>::value
};
typedef typename sp_array_storage<T, scalar>::type type;
typedef typename boost::type_with_alignment<sp_array_alignment<T,
element>::value>::type type;
public:
template<class U>
sp_array_creator(const U& other, std::size_t size) BOOST_SP_NOEXCEPT
: other_(other),
size_(sp_objects<type>(offset + sizeof(scalar) * size)) { }
size_(sp_objects<type>(offset + sizeof(element) * size)) { }
T* create() {
return reinterpret_cast<T*>(other_.allocate(size_));
@ -347,9 +175,7 @@ private:
std::size_t size_;
};
struct sp_default { };
template<class T, bool E = sp_use_construct<T>::value>
template<class T>
class BOOST_SYMBOL_VISIBLE sp_array_base
: public sp_counted_base {
typedef typename T::type allocator;
@ -358,23 +184,22 @@ public:
typedef typename allocator::value_type type;
template<class A>
sp_array_base(const A& other, std::size_t size, type* start)
sp_array_base(const A& other, type* start, std::size_t size)
: state_(other, size) {
sp_array_construct<E>(state_.allocator(), start, state_.size());
boost::alloc_construct_n(state_.allocator(),
boost::first_scalar(start),
state_.size() * sp_array_count<type>::value);
}
template<class A>
sp_array_base(const A& other, std::size_t size, const type* list,
std::size_t count, type* start)
template<class A, class U>
sp_array_base(const A& other, type* start, std::size_t size, const U& list)
: state_(other, size) {
sp_array_construct<E>(state_.allocator(), start, state_.size(), list,
count);
}
template<class A>
sp_array_base(sp_default, const A& other, std::size_t size, type* start)
: state_(other, size) {
sp_array_default(state_.allocator(), start, state_.size());
enum {
count = sp_array_count<type>::value
};
boost::alloc_construct_n(state_.allocator(),
boost::first_scalar(start), state_.size() * count,
boost::first_scalar(&list), count);
}
T& state() BOOST_SP_NOEXCEPT {
@ -382,8 +207,9 @@ public:
}
virtual void dispose() BOOST_SP_NOEXCEPT {
sp_array_destroy<E>(state_.allocator(),
sp_array_start<sp_array_base, type>(this), state_.size());
boost::alloc_destroy_n(state_.allocator(),
boost::first_scalar(sp_array_start<type>(this)),
state_.size() * sp_array_count<type>::value);
}
virtual void destroy() BOOST_SP_NOEXCEPT {
@ -393,11 +219,11 @@ public:
other.destroy(this);
}
virtual void* get_deleter(const sp_typeinfo&) BOOST_SP_NOEXCEPT {
virtual void* get_deleter(const sp_typeinfo_&) BOOST_SP_NOEXCEPT {
return 0;
}
virtual void* get_local_deleter(const sp_typeinfo&) BOOST_SP_NOEXCEPT {
virtual void* get_local_deleter(const sp_typeinfo_&) BOOST_SP_NOEXCEPT {
return 0;
}
@ -423,11 +249,11 @@ public:
}
}
T* get() const {
T* get() const BOOST_SP_NOEXCEPT {
return result_;
}
void release() {
void release() BOOST_SP_NOEXCEPT {
result_ = 0;
}
@ -445,40 +271,37 @@ template<class T, class A>
inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type
allocate_shared(const A& allocator, std::size_t count)
{
typedef typename remove_extent<T>::type type;
typedef typename detail::sp_array_scalar<T>::type scalar;
typedef typename detail::sp_bind_allocator<A, scalar>::type other;
typedef typename detail::sp_array_element<T>::type element;
typedef typename detail::sp_bind_allocator<A, element>::type other;
typedef detail::sp_array_state<other> state;
typedef detail::sp_array_base<state> base;
std::size_t size = count * detail::sp_array_count<type, scalar>::value;
detail::sp_array_result<other, base> result(allocator, size);
detail::sp_counted_base* node = result.get();
scalar* start = detail::sp_array_start<base, scalar>(node);
::new(static_cast<void*>(node)) base(allocator, size, start);
detail::sp_array_result<other, base> result(allocator, count);
base* node = result.get();
element* start = detail::sp_array_start<element>(node);
::new(static_cast<void*>(node)) base(allocator, start, count);
result.release();
return shared_ptr<T>(detail::sp_internal_constructor_tag(),
reinterpret_cast<type*>(start), detail::shared_count(node));
return shared_ptr<T>(detail::sp_internal_constructor_tag(), start,
detail::shared_count(static_cast<detail::sp_counted_base*>(node)));
}
template<class T, class A>
inline typename enable_if_<is_bounded_array<T>::value, shared_ptr<T> >::type
allocate_shared(const A& allocator)
{
typedef typename remove_extent<T>::type type;
typedef typename detail::sp_array_scalar<T>::type scalar;
typedef typename detail::sp_bind_allocator<A, scalar>::type other;
enum {
size = detail::sp_array_count<T, scalar>::value
count = extent<T>::value
};
typedef detail::sp_size_array_state<other, size> state;
typedef typename detail::sp_array_element<T>::type element;
typedef typename detail::sp_bind_allocator<A, element>::type other;
typedef detail::sp_size_array_state<other, extent<T>::value> state;
typedef detail::sp_array_base<state> base;
detail::sp_array_result<other, base> result(allocator, size);
detail::sp_counted_base* node = result.get();
scalar* start = detail::sp_array_start<base, scalar>(node);
::new(static_cast<void*>(node)) base(allocator, size, start);
detail::sp_array_result<other, base> result(allocator, count);
base* node = result.get();
element* start = detail::sp_array_start<element>(node);
::new(static_cast<void*>(node)) base(allocator, start, count);
result.release();
return shared_ptr<T>(detail::sp_internal_constructor_tag(),
reinterpret_cast<type*>(start), detail::shared_count(node));
return shared_ptr<T>(detail::sp_internal_constructor_tag(), start,
detail::shared_count(static_cast<detail::sp_counted_base*>(node)));
}
template<class T, class A>
@ -486,23 +309,17 @@ inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type
allocate_shared(const A& allocator, std::size_t count,
const typename remove_extent<T>::type& value)
{
typedef typename remove_extent<T>::type type;
typedef typename detail::sp_array_scalar<T>::type scalar;
typedef typename detail::sp_bind_allocator<A, scalar>::type other;
typedef typename detail::sp_array_element<T>::type element;
typedef typename detail::sp_bind_allocator<A, element>::type other;
typedef detail::sp_array_state<other> state;
typedef detail::sp_array_base<state> base;
enum {
total = detail::sp_array_count<type, scalar>::value
};
std::size_t size = count * total;
detail::sp_array_result<other, base> result(allocator, size);
detail::sp_counted_base* node = result.get();
scalar* start = detail::sp_array_start<base, scalar>(node);
::new(static_cast<void*>(node)) base(allocator, size,
reinterpret_cast<const scalar*>(&value), total, start);
detail::sp_array_result<other, base> result(allocator, count);
base* node = result.get();
element* start = detail::sp_array_start<element>(node);
::new(static_cast<void*>(node)) base(allocator, start, count, value);
result.release();
return shared_ptr<T>(detail::sp_internal_constructor_tag(),
reinterpret_cast<type*>(start), detail::shared_count(node));
return shared_ptr<T>(detail::sp_internal_constructor_tag(), start,
detail::shared_count(static_cast<detail::sp_counted_base*>(node)));
}
template<class T, class A>
@ -510,65 +327,34 @@ inline typename enable_if_<is_bounded_array<T>::value, shared_ptr<T> >::type
allocate_shared(const A& allocator,
const typename remove_extent<T>::type& value)
{
typedef typename remove_extent<T>::type type;
typedef typename detail::sp_array_scalar<T>::type scalar;
typedef typename detail::sp_bind_allocator<A, scalar>::type other;
enum {
size = detail::sp_array_count<T, scalar>::value
count = extent<T>::value
};
typedef detail::sp_size_array_state<other, size> state;
typedef typename detail::sp_array_element<T>::type element;
typedef typename detail::sp_bind_allocator<A, element>::type other;
typedef detail::sp_size_array_state<other, extent<T>::value> state;
typedef detail::sp_array_base<state> base;
detail::sp_array_result<other, base> result(allocator, size);
detail::sp_counted_base* node = result.get();
scalar* start = detail::sp_array_start<base, scalar>(node);
::new(static_cast<void*>(node)) base(allocator, size,
reinterpret_cast<const scalar*>(&value),
detail::sp_array_count<type, scalar>::value, start);
detail::sp_array_result<other, base> result(allocator, count);
base* node = result.get();
element* start = detail::sp_array_start<element>(node);
::new(static_cast<void*>(node)) base(allocator, start, count, value);
result.release();
return shared_ptr<T>(detail::sp_internal_constructor_tag(),
reinterpret_cast<type*>(start), detail::shared_count(node));
return shared_ptr<T>(detail::sp_internal_constructor_tag(), start,
detail::shared_count(static_cast<detail::sp_counted_base*>(node)));
}
template<class T, class A>
inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type
allocate_shared_noinit(const A& allocator, std::size_t count)
{
typedef typename remove_extent<T>::type type;
typedef typename detail::sp_array_scalar<T>::type scalar;
typedef typename detail::sp_bind_allocator<A, scalar>::type other;
typedef detail::sp_array_state<other> state;
typedef detail::sp_array_base<state, false> base;
std::size_t size = count * detail::sp_array_count<type, scalar>::value;
detail::sp_array_result<other, base> result(allocator, size);
detail::sp_counted_base* node = result.get();
scalar* start = detail::sp_array_start<base, scalar>(node);
::new(static_cast<void*>(node)) base(detail::sp_default(), allocator,
size, start);
result.release();
return shared_ptr<T>(detail::sp_internal_constructor_tag(),
reinterpret_cast<type*>(start), detail::shared_count(node));
return boost::allocate_shared<T>(boost::noinit_adapt(allocator), count);
}
template<class T, class A>
inline typename enable_if_<is_bounded_array<T>::value, shared_ptr<T> >::type
allocate_shared_noinit(const A& allocator)
{
typedef typename remove_extent<T>::type type;
typedef typename detail::sp_array_scalar<T>::type scalar;
typedef typename detail::sp_bind_allocator<A, scalar>::type other;
enum {
size = detail::sp_array_count<T, scalar>::value
};
typedef detail::sp_size_array_state<other, size> state;
typedef detail::sp_array_base<state, false> base;
detail::sp_array_result<other, base> result(allocator, size);
detail::sp_counted_base* node = result.get();
scalar* start = detail::sp_array_start<base, scalar>(node);
::new(static_cast<void*>(node)) base(detail::sp_default(), allocator,
size, start);
result.release();
return shared_ptr<T>(detail::sp_internal_constructor_tag(),
reinterpret_cast<type*>(start), detail::shared_count(node));
return boost::allocate_shared<T>(boost::noinit_adapt(allocator));
}
} /* boost */

View File

@ -26,7 +26,7 @@ class atomic_count
{
public:
explicit atomic_count( long v ): value_( v )
explicit atomic_count( long v ): value_( static_cast< std::int_least32_t >( v ) )
{
}

View File

@ -499,12 +499,12 @@ public:
return std::less<sp_counted_base *>()( a.pi_, b.pi_ );
}
void * get_deleter( sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT
void * get_deleter( sp_typeinfo_ const & ti ) const BOOST_SP_NOEXCEPT
{
return pi_? pi_->get_deleter( ti ): 0;
}
void * get_local_deleter( sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT
void * get_local_deleter( sp_typeinfo_ const & ti ) const BOOST_SP_NOEXCEPT
{
return pi_? pi_->get_local_deleter( ti ): 0;
}

View File

@ -15,7 +15,7 @@
// Lock-free algorithm by Alexander Terekhov
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
#include <boost/config.hpp>
#include <machine/sys/inline.h>
@ -104,8 +104,8 @@ public:
delete this;
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy()

View File

@ -20,7 +20,7 @@
// formulation
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
#include <boost/config.hpp>
#include <builtins.h>
#include <sys/atomic_op.h>
@ -96,8 +96,8 @@ public:
delete this;
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy()

View File

@ -15,7 +15,7 @@
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
#include <boost/smart_ptr/detail/sp_noexcept.hpp>
#include <boost/config.hpp>
#include <boost/cstdint.hpp>
@ -99,8 +99,8 @@ public:
delete this;
}
virtual void * get_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT = 0;
virtual void * get_local_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT = 0;
virtual void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0;
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0;
virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT = 0;
void add_ref_copy() BOOST_SP_NOEXCEPT

View File

@ -24,7 +24,7 @@
// formulation
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
#include <boost/config.hpp>
namespace boost
@ -124,8 +124,8 @@ public:
delete this;
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy()

View File

@ -16,7 +16,7 @@
// Lock-free algorithm by Alexander Terekhov
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
#include <boost/config.hpp>
namespace boost
@ -111,8 +111,8 @@ public:
delete this;
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy()

View File

@ -20,7 +20,7 @@
// Lock-free algorithm by Alexander Terekhov
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
#include <boost/config.hpp>
namespace boost
@ -141,8 +141,8 @@ public:
delete this;
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy()

View File

@ -24,7 +24,7 @@
// formulation
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
#include <boost/config.hpp>
namespace boost
@ -135,8 +135,8 @@ public:
delete this;
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy()

View File

@ -19,7 +19,7 @@
//
// Thanks to Michael van der Westhuizen
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
#include <boost/config.hpp>
#include <inttypes.h> // int32_t
@ -120,8 +120,8 @@ public:
delete this;
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy()

View File

@ -24,7 +24,7 @@
// formulation
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
#include <boost/config.hpp>
namespace boost
@ -127,8 +127,8 @@ public:
delete this;
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy()

View File

@ -18,7 +18,7 @@
// http://www.boost.org/LICENSE_1_0.txt)
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
#include <boost/smart_ptr/detail/sp_noexcept.hpp>
#include <boost/config.hpp>
#include <boost/cstdint.hpp>
@ -61,8 +61,8 @@ public:
delete this;
}
virtual void * get_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT = 0;
virtual void * get_local_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT = 0;
virtual void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0;
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0;
virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT = 0;
void add_ref_copy() BOOST_SP_NOEXCEPT

View File

@ -18,7 +18,7 @@
// http://www.boost.org/LICENSE_1_0.txt)
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
#include <boost/assert.hpp>
#include <boost/config.hpp>
#include <boost/cstdint.hpp>
@ -72,8 +72,8 @@ public:
delete this;
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy()

View File

@ -19,7 +19,7 @@
//
// Thanks to Michael van der Westhuizen
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
#include <boost/config.hpp>
#include <inttypes.h> // uint32_t
@ -115,8 +115,8 @@ public:
delete this;
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy()

View File

@ -18,7 +18,7 @@
// http://www.boost.org/LICENSE_1_0.txt)
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
#include <boost/smart_ptr/detail/spinlock_pool.hpp>
#include <boost/config.hpp>
@ -84,8 +84,8 @@ public:
delete this;
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy()

View File

@ -15,7 +15,7 @@
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
#include <boost/smart_ptr/detail/sp_noexcept.hpp>
#include <boost/config.hpp>
#include <atomic>
@ -91,8 +91,8 @@ public:
delete this;
}
virtual void * get_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT = 0;
virtual void * get_local_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT = 0;
virtual void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0;
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0;
virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT = 0;
void add_ref_copy() BOOST_SP_NOEXCEPT

View File

@ -15,7 +15,7 @@
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
#include <boost/config.hpp>
#include <limits.h>
@ -109,8 +109,8 @@ public:
delete this;
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy()

View File

@ -21,7 +21,7 @@
// formulation
//
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
#include <boost/config.hpp>
extern "builtin" void __lwsync(void);
@ -104,8 +104,8 @@ public:
delete this;
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy()

View File

@ -25,8 +25,8 @@
//
#include <boost/smart_ptr/detail/sp_interlocked.hpp>
#include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/detail/sp_typeinfo.hpp>
#include <boost/config.hpp>
namespace boost
@ -67,8 +67,8 @@ public:
delete this;
}
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy()

View File

@ -93,12 +93,12 @@ public:
boost::checked_delete( px_ );
}
virtual void * get_deleter( sp_typeinfo const & ) BOOST_SP_NOEXCEPT
virtual void * get_deleter( sp_typeinfo_ const & ) BOOST_SP_NOEXCEPT
{
return 0;
}
virtual void * get_local_deleter( sp_typeinfo const & ) BOOST_SP_NOEXCEPT
virtual void * get_local_deleter( sp_typeinfo_ const & ) BOOST_SP_NOEXCEPT
{
return 0;
}
@ -173,14 +173,14 @@ public:
del( ptr );
}
virtual void * get_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT
virtual void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT
{
return ti == BOOST_SP_TYPEID(D)? &reinterpret_cast<char&>( del ): 0;
return ti == BOOST_SP_TYPEID_(D)? &reinterpret_cast<char&>( del ): 0;
}
virtual void * get_local_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT
{
return ti == BOOST_SP_TYPEID(D)? boost::detail::get_local_deleter( boost::addressof( del ) ): 0;
return ti == BOOST_SP_TYPEID_(D)? boost::detail::get_local_deleter( boost::addressof( del ) ): 0;
}
virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT
@ -266,14 +266,14 @@ public:
a2.deallocate( this, 1 );
}
virtual void * get_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT
virtual void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT
{
return ti == BOOST_SP_TYPEID( D )? &reinterpret_cast<char&>( d_ ): 0;
return ti == BOOST_SP_TYPEID_( D )? &reinterpret_cast<char&>( d_ ): 0;
}
virtual void * get_local_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT
{
return ti == BOOST_SP_TYPEID(D)? boost::detail::get_local_deleter( boost::addressof( d_ ) ): 0;
return ti == BOOST_SP_TYPEID_( D )? boost::detail::get_local_deleter( boost::addressof( d_ ) ): 0;
}
virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT

View File

@ -0,0 +1,58 @@
#ifndef BOOST_SMART_PTR_DETAIL_SP_TYPEINFO_HPP_INCLUDED
#define BOOST_SMART_PTR_DETAIL_SP_TYPEINFO_HPP_INCLUDED
// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif
// smart_ptr/detail/sp_typeinfo_.hpp
//
// Copyright 2007, 2019 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 ) || defined( BOOST_NO_STD_TYPEINFO )
#include <boost/core/typeinfo.hpp>
namespace boost
{
namespace detail
{
typedef boost::core::typeinfo sp_typeinfo_;
} // namespace detail
} // namespace boost
#define BOOST_SP_TYPEID_(T) BOOST_CORE_TYPEID(T)
#else // defined( BOOST_NO_TYPEID ) || defined( BOOST_NO_STD_TYPEINFO )
#include <typeinfo>
namespace boost
{
namespace detail
{
typedef std::type_info sp_typeinfo_;
} // namespace detail
} // namespace boost
#define BOOST_SP_TYPEID_(T) typeid(T)
#endif // defined( BOOST_NO_TYPEID ) || defined( BOOST_NO_STD_TYPEINFO )
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_TYPEINFO_HPP_INCLUDED

View File

@ -297,6 +297,8 @@ template<class T> T * get_pointer(intrusive_ptr<T> const & p) BOOST_SP_NOEXCEPT
return p.get();
}
// pointer casts
template<class T, class U> intrusive_ptr<T> static_pointer_cast(intrusive_ptr<U> const & p)
{
return static_cast<T *>(p.get());
@ -312,6 +314,31 @@ template<class T, class U> intrusive_ptr<T> dynamic_pointer_cast(intrusive_ptr<U
return dynamic_cast<T *>(p.get());
}
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
template<class T, class U> intrusive_ptr<T> static_pointer_cast( intrusive_ptr<U> && p ) BOOST_SP_NOEXCEPT
{
return intrusive_ptr<T>( static_cast<T*>( p.detach() ), false );
}
template<class T, class U> intrusive_ptr<T> const_pointer_cast( intrusive_ptr<U> && p ) BOOST_SP_NOEXCEPT
{
return intrusive_ptr<T>( const_cast<T*>( p.detach() ), false );
}
template<class T, class U> intrusive_ptr<T> dynamic_pointer_cast( intrusive_ptr<U> && p ) BOOST_SP_NOEXCEPT
{
T * p2 = dynamic_cast<T*>( p.get() );
intrusive_ptr<T> r( p2, false );
if( p2 ) p.detach();
return r;
}
#endif // defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
// operator<<
#if !defined(BOOST_NO_IOSTREAM)

View File

@ -8,6 +8,7 @@ Distributed under the Boost Software License, Version 1.0.
#ifndef BOOST_SMART_PTR_MAKE_SHARED_ARRAY_HPP
#define BOOST_SMART_PTR_MAKE_SHARED_ARRAY_HPP
#include <boost/core/default_allocator.hpp>
#include <boost/smart_ptr/allocate_shared_array.hpp>
namespace boost {
@ -16,48 +17,48 @@ template<class T>
inline typename enable_if_<is_bounded_array<T>::value, shared_ptr<T> >::type
make_shared()
{
return boost::allocate_shared<T>(std::allocator<typename
detail::sp_array_scalar<T>::type>());
return boost::allocate_shared<T>(boost::default_allocator<typename
detail::sp_array_element<T>::type>());
}
template<class T>
inline typename enable_if_<is_bounded_array<T>::value, shared_ptr<T> >::type
make_shared(const typename remove_extent<T>::type& value)
{
return boost::allocate_shared<T>(std::allocator<typename
detail::sp_array_scalar<T>::type>(), value);
return boost::allocate_shared<T>(boost::default_allocator<typename
detail::sp_array_element<T>::type>(), value);
}
template<class T>
inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type
make_shared(std::size_t size)
{
return boost::allocate_shared<T>(std::allocator<typename
detail::sp_array_scalar<T>::type>(), size);
return boost::allocate_shared<T>(boost::default_allocator<typename
detail::sp_array_element<T>::type>(), size);
}
template<class T>
inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type
make_shared(std::size_t size, const typename remove_extent<T>::type& value)
{
return boost::allocate_shared<T>(std::allocator<typename
detail::sp_array_scalar<T>::type>(), size, value);
return boost::allocate_shared<T>(boost::default_allocator<typename
detail::sp_array_element<T>::type>(), size, value);
}
template<class T>
inline typename enable_if_<is_bounded_array<T>::value, shared_ptr<T> >::type
make_shared_noinit()
{
return boost::allocate_shared_noinit<T>(std::allocator<typename
detail::sp_array_scalar<T>::type>());
return boost::allocate_shared_noinit<T>(boost::default_allocator<typename
detail::sp_array_element<T>::type>());
}
template<class T>
inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type
make_shared_noinit(std::size_t size)
{
return boost::allocate_shared_noinit<T>(std::allocator<typename
detail::sp_array_scalar<T>::type>(), size);
return boost::allocate_shared_noinit<T>(boost::default_allocator<typename
detail::sp_array_element<T>::type>(), size);
}
} /* boost */

View File

@ -777,12 +777,12 @@ public:
return pn < rhs.pn;
}
void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT
void * _internal_get_deleter( boost::detail::sp_typeinfo_ const & ti ) const BOOST_SP_NOEXCEPT
{
return pn.get_deleter( ti );
}
void * _internal_get_local_deleter( boost::detail::sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT
void * _internal_get_local_deleter( boost::detail::sp_typeinfo_ const & ti ) const BOOST_SP_NOEXCEPT
{
return pn.get_local_deleter( ti );
}
@ -1008,7 +1008,7 @@ namespace detail
template<class D, class T> D * basic_get_deleter( shared_ptr<T> const & p ) BOOST_SP_NOEXCEPT
{
return static_cast<D *>( p._internal_get_deleter(BOOST_SP_TYPEID(D)) );
return static_cast<D *>( p._internal_get_deleter(BOOST_SP_TYPEID_(D)) );
}
template<class D, class T> D * basic_get_local_deleter( D *, shared_ptr<T> const & p ) BOOST_SP_NOEXCEPT;
@ -1165,12 +1165,12 @@ namespace detail
template<class D, class T> D * basic_get_local_deleter( D *, shared_ptr<T> const & p ) BOOST_SP_NOEXCEPT
{
return static_cast<D *>( p._internal_get_local_deleter( BOOST_SP_TYPEID(local_sp_deleter<D>) ) );
return static_cast<D *>( p._internal_get_local_deleter( BOOST_SP_TYPEID_(local_sp_deleter<D>) ) );
}
template<class D, class T> D const * basic_get_local_deleter( D const *, shared_ptr<T> const & p ) BOOST_SP_NOEXCEPT
{
return static_cast<D *>( p._internal_get_local_deleter( BOOST_SP_TYPEID(local_sp_deleter<D>) ) );
return static_cast<D *>( p._internal_get_local_deleter( BOOST_SP_TYPEID_(local_sp_deleter<D>) ) );
}
} // namespace detail

View File

@ -137,6 +137,23 @@ public:
boost::detail::sp_assert_convertible< Y, T >();
}
// aliasing
template<class Y> weak_ptr(shared_ptr<Y> const & r, element_type * p) BOOST_SP_NOEXCEPT: px( p ), pn( r.pn )
{
}
template<class Y> weak_ptr(weak_ptr<Y> const & r, element_type * p) BOOST_SP_NOEXCEPT: px( p ), pn( r.pn )
{
}
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
template<class Y> weak_ptr(weak_ptr<Y> && r, element_type * p) BOOST_SP_NOEXCEPT: px( p ), pn( std::move( r.pn ) )
{
}
#endif
#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1300)
template<class Y>
@ -194,6 +211,11 @@ public:
return pn.empty();
}
bool empty() const BOOST_SP_NOEXCEPT // extension, not in std::weak_ptr
{
return pn.empty();
}
void reset() BOOST_SP_NOEXCEPT
{
this_type().swap(*this);
@ -205,13 +227,6 @@ public:
pn.swap(other.pn);
}
template<typename Y>
void _internal_aliasing_assign(weak_ptr<Y> const & r, element_type * px2) BOOST_SP_NOEXCEPT
{
px = px2;
pn = r.pn;
}
template<class Y> bool owner_before( weak_ptr<Y> const & rhs ) const BOOST_SP_NOEXCEPT
{
return pn < rhs.pn;

View File

@ -22,6 +22,11 @@
# undef BOOST_SYSTEM_HAS_SYSTEM_ERROR
#endif
#if defined(BOOST_NO_CXX11_HDR_MUTEX)
// Required for thread-safe map manipulation
# undef BOOST_SYSTEM_HAS_SYSTEM_ERROR
#endif
// BOOST_SYSTEM_NOEXCEPT
// Retained for backward compatibility
@ -43,15 +48,4 @@
# define BOOST_SYSTEM_CONSTEXPR
#endif
// BOOST_SYSTEM_REQUIRE_CONST_INIT
#define BOOST_SYSTEM_REQUIRE_CONST_INIT
#if defined(__has_cpp_attribute)
#if __has_cpp_attribute(clang::require_constant_initialization)
# undef BOOST_SYSTEM_REQUIRE_CONST_INIT
# define BOOST_SYSTEM_REQUIRE_CONST_INIT [[clang::require_constant_initialization]]
#endif
#endif
#endif // BOOST_SYSTEM_DETAIL_CONFIG_HPP_INCLUDED

View File

@ -10,6 +10,7 @@
#include <system_error>
#include <map>
#include <memory>
#include <mutex>
//
@ -30,8 +31,20 @@ private:
public:
explicit std_category( boost::system::error_category const * pc ): pc_( pc )
explicit std_category( boost::system::error_category const * pc, unsigned id ): pc_( pc )
{
if( id != 0 )
{
#if defined(_MSC_VER) && defined(_CPPLIB_VER) && _MSC_VER >= 1900 && _MSC_VER < 2000
// Poking into the protected _Addr member of std::error_category
// is not a particularly good programming practice, but what can
// you do
_Addr = id;
#endif
}
}
virtual const char * name() const BOOST_NOEXCEPT
@ -53,24 +66,50 @@ public:
virtual bool equivalent( const std::error_code & code, int condition ) const BOOST_NOEXCEPT;
};
inline std::error_category const & to_std_category( boost::system::error_category const & cat ) BOOST_SYMBOL_VISIBLE;
struct cat_ptr_less
{
bool operator()( boost::system::error_category const * p1, boost::system::error_category const * p2 ) const BOOST_NOEXCEPT
{
return *p1 < *p2;
}
};
inline std::error_category const & to_std_category( boost::system::error_category const & cat )
{
typedef std::map< boost::system::error_category const *, std::unique_ptr<std_category> > map_type;
static map_type map_;
map_type::iterator i = map_.find( &cat );
if( i == map_.end() )
if( cat == boost::system::system_category() )
{
std::unique_ptr<std_category> p( new std_category( &cat ) );
std::pair<map_type::iterator, bool> r = map_.insert( map_type::value_type( &cat, std::move( p ) ) );
i = r.first;
static const std_category system_instance( &cat, 0x1F4D7 );
return system_instance;
}
else if( cat == boost::system::generic_category() )
{
static const std_category generic_instance( &cat, 0x1F4D3 );
return generic_instance;
}
else
{
typedef std::map< boost::system::error_category const *, std::unique_ptr<std_category>, cat_ptr_less > map_type;
return *i->second;
static map_type map_;
static std::mutex map_mx_;
std::lock_guard<std::mutex> guard( map_mx_ );
map_type::iterator i = map_.find( &cat );
if( i == map_.end() )
{
std::unique_ptr<std_category> p( new std_category( &cat, 0 ) );
std::pair<map_type::iterator, bool> r = map_.insert( map_type::value_type( &cat, std::move( p ) ) );
i = r.first;
}
return *i->second;
}
}
inline bool std_category::equivalent( int code, const std::error_condition & condition ) const BOOST_NOEXCEPT

View File

@ -264,6 +264,7 @@ inline error_condition system_category_default_error_condition_win32( int ev ) B
case ERROR_CANTOPEN_: return make_error_condition( io_error );
case ERROR_CANTREAD_: return make_error_condition( io_error );
case ERROR_CANTWRITE_: return make_error_condition( io_error );
case ERROR_CONNECTION_ABORTED_: return make_error_condition( connection_aborted );
case ERROR_CURRENT_DIRECTORY_: return make_error_condition( permission_denied );
case ERROR_DEV_NOT_EXIST_: return make_error_condition( no_such_device );
case ERROR_DEVICE_IN_USE_: return make_error_condition( device_or_resource_busy );

View File

@ -329,14 +329,14 @@ public:
namespace detail
{
template<class T> struct cat_holder
template<class T> struct BOOST_SYMBOL_VISIBLE cat_holder
{
BOOST_SYSTEM_REQUIRE_CONST_INIT static constexpr system_error_category system_category_instance{};
BOOST_SYSTEM_REQUIRE_CONST_INIT static constexpr generic_error_category generic_category_instance{};
static constexpr system_error_category system_category_instance{};
static constexpr generic_error_category generic_category_instance{};
};
template<class T> BOOST_SYSTEM_REQUIRE_CONST_INIT constexpr system_error_category cat_holder<T>::system_category_instance;
template<class T> BOOST_SYSTEM_REQUIRE_CONST_INIT constexpr generic_error_category cat_holder<T>::generic_category_instance;
template<class T> constexpr system_error_category cat_holder<T>::system_category_instance;
template<class T> constexpr generic_error_category cat_holder<T>::generic_category_instance;
} // namespace detail
@ -352,12 +352,16 @@ constexpr error_category const & generic_category() BOOST_NOEXCEPT
#else // #if defined(BOOST_SYSTEM_HAS_CONSTEXPR)
inline error_category const & system_category() BOOST_NOEXCEPT BOOST_SYMBOL_VISIBLE;
inline error_category const & system_category() BOOST_NOEXCEPT
{
static const detail::system_error_category system_category_instance;
return system_category_instance;
}
inline error_category const & generic_category() BOOST_NOEXCEPT BOOST_SYMBOL_VISIBLE;
inline error_category const & generic_category() BOOST_NOEXCEPT
{
static const detail::generic_error_category generic_category_instance;
@ -780,7 +784,7 @@ inline std::size_t hash_value( error_code const & ec )
if( id == 0 )
{
id = reinterpret_cast<boost::ulong_long_type>( &cat );
id = reinterpret_cast<boost::uintptr_t>( &cat );
}
boost::ulong_long_type hv = ( boost::ulong_long_type( 0xCBF29CE4 ) << 32 ) + 0x84222325;

View File

@ -54,7 +54,7 @@ namespace boost
{
#ifdef BOOST_NO_EXCEPTIONS
void throw_exception( std::exception const & e ); // user defined
BOOST_NORETURN void throw_exception( std::exception const & e ); // user defined
#else

View File

@ -93,6 +93,20 @@
# define BOOST_TT_NO_DEDUCED_NOEXCEPT_PARAM
# define BOOST_TT_NO_NOEXCEPT_SEPARATE_TYPE
#endif
//
// If we have the SD6 macros (check for C++11's __cpp_rvalue_references), and we don't have __cpp_noexcept_function_type
// set, then don't treat noexcept functions as seperate types. This is a fix for msvc with the /Zc:noexceptTypes- flag set.
//
#if defined(__cpp_rvalue_references) && !defined(__cpp_noexcept_function_type) && !defined(BOOST_TT_NO_NOEXCEPT_SEPARATE_TYPE)
# define BOOST_TT_NO_NOEXCEPT_SEPARATE_TYPE
#endif
//
// Check MSVC specific macro on older msvc compilers that don't support the SD6 macros, we don't rely on this
// if the SD6 macros *are* available as it appears to be undocumented.
//
#if defined(BOOST_MSVC) && !defined(__cpp_rvalue_references) && !defined(BOOST_TT_NO_NOEXCEPT_SEPARATE_TYPE) && !defined(_NOEXCEPT_TYPES_SUPPORTED)
# define BOOST_TT_NO_NOEXCEPT_SEPARATE_TYPE
#endif
#endif // BOOST_TT_CONFIG_HPP_INCLUDED

View File

@ -376,7 +376,7 @@ namespace boost {
template <class Ret, class ...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret(Args..., ...)const volatile && BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(_M_ARM) && !defined(_M_ARM64)
#ifdef __CLR_VER
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __clrcall(Args...)BOOST_TT_NOEXCEPT_DECL> : public true_type {};
@ -384,9 +384,11 @@ namespace boost {
#ifndef _M_AMD64
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __stdcall(Args...)BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#ifndef __CLR_VER
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __fastcall(Args...)BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#endif
#endif
#if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64))
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __vectorcall(Args...)BOOST_TT_NOEXCEPT_DECL> : public true_type {};
@ -399,9 +401,11 @@ namespace boost {
#ifndef _M_AMD64
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __stdcall(Args...)const BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#ifndef __CLR_VER
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __fastcall(Args...)const BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#endif
#endif
#if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64))
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __vectorcall(Args...)const BOOST_TT_NOEXCEPT_DECL> : public true_type {};
@ -414,9 +418,11 @@ namespace boost {
#ifndef _M_AMD64
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __stdcall(Args...)volatile BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#ifndef __CLR_VER
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __fastcall(Args...)volatile BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#endif
#endif
#if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64))
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __vectorcall(Args...)volatile BOOST_TT_NOEXCEPT_DECL> : public true_type {};
@ -429,9 +435,11 @@ namespace boost {
#ifndef _M_AMD64
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __stdcall(Args...)const volatile BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#ifndef __CLR_VER
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __fastcall(Args...)const volatile BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#endif
#endif
#if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64))
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __vectorcall(Args...)const volatile BOOST_TT_NOEXCEPT_DECL> : public true_type {};
@ -445,9 +453,11 @@ namespace boost {
#ifndef _M_AMD64
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __stdcall(Args...)&BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#ifndef __CLR_VER
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __fastcall(Args...)&BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#endif
#endif
#if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64))
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __vectorcall(Args...)&BOOST_TT_NOEXCEPT_DECL> : public true_type {};
@ -460,9 +470,11 @@ namespace boost {
#ifndef _M_AMD64
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __stdcall(Args...)const &BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#ifndef __CLR_VER
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __fastcall(Args...)const &BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#endif
#endif
#if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64))
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __vectorcall(Args...)const &BOOST_TT_NOEXCEPT_DECL> : public true_type {};
@ -475,9 +487,11 @@ namespace boost {
#ifndef _M_AMD64
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __stdcall(Args...)volatile &BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#ifndef __CLR_VER
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __fastcall(Args...)volatile &BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#endif
#endif
#if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64))
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __vectorcall(Args...)volatile &BOOST_TT_NOEXCEPT_DECL> : public true_type {};
@ -490,9 +504,11 @@ namespace boost {
#ifndef _M_AMD64
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __stdcall(Args...)const volatile &BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#ifndef __CLR_VER
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __fastcall(Args...)const volatile &BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#endif
#endif
#if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64))
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __vectorcall(Args...)const volatile &BOOST_TT_NOEXCEPT_DECL> : public true_type {};
@ -506,9 +522,11 @@ namespace boost {
#ifndef _M_AMD64
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __stdcall(Args...) && BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#ifndef __CLR_VER
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __fastcall(Args...) && BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#endif
#endif
#if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64))
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __vectorcall(Args...) && BOOST_TT_NOEXCEPT_DECL> : public true_type {};
@ -521,9 +539,11 @@ namespace boost {
#ifndef _M_AMD64
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __stdcall(Args...)const &&BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#ifndef __CLR_VER
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __fastcall(Args...)const &&BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#endif
#endif
#if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64))
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __vectorcall(Args...)const &&BOOST_TT_NOEXCEPT_DECL> : public true_type {};
@ -536,9 +556,11 @@ namespace boost {
#ifndef _M_AMD64
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __stdcall(Args...)volatile &&BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#ifndef __CLR_VER
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __fastcall(Args...)volatile &&BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#endif
#endif
#if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64))
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __vectorcall(Args...)volatile &&BOOST_TT_NOEXCEPT_DECL> : public true_type {};
@ -551,15 +573,17 @@ namespace boost {
#ifndef _M_AMD64
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __stdcall(Args...)const volatile &&BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#ifndef __CLR_VER
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __fastcall(Args...)const volatile &&BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#endif
#endif
#if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64))
template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_function<Ret __vectorcall(Args...)const volatile &&BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#endif
#endif // _MSC_VER
#endif // defined(_MSC_VER) && !defined(_M_ARM) && !defined(_M_ARM64)
#endif

View File

@ -419,7 +419,7 @@ namespace boost {
template <class Ret, class C, class ...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_member_function_pointer<Ret(C::*)(Args..., ...)const volatile && BOOST_TT_NOEXCEPT_DECL> : public true_type {};
#ifdef _MSC_VER
#if defined(_MSC_VER) && !defined(_M_ARM) && !defined(_M_ARM64)
#ifdef __CLR_VER
template <class Ret, class C, class...Args BOOST_TT_NOEXCEPT_PARAM>
struct is_member_function_pointer<Ret(__clrcall C::*)(Args...)BOOST_TT_NOEXCEPT_DECL> : public true_type {};

View File

@ -23,6 +23,7 @@
# include <boost/mpl/size.hpp>
# include <boost/utility/declval.hpp>
# include <boost/core/enable_if.hpp>
# include <boost/type_traits/copy_cv_ref.hpp>
# include <boost/type_traits/remove_reference.hpp>
# include <boost/variant/detail/has_result_type.hpp>
#endif
@ -85,7 +86,7 @@ namespace detail { namespace variant {
// This class serves only metaprogramming purposes. none of its methods must be called at runtime!
template <class Visitor, class Variant>
struct result_multideduce1 {
typedef typename Variant::types types;
typedef typename remove_reference<Variant>::type::types types;
typedef typename boost::mpl::begin<types>::type begin_it;
typedef typename boost::mpl::advance<
begin_it, boost::mpl::int_<boost::mpl::size<types>::type::value - 1>
@ -95,14 +96,14 @@ struct result_multideduce1 {
struct deduce_impl {
typedef typename boost::mpl::next<It>::type next_t;
typedef typename boost::mpl::deref<It>::type value_t;
typedef decltype(true ? boost::declval< Visitor& >()( boost::declval< value_t >() )
typedef decltype(true ? boost::declval< Visitor& >()( boost::declval< copy_cv_ref_t< value_t, Variant > >() )
: boost::declval< typename deduce_impl<next_t>::type >()) type;
};
template <class Dummy>
struct deduce_impl<last_it, Dummy> {
typedef typename boost::mpl::deref<last_it>::type value_t;
typedef decltype(boost::declval< Visitor& >()( boost::declval< value_t >() )) type;
typedef decltype(boost::declval< Visitor& >()( boost::declval< copy_cv_ref_t< value_t, Variant > >() )) type;
};
typedef typename deduce_impl<begin_it>::type type;
@ -132,7 +133,7 @@ inline decltype(auto) apply_visitor(Visitor&& visitor, Visitable&& visitable,
boost::detail::variant::has_result_type<Visitor>
>::type* = 0)
{
boost::detail::variant::result_wrapper1<Visitor, typename remove_reference<Visitable>::type> cpp14_vis(::boost::forward<Visitor>(visitor));
boost::detail::variant::result_wrapper1<Visitor, Visitable> cpp14_vis(::boost::forward<Visitor>(visitor));
return ::boost::forward<Visitable>(visitable).apply_visitor(cpp14_vis);
}

View File

@ -15,7 +15,6 @@
#include <boost/config.hpp>
#include <boost/assert.hpp>
#include <cstdlib> // std::abort
#ifdef BOOST_MSVC
@ -25,12 +24,6 @@
namespace boost { namespace detail { namespace variant {
BOOST_NORETURN inline void forced_return_no_return() { // fixes `must return a value` warnings
using namespace std;
abort(); // some implementations have no std::abort
}
///////////////////////////////////////////////////////////////////////////////
// (detail) function template forced_return
//
@ -44,12 +37,9 @@ forced_return()
// logical error: should never be here! (see above)
BOOST_ASSERT(false);
forced_return_no_return();
#ifdef BOOST_NO_NORETURN
T (*dummy)() = 0;
return dummy();
#endif
(void)dummy;
BOOST_UNREACHABLE_RETURN(dummy());
}
}}} // namespace boost::detail::variant

View File

@ -0,0 +1,46 @@
//-----------------------------------------------------------------------------
// boost variant/detail/std_hash.hpp header file
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2018-2019 Antony Polukhin
//
// 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_VARIANT_DETAIL_STD_HASH_HPP
#define BOOST_VARIANT_DETAIL_STD_HASH_HPP
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
#include <boost/variant/variant_fwd.hpp>
#include <boost/variant/detail/hash_variant.hpp>
///////////////////////////////////////////////////////////////////////////////
// macro BOOST_VARIANT_DO_NOT_SPECIALIZE_STD_HASH
//
// Define this macro if you do not with to have a std::hash specialization for
// boost::variant.
#if !defined(BOOST_VARIANT_DO_NOT_SPECIALIZE_STD_HASH) && !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
#include <functional> // for std::hash
namespace std {
template < BOOST_VARIANT_ENUM_PARAMS(typename T) >
struct hash<boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) > > {
std::size_t operator()(const boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) >& val) const {
return ::boost::hash_value(val);
}
};
}
#endif // #if !defined(BOOST_VARIANT_DO_NOT_SPECIALIZE_STD_HASH) && !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)
#endif // BOOST_VARIANT_DETAIL_STD_HASH_HPP

View File

@ -190,7 +190,7 @@ template <
, typename Visitor, typename VoidPtrCV
, typename NoBackupFlag
>
inline typename Visitor::result_type
BOOST_FORCEINLINE typename Visitor::result_type
visitation_impl(
const int internal_which, const int logical_which
, Visitor& visitor, VoidPtrCV storage

View File

@ -32,6 +32,7 @@
#include <boost/variant/detail/over_sequence.hpp>
#include <boost/variant/detail/visitation_impl.hpp>
#include <boost/variant/detail/hash_variant.hpp>
#include <boost/variant/detail/std_hash.hpp>
#include <boost/variant/detail/move.hpp>
@ -2314,7 +2315,7 @@ public:
#endif// !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
template <typename Visitor, typename VoidPtrCV>
static typename Visitor::result_type
BOOST_FORCEINLINE static typename Visitor::result_type
internal_apply_visitor_impl(
int internal_which
, int logical_which
@ -2339,7 +2340,7 @@ public:
}
template <typename Visitor>
typename Visitor::result_type
BOOST_FORCEINLINE typename Visitor::result_type
internal_apply_visitor(Visitor& visitor)
{
return internal_apply_visitor_impl(
@ -2348,7 +2349,7 @@ public:
}
template <typename Visitor>
typename Visitor::result_type
BOOST_FORCEINLINE typename Visitor::result_type
internal_apply_visitor(Visitor& visitor) const
{
return internal_apply_visitor_impl(

Some files were not shown because too many files have changed in this diff Show More