forked from organicmaps/organicmaps
[boost] Update repo boost sources to 1.64
This commit is contained in:
parent
48f96cee99
commit
455c921374
4870 changed files with 328183 additions and 75959 deletions
|
@ -1,16 +0,0 @@
|
|||
Notes for upgrading boost library:
|
||||
|
||||
For the 1.59 version we need to apply a patch to compile it correctly:
|
||||
|
||||
commit 1f43ee7cce43b2b145c8df4b9e088b11d66d1137
|
||||
Author: Alex Zolotarev <alex@maps.me>
|
||||
Date: Fri Oct 16 23:17:29 2015 -0700
|
||||
|
||||
Boost compilation fixes. These patches are better than those we used previously.
|
||||
|
||||
More details:
|
||||
|
||||
- http://lists.boost.org/Archives/boost/2013/02/200721.php
|
||||
- https://github.com/mapnik/mapnik/issues/1970
|
||||
- https://github.com/bassosimone/boost-core-gabicxx-fix
|
||||
- http://stackoverflow.com/questions/25836364/stlport-error-cxa-demangle-is-not-a-member-of-abi-for-boost-library
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
Copyright (c) Marshall Clow 2014.
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
|
@ -6,7 +6,7 @@
|
|||
|
||||
Revision history:
|
||||
2 Dec 2014 mtc First version; power
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/// \file algorithm.hpp
|
||||
|
@ -17,6 +17,8 @@
|
|||
#ifndef BOOST_ALGORITHM_HPP
|
||||
#define BOOST_ALGORITHM_HPP
|
||||
|
||||
#include <functional> // for plus and multiplies
|
||||
|
||||
#include <boost/utility/enable_if.hpp> // for boost::disable_if
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
|
||||
|
@ -31,7 +33,7 @@ T identity_operation ( std::plus<T> ) { return T(0); }
|
|||
|
||||
/// \fn power ( T x, Integer n )
|
||||
/// \return the value "x" raised to the power "n"
|
||||
///
|
||||
///
|
||||
/// \param x The value to be exponentiated
|
||||
/// \param n The exponent (must be >= 0)
|
||||
///
|
||||
|
@ -40,7 +42,7 @@ T identity_operation ( std::plus<T> ) { return T(0); }
|
|||
template <typename T, typename Integer>
|
||||
typename boost::enable_if<boost::is_integral<Integer>, T>::type
|
||||
power (T x, Integer n) {
|
||||
T y = 1; // Should be "T y{1};"
|
||||
T y = 1; // Should be "T y{1};"
|
||||
if (n == 0) return y;
|
||||
while (true) {
|
||||
if (n % 2 == 1) {
|
||||
|
@ -56,8 +58,8 @@ power (T x, Integer n) {
|
|||
|
||||
/// \fn power ( T x, Integer n, Operation op )
|
||||
/// \return the value "x" raised to the power "n"
|
||||
/// using the operaton "op".
|
||||
///
|
||||
/// using the operation "op".
|
||||
///
|
||||
/// \param x The value to be exponentiated
|
||||
/// \param n The exponent (must be >= 0)
|
||||
/// \param op The operation used
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#ifndef BOOST_ALGORITHM_ALL_OF_HPP
|
||||
#define BOOST_ALGORITHM_ALL_OF_HPP
|
||||
|
||||
#include <algorithm> // for std::all_of, if available
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
|
@ -27,8 +26,6 @@ namespace boost { namespace algorithm {
|
|||
/// \param p A predicate for testing the elements of the sequence
|
||||
///
|
||||
/// \note This function is part of the C++2011 standard library.
|
||||
/// We will use the standard one if it is available,
|
||||
/// otherwise we have our own implementation.
|
||||
template<typename InputIterator, typename Predicate>
|
||||
bool all_of ( InputIterator first, InputIterator last, Predicate p )
|
||||
{
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#ifndef BOOST_ALGORITHM_ANY_OF_HPP
|
||||
#define BOOST_ALGORITHM_ANY_OF_HPP
|
||||
|
||||
#include <algorithm> // for std::any_of, if available
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#ifndef BOOST_ALGORITHM_COPY_IF_HPP
|
||||
#define BOOST_ALGORITHM_COPY_IF_HPP
|
||||
|
||||
#include <algorithm> // for std::copy_if, if available
|
||||
#include <utility> // for std::pair, std::make_pair
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
|
@ -28,8 +28,6 @@ namespace boost { namespace algorithm {
|
|||
/// \param result An output iterator to write the results into
|
||||
/// \param p A predicate for testing the elements of the range
|
||||
/// \note This function is part of the C++2011 standard library.
|
||||
/// We will use the standard one if it is available,
|
||||
/// otherwise we have our own implementation.
|
||||
template<typename InputIterator, typename OutputIterator, typename Predicate>
|
||||
OutputIterator copy_if ( InputIterator first, InputIterator last, OutputIterator result, Predicate p )
|
||||
{
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
#ifndef BOOST_ALGORITHM_COPY_N_HPP
|
||||
#define BOOST_ALGORITHM_COPY_N_HPP
|
||||
|
||||
#include <algorithm> // for std::copy_n, if available
|
||||
|
||||
namespace boost { namespace algorithm {
|
||||
|
||||
/// \fn copy_n ( InputIterator first, Size n, OutputIterator result )
|
||||
|
@ -25,8 +23,6 @@ namespace boost { namespace algorithm {
|
|||
/// \param n The number of elements to copy
|
||||
/// \param result An output iterator to write the results into
|
||||
/// \note This function is part of the C++2011 standard library.
|
||||
/// We will use the standard one if it is available,
|
||||
/// otherwise we have our own implementation.
|
||||
template <typename InputIterator, typename Size, typename OutputIterator>
|
||||
OutputIterator copy_n ( InputIterator first, Size n, OutputIterator result )
|
||||
{
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
#ifndef BOOST_ALGORITHM_FIND_IF_NOT_HPP
|
||||
#define BOOST_ALGORITHM_FIND_IF_NOT_HPP
|
||||
|
||||
#include <algorithm> // for std::find_if_not, if it exists
|
||||
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
|
@ -27,8 +25,6 @@ namespace boost { namespace algorithm {
|
|||
/// \param last One past the end of the input sequence
|
||||
/// \param p A predicate for testing the elements of the range
|
||||
/// \note This function is part of the C++2011 standard library.
|
||||
/// We will use the standard one if it is available,
|
||||
/// otherwise we have our own implementation.
|
||||
template<typename InputIterator, typename Predicate>
|
||||
InputIterator find_if_not ( InputIterator first, InputIterator last, Predicate p )
|
||||
{
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
#ifndef BOOST_ALGORITHM_IOTA_HPP
|
||||
#define BOOST_ALGORITHM_IOTA_HPP
|
||||
|
||||
#include <numeric>
|
||||
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
|
@ -26,8 +24,6 @@ namespace boost { namespace algorithm {
|
|||
/// \param last One past the end of the input sequence
|
||||
/// \param value The initial value of the sequence to be generated
|
||||
/// \note This function is part of the C++2011 standard library.
|
||||
/// We will use the standard one if it is available,
|
||||
/// otherwise we have our own implementation.
|
||||
template <typename ForwardIterator, typename T>
|
||||
void iota ( ForwardIterator first, ForwardIterator last, T value )
|
||||
{
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
#ifndef BOOST_ALGORITHM_IS_PARTITIONED_HPP
|
||||
#define BOOST_ALGORITHM_IS_PARTITIONED_HPP
|
||||
|
||||
#include <algorithm> // for std::is_partitioned, if available
|
||||
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
|
@ -26,8 +24,6 @@ namespace boost { namespace algorithm {
|
|||
/// \param last One past the end of the input sequence
|
||||
/// \param p The predicate to test the values with
|
||||
/// \note This function is part of the C++2011 standard library.
|
||||
/// We will use the standard one if it is available,
|
||||
/// otherwise we have our own implementation.
|
||||
template <typename InputIterator, typename UnaryPredicate>
|
||||
bool is_partitioned ( InputIterator first, InputIterator last, UnaryPredicate p )
|
||||
{
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
#ifndef BOOST_ALGORITHM_IS_PERMUTATION11_HPP
|
||||
#define BOOST_ALGORITHM_IS_PERMUTATION11_HPP
|
||||
|
||||
#include <algorithm> // for std::less, tie, mismatch and is_permutation (if available)
|
||||
#include <utility> // for std::make_pair
|
||||
#include <algorithm> // for std::find_if, count_if, mismatch
|
||||
#include <utility> // for std::pair
|
||||
#include <functional> // for std::equal_to
|
||||
#include <iterator>
|
||||
|
||||
|
@ -108,8 +108,6 @@ namespace detail {
|
|||
/// \param p The predicate to compare elements with
|
||||
///
|
||||
/// \note This function is part of the C++2011 standard library.
|
||||
/// We will use the standard one if it is available,
|
||||
/// otherwise we have our own implementation.
|
||||
template< class ForwardIterator1, class ForwardIterator2, class BinaryPredicate >
|
||||
bool is_permutation ( ForwardIterator1 first1, ForwardIterator1 last1,
|
||||
ForwardIterator2 first2, BinaryPredicate p )
|
||||
|
@ -135,8 +133,6 @@ bool is_permutation ( ForwardIterator1 first1, ForwardIterator1 last1,
|
|||
/// \param last2 One past the end of the input sequence
|
||||
/// \param first2 The start of the second sequence
|
||||
/// \note This function is part of the C++2011 standard library.
|
||||
/// We will use the standard one if it is available,
|
||||
/// otherwise we have our own implementation.
|
||||
template< class ForwardIterator1, class ForwardIterator2 >
|
||||
bool is_permutation ( ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2 )
|
||||
{
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#ifndef BOOST_ALGORITHM_ORDERED_HPP
|
||||
#define BOOST_ALGORITHM_ORDERED_HPP
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#ifndef BOOST_ALGORITHM_NONE_OF_HPP
|
||||
#define BOOST_ALGORITHM_NONE_OF_HPP
|
||||
|
||||
#include <algorithm> // for std::none_of, if available
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
|
@ -29,9 +28,9 @@ namespace boost { namespace algorithm {
|
|||
template<typename InputIterator, typename Predicate>
|
||||
bool none_of ( InputIterator first, InputIterator last, Predicate p )
|
||||
{
|
||||
for ( ; first != last; ++first )
|
||||
if ( p(*first))
|
||||
return false;
|
||||
for ( ; first != last; ++first )
|
||||
if ( p(*first))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,7 @@
|
|||
#ifndef BOOST_ALGORITHM_PARTITION_COPY_HPP
|
||||
#define BOOST_ALGORITHM_PARTITION_COPY_HPP
|
||||
|
||||
#include <algorithm> // for std::partition_copy, if available
|
||||
#include <utility> // for make_pair
|
||||
#include <utility> // for std::pair
|
||||
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
@ -34,8 +33,6 @@ namespace boost { namespace algorithm {
|
|||
/// \param p A predicate for dividing the elements of the input sequence.
|
||||
///
|
||||
/// \note This function is part of the C++2011 standard library.
|
||||
/// We will use the standard one if it is available,
|
||||
/// otherwise we have our own implementation.
|
||||
template <typename InputIterator,
|
||||
typename OutputIterator1, typename OutputIterator2, typename UnaryPredicate>
|
||||
std::pair<OutputIterator1, OutputIterator2>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#ifndef BOOST_ALGORITHM_PARTITION_POINT_HPP
|
||||
#define BOOST_ALGORITHM_PARTITION_POINT_HPP
|
||||
|
||||
#include <algorithm> // for std::partition_point, if available
|
||||
#include <iterator> // for std::distance, advance
|
||||
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
@ -27,8 +27,6 @@ namespace boost { namespace algorithm {
|
|||
/// \param last One past the end of the input sequence
|
||||
/// \param p The predicate to test the values with
|
||||
/// \note This function is part of the C++2011 standard library.
|
||||
/// We will use the standard one if it is available,
|
||||
/// otherwise we have our own implementation.
|
||||
template <typename ForwardIterator, typename Predicate>
|
||||
ForwardIterator partition_point ( ForwardIterator first, ForwardIterator last, Predicate p )
|
||||
{
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
#define BOOST_ALGORITHM_EQUAL_HPP
|
||||
|
||||
#include <algorithm> // for std::equal
|
||||
#include <functional> // for std::equal_to
|
||||
#include <functional> // for std::binary_function
|
||||
#include <iterator>
|
||||
|
||||
namespace boost { namespace algorithm {
|
||||
|
||||
|
|
|
@ -12,8 +12,7 @@
|
|||
#ifndef BOOST_ALGORITHM_IS_PERMUTATION14_HPP
|
||||
#define BOOST_ALGORITHM_IS_PERMUTATION14_HPP
|
||||
|
||||
#include <algorithm> // for std::less, tie, mismatch and is_permutation (if available)
|
||||
#include <utility> // for std::make_pair
|
||||
#include <utility> // for std::pair
|
||||
#include <functional> // for std::equal_to
|
||||
#include <iterator>
|
||||
|
||||
|
@ -31,8 +30,6 @@ namespace boost { namespace algorithm {
|
|||
/// \param first2 The start of the second sequence
|
||||
/// \param last1 One past the end of the second sequence
|
||||
/// \note This function is part of the C++2014 standard library.
|
||||
/// We will use the standard one if it is available,
|
||||
/// otherwise we have our own implementation.
|
||||
template< class ForwardIterator1, class ForwardIterator2 >
|
||||
bool is_permutation ( ForwardIterator1 first1, ForwardIterator1 last1,
|
||||
ForwardIterator2 first2, ForwardIterator2 last2 )
|
||||
|
@ -62,8 +59,6 @@ bool is_permutation ( ForwardIterator1 first1, ForwardIterator1 last1,
|
|||
/// \param pred The predicate to compare elements with
|
||||
///
|
||||
/// \note This function is part of the C++2014 standard library.
|
||||
/// We will use the standard one if it is available,
|
||||
/// otherwise we have our own implementation.
|
||||
template< class ForwardIterator1, class ForwardIterator2, class BinaryPredicate >
|
||||
bool is_permutation ( ForwardIterator1 first1, ForwardIterator1 last1,
|
||||
ForwardIterator2 first2, ForwardIterator2 last2,
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#ifndef BOOST_ALGORITHM_MISMATCH_HPP
|
||||
#define BOOST_ALGORITHM_MISMATCH_HPP
|
||||
|
||||
#include <algorithm> // for std::mismatch
|
||||
#include <utility> // for std::pair
|
||||
|
||||
namespace boost { namespace algorithm {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*
|
||||
/*
|
||||
Copyright (c) Marshall Clow 2011-2012.
|
||||
|
||||
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)
|
||||
|
||||
|
||||
Thanks to Nevin for his comments/help.
|
||||
*/
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
*/
|
||||
|
||||
/// \file hex.hpp
|
||||
/// \brief Convert sequence of integral types into a sequence of hexadecimal
|
||||
/// \brief Convert sequence of integral types into a sequence of hexadecimal
|
||||
/// characters and back. Based on the MySQL functions HEX and UNHEX
|
||||
/// \author Marshall Clow
|
||||
|
||||
|
@ -25,7 +25,9 @@
|
|||
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/exception/all.hpp>
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/exception/info.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
|
@ -33,17 +35,17 @@
|
|||
|
||||
namespace boost { namespace algorithm {
|
||||
|
||||
/*!
|
||||
\struct hex_decode_error
|
||||
\brief Base exception class for all hex decoding errors
|
||||
/*!
|
||||
\struct hex_decode_error
|
||||
\brief Base exception class for all hex decoding errors
|
||||
*/ /*!
|
||||
\struct non_hex_input
|
||||
\struct non_hex_input
|
||||
\brief Thrown when a non-hex value (0-9, A-F) encountered when decoding.
|
||||
Contains the offending character
|
||||
*/ /*!
|
||||
\struct not_enough_input
|
||||
*/ /*!
|
||||
\struct not_enough_input
|
||||
\brief Thrown when the input sequence unexpectedly ends
|
||||
|
||||
|
||||
*/
|
||||
struct hex_decode_error : virtual boost::exception, virtual std::exception {};
|
||||
struct not_enough_input : virtual hex_decode_error {};
|
||||
|
@ -54,12 +56,12 @@ namespace detail {
|
|||
/// \cond DOXYGEN_HIDE
|
||||
|
||||
template <typename T, typename OutputIterator>
|
||||
OutputIterator encode_one ( T val, OutputIterator out ) {
|
||||
OutputIterator encode_one ( T val, OutputIterator out, const char * hexDigits ) {
|
||||
const std::size_t num_hex_digits = 2 * sizeof ( T );
|
||||
char res [ num_hex_digits ];
|
||||
char *p = res + num_hex_digits;
|
||||
for ( std::size_t i = 0; i < num_hex_digits; ++i, val >>= 4 )
|
||||
*--p = "0123456789ABCDEF" [ val & 0x0F ];
|
||||
*--p = hexDigits [ val & 0x0F ];
|
||||
return std::copy ( res, res + num_hex_digits, out );
|
||||
}
|
||||
|
||||
|
@ -106,12 +108,12 @@ namespace detail {
|
|||
typedef T value_type;
|
||||
};
|
||||
|
||||
template <typename Iterator>
|
||||
template <typename Iterator>
|
||||
bool iter_end ( Iterator current, Iterator last ) { return current == last; }
|
||||
|
||||
|
||||
template <typename T>
|
||||
bool ptr_end ( const T* ptr, const T* /*end*/ ) { return *ptr == '\0'; }
|
||||
|
||||
|
||||
// What can we assume here about the inputs?
|
||||
// is std::iterator_traits<InputIterator>::value_type always 'char' ?
|
||||
// Could it be wchar_t, say? Does it matter?
|
||||
|
@ -124,11 +126,11 @@ namespace detail {
|
|||
|
||||
// Need to make sure that we get can read that many chars here.
|
||||
for ( std::size_t i = 0; i < 2 * sizeof ( T ); ++i, ++first ) {
|
||||
if ( pred ( first, last ))
|
||||
if ( pred ( first, last ))
|
||||
BOOST_THROW_EXCEPTION (not_enough_input ());
|
||||
res = ( 16 * res ) + hex_char_to_int (*first);
|
||||
}
|
||||
|
||||
|
||||
*out = res;
|
||||
return ++out;
|
||||
}
|
||||
|
@ -138,7 +140,7 @@ namespace detail {
|
|||
|
||||
/// \fn hex ( InputIterator first, InputIterator last, OutputIterator out )
|
||||
/// \brief Converts a sequence of integral types into a hexadecimal sequence of characters.
|
||||
///
|
||||
///
|
||||
/// \param first The start of the input sequence
|
||||
/// \param last One past the end of the input sequence
|
||||
/// \param out An output iterator to the results into
|
||||
|
@ -148,14 +150,31 @@ template <typename InputIterator, typename OutputIterator>
|
|||
typename boost::enable_if<boost::is_integral<typename detail::hex_iterator_traits<InputIterator>::value_type>, OutputIterator>::type
|
||||
hex ( InputIterator first, InputIterator last, OutputIterator out ) {
|
||||
for ( ; first != last; ++first )
|
||||
out = detail::encode_one ( *first, out );
|
||||
out = detail::encode_one ( *first, out, "0123456789ABCDEF" );
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// \fn hex_lower ( InputIterator first, InputIterator last, OutputIterator out )
|
||||
/// \brief Converts a sequence of integral types into a lower case hexadecimal sequence of characters.
|
||||
///
|
||||
/// \param first The start of the input sequence
|
||||
/// \param last One past the end of the input sequence
|
||||
/// \param out An output iterator to the results into
|
||||
/// \return The updated output iterator
|
||||
/// \note Based on the MySQL function of the same name
|
||||
template <typename InputIterator, typename OutputIterator>
|
||||
typename boost::enable_if<boost::is_integral<typename detail::hex_iterator_traits<InputIterator>::value_type>, OutputIterator>::type
|
||||
hex_lower ( InputIterator first, InputIterator last, OutputIterator out ) {
|
||||
for ( ; first != last; ++first )
|
||||
out = detail::encode_one ( *first, out, "0123456789abcdef" );
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
/// \fn hex ( const T *ptr, OutputIterator out )
|
||||
/// \brief Converts a sequence of integral types into a hexadecimal sequence of characters.
|
||||
///
|
||||
///
|
||||
/// \param ptr A pointer to a 0-terminated sequence of data.
|
||||
/// \param out An output iterator to the results into
|
||||
/// \return The updated output iterator
|
||||
|
@ -164,13 +183,30 @@ template <typename T, typename OutputIterator>
|
|||
typename boost::enable_if<boost::is_integral<T>, OutputIterator>::type
|
||||
hex ( const T *ptr, OutputIterator out ) {
|
||||
while ( *ptr )
|
||||
out = detail::encode_one ( *ptr++, out );
|
||||
out = detail::encode_one ( *ptr++, out, "0123456789ABCDEF" );
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
/// \fn hex_lower ( const T *ptr, OutputIterator out )
|
||||
/// \brief Converts a sequence of integral types into a lower case hexadecimal sequence of characters.
|
||||
///
|
||||
/// \param ptr A pointer to a 0-terminated sequence of data.
|
||||
/// \param out An output iterator to the results into
|
||||
/// \return The updated output iterator
|
||||
/// \note Based on the MySQL function of the same name
|
||||
template <typename T, typename OutputIterator>
|
||||
typename boost::enable_if<boost::is_integral<T>, OutputIterator>::type
|
||||
hex_lower ( const T *ptr, OutputIterator out ) {
|
||||
while ( *ptr )
|
||||
out = detail::encode_one ( *ptr++, out, "0123456789abcdef" );
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
/// \fn hex ( const Range &r, OutputIterator out )
|
||||
/// \brief Converts a sequence of integral types into a hexadecimal sequence of characters.
|
||||
///
|
||||
///
|
||||
/// \param r The input range
|
||||
/// \param out An output iterator to the results into
|
||||
/// \return The updated output iterator
|
||||
|
@ -182,9 +218,23 @@ hex ( const Range &r, OutputIterator out ) {
|
|||
}
|
||||
|
||||
|
||||
/// \fn hex_lower ( const Range &r, OutputIterator out )
|
||||
/// \brief Converts a sequence of integral types into a lower case hexadecimal sequence of characters.
|
||||
///
|
||||
/// \param r The input range
|
||||
/// \param out An output iterator to the results into
|
||||
/// \return The updated output iterator
|
||||
/// \note Based on the MySQL function of the same name
|
||||
template <typename Range, typename OutputIterator>
|
||||
typename boost::enable_if<boost::is_integral<typename detail::hex_iterator_traits<typename Range::iterator>::value_type>, OutputIterator>::type
|
||||
hex_lower ( const Range &r, OutputIterator out ) {
|
||||
return hex_lower (boost::begin(r), boost::end(r), out);
|
||||
}
|
||||
|
||||
|
||||
/// \fn unhex ( InputIterator first, InputIterator last, OutputIterator out )
|
||||
/// \brief Converts a sequence of hexadecimal characters into a sequence of integers.
|
||||
///
|
||||
///
|
||||
/// \param first The start of the input sequence
|
||||
/// \param last One past the end of the input sequence
|
||||
/// \param out An output iterator to the results into
|
||||
|
@ -200,7 +250,7 @@ OutputIterator unhex ( InputIterator first, InputIterator last, OutputIterator o
|
|||
|
||||
/// \fn unhex ( const T *ptr, OutputIterator out )
|
||||
/// \brief Converts a sequence of hexadecimal characters into a sequence of integers.
|
||||
///
|
||||
///
|
||||
/// \param ptr A pointer to a null-terminated input sequence.
|
||||
/// \param out An output iterator to the results into
|
||||
/// \return The updated output iterator
|
||||
|
@ -218,7 +268,7 @@ OutputIterator unhex ( const T *ptr, OutputIterator out ) {
|
|||
|
||||
/// \fn OutputIterator unhex ( const Range &r, OutputIterator out )
|
||||
/// \brief Converts a sequence of hexadecimal characters into a sequence of integers.
|
||||
///
|
||||
///
|
||||
/// \param r The input range
|
||||
/// \param out An output iterator to the results into
|
||||
/// \return The updated output iterator
|
||||
|
@ -231,7 +281,7 @@ OutputIterator unhex ( const Range &r, OutputIterator out ) {
|
|||
|
||||
/// \fn String hex ( const String &input )
|
||||
/// \brief Converts a sequence of integral types into a hexadecimal sequence of characters.
|
||||
///
|
||||
///
|
||||
/// \param input A container to be converted
|
||||
/// \return A container with the encoded text
|
||||
template<typename String>
|
||||
|
@ -242,9 +292,24 @@ String hex ( const String &input ) {
|
|||
return output;
|
||||
}
|
||||
|
||||
|
||||
/// \fn String hex_lower ( const String &input )
|
||||
/// \brief Converts a sequence of integral types into a lower case hexadecimal sequence of characters.
|
||||
///
|
||||
/// \param input A container to be converted
|
||||
/// \return A container with the encoded text
|
||||
template<typename String>
|
||||
String hex_lower ( const String &input ) {
|
||||
String output;
|
||||
output.reserve (input.size () * (2 * sizeof (typename String::value_type)));
|
||||
(void) hex_lower (input, std::back_inserter (output));
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
/// \fn String unhex ( const String &input )
|
||||
/// \brief Converts a sequence of hexadecimal characters into a sequence of characters.
|
||||
///
|
||||
///
|
||||
/// \param input A container to be converted
|
||||
/// \return A container with the decoded text
|
||||
template<typename String>
|
||||
|
|
161
3party/boost/boost/algorithm/is_palindrome.hpp
Normal file
161
3party/boost/boost/algorithm/is_palindrome.hpp
Normal file
|
@ -0,0 +1,161 @@
|
|||
/*
|
||||
Copyright (c) Alexander Zaitsev <zamazan4ik@gmail.com>, 2016
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0. (See
|
||||
accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
See http://www.boost.org/ for latest version.
|
||||
*/
|
||||
|
||||
/// \file is_palindrome.hpp
|
||||
/// \brief Checks the input sequence on palindrome.
|
||||
/// \author Alexander Zaitsev
|
||||
|
||||
#ifndef BOOST_ALGORITHM_IS_PALINDROME_HPP
|
||||
#define BOOST_ALGORITHM_IS_PALINDROME_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <functional>
|
||||
#include <cstring>
|
||||
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
namespace boost { namespace algorithm {
|
||||
|
||||
/// \fn is_palindrome ( BidirectionalIterator begin, BidirectionalIterator end, Predicate p )
|
||||
/// \return true if the entire sequence is palindrome
|
||||
///
|
||||
/// \param begin The start of the input sequence
|
||||
/// \param end One past the end of the input sequence
|
||||
/// \param p A predicate used to compare the values.
|
||||
///
|
||||
/// \note This function will return true for empty sequences and for palindromes.
|
||||
/// For other sequences function will return false.
|
||||
/// Complexity: O(N).
|
||||
template <typename BidirectionalIterator, typename Predicate>
|
||||
bool is_palindrome(BidirectionalIterator begin, BidirectionalIterator end, Predicate p )
|
||||
{
|
||||
if(begin == end)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
--end;
|
||||
while(begin != end)
|
||||
{
|
||||
if(!p(*begin, *end))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
++begin;
|
||||
if(begin == end)
|
||||
{
|
||||
break;
|
||||
}
|
||||
--end;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \fn is_palindrome ( BidirectionalIterator begin, BidirectionalIterator end )
|
||||
/// \return true if the entire sequence is palindrome
|
||||
///
|
||||
/// \param begin The start of the input sequence
|
||||
/// \param end One past the end of the input sequence
|
||||
///
|
||||
/// \note This function will return true for empty sequences and for palindromes.
|
||||
/// For other sequences function will return false.
|
||||
/// Complexity: O(N).
|
||||
template <typename BidirectionalIterator>
|
||||
bool is_palindrome(BidirectionalIterator begin, BidirectionalIterator end)
|
||||
{
|
||||
if(begin == end)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
--end;
|
||||
while(begin != end)
|
||||
{
|
||||
if(!(*begin == *end))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
++begin;
|
||||
if(begin == end)
|
||||
{
|
||||
break;
|
||||
}
|
||||
--end;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// \fn is_palindrome ( const R& range )
|
||||
/// \return true if the entire sequence is palindrome
|
||||
///
|
||||
/// \param range The range to be tested.
|
||||
///
|
||||
/// \note This function will return true for empty sequences and for palindromes.
|
||||
/// For other sequences function will return false.
|
||||
/// Complexity: O(N).
|
||||
template <typename R>
|
||||
bool is_palindrome(const R& range)
|
||||
{
|
||||
return is_palindrome(boost::begin(range), boost::end(range));
|
||||
}
|
||||
|
||||
/// \fn is_palindrome ( const R& range, Predicate p )
|
||||
/// \return true if the entire sequence is palindrome
|
||||
///
|
||||
/// \param range The range to be tested.
|
||||
/// \param p A predicate used to compare the values.
|
||||
///
|
||||
/// \note This function will return true for empty sequences and for palindromes.
|
||||
/// For other sequences function will return false.
|
||||
/// Complexity: O(N).
|
||||
template <typename R, typename Predicate>
|
||||
bool is_palindrome(const R& range, Predicate p)
|
||||
{
|
||||
return is_palindrome(boost::begin(range), boost::end(range), p);
|
||||
}
|
||||
|
||||
|
||||
/// \fn is_palindrome ( const char* str )
|
||||
/// \return true if the entire sequence is palindrome
|
||||
///
|
||||
/// \param str C-string to be tested.
|
||||
///
|
||||
/// \note This function will return true for empty sequences and for palindromes.
|
||||
/// For other sequences function will return false.
|
||||
/// Complexity: O(N).
|
||||
bool is_palindrome(const char* str)
|
||||
{
|
||||
if(!str)
|
||||
return true;
|
||||
return is_palindrome(str, str + strlen(str));
|
||||
}
|
||||
|
||||
|
||||
/// \fn is_palindrome ( const char* str, Predicate p )
|
||||
/// \return true if the entire sequence is palindrome
|
||||
///
|
||||
/// \param str C-string to be tested.
|
||||
/// \param p A predicate used to compare the values.
|
||||
///
|
||||
/// \note This function will return true for empty sequences and for palindromes.
|
||||
/// For other sequences function will return false.
|
||||
/// Complexity: O(N).
|
||||
template<typename Predicate>
|
||||
bool is_palindrome(const char* str, Predicate p)
|
||||
{
|
||||
if(!str)
|
||||
return true;
|
||||
return is_palindrome(str, str + strlen(str), p);
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_ALGORITHM_IS_PALINDROME_HPP
|
|
@ -75,25 +75,27 @@ Requirements:
|
|||
/// \param corpus_last One past the end of the data to search
|
||||
///
|
||||
template <typename corpusIter>
|
||||
corpusIter operator () ( corpusIter corpus_first, corpusIter corpus_last ) const {
|
||||
std::pair<corpusIter, corpusIter>
|
||||
operator () ( corpusIter corpus_first, corpusIter corpus_last ) const {
|
||||
BOOST_STATIC_ASSERT (( boost::is_same<
|
||||
typename std::iterator_traits<patIter>::value_type,
|
||||
typename std::iterator_traits<corpusIter>::value_type>::value ));
|
||||
|
||||
if ( corpus_first == corpus_last ) return corpus_last; // if nothing to search, we didn't find it!
|
||||
if ( pat_first == pat_last ) return corpus_first; // empty pattern matches at start
|
||||
if ( corpus_first == corpus_last ) return std::make_pair(corpus_last, corpus_last); // if nothing to search, we didn't find it!
|
||||
if ( pat_first == pat_last ) return std::make_pair(corpus_first, corpus_first); // empty pattern matches at start
|
||||
|
||||
const difference_type k_corpus_length = std::distance ( corpus_first, corpus_last );
|
||||
// If the pattern is larger than the corpus, we can't find it!
|
||||
if ( k_corpus_length < k_pattern_length )
|
||||
return corpus_last;
|
||||
return std::make_pair(corpus_last, corpus_last);
|
||||
|
||||
// Do the search
|
||||
return this->do_search ( corpus_first, corpus_last );
|
||||
return this->do_search ( corpus_first, corpus_last );
|
||||
}
|
||||
|
||||
template <typename Range>
|
||||
typename boost::range_iterator<Range>::type operator () ( Range &r ) const {
|
||||
std::pair<typename boost::range_iterator<Range>::type, typename boost::range_iterator<Range>::type>
|
||||
operator () ( Range &r ) const {
|
||||
return (*this) (boost::begin(r), boost::end(r));
|
||||
}
|
||||
|
||||
|
@ -112,7 +114,8 @@ Requirements:
|
|||
/// \param p A predicate used for the search comparisons.
|
||||
///
|
||||
template <typename corpusIter>
|
||||
corpusIter do_search ( corpusIter corpus_first, corpusIter corpus_last ) const {
|
||||
std::pair<corpusIter, corpusIter>
|
||||
do_search ( corpusIter corpus_first, corpusIter corpus_last ) const {
|
||||
/* ---- Do the matching ---- */
|
||||
corpusIter curPos = corpus_first;
|
||||
const corpusIter lastPos = corpus_last - k_pattern_length;
|
||||
|
@ -126,7 +129,7 @@ Requirements:
|
|||
j--;
|
||||
// We matched - we're done!
|
||||
if ( j == 0 )
|
||||
return curPos;
|
||||
return std::make_pair(curPos, curPos + k_pattern_length);
|
||||
}
|
||||
|
||||
// Since we didn't match, figure out how far to skip forward
|
||||
|
@ -138,7 +141,7 @@ Requirements:
|
|||
curPos += suffix_ [ j ];
|
||||
}
|
||||
|
||||
return corpus_last; // We didn't find anything
|
||||
return std::make_pair(corpus_last, corpus_last); // We didn't find anything
|
||||
}
|
||||
|
||||
|
||||
|
@ -211,7 +214,7 @@ Requirements:
|
|||
/// \param pat_last One past the end of the data to search for
|
||||
///
|
||||
template <typename patIter, typename corpusIter>
|
||||
corpusIter boyer_moore_search (
|
||||
std::pair<corpusIter, corpusIter> boyer_moore_search (
|
||||
corpusIter corpus_first, corpusIter corpus_last,
|
||||
patIter pat_first, patIter pat_last )
|
||||
{
|
||||
|
@ -220,7 +223,7 @@ Requirements:
|
|||
}
|
||||
|
||||
template <typename PatternRange, typename corpusIter>
|
||||
corpusIter boyer_moore_search (
|
||||
std::pair<corpusIter, corpusIter> boyer_moore_search (
|
||||
corpusIter corpus_first, corpusIter corpus_last, const PatternRange &pattern )
|
||||
{
|
||||
typedef typename boost::range_iterator<const PatternRange>::type pattern_iterator;
|
||||
|
@ -229,8 +232,9 @@ Requirements:
|
|||
}
|
||||
|
||||
template <typename patIter, typename CorpusRange>
|
||||
typename boost::lazy_disable_if_c<
|
||||
boost::is_same<CorpusRange, patIter>::value, typename boost::range_iterator<CorpusRange> >
|
||||
typename boost::disable_if_c<
|
||||
boost::is_same<CorpusRange, patIter>::value,
|
||||
std::pair<typename boost::range_iterator<CorpusRange>::type, typename boost::range_iterator<CorpusRange>::type> >
|
||||
::type
|
||||
boyer_moore_search ( CorpusRange &corpus, patIter pat_first, patIter pat_last )
|
||||
{
|
||||
|
@ -239,7 +243,7 @@ Requirements:
|
|||
}
|
||||
|
||||
template <typename PatternRange, typename CorpusRange>
|
||||
typename boost::range_iterator<CorpusRange>::type
|
||||
std::pair<typename boost::range_iterator<CorpusRange>::type, typename boost::range_iterator<CorpusRange>::type>
|
||||
boyer_moore_search ( CorpusRange &corpus, const PatternRange &pattern )
|
||||
{
|
||||
typedef typename boost::range_iterator<const PatternRange>::type pattern_iterator;
|
||||
|
|
|
@ -64,33 +64,34 @@ http://www-igm.univ-mlv.fr/%7Elecroq/string/node18.html
|
|||
|
||||
~boyer_moore_horspool () {}
|
||||
|
||||
/// \fn operator ( corpusIter corpus_first, corpusIter corpus_last, Pred p )
|
||||
/// \fn operator ( corpusIter corpus_first, corpusIter corpus_last)
|
||||
/// \brief Searches the corpus for the pattern that was passed into the constructor
|
||||
///
|
||||
/// \param corpus_first The start of the data to search (Random Access Iterator)
|
||||
/// \param corpus_last One past the end of the data to search
|
||||
/// \param p A predicate used for the search comparisons.
|
||||
///
|
||||
template <typename corpusIter>
|
||||
corpusIter operator () ( corpusIter corpus_first, corpusIter corpus_last ) const {
|
||||
std::pair<corpusIter, corpusIter>
|
||||
operator () ( corpusIter corpus_first, corpusIter corpus_last ) const {
|
||||
BOOST_STATIC_ASSERT (( boost::is_same<
|
||||
typename std::iterator_traits<patIter>::value_type,
|
||||
typename std::iterator_traits<corpusIter>::value_type>::value ));
|
||||
|
||||
if ( corpus_first == corpus_last ) return corpus_last; // if nothing to search, we didn't find it!
|
||||
if ( pat_first == pat_last ) return corpus_first; // empty pattern matches at start
|
||||
if ( corpus_first == corpus_last ) return std::make_pair(corpus_last, corpus_last); // if nothing to search, we didn't find it!
|
||||
if ( pat_first == pat_last ) return std::make_pair(corpus_first, corpus_first); // empty pattern matches at start
|
||||
|
||||
const difference_type k_corpus_length = std::distance ( corpus_first, corpus_last );
|
||||
// If the pattern is larger than the corpus, we can't find it!
|
||||
if ( k_corpus_length < k_pattern_length )
|
||||
return corpus_last;
|
||||
return std::make_pair(corpus_last, corpus_last);
|
||||
|
||||
// Do the search
|
||||
return this->do_search ( corpus_first, corpus_last );
|
||||
}
|
||||
|
||||
template <typename Range>
|
||||
typename boost::range_iterator<Range>::type operator () ( Range &r ) const {
|
||||
std::pair<typename boost::range_iterator<Range>::type, typename boost::range_iterator<Range>::type>
|
||||
operator () ( Range &r ) const {
|
||||
return (*this) (boost::begin(r), boost::end(r));
|
||||
}
|
||||
|
||||
|
@ -108,7 +109,8 @@ http://www-igm.univ-mlv.fr/%7Elecroq/string/node18.html
|
|||
/// \param k_corpus_length The length of the corpus to search
|
||||
///
|
||||
template <typename corpusIter>
|
||||
corpusIter do_search ( corpusIter corpus_first, corpusIter corpus_last ) const {
|
||||
std::pair<corpusIter, corpusIter>
|
||||
do_search ( corpusIter corpus_first, corpusIter corpus_last ) const {
|
||||
corpusIter curPos = corpus_first;
|
||||
const corpusIter lastPos = corpus_last - k_pattern_length;
|
||||
while ( curPos <= lastPos ) {
|
||||
|
@ -117,14 +119,14 @@ http://www-igm.univ-mlv.fr/%7Elecroq/string/node18.html
|
|||
while ( pat_first [j] == curPos [j] ) {
|
||||
// We matched - we're done!
|
||||
if ( j == 0 )
|
||||
return curPos;
|
||||
return std::make_pair(curPos, curPos + k_pattern_length);
|
||||
j--;
|
||||
}
|
||||
|
||||
curPos += skip_ [ curPos [ k_pattern_length - 1 ]];
|
||||
}
|
||||
|
||||
return corpus_last;
|
||||
return std::make_pair(corpus_last, corpus_last);
|
||||
}
|
||||
// \endcond
|
||||
};
|
||||
|
@ -142,7 +144,7 @@ http://www-igm.univ-mlv.fr/%7Elecroq/string/node18.html
|
|||
/// \param pat_last One past the end of the data to search for
|
||||
///
|
||||
template <typename patIter, typename corpusIter>
|
||||
corpusIter boyer_moore_horspool_search (
|
||||
std::pair<corpusIter, corpusIter> boyer_moore_horspool_search (
|
||||
corpusIter corpus_first, corpusIter corpus_last,
|
||||
patIter pat_first, patIter pat_last )
|
||||
{
|
||||
|
@ -151,7 +153,7 @@ http://www-igm.univ-mlv.fr/%7Elecroq/string/node18.html
|
|||
}
|
||||
|
||||
template <typename PatternRange, typename corpusIter>
|
||||
corpusIter boyer_moore_horspool_search (
|
||||
std::pair<corpusIter, corpusIter> boyer_moore_horspool_search (
|
||||
corpusIter corpus_first, corpusIter corpus_last, const PatternRange &pattern )
|
||||
{
|
||||
typedef typename boost::range_iterator<const PatternRange>::type pattern_iterator;
|
||||
|
@ -160,8 +162,9 @@ http://www-igm.univ-mlv.fr/%7Elecroq/string/node18.html
|
|||
}
|
||||
|
||||
template <typename patIter, typename CorpusRange>
|
||||
typename boost::lazy_disable_if_c<
|
||||
boost::is_same<CorpusRange, patIter>::value, typename boost::range_iterator<CorpusRange> >
|
||||
typename boost::disable_if_c<
|
||||
boost::is_same<CorpusRange, patIter>::value,
|
||||
std::pair<typename boost::range_iterator<CorpusRange>::type, typename boost::range_iterator<CorpusRange>::type> >
|
||||
::type
|
||||
boyer_moore_horspool_search ( CorpusRange &corpus, patIter pat_first, patIter pat_last )
|
||||
{
|
||||
|
@ -170,7 +173,7 @@ http://www-igm.univ-mlv.fr/%7Elecroq/string/node18.html
|
|||
}
|
||||
|
||||
template <typename PatternRange, typename CorpusRange>
|
||||
typename boost::range_iterator<CorpusRange>::type
|
||||
std::pair<typename boost::range_iterator<CorpusRange>::type, typename boost::range_iterator<CorpusRange>::type>
|
||||
boyer_moore_horspool_search ( CorpusRange &corpus, const PatternRange &pattern )
|
||||
{
|
||||
typedef typename boost::range_iterator<const PatternRange>::type pattern_iterator;
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace boost { namespace algorithm { namespace detail {
|
|||
skip_map skip_;
|
||||
const value_type k_default_value;
|
||||
public:
|
||||
skip_table ( std::size_t patSize, value_type default_value ) : k_default_value ( default_value ) {
|
||||
skip_table ( std::size_t /*patSize*/, value_type default_value ) : k_default_value ( default_value ) {
|
||||
std::fill_n ( skip_.begin(), skip_.size(), default_value );
|
||||
}
|
||||
|
||||
|
|
|
@ -69,23 +69,26 @@ namespace boost { namespace algorithm {
|
|||
/// \param p A predicate used for the search comparisons.
|
||||
///
|
||||
template <typename corpusIter>
|
||||
corpusIter operator () ( corpusIter corpus_first, corpusIter corpus_last ) const {
|
||||
std::pair<corpusIter, corpusIter>
|
||||
operator () ( corpusIter corpus_first, corpusIter corpus_last ) const {
|
||||
BOOST_STATIC_ASSERT (( boost::is_same<
|
||||
typename std::iterator_traits<patIter>::value_type,
|
||||
typename std::iterator_traits<corpusIter>::value_type>::value ));
|
||||
if ( corpus_first == corpus_last ) return corpus_last; // if nothing to search, we didn't find it!
|
||||
if ( pat_first == pat_last ) return corpus_first; // empty pattern matches at start
|
||||
|
||||
if ( corpus_first == corpus_last ) return std::make_pair(corpus_last, corpus_last); // if nothing to search, we didn't find it!
|
||||
if ( pat_first == pat_last ) return std::make_pair(corpus_first, corpus_first); // empty pattern matches at start
|
||||
|
||||
const difference_type k_corpus_length = std::distance ( corpus_first, corpus_last );
|
||||
// If the pattern is larger than the corpus, we can't find it!
|
||||
if ( k_corpus_length < k_pattern_length )
|
||||
return corpus_last;
|
||||
return std::make_pair(corpus_last, corpus_last);
|
||||
|
||||
return do_search ( corpus_first, corpus_last, k_corpus_length );
|
||||
return do_search ( corpus_first, corpus_last, k_corpus_length );
|
||||
}
|
||||
|
||||
template <typename Range>
|
||||
typename boost::range_iterator<Range>::type operator () ( Range &r ) const {
|
||||
std::pair<typename boost::range_iterator<Range>::type, typename boost::range_iterator<Range>::type>
|
||||
operator () ( Range &r ) const {
|
||||
return (*this) (boost::begin(r), boost::end(r));
|
||||
}
|
||||
|
||||
|
@ -103,7 +106,8 @@ namespace boost { namespace algorithm {
|
|||
/// \param p A predicate used for the search comparisons.
|
||||
///
|
||||
template <typename corpusIter>
|
||||
corpusIter do_search ( corpusIter corpus_first, corpusIter corpus_last,
|
||||
std::pair<corpusIter, corpusIter>
|
||||
do_search ( corpusIter corpus_first, corpusIter corpus_last,
|
||||
difference_type k_corpus_length ) const {
|
||||
difference_type match_start = 0; // position in the corpus that we're matching
|
||||
|
||||
|
@ -135,7 +139,7 @@ namespace boost { namespace algorithm {
|
|||
while ( match_start <= last_match ) {
|
||||
while ( pat_first [ idx ] == corpus_first [ match_start + idx ] ) {
|
||||
if ( ++idx == k_pattern_length )
|
||||
return corpus_first + match_start;
|
||||
return std::make_pair(corpus_first + match_start, corpus_first + match_start + k_pattern_length);
|
||||
}
|
||||
// Figure out where to start searching again
|
||||
// assert ( idx - skip_ [ idx ] > 0 ); // we're always moving forward
|
||||
|
@ -146,7 +150,7 @@ namespace boost { namespace algorithm {
|
|||
#endif
|
||||
|
||||
// We didn't find anything
|
||||
return corpus_last;
|
||||
return std::make_pair(corpus_last, corpus_last);
|
||||
}
|
||||
|
||||
|
||||
|
@ -202,7 +206,7 @@ namespace boost { namespace algorithm {
|
|||
/// \param pat_last One past the end of the data to search for
|
||||
///
|
||||
template <typename patIter, typename corpusIter>
|
||||
corpusIter knuth_morris_pratt_search (
|
||||
std::pair<corpusIter, corpusIter> knuth_morris_pratt_search (
|
||||
corpusIter corpus_first, corpusIter corpus_last,
|
||||
patIter pat_first, patIter pat_last )
|
||||
{
|
||||
|
@ -211,7 +215,7 @@ namespace boost { namespace algorithm {
|
|||
}
|
||||
|
||||
template <typename PatternRange, typename corpusIter>
|
||||
corpusIter knuth_morris_pratt_search (
|
||||
std::pair<corpusIter, corpusIter> knuth_morris_pratt_search (
|
||||
corpusIter corpus_first, corpusIter corpus_last, const PatternRange &pattern )
|
||||
{
|
||||
typedef typename boost::range_iterator<const PatternRange>::type pattern_iterator;
|
||||
|
@ -220,8 +224,9 @@ namespace boost { namespace algorithm {
|
|||
}
|
||||
|
||||
template <typename patIter, typename CorpusRange>
|
||||
typename boost::lazy_disable_if_c<
|
||||
boost::is_same<CorpusRange, patIter>::value, typename boost::range_iterator<CorpusRange> >
|
||||
typename boost::disable_if_c<
|
||||
boost::is_same<CorpusRange, patIter>::value,
|
||||
std::pair<typename boost::range_iterator<CorpusRange>::type, typename boost::range_iterator<CorpusRange>::type> >
|
||||
::type
|
||||
knuth_morris_pratt_search ( CorpusRange &corpus, patIter pat_first, patIter pat_last )
|
||||
{
|
||||
|
@ -230,7 +235,7 @@ namespace boost { namespace algorithm {
|
|||
}
|
||||
|
||||
template <typename PatternRange, typename CorpusRange>
|
||||
typename boost::range_iterator<CorpusRange>::type
|
||||
std::pair<typename boost::range_iterator<CorpusRange>::type, typename boost::range_iterator<CorpusRange>::type>
|
||||
knuth_morris_pratt_search ( CorpusRange &corpus, const PatternRange &pattern )
|
||||
{
|
||||
typedef typename boost::range_iterator<const PatternRange>::type pattern_iterator;
|
||||
|
|
109
3party/boost/boost/algorithm/sort_subrange.hpp
Normal file
109
3party/boost/boost/algorithm/sort_subrange.hpp
Normal file
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
Copyright (c) Marshall Clow 2008-2012.
|
||||
|
||||
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:
|
||||
28 Sep 2015 mtc First version
|
||||
|
||||
*/
|
||||
|
||||
/// \file sort_subrange.hpp
|
||||
/// \brief Sort a subrange
|
||||
/// \author Marshall Clow
|
||||
///
|
||||
/// Suggested by Sean Parent in his CppCon 2015 keynote
|
||||
|
||||
#ifndef BOOST_ALGORITHM_SORT_SUBRANGE_HPP
|
||||
#define BOOST_ALGORITHM_SORT_SUBRANGE_HPP
|
||||
|
||||
#include <functional> // For std::less
|
||||
#include <iterator> // For std::iterator_traits
|
||||
#include <algorithm> // For nth_element and partial_sort
|
||||
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
namespace boost { namespace algorithm {
|
||||
|
||||
/// \fn sort_subrange ( T const& val,
|
||||
/// Iterator first, Iterator last,
|
||||
/// Iterator sub_first, Iterator sub_last,
|
||||
/// Pred p )
|
||||
/// \brief Sort the subrange [sub_first, sub_last) that is inside
|
||||
/// the range [first, last) as if you had sorted the entire range.
|
||||
///
|
||||
/// \param first The start of the larger range
|
||||
/// \param last The end of the larger range
|
||||
/// \param sub_first The start of the sub range
|
||||
/// \param sub_last The end of the sub range
|
||||
/// \param p A predicate to use to compare the values.
|
||||
/// p ( a, b ) returns a boolean.
|
||||
///
|
||||
template<typename Iterator, typename Pred>
|
||||
void sort_subrange (
|
||||
Iterator first, Iterator last,
|
||||
Iterator sub_first, Iterator sub_last,
|
||||
Pred p)
|
||||
{
|
||||
if (sub_first == sub_last) return; // the empty sub-range is already sorted.
|
||||
|
||||
if (sub_first != first) { // sub-range is at the start, don't need to partition
|
||||
(void) std::nth_element(first, sub_first, last, p);
|
||||
++sub_first;
|
||||
}
|
||||
std::partial_sort(sub_first, sub_last, last, p);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename Iterator>
|
||||
void sort_subrange (Iterator first, Iterator last, Iterator sub_first, Iterator sub_last)
|
||||
{
|
||||
typedef typename std::iterator_traits<Iterator>::value_type value_type;
|
||||
return sort_subrange(first, last, sub_first, sub_last, std::less<value_type>());
|
||||
}
|
||||
|
||||
/// range versions?
|
||||
|
||||
|
||||
/// \fn partition_subrange ( T const& val,
|
||||
/// Iterator first, Iterator last,
|
||||
/// Iterator sub_first, Iterator sub_last,
|
||||
/// Pred p )
|
||||
/// \brief Gather the elements of the subrange [sub_first, sub_last) that is
|
||||
/// inside the range [first, last) as if you had sorted the entire range.
|
||||
///
|
||||
/// \param first The start of the larger range
|
||||
/// \param last The end of the larger range
|
||||
/// \param sub_first The start of the sub range
|
||||
/// \param sub_last The end of the sub range
|
||||
/// \param p A predicate to use to compare the values.
|
||||
/// p ( a, b ) returns a boolean.
|
||||
///
|
||||
template<typename Iterator, typename Pred>
|
||||
void partition_subrange (
|
||||
Iterator first, Iterator last,
|
||||
Iterator sub_first, Iterator sub_last,
|
||||
Pred p)
|
||||
{
|
||||
if (sub_first != first) {
|
||||
(void) std::nth_element(first, sub_first, last, p);
|
||||
++sub_first;
|
||||
}
|
||||
|
||||
if (sub_last != last)
|
||||
(void) std::nth_element(sub_first, sub_last, last, p);
|
||||
}
|
||||
|
||||
template<typename Iterator>
|
||||
void partition_subrange (Iterator first, Iterator last, Iterator sub_first, Iterator sub_last)
|
||||
{
|
||||
typedef typename std::iterator_traits<Iterator>::value_type value_type;
|
||||
return partition_subrange(first, last, sub_first, sub_last, std::less<value_type>());
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_ALGORITHM_SORT_SUBRANGE_HPP
|
|
@ -401,7 +401,6 @@ namespace boost {
|
|||
\param Search A substring to be searched for
|
||||
\param Format A substitute string
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
\return A reference to the modified input
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline void ireplace_last(
|
||||
|
@ -643,7 +642,6 @@ namespace boost {
|
|||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Format A substitute string
|
||||
\return A reference to the modified input
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline void replace_all(
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
/*
|
||||
(c) 2014-2015 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014-2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_HPP
|
||||
#define BOOST_ALIGN_HPP
|
||||
|
||||
#include <boost/align/align.hpp>
|
||||
#include <boost/align/align_down.hpp>
|
||||
#include <boost/align/align_up.hpp>
|
||||
#include <boost/align/aligned_alloc.hpp>
|
||||
#include <boost/align/aligned_allocator.hpp>
|
||||
#include <boost/align/aligned_allocator_adaptor.hpp>
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014-2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_ALIGN_HPP
|
||||
#define BOOST_ALIGN_ALIGN_HPP
|
||||
|
|
25
3party/boost/boost/align/align_down.hpp
Normal file
25
3party/boost/boost/align/align_down.hpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
Copyright 2015 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_ALIGN_ALIGN_DOWN_HPP
|
||||
#define BOOST_ALIGN_ALIGN_DOWN_HPP
|
||||
|
||||
#include <boost/align/detail/align_down.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
BOOST_CONSTEXPR inline std::size_t
|
||||
align_down(std::size_t value, std::size_t alignment) BOOST_NOEXCEPT
|
||||
{
|
||||
return value & ~(alignment - 1);
|
||||
}
|
||||
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
25
3party/boost/boost/align/align_up.hpp
Normal file
25
3party/boost/boost/align/align_up.hpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
Copyright 2015 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_ALIGN_ALIGN_UP_HPP
|
||||
#define BOOST_ALIGN_ALIGN_UP_HPP
|
||||
|
||||
#include <boost/align/detail/align_up.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
BOOST_CONSTEXPR inline std::size_t
|
||||
align_up(std::size_t value, std::size_t alignment) BOOST_NOEXCEPT
|
||||
{
|
||||
return (value + alignment - 1) & ~(alignment - 1);
|
||||
}
|
||||
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
|
@ -1,10 +1,9 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014-2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_ALIGNED_ALLOC_HPP
|
||||
#define BOOST_ALIGN_ALIGNED_ALLOC_HPP
|
||||
|
@ -19,7 +18,9 @@ http://boost.org/LICENSE_1_0.txt
|
|||
#include <AvailabilityMacros.h>
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(BOOST_ALIGN_USE_ALLOCATE)
|
||||
#include <boost/align/detail/aligned_alloc.hpp>
|
||||
#elif defined(_MSC_VER) && !defined(UNDER_CE)
|
||||
#include <boost/align/detail/aligned_alloc_msvc.hpp>
|
||||
#elif defined(__MINGW32__) && (__MSVCRT_VERSION__ >= 0x0700)
|
||||
#include <boost/align/detail/aligned_alloc_msvc.hpp>
|
||||
|
|
|
@ -1,24 +1,22 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014-2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_ALIGNED_ALLOCATOR_HPP
|
||||
#define BOOST_ALIGN_ALIGNED_ALLOCATOR_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/align/detail/addressof.hpp>
|
||||
#include <boost/align/detail/is_alignment_constant.hpp>
|
||||
#include <boost/align/detail/max_objects.hpp>
|
||||
#include <boost/align/detail/max_size.hpp>
|
||||
#include <boost/align/aligned_alloc.hpp>
|
||||
#include <boost/align/aligned_allocator_forward.hpp>
|
||||
#include <boost/align/alignment_of.hpp>
|
||||
#include <boost/align/detail/addressof.hpp>
|
||||
#include <boost/align/detail/is_alignment_constant.hpp>
|
||||
#include <boost/align/detail/max_align.hpp>
|
||||
#include <boost/align/detail/max_count_of.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <new>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
|
@ -46,7 +44,7 @@ public:
|
|||
|
||||
private:
|
||||
enum {
|
||||
min_align = detail::max_align<Alignment,
|
||||
min_align = detail::max_size<Alignment,
|
||||
alignment_of<value_type>::value>::value
|
||||
};
|
||||
|
||||
|
@ -57,68 +55,64 @@ public:
|
|||
};
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
|
||||
aligned_allocator() BOOST_NOEXCEPT = default;
|
||||
aligned_allocator() = default;
|
||||
#else
|
||||
aligned_allocator() BOOST_NOEXCEPT {
|
||||
}
|
||||
aligned_allocator() BOOST_NOEXCEPT { }
|
||||
#endif
|
||||
|
||||
template<class U>
|
||||
aligned_allocator(const aligned_allocator<U, Alignment>&)
|
||||
BOOST_NOEXCEPT {
|
||||
}
|
||||
BOOST_NOEXCEPT { }
|
||||
|
||||
pointer address(reference value) const BOOST_NOEXCEPT {
|
||||
return detail::addressof(value);
|
||||
}
|
||||
|
||||
const_pointer address(const_reference value) const
|
||||
BOOST_NOEXCEPT {
|
||||
const_pointer address(const_reference value) const BOOST_NOEXCEPT {
|
||||
return detail::addressof(value);
|
||||
}
|
||||
|
||||
pointer allocate(size_type size, const_void_pointer = 0) {
|
||||
if (size == 0) {
|
||||
return 0;
|
||||
}
|
||||
void* p = aligned_alloc(min_align, sizeof(T) * size);
|
||||
if (!p && size > 0) {
|
||||
if (!p) {
|
||||
boost::throw_exception(std::bad_alloc());
|
||||
}
|
||||
return static_cast<T*>(p);
|
||||
}
|
||||
|
||||
void deallocate(pointer ptr, size_type) {
|
||||
alignment::aligned_free(ptr);
|
||||
boost::alignment::aligned_free(ptr);
|
||||
}
|
||||
|
||||
BOOST_CONSTEXPR size_type max_size() const BOOST_NOEXCEPT {
|
||||
return detail::max_count_of<T>::value;
|
||||
return detail::max_objects<T>::value;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template<class U, class... Args>
|
||||
void construct(U* ptr, Args&&... args) {
|
||||
void* p = ptr;
|
||||
::new(p) U(std::forward<Args>(args)...);
|
||||
::new((void*)ptr) U(std::forward<Args>(args)...);
|
||||
}
|
||||
#else
|
||||
template<class U, class V>
|
||||
void construct(U* ptr, V&& value) {
|
||||
void* p = ptr;
|
||||
::new(p) U(std::forward<V>(value));
|
||||
::new((void*)ptr) U(std::forward<V>(value));
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
template<class U, class V>
|
||||
void construct(U* ptr, const V& value) {
|
||||
void* p = ptr;
|
||||
::new(p) U(value);
|
||||
::new((void*)ptr) U(value);
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class U>
|
||||
void construct(U* ptr) {
|
||||
void* p = ptr;
|
||||
::new(p) U();
|
||||
::new((void*)ptr) U();
|
||||
}
|
||||
|
||||
template<class U>
|
||||
|
@ -144,23 +138,23 @@ public:
|
|||
};
|
||||
};
|
||||
|
||||
template<class T1, class T2, std::size_t Alignment>
|
||||
inline bool operator==(const aligned_allocator<T1,
|
||||
Alignment>&, const aligned_allocator<T2,
|
||||
Alignment>&) BOOST_NOEXCEPT
|
||||
template<class T, class U, std::size_t Alignment>
|
||||
inline bool
|
||||
operator==(const aligned_allocator<T, Alignment>&,
|
||||
const aligned_allocator<U, Alignment>&) BOOST_NOEXCEPT
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
template<class T1, class T2, std::size_t Alignment>
|
||||
inline bool operator!=(const aligned_allocator<T1,
|
||||
Alignment>&, const aligned_allocator<T2,
|
||||
Alignment>&) BOOST_NOEXCEPT
|
||||
template<class T, class U, std::size_t Alignment>
|
||||
inline bool
|
||||
operator!=(const aligned_allocator<T, Alignment>&,
|
||||
const aligned_allocator<U, Alignment>&) BOOST_NOEXCEPT
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
/*
|
||||
(c) 2014-2015 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014-2016 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_ALIGNED_ALLOCATOR_ADAPTOR_HPP
|
||||
#define BOOST_ALIGN_ALIGNED_ALLOCATOR_ADAPTOR_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/align/align.hpp>
|
||||
#include <boost/align/aligned_allocator_adaptor_forward.hpp>
|
||||
#include <boost/align/alignment_of.hpp>
|
||||
#include <boost/align/detail/addressof.hpp>
|
||||
#include <boost/align/detail/is_alignment_constant.hpp>
|
||||
#include <boost/align/detail/max_align.hpp>
|
||||
#include <boost/align/detail/max_size.hpp>
|
||||
#include <boost/align/align.hpp>
|
||||
#include <boost/align/aligned_allocator_adaptor_forward.hpp>
|
||||
#include <boost/align/alignment_of.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <new>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
|
||||
|
@ -53,10 +52,6 @@ class aligned_allocator_adaptor
|
|||
typedef typename char_alloc::pointer char_ptr;
|
||||
#endif
|
||||
|
||||
enum {
|
||||
ptr_align = alignment_of<char_ptr>::value
|
||||
};
|
||||
|
||||
public:
|
||||
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
|
||||
typedef typename traits::value_type value_type;
|
||||
|
@ -74,9 +69,8 @@ public:
|
|||
|
||||
private:
|
||||
enum {
|
||||
min_align = detail::max_align<Alignment,
|
||||
detail::max_align<alignment_of<value_type>::value,
|
||||
alignment_of<char_ptr>::value>::value>::value
|
||||
min_align = detail::max_size<Alignment,
|
||||
detail::max_align<value_type, char_ptr>::value>::value
|
||||
};
|
||||
|
||||
public:
|
||||
|
@ -95,28 +89,23 @@ public:
|
|||
aligned_allocator_adaptor() = default;
|
||||
#else
|
||||
aligned_allocator_adaptor()
|
||||
: Allocator() {
|
||||
}
|
||||
: Allocator() { }
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
template<class A>
|
||||
explicit aligned_allocator_adaptor(A&& alloc) BOOST_NOEXCEPT
|
||||
: Allocator(std::forward<A>(alloc)) {
|
||||
}
|
||||
: Allocator(std::forward<A>(alloc)) { }
|
||||
#else
|
||||
template<class A>
|
||||
explicit aligned_allocator_adaptor(const A& alloc)
|
||||
BOOST_NOEXCEPT
|
||||
: Allocator(alloc) {
|
||||
}
|
||||
explicit aligned_allocator_adaptor(const A& alloc) BOOST_NOEXCEPT
|
||||
: Allocator(alloc) { }
|
||||
#endif
|
||||
|
||||
template<class U>
|
||||
aligned_allocator_adaptor(const aligned_allocator_adaptor<U,
|
||||
Alignment>& other) BOOST_NOEXCEPT
|
||||
: Allocator(other.base()) {
|
||||
}
|
||||
: Allocator(other.base()) { }
|
||||
|
||||
Allocator& base() BOOST_NOEXCEPT {
|
||||
return static_cast<Allocator&>(*this);
|
||||
|
@ -127,64 +116,64 @@ public:
|
|||
}
|
||||
|
||||
pointer allocate(size_type size) {
|
||||
std::size_t n1 = size * sizeof(value_type);
|
||||
std::size_t n2 = n1 + min_align - ptr_align;
|
||||
std::size_t s = size * sizeof(value_type);
|
||||
std::size_t n = s + min_align - 1;
|
||||
char_alloc a(base());
|
||||
char_ptr p1 = a.allocate(sizeof p1 + n2);
|
||||
void* p2 = detail::addressof(*p1) + sizeof p1;
|
||||
(void)align(min_align, n1, p2, n2);
|
||||
void* p3 = static_cast<char_ptr*>(p2) - 1;
|
||||
::new(p3) char_ptr(p1);
|
||||
return static_cast<pointer>(p2);
|
||||
char_ptr p = a.allocate(sizeof p + n);
|
||||
void* r = detail::addressof(*p) + sizeof p;
|
||||
(void)align(min_align, s, r, n);
|
||||
::new(static_cast<void*>(static_cast<char_ptr*>(r)
|
||||
- 1)) char_ptr(p);
|
||||
return static_cast<pointer>(r);
|
||||
}
|
||||
|
||||
pointer allocate(size_type size, const_void_pointer hint) {
|
||||
std::size_t n1 = size * sizeof(value_type);
|
||||
std::size_t n2 = n1 + min_align - ptr_align;
|
||||
std::size_t s = size * sizeof(value_type);
|
||||
std::size_t n = s + min_align - 1;
|
||||
char_ptr h = char_ptr();
|
||||
if (hint) {
|
||||
h = *(static_cast<const char_ptr*>(hint) - 1);
|
||||
}
|
||||
char_alloc a(base());
|
||||
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
|
||||
char_ptr p1 = char_traits::allocate(a, sizeof p1 + n2, h);
|
||||
char_ptr p = char_traits::allocate(a, sizeof p + n, h);
|
||||
#else
|
||||
char_ptr p1 = a.allocate(sizeof p1 + n2, h);
|
||||
char_ptr p = a.allocate(sizeof p + n, h);
|
||||
#endif
|
||||
void* p2 = detail::addressof(*p1) + sizeof p1;
|
||||
(void)align(min_align, n1, p2, n2);
|
||||
void* p3 = static_cast<char_ptr*>(p2) - 1;
|
||||
::new(p3) char_ptr(p1);
|
||||
return static_cast<pointer>(p2);
|
||||
void* r = detail::addressof(*p) + sizeof p;
|
||||
(void)align(min_align, s, r, n);
|
||||
::new(static_cast<void*>(static_cast<char_ptr*>(r)
|
||||
- 1)) char_ptr(p);
|
||||
return static_cast<pointer>(r);
|
||||
}
|
||||
|
||||
void deallocate(pointer ptr, size_type size) {
|
||||
char_ptr* p1 = reinterpret_cast<char_ptr*>(ptr) - 1;
|
||||
char_ptr p2 = *p1;
|
||||
p1->~char_ptr();
|
||||
char_ptr* p = reinterpret_cast<char_ptr*>(ptr) - 1;
|
||||
char_ptr r = *p;
|
||||
p->~char_ptr();
|
||||
char_alloc a(base());
|
||||
a.deallocate(p2, size * sizeof(value_type) +
|
||||
min_align - ptr_align + sizeof p2);
|
||||
a.deallocate(r, sizeof r + size * sizeof(value_type) +
|
||||
min_align - 1);
|
||||
}
|
||||
};
|
||||
|
||||
template<class A1, class A2, std::size_t Alignment>
|
||||
inline bool operator==(const aligned_allocator_adaptor<A1,
|
||||
Alignment>& a, const aligned_allocator_adaptor<A2,
|
||||
Alignment>& b) BOOST_NOEXCEPT
|
||||
template<class A, class B, std::size_t Alignment>
|
||||
inline bool
|
||||
operator==(const aligned_allocator_adaptor<A, Alignment>& a,
|
||||
const aligned_allocator_adaptor<B, Alignment>& b) BOOST_NOEXCEPT
|
||||
{
|
||||
return a.base() == b.base();
|
||||
}
|
||||
|
||||
template<class A1, class A2, std::size_t Alignment>
|
||||
inline bool operator!=(const aligned_allocator_adaptor<A1,
|
||||
Alignment>& a, const aligned_allocator_adaptor<A2,
|
||||
Alignment>& b) BOOST_NOEXCEPT
|
||||
template<class A, class B, std::size_t Alignment>
|
||||
inline bool
|
||||
operator!=(const aligned_allocator_adaptor<A, Alignment>& a,
|
||||
const aligned_allocator_adaptor<B, Alignment>& b) BOOST_NOEXCEPT
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_ALIGNED_ALLOCATOR_ADAPTOR_FORWARD_HPP
|
||||
#define BOOST_ALIGN_ALIGNED_ALLOCATOR_ADAPTOR_FORWARD_HPP
|
||||
|
@ -17,7 +16,7 @@ namespace alignment {
|
|||
template<class Allocator, std::size_t Alignment = 1>
|
||||
class aligned_allocator_adaptor;
|
||||
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_ALIGNED_ALLOCATOR_FORWARD_HPP
|
||||
#define BOOST_ALIGN_ALIGNED_ALLOCATOR_FORWARD_HPP
|
||||
|
@ -17,7 +16,7 @@ namespace alignment {
|
|||
template<class T, std::size_t Alignment = 1>
|
||||
class aligned_allocator;
|
||||
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,34 +1,31 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014-2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_ALIGNED_DELETE_HPP
|
||||
#define BOOST_ALIGN_ALIGNED_DELETE_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/align/aligned_alloc.hpp>
|
||||
#include <boost/align/aligned_delete_forward.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
class aligned_delete {
|
||||
public:
|
||||
struct aligned_delete {
|
||||
template<class T>
|
||||
void operator()(T* ptr) const
|
||||
BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(ptr->~T())) {
|
||||
if (ptr) {
|
||||
ptr->~T();
|
||||
alignment::aligned_free(ptr);
|
||||
boost::alignment::aligned_free(ptr);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014-2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_ALIGNED_DELETE_FORWARD_HPP
|
||||
#define BOOST_ALIGN_ALIGNED_DELETE_FORWARD_HPP
|
||||
|
@ -12,9 +11,9 @@ http://boost.org/LICENSE_1_0.txt
|
|||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
class aligned_delete;
|
||||
struct aligned_delete;
|
||||
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
/*
|
||||
(c) 2014-2015 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014-2016 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_ALIGNMENT_OF_HPP
|
||||
#define BOOST_ALIGN_ALIGNMENT_OF_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/align/detail/element_type.hpp>
|
||||
#include <boost/align/alignment_of_forward.hpp>
|
||||
#include <boost/align/detail/remove_traits.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#include <boost/align/detail/alignment_of_msvc.hpp>
|
||||
|
@ -41,13 +39,14 @@ namespace alignment {
|
|||
template<class T>
|
||||
struct alignment_of
|
||||
: detail::alignment_of<typename
|
||||
detail::remove_cv<typename
|
||||
detail::remove_all_extents<typename
|
||||
detail::remove_reference<T>::
|
||||
type>::type>::type>::type {
|
||||
};
|
||||
detail::element_type<T>::type>::type { };
|
||||
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
#if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES)
|
||||
template<class T>
|
||||
constexpr std::size_t alignment_of_v = alignment_of<T>::value;
|
||||
#endif
|
||||
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_ALIGNMENT_OF_FORWARD_HPP
|
||||
#define BOOST_ALIGN_ALIGNMENT_OF_FORWARD_HPP
|
||||
|
@ -15,7 +14,7 @@ namespace alignment {
|
|||
template<class T>
|
||||
struct alignment_of;
|
||||
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
/*
|
||||
(c) 2015 NumScale SAS
|
||||
(c) 2015 LRI UMR 8623 CNRS/University Paris Sud XI
|
||||
Copyright 2015 NumScale SAS
|
||||
Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI
|
||||
|
||||
(c) 2015 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_ASSUME_ALIGNED_HPP
|
||||
#define BOOST_ALIGN_ASSUME_ALIGNED_HPP
|
||||
|
@ -16,7 +15,7 @@ http://boost.org/LICENSE_1_0.txt
|
|||
|
||||
#if defined(BOOST_MSVC)
|
||||
#include <boost/align/detail/assume_aligned_msvc.hpp>
|
||||
#elif defined(BOOST_CLANG)
|
||||
#elif defined(BOOST_CLANG) && defined(__has_builtin)
|
||||
#include <boost/align/detail/assume_aligned_clang.hpp>
|
||||
#elif BOOST_GCC_VERSION >= 40700
|
||||
#include <boost/align/detail/assume_aligned_gcc.hpp>
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ADDRESS_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ADDRESS_HPP
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
#if defined(BOOST_HAS_INTPTR_T)
|
||||
typedef boost::uintptr_t address_t;
|
||||
#else
|
||||
typedef std::size_t address_t;
|
||||
#endif
|
||||
|
||||
} /* :detail */
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
|
||||
#endif
|
|
@ -1,10 +1,9 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ADDRESSOF_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ADDRESSOF_HPP
|
||||
|
@ -27,8 +26,8 @@ using std::addressof;
|
|||
using boost::addressof;
|
||||
#endif
|
||||
|
||||
} /* :detail */
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,40 +1,38 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014-2016 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGN_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGN_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/align/detail/address.hpp>
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <cstddef>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline void* align(std::size_t alignment, std::size_t size,
|
||||
void*& ptr, std::size_t& space)
|
||||
inline void*
|
||||
align(std::size_t alignment, std::size_t size, void*& ptr,
|
||||
std::size_t& space)
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
std::size_t n = detail::address_t(ptr) & (alignment - 1);
|
||||
if (n != 0) {
|
||||
n = alignment - n;
|
||||
if (size <= space) {
|
||||
char* p = reinterpret_cast<char*>((reinterpret_cast<std::
|
||||
size_t>(ptr) + alignment - 1) & ~(alignment - 1));
|
||||
std::size_t n = space - (p - static_cast<char*>(ptr));
|
||||
if (size <= n) {
|
||||
ptr = p;
|
||||
space = n;
|
||||
return p;
|
||||
}
|
||||
}
|
||||
void* p = 0;
|
||||
if (n <= space && size <= space - n) {
|
||||
p = static_cast<char*>(ptr) + n;
|
||||
ptr = p;
|
||||
space -= n;
|
||||
}
|
||||
return p;
|
||||
return 0;
|
||||
}
|
||||
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGN_CXX11_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGN_CXX11_HPP
|
||||
|
@ -16,7 +15,7 @@ namespace alignment {
|
|||
|
||||
using std::align;
|
||||
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
28
3party/boost/boost/align/detail/align_down.hpp
Normal file
28
3party/boost/boost/align/detail/align_down.hpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
Copyright 2015 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_ALIGN_DETAIL_ALIGN_DOWN_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGN_DOWN_HPP
|
||||
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline void*
|
||||
align_down(void* ptr, std::size_t alignment) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
return reinterpret_cast<void*>(reinterpret_cast<std::
|
||||
size_t>(ptr) & ~(alignment - 1));
|
||||
}
|
||||
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
28
3party/boost/boost/align/detail/align_up.hpp
Normal file
28
3party/boost/boost/align/detail/align_up.hpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
Copyright 2015 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_ALIGN_DETAIL_ALIGN_UP_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGN_UP_HPP
|
||||
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline void*
|
||||
align_up(void* ptr, std::size_t alignment) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
return reinterpret_cast<void*>((reinterpret_cast<std::
|
||||
size_t>(ptr) + alignment - 1) & ~(alignment - 1));
|
||||
}
|
||||
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
|
@ -1,26 +1,24 @@
|
|||
/*
|
||||
(c) 2014-2015 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014-2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <boost/align/align.hpp>
|
||||
#include <boost/align/alignment_of.hpp>
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline void* aligned_alloc(std::size_t alignment, std::size_t size)
|
||||
BOOST_NOEXCEPT
|
||||
inline void*
|
||||
aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
enum {
|
||||
|
@ -30,25 +28,25 @@ inline void* aligned_alloc(std::size_t alignment, std::size_t size)
|
|||
alignment = N;
|
||||
}
|
||||
std::size_t n = size + alignment - N;
|
||||
void* p1 = 0;
|
||||
void* p2 = std::malloc(n + sizeof p1);
|
||||
if (p2) {
|
||||
p1 = static_cast<char*>(p2) + sizeof p1;
|
||||
(void)align(alignment, size, p1, n);
|
||||
*(static_cast<void**>(p1) - 1) = p2;
|
||||
void* p = std::malloc(sizeof(void*) + n);
|
||||
if (p) {
|
||||
void* r = static_cast<char*>(p) + sizeof(void*);
|
||||
(void)align(alignment, size, r, n);
|
||||
*(static_cast<void**>(r) - 1) = p;
|
||||
p = r;
|
||||
}
|
||||
return p1;
|
||||
return p;
|
||||
}
|
||||
|
||||
inline void aligned_free(void* ptr) BOOST_NOEXCEPT
|
||||
inline void
|
||||
aligned_free(void* ptr) BOOST_NOEXCEPT
|
||||
{
|
||||
if (ptr) {
|
||||
void* p = *(static_cast<void**>(ptr) - 1);
|
||||
std::free(p);
|
||||
std::free(*(static_cast<void**>(ptr) - 1));
|
||||
}
|
||||
}
|
||||
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,36 +1,34 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_ANDROID_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_ANDROID_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <cstddef>
|
||||
#include <boost/assert.hpp>
|
||||
#include <malloc.h>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline void* aligned_alloc(std::size_t alignment, std::size_t size)
|
||||
BOOST_NOEXCEPT
|
||||
inline void*
|
||||
aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
return ::memalign(alignment, size);
|
||||
}
|
||||
|
||||
inline void aligned_free(void* ptr) BOOST_NOEXCEPT
|
||||
inline void
|
||||
aligned_free(void* ptr) BOOST_NOEXCEPT
|
||||
{
|
||||
::free(ptr);
|
||||
}
|
||||
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,28 +1,25 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MACOS_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MACOS_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <cstddef>
|
||||
#include <boost/assert.hpp>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline void* aligned_alloc(std::size_t alignment, std::size_t size)
|
||||
BOOST_NOEXCEPT
|
||||
inline void*
|
||||
aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
if (!size) {
|
||||
if (size == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (alignment < sizeof(void*)) {
|
||||
|
@ -35,12 +32,13 @@ inline void* aligned_alloc(std::size_t alignment, std::size_t size)
|
|||
return p;
|
||||
}
|
||||
|
||||
inline void aligned_free(void* ptr) BOOST_NOEXCEPT
|
||||
inline void
|
||||
aligned_free(void* ptr) BOOST_NOEXCEPT
|
||||
{
|
||||
::free(ptr);
|
||||
}
|
||||
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,36 +1,34 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MSVC_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MSVC_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <cstddef>
|
||||
#include <boost/assert.hpp>
|
||||
#include <malloc.h>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline void* aligned_alloc(std::size_t alignment, std::size_t size)
|
||||
BOOST_NOEXCEPT
|
||||
inline void*
|
||||
aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
return ::_aligned_malloc(size, alignment);
|
||||
}
|
||||
|
||||
inline void aligned_free(void* ptr) BOOST_NOEXCEPT
|
||||
inline void
|
||||
aligned_free(void* ptr) BOOST_NOEXCEPT
|
||||
{
|
||||
::_aligned_free(ptr);
|
||||
}
|
||||
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,25 +1,22 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_POSIX_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_POSIX_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <cstddef>
|
||||
#include <boost/assert.hpp>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline void* aligned_alloc(std::size_t alignment, std::size_t size)
|
||||
BOOST_NOEXCEPT
|
||||
inline void*
|
||||
aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
if (alignment < sizeof(void*)) {
|
||||
|
@ -32,12 +29,13 @@ inline void* aligned_alloc(std::size_t alignment, std::size_t size)
|
|||
return p;
|
||||
}
|
||||
|
||||
inline void aligned_free(void* ptr) BOOST_NOEXCEPT
|
||||
inline void
|
||||
aligned_free(void* ptr) BOOST_NOEXCEPT
|
||||
{
|
||||
::free(ptr);
|
||||
}
|
||||
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,36 +1,34 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_SUNOS_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_SUNOS_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <cstddef>
|
||||
#include <boost/assert.hpp>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline void* aligned_alloc(std::size_t alignment, std::size_t size)
|
||||
BOOST_NOEXCEPT
|
||||
inline void*
|
||||
aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
return ::memalign(alignment, size);
|
||||
}
|
||||
|
||||
inline void aligned_free(void* ptr) BOOST_NOEXCEPT
|
||||
inline void
|
||||
aligned_free(void* ptr) BOOST_NOEXCEPT
|
||||
{
|
||||
::free(ptr);
|
||||
}
|
||||
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,29 +1,31 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014-2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_HPP
|
||||
|
||||
#include <boost/align/detail/min_size.hpp>
|
||||
#include <boost/align/detail/offset_object.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
template<class T>
|
||||
struct alignment_of
|
||||
: min_size<sizeof(T),
|
||||
sizeof(offset_object<T>) - sizeof(T)>::type {
|
||||
struct offset_value {
|
||||
char value;
|
||||
T object;
|
||||
};
|
||||
|
||||
} /* :detail */
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
template<class T>
|
||||
struct alignment_of
|
||||
: min_size<sizeof(T), sizeof(offset_value<T>) - sizeof(T)> { };
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CLANG_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CLANG_HPP
|
||||
|
@ -18,11 +17,10 @@ namespace detail {
|
|||
|
||||
template<class T>
|
||||
struct alignment_of
|
||||
: integral_constant<std::size_t, __alignof(T)> {
|
||||
};
|
||||
: integral_constant<std::size_t, __alignof(T)> { };
|
||||
|
||||
} /* :detail */
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CODEGEAR_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CODEGEAR_HPP
|
||||
|
@ -18,11 +17,10 @@ namespace detail {
|
|||
|
||||
template<class T>
|
||||
struct alignment_of
|
||||
: integral_constant<std::size_t, alignof(T)> {
|
||||
};
|
||||
: integral_constant<std::size_t, alignof(T)> { };
|
||||
|
||||
} /* :detail */
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CXX11_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CXX11_HPP
|
||||
|
@ -17,8 +16,8 @@ namespace detail {
|
|||
|
||||
using std::alignment_of;
|
||||
|
||||
} /* :detail */
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_GCC_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_GCC_HPP
|
||||
|
@ -18,11 +17,10 @@ namespace detail {
|
|||
|
||||
template<class T>
|
||||
struct alignment_of
|
||||
: integral_constant<std::size_t, __alignof__(T)> {
|
||||
};
|
||||
: integral_constant<std::size_t, __alignof__(T)> { };
|
||||
|
||||
} /* :detail */
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,28 +1,33 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014-2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_MSVC_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_MSVC_HPP
|
||||
|
||||
#include <boost/align/detail/min_size.hpp>
|
||||
#include <boost/align/detail/offset_object.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
template<class T>
|
||||
struct alignment_of
|
||||
: min_size<sizeof(T), offsetof(offset_object<T>, object)>::type {
|
||||
struct offset_value {
|
||||
T first;
|
||||
char value;
|
||||
T second;
|
||||
};
|
||||
|
||||
} /* :detail */
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
template<class T>
|
||||
struct alignment_of
|
||||
: min_size<sizeof(T),
|
||||
sizeof(offset_value<T>) - (sizeof(T) << 1)> { };
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
/*
|
||||
(c) 2015 NumScale SAS
|
||||
(c) 2015 LRI UMR 8623 CNRS/University Paris Sud XI
|
||||
Copyright 2015 NumScale SAS
|
||||
Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI
|
||||
|
||||
(c) 2015 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_HPP
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
/*
|
||||
(c) 2015 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_CLANG_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_CLANG_HPP
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(__has_builtin) && __has_builtin(__builtin_assume)
|
||||
#define BOOST_ALIGN_ASSUME_ALIGNED(ptr, alignment) \
|
||||
__builtin_assume((uintptr_t(ptr) & ((alignment) - 1)) == 0)
|
||||
#if __has_builtin(__builtin_assume_aligned)
|
||||
#define BOOST_ALIGN_ASSUME_ALIGNED(p, n) \
|
||||
(p) = static_cast<__typeof__(p)>(__builtin_assume_aligned((p), (n)))
|
||||
#else
|
||||
#define BOOST_ALIGN_ASSUME_ALIGNED(ptr, alignment)
|
||||
#define BOOST_ALIGN_ASSUME_ALIGNED(p, n)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
/*
|
||||
(c) 2015 NumScale SAS
|
||||
(c) 2015 LRI UMR 8623 CNRS/University Paris Sud XI
|
||||
Copyright 2015 NumScale SAS
|
||||
Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI
|
||||
|
||||
(c) 2015 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_GCC_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_GCC_HPP
|
||||
|
||||
#define BOOST_ALIGN_ASSUME_ALIGNED(ptr, alignment) \
|
||||
(ptr) = __builtin_assume_aligned((ptr), (alignment))
|
||||
#define BOOST_ALIGN_ASSUME_ALIGNED(p, n) \
|
||||
(p) = static_cast<__typeof__(p)>(__builtin_assume_aligned((p), (n)))
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
/*
|
||||
(c) 2015 NumScale SAS
|
||||
(c) 2015 LRI UMR 8623 CNRS/University Paris Sud XI
|
||||
Copyright 2015 NumScale SAS
|
||||
Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI
|
||||
|
||||
(c) 2015 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_INTEL_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_INTEL_HPP
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
/*
|
||||
(c) 2015 NumScale SAS
|
||||
(c) 2015 LRI UMR 8623 CNRS/University Paris Sud XI
|
||||
Copyright 2015 NumScale SAS
|
||||
Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI
|
||||
|
||||
(c) 2015 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_MSVC_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_MSVC_HPP
|
||||
|
||||
#include <stddef.h>
|
||||
#include <cstddef>
|
||||
|
||||
#define BOOST_ALIGN_ASSUME_ALIGNED(ptr, alignment) \
|
||||
__assume((uintptr_t(ptr) & ((alignment) - 1)) == 0)
|
||||
__assume((reinterpret_cast<std::size_t>(ptr) & ((alignment) - 1)) == 0)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_REMOVE_TRAITS_HPP
|
||||
#define BOOST_ALIGN_DETAIL_REMOVE_TRAITS_HPP
|
||||
#ifndef BOOST_ALIGN_DETAIL_ELEMENT_TYPE_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ELEMENT_TYPE_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
|
@ -58,35 +57,35 @@ struct remove_all_extents<T[N]> {
|
|||
typedef typename remove_all_extents<T>::type type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct remove_const {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct remove_const<const T> {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct remove_volatile {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct remove_volatile<volatile T> {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct remove_cv {
|
||||
typedef typename remove_volatile<typename
|
||||
remove_const<T>::type>::type type;
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct remove_cv<const T> {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct remove_cv<volatile T> {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct remove_cv<const volatile T> {
|
||||
typedef T type;
|
||||
};
|
||||
#endif
|
||||
|
||||
} /* :detail */
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
template<class T>
|
||||
struct element_type {
|
||||
typedef typename remove_cv<typename remove_all_extents<typename
|
||||
remove_reference<T>::type>::type>::type type;
|
||||
};
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
|
@ -1,10 +1,9 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014-2016 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_INTEGRAL_CONSTANT_HPP
|
||||
#define BOOST_ALIGN_DETAIL_INTEGRAL_CONSTANT_HPP
|
||||
|
@ -25,24 +24,25 @@ using std::integral_constant;
|
|||
template<class T, T Value>
|
||||
struct integral_constant {
|
||||
typedef T value_type;
|
||||
typedef integral_constant<T, Value> type;
|
||||
typedef integral_constant type;
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_CONSTEXPR)
|
||||
constexpr operator value_type() const {
|
||||
BOOST_CONSTEXPR operator value_type() const BOOST_NOEXCEPT {
|
||||
return Value;
|
||||
}
|
||||
|
||||
static constexpr T value = Value;
|
||||
#else
|
||||
enum {
|
||||
value = Value
|
||||
};
|
||||
#endif
|
||||
BOOST_CONSTEXPR value_type operator()() const BOOST_NOEXCEPT {
|
||||
return Value;
|
||||
}
|
||||
|
||||
BOOST_STATIC_CONSTEXPR T value = Value;
|
||||
};
|
||||
|
||||
template<class T, T Value>
|
||||
BOOST_CONSTEXPR_OR_CONST T integral_constant<T, Value>::value;
|
||||
#endif
|
||||
|
||||
} /* :detail */
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,31 +1,34 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_IS_ALIGNED_HPP
|
||||
#define BOOST_ALIGN_DETAIL_IS_ALIGNED_HPP
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/align/detail/address.hpp>
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <cstddef>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline bool is_aligned(std::size_t alignment, const void* ptr)
|
||||
BOOST_NOEXCEPT
|
||||
inline bool
|
||||
is_aligned(const void* ptr, std::size_t alignment) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
return (detail::address_t(ptr) & (alignment - 1)) == 0;
|
||||
return (reinterpret_cast<std::size_t>(ptr) & (alignment - 1)) == 0;
|
||||
}
|
||||
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
inline bool
|
||||
is_aligned(std::size_t alignment, const void* ptr) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
return (reinterpret_cast<std::size_t>(ptr) & (alignment - 1)) == 0;
|
||||
}
|
||||
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_IS_ALIGNMENT_HPP
|
||||
#define BOOST_ALIGN_DETAIL_IS_ALIGNMENT_HPP
|
||||
|
@ -16,14 +16,14 @@ namespace boost {
|
|||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
BOOST_CONSTEXPR inline bool is_alignment(std::size_t value)
|
||||
BOOST_NOEXCEPT
|
||||
BOOST_CONSTEXPR inline bool
|
||||
is_alignment(std::size_t value) BOOST_NOEXCEPT
|
||||
{
|
||||
return (value > 0) && ((value & (value - 1)) == 0);
|
||||
}
|
||||
|
||||
} /* :detail */
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_IS_ALIGNMENT_CONSTANT_HPP
|
||||
#define BOOST_ALIGN_DETAIL_IS_ALIGNMENT_CONSTANT_HPP
|
||||
|
@ -18,11 +17,10 @@ namespace detail {
|
|||
|
||||
template<std::size_t N>
|
||||
struct is_alignment_constant
|
||||
: integral_constant<bool, (N > 0) && ((N & (N - 1)) == 0)> {
|
||||
};
|
||||
: integral_constant<bool, (N > 0) && ((N & (N - 1)) == 0)> { };
|
||||
|
||||
} /* :detail */
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,28 +1,26 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014-2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_MAX_ALIGN_HPP
|
||||
#define BOOST_ALIGN_DETAIL_MAX_ALIGN_HPP
|
||||
|
||||
#include <boost/align/detail/integral_constant.hpp>
|
||||
#include <cstddef>
|
||||
#include <boost/align/detail/max_size.hpp>
|
||||
#include <boost/align/alignment_of.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
template<std::size_t A, std::size_t B>
|
||||
template<class A, class B>
|
||||
struct max_align
|
||||
: integral_constant<std::size_t, (A > B) ? A : B> {
|
||||
};
|
||||
: max_size<alignment_of<A>::value, alignment_of<B>::value> { };
|
||||
|
||||
} /* :detail */
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_MAX_COUNT_OF_HPP
|
||||
#define BOOST_ALIGN_DETAIL_MAX_COUNT_OF_HPP
|
||||
|
||||
#include <boost/align/detail/integral_constant.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
template<class T>
|
||||
struct max_count_of
|
||||
: integral_constant<std::size_t,
|
||||
~static_cast<std::size_t>(0) / sizeof(T)> {
|
||||
};
|
||||
|
||||
} /* :detail */
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
|
||||
#endif
|
27
3party/boost/boost/align/detail/max_objects.hpp
Normal file
27
3party/boost/boost/align/detail/max_objects.hpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
Copyright 2014 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_ALIGN_DETAIL_MAX_OBJECTS_HPP
|
||||
#define BOOST_ALIGN_DETAIL_MAX_OBJECTS_HPP
|
||||
|
||||
#include <boost/align/detail/integral_constant.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
template<class T>
|
||||
struct max_objects
|
||||
: integral_constant<std::size_t,
|
||||
~static_cast<std::size_t>(0) / sizeof(T)> { };
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
26
3party/boost/boost/align/detail/max_size.hpp
Normal file
26
3party/boost/boost/align/detail/max_size.hpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
Copyright 2014-2015 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_ALIGN_DETAIL_MAX_SIZE_HPP
|
||||
#define BOOST_ALIGN_DETAIL_MAX_SIZE_HPP
|
||||
|
||||
#include <boost/align/detail/integral_constant.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
template<std::size_t A, std::size_t B>
|
||||
struct max_size
|
||||
: integral_constant<std::size_t, (A > B) ? A : B> { };
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
|
@ -1,10 +1,9 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_MIN_SIZE_HPP
|
||||
#define BOOST_ALIGN_DETAIL_MIN_SIZE_HPP
|
||||
|
@ -18,11 +17,10 @@ namespace detail {
|
|||
|
||||
template<std::size_t A, std::size_t B>
|
||||
struct min_size
|
||||
: integral_constant<std::size_t, (A < B) ? A : B> {
|
||||
};
|
||||
: integral_constant<std::size_t, (A < B) ? A : B> { };
|
||||
|
||||
} /* :detail */
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_OFFSET_OBJECT_HPP
|
||||
#define BOOST_ALIGN_DETAIL_OFFSET_OBJECT_HPP
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
template<class T>
|
||||
struct offset_object {
|
||||
char offset;
|
||||
T object;
|
||||
};
|
||||
|
||||
} /* :detail */
|
||||
} /* :alignment */
|
||||
} /* :boost */
|
||||
|
||||
#endif
|
|
@ -1,14 +1,26 @@
|
|||
/*
|
||||
(c) 2014 Glen Joseph Fernandes
|
||||
glenjofe at gmail dot com
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0.
|
||||
http://boost.org/LICENSE_1_0.txt
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_IS_ALIGNED_HPP
|
||||
#define BOOST_ALIGN_IS_ALIGNED_HPP
|
||||
|
||||
#include <boost/align/detail/is_aligned.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
BOOST_CONSTEXPR inline bool
|
||||
is_aligned(std::size_t value, std::size_t alignment) BOOST_NOEXCEPT
|
||||
{
|
||||
return (value & (alignment - 1)) == 0;
|
||||
}
|
||||
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
|
|
|
@ -13,131 +13,6 @@
|
|||
#ifndef BOOST_ALIGNED_STORAGE_HPP
|
||||
#define BOOST_ALIGNED_STORAGE_HPP
|
||||
|
||||
#include <cstddef> // for std::size_t
|
||||
|
||||
#include "boost/config.hpp"
|
||||
#include "boost/detail/workaround.hpp"
|
||||
#include "boost/type_traits/alignment_of.hpp"
|
||||
#include "boost/type_traits/type_with_alignment.hpp"
|
||||
#include "boost/type_traits/is_pod.hpp"
|
||||
|
||||
#include "boost/mpl/eval_if.hpp"
|
||||
#include "boost/mpl/identity.hpp"
|
||||
|
||||
#include "boost/type_traits/detail/bool_trait_def.hpp"
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace detail { namespace aligned_storage {
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
std::size_t
|
||||
, alignment_of_max_align = ::boost::alignment_of<max_align>::value
|
||||
);
|
||||
|
||||
//
|
||||
// To be TR1 conforming this must be a POD type:
|
||||
//
|
||||
template <
|
||||
std::size_t size_
|
||||
, std::size_t alignment_
|
||||
>
|
||||
struct aligned_storage_imp
|
||||
{
|
||||
union data_t
|
||||
{
|
||||
char buf[size_];
|
||||
|
||||
typename ::boost::mpl::eval_if_c<
|
||||
alignment_ == std::size_t(-1)
|
||||
, ::boost::mpl::identity< ::boost::detail::max_align >
|
||||
, ::boost::type_with_alignment<alignment_>
|
||||
>::type align_;
|
||||
} data_;
|
||||
void* address() const { return const_cast<aligned_storage_imp*>(this); }
|
||||
};
|
||||
|
||||
template< std::size_t alignment_ >
|
||||
struct aligned_storage_imp<0u,alignment_>
|
||||
{
|
||||
/* intentionally empty */
|
||||
void* address() const { return 0; }
|
||||
};
|
||||
|
||||
}} // namespace detail::aligned_storage
|
||||
|
||||
template <
|
||||
std::size_t size_
|
||||
, std::size_t alignment_ = std::size_t(-1)
|
||||
>
|
||||
class aligned_storage :
|
||||
#ifndef __BORLANDC__
|
||||
private
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
::boost::detail::aligned_storage::aligned_storage_imp<size_, alignment_>
|
||||
{
|
||||
|
||||
public: // constants
|
||||
|
||||
typedef ::boost::detail::aligned_storage::aligned_storage_imp<size_, alignment_> type;
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
std::size_t
|
||||
, size = size_
|
||||
);
|
||||
BOOST_STATIC_CONSTANT(
|
||||
std::size_t
|
||||
, alignment = (
|
||||
alignment_ == std::size_t(-1)
|
||||
? ::boost::detail::aligned_storage::alignment_of_max_align
|
||||
: alignment_
|
||||
)
|
||||
);
|
||||
|
||||
private: // noncopyable
|
||||
|
||||
aligned_storage(const aligned_storage&);
|
||||
aligned_storage& operator=(const aligned_storage&);
|
||||
|
||||
public: // structors
|
||||
|
||||
aligned_storage()
|
||||
{
|
||||
}
|
||||
|
||||
~aligned_storage()
|
||||
{
|
||||
}
|
||||
|
||||
public: // accessors
|
||||
|
||||
void* address()
|
||||
{
|
||||
return static_cast<type*>(this)->address();
|
||||
}
|
||||
|
||||
const void* address() const
|
||||
{
|
||||
return static_cast<const type*>(this)->address();
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Make sure that is_pod recognises aligned_storage<>::type
|
||||
// as a POD (Note that aligned_storage<> itself is not a POD):
|
||||
//
|
||||
template <std::size_t size_, std::size_t alignment_>
|
||||
struct is_pod< ::boost::detail::aligned_storage::aligned_storage_imp<size_,alignment_> >
|
||||
BOOST_TT_AUX_BOOL_C_BASE(true)
|
||||
{
|
||||
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(true)
|
||||
};
|
||||
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include "boost/type_traits/detail/bool_trait_undef.hpp"
|
||||
#include <boost/type_traits/aligned_storage.hpp>
|
||||
|
||||
#endif // BOOST_ALIGNED_STORAGE_HPP
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#include "boost/config.hpp"
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/type_index.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/type_traits/decay.hpp>
|
||||
|
@ -27,6 +27,7 @@
|
|||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/core/addressof.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
@ -244,7 +245,9 @@ namespace boost
|
|||
ValueType * any_cast(any * operand) BOOST_NOEXCEPT
|
||||
{
|
||||
return operand && operand->type() == boost::typeindex::type_id<ValueType>()
|
||||
? &static_cast<any::holder<BOOST_DEDUCED_TYPENAME remove_cv<ValueType>::type> *>(operand->content)->held
|
||||
? boost::addressof(
|
||||
static_cast<any::holder<BOOST_DEDUCED_TYPENAME remove_cv<ValueType>::type> *>(operand->content)->held
|
||||
)
|
||||
: 0;
|
||||
}
|
||||
|
||||
|
@ -260,7 +263,7 @@ namespace boost
|
|||
typedef BOOST_DEDUCED_TYPENAME remove_reference<ValueType>::type nonref;
|
||||
|
||||
|
||||
nonref * result = any_cast<nonref>(&operand);
|
||||
nonref * result = any_cast<nonref>(boost::addressof(operand));
|
||||
if(!result)
|
||||
boost::throw_exception(bad_any_cast());
|
||||
|
||||
|
@ -274,7 +277,14 @@ namespace boost
|
|||
BOOST_DEDUCED_TYPENAME boost::add_reference<ValueType>::type
|
||||
>::type ref_type;
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4172) // "returning address of local variable or temporary" but *result is not local!
|
||||
#endif
|
||||
return static_cast<ref_type>(*result);
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename ValueType>
|
||||
|
@ -306,7 +316,9 @@ namespace boost
|
|||
template<typename ValueType>
|
||||
inline ValueType * unsafe_any_cast(any * operand) BOOST_NOEXCEPT
|
||||
{
|
||||
return &static_cast<any::holder<ValueType> *>(operand->content)->held;
|
||||
return boost::addressof(
|
||||
static_cast<any::holder<ValueType> *>(operand->content)->held
|
||||
);
|
||||
}
|
||||
|
||||
template<typename ValueType>
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
#ifndef BOOST_ARCHIVE_ADD_FACET_HPP
|
||||
#define BOOST_ARCHIVE_ADD_FACET_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// add_facet.hpp
|
||||
|
||||
// (C) Copyright 2003 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <locale>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
// does STLport uses native STL for locales?
|
||||
#if (defined(__SGI_STL_PORT)&& defined(_STLP_NO_OWN_IOSTREAMS))
|
||||
// and this native STL lib is old Dinkumware (has not defined _CPPLIB_VER)
|
||||
# if (defined(_YVALS) && !defined(__IBMCPP__)) || !defined(_CPPLIB_VER)
|
||||
# define BOOST_ARCHIVE_OLD_DINKUMWARE_BENEATH_STLPORT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
template<class Facet>
|
||||
inline std::locale *
|
||||
add_facet(const std::locale &l, Facet * f){
|
||||
return
|
||||
#if defined BOOST_ARCHIVE_OLD_DINKUMWARE_BENEATH_STLPORT
|
||||
// std namespace used for native locale
|
||||
new std::locale(std::_Addfac(l, f));
|
||||
#elif BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) // old Dinkumwar
|
||||
// std namespace used for native locale
|
||||
new std::locale(std::_Addfac(l, f));
|
||||
#else
|
||||
// standard compatible
|
||||
new std::locale(l, f);
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#undef BOOST_ARCHIVE_OLD_DINKUMWARE_BENEATH_STLPORT
|
||||
|
||||
#endif // BOOST_ARCHIVE_ADD_FACET_HPP
|
|
@ -39,7 +39,7 @@ namespace archive {
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
// exceptions thrown by archives
|
||||
//
|
||||
class BOOST_SYMBOL_VISIBLE archive_exception :
|
||||
class BOOST_SYMBOL_VISIBLE archive_exception :
|
||||
public virtual std::exception
|
||||
{
|
||||
private:
|
||||
|
@ -87,6 +87,7 @@ public:
|
|||
const char * e1 = NULL,
|
||||
const char * e2 = NULL
|
||||
) BOOST_NOEXCEPT;
|
||||
BOOST_ARCHIVE_DECL archive_exception(archive_exception const &) BOOST_NOEXCEPT ;
|
||||
virtual BOOST_ARCHIVE_DECL ~archive_exception() BOOST_NOEXCEPT_OR_NOTHROW ;
|
||||
virtual BOOST_ARCHIVE_DECL const char * what() const BOOST_NOEXCEPT_OR_NOTHROW ;
|
||||
};
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace detail {
|
|||
/////////////////////////////////////////////////////////////////////////
|
||||
// class basic_binary_iarchive - read serialized objects from a input binary stream
|
||||
template<class Archive>
|
||||
class BOOST_SYMBOL_VISIBLE basic_binary_iarchive :
|
||||
class BOOST_SYMBOL_VISIBLE basic_binary_iarchive :
|
||||
public detail::common_iarchive<Archive>
|
||||
{
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
|
|
|
@ -44,16 +44,16 @@ namespace std{
|
|||
#endif
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
#include <boost/integer.hpp>
|
||||
#include <boost/integer_traits.hpp>
|
||||
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
//#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/serialization/is_bitwise_serializable.hpp>
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <boost/serialization/array_wrapper.hpp>
|
||||
|
||||
#include <boost/archive/basic_streambuf_locale_saver.hpp>
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
@ -61,9 +61,6 @@ namespace std{
|
|||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
template<class Ch>
|
||||
class codecvt_null;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// class binary_iarchive - read serialized objects from a input binary stream
|
||||
template<class Archive, class Elem, class Tr>
|
||||
|
@ -81,9 +78,16 @@ public:
|
|||
}
|
||||
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
boost::scoped_ptr<codecvt_null<Elem> > codecvt_facet;
|
||||
boost::scoped_ptr<std::locale> archive_locale;
|
||||
// note order! - if you change this, libstd++ will fail!
|
||||
// a) create new locale with new codecvt facet
|
||||
// b) save current locale
|
||||
// c) change locale to new one
|
||||
// d) use stream buffer
|
||||
// e) change locale back to original
|
||||
// f) destroy new codecvt facet
|
||||
boost::archive::codecvt_null<Elem> codecvt_null_facet;
|
||||
basic_streambuf_locale_saver<Elem, Tr> locale_saver;
|
||||
std::locale archive_locale;
|
||||
#endif
|
||||
|
||||
// main template for serilization of primitive types
|
||||
|
@ -115,12 +119,12 @@ public:
|
|||
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
init();
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_binary_iprimitive(
|
||||
std::basic_streambuf<Elem, Tr> & sb,
|
||||
bool no_codecvt
|
||||
);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
~basic_binary_iprimitive();
|
||||
public:
|
||||
// we provide an optimized load for all fundamental types
|
||||
|
@ -139,7 +143,7 @@ public:
|
|||
|
||||
// the optimized load_array dispatches to load_binary
|
||||
template <class ValueType>
|
||||
void load_array(serialization::array<ValueType>& a, unsigned int)
|
||||
void load_array(serialization::array_wrapper<ValueType>& a, unsigned int)
|
||||
{
|
||||
load_binary(a.address(),a.count()*sizeof(ValueType));
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace detail {
|
|||
// does have the virtue of buiding the smalles archive in the minimum amount
|
||||
// of time. So under some circumstances it may be he right choice.
|
||||
template<class Archive>
|
||||
class BOOST_SYMBOL_VISIBLE basic_binary_oarchive :
|
||||
class BOOST_SYMBOL_VISIBLE basic_binary_oarchive :
|
||||
public detail::common_oarchive<Archive>
|
||||
{
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
|
|
|
@ -43,20 +43,19 @@ namespace std{
|
|||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
|
||||
#include <boost/archive/basic_streambuf_locale_saver.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
//#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/serialization/is_bitwise_serializable.hpp>
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <boost/serialization/array_wrapper.hpp>
|
||||
|
||||
#include <boost/archive/basic_streambuf_locale_saver.hpp>
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
template<class Ch>
|
||||
class codecvt_null;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// class basic_binary_oprimitive - binary output of prmitives
|
||||
|
||||
|
@ -74,9 +73,16 @@ public:
|
|||
return static_cast<Archive *>(this);
|
||||
}
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
boost::scoped_ptr<codecvt_null<Elem> > codecvt_facet;
|
||||
boost::scoped_ptr<std::locale> archive_locale;
|
||||
// note order! - if you change this, libstd++ will fail!
|
||||
// a) create new locale with new codecvt facet
|
||||
// b) save current locale
|
||||
// c) change locale to new one
|
||||
// d) use stream buffer
|
||||
// e) change locale back to original
|
||||
// f) destroy new codecvt facet
|
||||
boost::archive::codecvt_null<Elem> codecvt_null_facet;
|
||||
basic_streambuf_locale_saver<Elem, Tr> locale_saver;
|
||||
std::locale archive_locale;
|
||||
#endif
|
||||
// default saving of primitives.
|
||||
template<class T>
|
||||
|
@ -108,12 +114,12 @@ public:
|
|||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
init();
|
||||
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_binary_oprimitive(
|
||||
std::basic_streambuf<Elem, Tr> & sb,
|
||||
bool no_codecvt
|
||||
);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
~basic_binary_oprimitive();
|
||||
public:
|
||||
|
||||
|
@ -131,11 +137,10 @@ public:
|
|||
struct apply : public boost::serialization::is_bitwise_serializable< T > {};
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
// the optimized save_array dispatches to save_binary
|
||||
template <class ValueType>
|
||||
void save_array(boost::serialization::array<ValueType> const& a, unsigned int)
|
||||
void save_array(boost::serialization::array_wrapper<ValueType> const& a, unsigned int)
|
||||
{
|
||||
save_binary(a.address(),a.count()*sizeof(ValueType));
|
||||
}
|
||||
|
@ -149,9 +154,7 @@ basic_binary_oprimitive<Archive, Elem, Tr>::save_binary(
|
|||
const void *address,
|
||||
std::size_t count
|
||||
){
|
||||
//BOOST_ASSERT(
|
||||
// static_cast<std::size_t>((std::numeric_limits<std::streamsize>::max)()) >= count
|
||||
//);
|
||||
// BOOST_ASSERT(count <= std::size_t(boost::integer_traits<std::streamsize>::const_max));
|
||||
// note: if the following assertions fail
|
||||
// a likely cause is that the output stream is set to "text"
|
||||
// mode where by cr characters recieve special treatment.
|
||||
|
@ -161,9 +164,7 @@ basic_binary_oprimitive<Archive, Elem, Tr>::save_binary(
|
|||
// archive_exception(archive_exception::output_stream_error)
|
||||
// );
|
||||
// figure number of elements to output - round up
|
||||
count = ( count + sizeof(Elem) - 1)
|
||||
/ sizeof(Elem);
|
||||
BOOST_ASSERT(count <= std::size_t(boost::integer_traits<std::streamsize>::const_max));
|
||||
count = ( count + sizeof(Elem) - 1) / sizeof(Elem);
|
||||
std::streamsize scount = m_sb.sputn(
|
||||
static_cast<const Elem *>(address),
|
||||
static_cast<std::streamsize>(count)
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#ifndef BOOST_NO_STD_LOCALE
|
||||
|
||||
#include <locale> // for std::locale
|
||||
#include <ios>
|
||||
#include <streambuf> // for std::basic_streambuf
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
@ -45,25 +46,57 @@ class basic_streambuf_locale_saver :
|
|||
private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
typedef ::std::basic_streambuf<Ch, Tr> state_type;
|
||||
typedef ::std::locale aspect_type;
|
||||
explicit basic_streambuf_locale_saver( state_type &s )
|
||||
: s_save_( s ), a_save_( s.getloc() )
|
||||
{}
|
||||
explicit basic_streambuf_locale_saver( state_type &s, aspect_type const &a )
|
||||
: s_save_( s ), a_save_( s.pubimbue(a) )
|
||||
{}
|
||||
~basic_streambuf_locale_saver()
|
||||
{ this->restore(); }
|
||||
void restore(){
|
||||
s_save_.pubsync();
|
||||
s_save_.pubimbue( a_save_ );
|
||||
explicit basic_streambuf_locale_saver(std::basic_streambuf<Ch, Tr> &s) :
|
||||
m_streambuf(s),
|
||||
m_locale(s.getloc())
|
||||
{}
|
||||
~basic_streambuf_locale_saver(){
|
||||
m_streambuf.pubsync();
|
||||
m_streambuf.pubimbue(m_locale);
|
||||
}
|
||||
private:
|
||||
state_type & s_save_;
|
||||
aspect_type const a_save_;
|
||||
std::basic_streambuf<Ch, Tr> & m_streambuf;
|
||||
std::locale const m_locale;
|
||||
};
|
||||
|
||||
template < typename Ch, class Tr >
|
||||
class basic_istream_locale_saver :
|
||||
private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
explicit basic_istream_locale_saver(std::basic_istream<Ch, Tr> &s) :
|
||||
m_istream(s),
|
||||
m_locale(s.getloc())
|
||||
{}
|
||||
~basic_istream_locale_saver(){
|
||||
// libstdc++ crashes without this
|
||||
m_istream.sync();
|
||||
m_istream.imbue(m_locale);
|
||||
}
|
||||
private:
|
||||
std::basic_istream<Ch, Tr> & m_istream;
|
||||
std::locale const m_locale;
|
||||
};
|
||||
|
||||
template < typename Ch, class Tr >
|
||||
class basic_ostream_locale_saver :
|
||||
private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
explicit basic_ostream_locale_saver(std::basic_ostream<Ch, Tr> &s) :
|
||||
m_ostream(s),
|
||||
m_locale(s.getloc())
|
||||
{}
|
||||
~basic_ostream_locale_saver(){
|
||||
m_ostream.flush();
|
||||
m_ostream.imbue(m_locale);
|
||||
}
|
||||
private:
|
||||
std::basic_ostream<Ch, Tr> & m_ostream;
|
||||
std::locale const m_locale;
|
||||
};
|
||||
|
||||
|
||||
} // archive
|
||||
} // boost
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace detail {
|
|||
/////////////////////////////////////////////////////////////////////////
|
||||
// class basic_text_iarchive - read serialized objects from a input text stream
|
||||
template<class Archive>
|
||||
class BOOST_SYMBOL_VISIBLE basic_text_iarchive :
|
||||
class BOOST_SYMBOL_VISIBLE basic_text_iarchive :
|
||||
public detail::common_iarchive<Archive>
|
||||
{
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
// in such cases. So we can't use basic_ostream<IStream::char_type> but rather
|
||||
// use two template parameters
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <locale>
|
||||
#include <cstddef> // size_t
|
||||
|
||||
|
@ -38,17 +37,15 @@ namespace std{
|
|||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/io/ios_state.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
|
||||
#include <boost/archive/dinkumware.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/io/ios_state.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/basic_streambuf_locale_saver.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
@ -71,9 +68,17 @@ protected:
|
|||
io::ios_precision_saver precision_saver;
|
||||
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
boost::scoped_ptr<std::locale> archive_locale;
|
||||
basic_streambuf_locale_saver<
|
||||
typename IStream::char_type,
|
||||
// note order! - if you change this, libstd++ will fail!
|
||||
// a) create new locale with new codecvt facet
|
||||
// b) save current locale
|
||||
// c) change locale to new one
|
||||
// d) use stream buffer
|
||||
// e) change locale back to original
|
||||
// f) destroy new codecvt facet
|
||||
boost::archive::codecvt_null<typename IStream::char_type> codecvt_null_facet;
|
||||
std::locale archive_locale;
|
||||
basic_istream_locale_saver<
|
||||
typename IStream::char_type,
|
||||
typename IStream::traits_type
|
||||
> locale_saver;
|
||||
#endif
|
||||
|
@ -116,9 +121,9 @@ protected:
|
|||
t = i;
|
||||
}
|
||||
#endif
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_text_iprimitive(IStream &is, bool no_codecvt);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
~basic_text_iprimitive();
|
||||
public:
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace detail {
|
|||
/////////////////////////////////////////////////////////////////////////
|
||||
// class basic_text_oarchive
|
||||
template<class Archive>
|
||||
class BOOST_SYMBOL_VISIBLE basic_text_oarchive :
|
||||
class BOOST_SYMBOL_VISIBLE basic_text_oarchive :
|
||||
public detail::common_oarchive<Archive>
|
||||
{
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
|
|
|
@ -26,14 +26,13 @@
|
|||
|
||||
#include <iomanip>
|
||||
#include <locale>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstddef> // size_t
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/io/ios_state.hpp>
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
|
||||
#include <boost/archive/dinkumware.hpp>
|
||||
#endif
|
||||
|
@ -52,10 +51,10 @@ namespace std{
|
|||
#include <boost/limits.hpp>
|
||||
#include <boost/integer.hpp>
|
||||
#include <boost/io/ios_state.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/basic_streambuf_locale_saver.hpp>
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
|
@ -72,9 +71,17 @@ protected:
|
|||
io::ios_precision_saver precision_saver;
|
||||
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
boost::scoped_ptr<std::locale> archive_locale;
|
||||
basic_streambuf_locale_saver<
|
||||
typename OStream::char_type,
|
||||
// note order! - if you change this, libstd++ will fail!
|
||||
// a) create new locale with new codecvt facet
|
||||
// b) save current locale
|
||||
// c) change locale to new one
|
||||
// d) use stream buffer
|
||||
// e) change locale back to original
|
||||
// f) destroy new codecvt facet
|
||||
boost::archive::codecvt_null<typename OStream::char_type> codecvt_null_facet;
|
||||
std::locale archive_locale;
|
||||
basic_ostream_locale_saver<
|
||||
typename OStream::char_type,
|
||||
typename OStream::traits_type
|
||||
> locale_saver;
|
||||
#endif
|
||||
|
@ -168,15 +175,13 @@ protected:
|
|||
|
||||
template<class T>
|
||||
void save(const T & t){
|
||||
boost::io::ios_flags_saver fs(os);
|
||||
boost::io::ios_precision_saver ps(os);
|
||||
typename is_float<T>::type tf;
|
||||
save_impl(t, tf);
|
||||
}
|
||||
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_text_oprimitive(OStream & os, bool no_codecvt);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
~basic_text_oprimitive();
|
||||
public:
|
||||
// unformatted append of one character
|
||||
|
@ -192,7 +197,7 @@ public:
|
|||
while('\0' != *s)
|
||||
os.put(*s++);
|
||||
}
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_binary(const void *address, std::size_t count);
|
||||
};
|
||||
|
||||
|
|
|
@ -17,15 +17,12 @@
|
|||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
|
||||
#include <boost/archive/detail/common_iarchive.hpp>
|
||||
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
|
||||
#include <boost/mpl/assert.hpp>
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
|
@ -41,24 +38,18 @@ namespace detail {
|
|||
} // namespace detail
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// class xml_iarchive - read serialized objects from a input text stream
|
||||
// class basic_xml_iarchive - read serialized objects from a input text stream
|
||||
template<class Archive>
|
||||
class BOOST_SYMBOL_VISIBLE basic_xml_iarchive :
|
||||
public detail::common_iarchive<Archive>
|
||||
{
|
||||
unsigned int depth;
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_iarchive<Archive>;
|
||||
#else
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
#endif
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
#endif
|
||||
unsigned int depth;
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load_start(const char *name);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
|
@ -96,14 +87,14 @@ protected:
|
|||
// an xml archive. So we can skip it here. Note: we MUST override
|
||||
// it otherwise it will be loaded as a normal primitive w/o tag and
|
||||
// leaving the archive in an undetermined state
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load_override(class_id_type & t);
|
||||
void load_override(class_id_optional_type & /* t */){}
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load_override(object_id_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load_override(version_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load_override(class_id_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load_override(tracking_type & t);
|
||||
// class_name_type can't be handled here as it depends upon the
|
||||
// char type used by the stream. So require the derived implementation
|
||||
|
|
|
@ -18,15 +18,11 @@
|
|||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/archive/detail/common_oarchive.hpp>
|
||||
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/tracking.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
|
@ -47,28 +43,23 @@ template<class Archive>
|
|||
class BOOST_SYMBOL_VISIBLE basic_xml_oarchive :
|
||||
public detail::common_oarchive<Archive>
|
||||
{
|
||||
// special stuff for xml output
|
||||
unsigned int depth;
|
||||
bool pending_preamble;
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_oarchive<Archive>;
|
||||
#else
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
#endif
|
||||
friend class save_access;
|
||||
// special stuff for xml output
|
||||
unsigned int depth;
|
||||
bool indent_next;
|
||||
bool pending_preamble;
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
indent();
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
init();
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
windup();
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
write_attribute(
|
||||
const char *attribute_name,
|
||||
int t,
|
||||
|
@ -113,18 +104,18 @@ protected:
|
|||
// specific overrides for attributes - not name value pairs so we
|
||||
// want to trap them before the above "fall through"
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const object_id_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const object_reference_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const version_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const class_id_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const class_id_optional_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const class_id_reference_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const object_id_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const object_reference_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const version_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const class_name_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const tracking_type & t);
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace detail {
|
|||
} // namespace detail
|
||||
|
||||
template<class Archive, class Elem, class Tr>
|
||||
class binary_iarchive_impl :
|
||||
class BOOST_SYMBOL_VISIBLE binary_iarchive_impl :
|
||||
public basic_binary_iprimitive<Archive, Elem, Tr>,
|
||||
public basic_binary_iarchive<Archive>
|
||||
{
|
||||
|
@ -58,8 +58,9 @@ protected:
|
|||
this->basic_binary_iarchive<Archive>::load_override(t);
|
||||
}
|
||||
void init(unsigned int flags){
|
||||
if(0 != (flags & no_header))
|
||||
if(0 != (flags & no_header)){
|
||||
return;
|
||||
}
|
||||
#if ! defined(__MWERKS__)
|
||||
this->basic_binary_iarchive<Archive>::init();
|
||||
this->basic_binary_iprimitive<Archive, Elem, Tr>::init();
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace archive {
|
|||
// do not derive from this class. If you want to extend this functionality
|
||||
// via inhertance, derived from binary_oarchive_impl instead. This will
|
||||
// preserve correct static polymorphism.
|
||||
class BOOST_SYMBOL_VISIBLE binary_oarchive :
|
||||
class BOOST_SYMBOL_VISIBLE binary_oarchive :
|
||||
public binary_oarchive_impl<
|
||||
binary_oarchive, std::ostream::char_type, std::ostream::traits_type
|
||||
>
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace detail {
|
|||
} // namespace detail
|
||||
|
||||
template<class Archive, class Elem, class Tr>
|
||||
class binary_oarchive_impl :
|
||||
class BOOST_SYMBOL_VISIBLE binary_oarchive_impl :
|
||||
public basic_binary_oprimitive<Archive, Elem, Tr>,
|
||||
public basic_binary_oarchive<Archive>
|
||||
{
|
||||
|
@ -59,8 +59,9 @@ protected:
|
|||
this->basic_binary_oarchive<Archive>::save_override(t);
|
||||
}
|
||||
void init(unsigned int flags) {
|
||||
if(0 != (flags & no_header))
|
||||
if(0 != (flags & no_header)){
|
||||
return;
|
||||
}
|
||||
#if ! defined(__MWERKS__)
|
||||
this->basic_binary_oarchive<Archive>::init();
|
||||
this->basic_binary_oprimitive<Archive, Elem, Tr>::init();
|
||||
|
|
|
@ -56,10 +56,11 @@ public:
|
|||
explicit codecvt_null(std::size_t no_locale_manage = 0) :
|
||||
std::codecvt<char, char, std::mbstate_t>(no_locale_manage)
|
||||
{}
|
||||
virtual ~codecvt_null(){};
|
||||
};
|
||||
|
||||
template<>
|
||||
class codecvt_null<wchar_t> : public std::codecvt<wchar_t, char, std::mbstate_t>
|
||||
class BOOST_SYMBOL_VISIBLE codecvt_null<wchar_t> : public std::codecvt<wchar_t, char, std::mbstate_t>
|
||||
{
|
||||
virtual BOOST_WARCHIVE_DECL std::codecvt_base::result
|
||||
do_out(
|
||||
|
@ -91,6 +92,7 @@ public:
|
|||
explicit codecvt_null(std::size_t no_locale_manage = 0) :
|
||||
std::codecvt<wchar_t, char, std::mbstate_t>(no_locale_manage)
|
||||
{}
|
||||
virtual ~codecvt_null(){};
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
|
|
|
@ -65,11 +65,7 @@ protected:
|
|||
public:
|
||||
// some msvc versions require that the following function be public
|
||||
// otherwise it should really protected.
|
||||
// account for bogus gcc warning
|
||||
#if defined(__GNUC__)
|
||||
virtual
|
||||
#endif
|
||||
BOOST_ARCHIVE_DECL ~basic_iarchive();
|
||||
virtual BOOST_ARCHIVE_DECL ~basic_iarchive();
|
||||
// note: NOT part of the public API.
|
||||
BOOST_ARCHIVE_DECL void next_object_pointer(void *t);
|
||||
BOOST_ARCHIVE_DECL void register_basic_serializer(
|
||||
|
@ -79,7 +75,7 @@ public:
|
|||
void *t,
|
||||
const basic_iserializer & bis
|
||||
);
|
||||
BOOST_ARCHIVE_DECL const basic_pointer_iserializer *
|
||||
BOOST_ARCHIVE_DECL const basic_pointer_iserializer *
|
||||
load_pointer(
|
||||
void * & t,
|
||||
const basic_pointer_iserializer * bpis_ptr,
|
||||
|
@ -88,15 +84,15 @@ public:
|
|||
)
|
||||
);
|
||||
// real public API starts here
|
||||
BOOST_ARCHIVE_DECL void
|
||||
BOOST_ARCHIVE_DECL void
|
||||
set_library_version(library_version_type archive_library_version);
|
||||
BOOST_ARCHIVE_DECL library_version_type
|
||||
BOOST_ARCHIVE_DECL library_version_type
|
||||
get_library_version() const;
|
||||
BOOST_ARCHIVE_DECL unsigned int
|
||||
get_flags() const;
|
||||
BOOST_ARCHIVE_DECL void
|
||||
BOOST_ARCHIVE_DECL void
|
||||
reset_object_address(const void * new_address, const void * old_address);
|
||||
BOOST_ARCHIVE_DECL void
|
||||
BOOST_ARCHIVE_DECL void
|
||||
delete_created_pointers();
|
||||
};
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace detail {
|
|||
class basic_iarchive;
|
||||
class basic_pointer_iserializer;
|
||||
|
||||
class BOOST_SYMBOL_VISIBLE basic_iserializer :
|
||||
class BOOST_SYMBOL_VISIBLE basic_iserializer :
|
||||
public basic_serializer
|
||||
{
|
||||
private:
|
||||
|
@ -51,11 +51,7 @@ protected:
|
|||
explicit BOOST_ARCHIVE_DECL basic_iserializer(
|
||||
const boost::serialization::extended_type_info & type
|
||||
);
|
||||
// account for bogus gcc warning
|
||||
#if defined(__GNUC__)
|
||||
virtual
|
||||
#endif
|
||||
BOOST_ARCHIVE_DECL ~basic_iserializer();
|
||||
virtual BOOST_ARCHIVE_DECL ~basic_iserializer();
|
||||
public:
|
||||
bool serialized_as_pointer() const {
|
||||
return m_bpis != NULL;
|
||||
|
|
|
@ -61,14 +61,8 @@ class BOOST_SYMBOL_VISIBLE basic_oarchive :
|
|||
protected:
|
||||
BOOST_ARCHIVE_DECL basic_oarchive(unsigned int flags = 0);
|
||||
BOOST_ARCHIVE_DECL boost::archive::detail::helper_collection &
|
||||
get_helper_collection(){
|
||||
return *this;
|
||||
}
|
||||
// account for bogus gcc warning
|
||||
#if defined(__GNUC__)
|
||||
virtual
|
||||
#endif
|
||||
BOOST_ARCHIVE_DECL ~basic_oarchive();
|
||||
get_helper_collection();
|
||||
virtual BOOST_ARCHIVE_DECL ~basic_oarchive();
|
||||
public:
|
||||
// note: NOT part of the public interface
|
||||
BOOST_ARCHIVE_DECL void register_basic_serializer(
|
||||
|
|
|
@ -52,11 +52,7 @@ protected:
|
|||
explicit BOOST_ARCHIVE_DECL basic_oserializer(
|
||||
const boost::serialization::extended_type_info & type_
|
||||
);
|
||||
// account for bogus gcc warning
|
||||
#if defined(__GNUC__)
|
||||
virtual
|
||||
#endif
|
||||
BOOST_ARCHIVE_DECL ~basic_oserializer();
|
||||
virtual BOOST_ARCHIVE_DECL ~basic_oserializer();
|
||||
public:
|
||||
bool serialized_as_pointer() const {
|
||||
return m_bpos != NULL;
|
||||
|
|
|
@ -46,11 +46,7 @@ protected:
|
|||
explicit BOOST_ARCHIVE_DECL basic_pointer_iserializer(
|
||||
const boost::serialization::extended_type_info & type_
|
||||
);
|
||||
// account for bogus gcc warning
|
||||
#if defined(__GNUC__)
|
||||
virtual
|
||||
#endif
|
||||
BOOST_ARCHIVE_DECL ~basic_pointer_iserializer();
|
||||
virtual BOOST_ARCHIVE_DECL ~basic_pointer_iserializer();
|
||||
public:
|
||||
virtual void * heap_allocation() const = 0;
|
||||
virtual const basic_iserializer & get_basic_serializer() const = 0;
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace detail {
|
|||
class basic_oarchive;
|
||||
class basic_oserializer;
|
||||
|
||||
class BOOST_SYMBOL_VISIBLE basic_pointer_oserializer :
|
||||
class BOOST_SYMBOL_VISIBLE basic_pointer_oserializer :
|
||||
public basic_serializer
|
||||
{
|
||||
protected:
|
||||
|
@ -47,11 +47,7 @@ protected:
|
|||
const boost::serialization::extended_type_info & type_
|
||||
);
|
||||
public:
|
||||
// account for bogus gcc warning
|
||||
#if defined(__GNUC__)
|
||||
virtual
|
||||
#endif
|
||||
BOOST_ARCHIVE_DECL ~basic_pointer_oserializer();
|
||||
virtual BOOST_ARCHIVE_DECL ~basic_pointer_oserializer();
|
||||
virtual const basic_oserializer & get_basic_serializer() const = 0;
|
||||
virtual void save_object_ptr(
|
||||
basic_oarchive & ar,
|
||||
|
|
|
@ -41,9 +41,7 @@ protected:
|
|||
const boost::serialization::extended_type_info & eti
|
||||
) :
|
||||
m_eti(& eti)
|
||||
{
|
||||
BOOST_ASSERT(NULL != & eti);
|
||||
}
|
||||
{}
|
||||
public:
|
||||
inline bool
|
||||
operator<(const basic_serializer & rhs) const {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue