Default allocator parameter changed form new_alloator<T> to void to reduce symbol lenghts

This commit is contained in:
Ion Gaztañaga
2019-01-10 22:54:58 +01:00
parent 80789255b9
commit 83bb62fed3
18 changed files with 417 additions and 358 deletions
+30 -29
View File
@@ -87,9 +87,9 @@ class basic_string_base
basic_string_base & operator=(const basic_string_base &);
basic_string_base(const basic_string_base &);
typedef allocator_traits<Allocator> allocator_traits_type;
typedef Allocator allocator_type;
public:
typedef Allocator allocator_type;
typedef allocator_traits<allocator_type> allocator_traits_type;
typedef allocator_type stored_allocator_type;
typedef typename allocator_traits_type::pointer pointer;
typedef typename allocator_traits_type::value_type value_type;
@@ -207,7 +207,7 @@ class basic_string_base
};
struct members_holder
: public Allocator
: public allocator_type
{
void init()
{
@@ -217,12 +217,12 @@ class basic_string_base
}
members_holder()
: Allocator()
: allocator_type()
{ this->init(); }
template<class AllocatorConvertible>
explicit members_holder(BOOST_FWD_REF(AllocatorConvertible) a)
: Allocator(boost::forward<AllocatorConvertible>(a))
: allocator_type(boost::forward<AllocatorConvertible>(a))
{ this->init(); }
const short_t *pshort_repr() const
@@ -240,10 +240,10 @@ class basic_string_base
repr_t m_repr;
} members_;
const Allocator &alloc() const
const allocator_type &alloc() const
{ return members_; }
Allocator &alloc()
allocator_type &alloc()
{ return members_; }
static const size_type InternalBufferChars = (sizeof(repr_t) - ShortDataOffset)/sizeof(value_type);
@@ -311,7 +311,7 @@ class basic_string_base
protected:
typedef dtl::integral_constant<unsigned,
boost::container::dtl::version<Allocator>::value> alloc_version;
boost::container::dtl::version<allocator_type>::value> alloc_version;
pointer allocation_command(allocation_type command,
size_type limit_size,
@@ -322,7 +322,7 @@ class basic_string_base
reuse = 0;
command &= ~(expand_fwd | expand_bwd);
}
return dtl::allocator_version_traits<Allocator>::allocation_command
return dtl::allocator_version_traits<allocator_type>::allocation_command
(this->alloc(), command, limit_size, prefer_in_recvd_out_size, reuse);
}
@@ -538,18 +538,18 @@ class basic_string_base
//! \tparam Traits The Character Traits type, which encapsulates basic character operations
//! \tparam Allocator The allocator, used for internal memory management.
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class CharT, class Traits = std::char_traits<CharT>, class Allocator = new_allocator<CharT> >
template <class CharT, class Traits = std::char_traits<CharT>, class Allocator = void >
#else
template <class CharT, class Traits, class Allocator>
#endif
class basic_string
: private dtl::basic_string_base<Allocator>
: private dtl::basic_string_base<typename real_allocator<CharT, Allocator>::type>
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private:
typedef allocator_traits<Allocator> allocator_traits_type;
BOOST_COPYABLE_AND_MOVABLE(basic_string)
typedef dtl::basic_string_base<Allocator> base_t;
typedef dtl::basic_string_base<typename real_allocator<CharT, Allocator>::type> base_t;
typedef typename base_t::allocator_traits_type allocator_traits_type;
static const typename base_t::size_type InternalBufferChars = base_t::InternalBufferChars;
protected:
@@ -596,13 +596,13 @@ class basic_string
//////////////////////////////////////////////
typedef Traits traits_type;
typedef CharT value_type;
typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
typedef typename ::boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<Allocator>::reference reference;
typedef typename ::boost::container::allocator_traits<Allocator>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<Allocator>::size_type size_type;
typedef typename ::boost::container::allocator_traits<Allocator>::difference_type difference_type;
typedef Allocator allocator_type;
typedef typename real_allocator<CharT, Allocator>::type allocator_type;
typedef typename ::boost::container::allocator_traits<allocator_type>::pointer pointer;
typedef typename ::boost::container::allocator_traits<allocator_type>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<allocator_type>::reference reference;
typedef typename ::boost::container::allocator_traits<allocator_type>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<allocator_type>::size_type size_type;
typedef typename ::boost::container::allocator_traits<allocator_type>::difference_type difference_type;
typedef BOOST_CONTAINER_IMPDEF(allocator_type) stored_allocator_type;
typedef BOOST_CONTAINER_IMPDEF(pointer) iterator;
typedef BOOST_CONTAINER_IMPDEF(const_pointer) const_iterator;
@@ -639,7 +639,7 @@ class basic_string
//! <b>Effects</b>: Default constructs a basic_string.
//!
//! <b>Throws</b>: If allocator_type's default constructor throws.
basic_string() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<Allocator>::value)
basic_string() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<allocator_type>::value)
: base_t()
{ this->priv_terminate_string(); }
@@ -667,7 +667,7 @@ class basic_string
//!
//! <b>Throws</b>: If allocator_type's default constructor or allocation throws.
template<template <class, class> class BasicStringView>
explicit basic_string(BasicStringView<CharT, Traits> sv, const Allocator& a = Allocator())
explicit basic_string(BasicStringView<CharT, Traits> sv, const allocator_type& a = allocator_type())
: base_t(allocator_traits_type::select_on_container_copy_construction(a))
{
this->priv_terminate_string();
@@ -2306,7 +2306,7 @@ class basic_string
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: find(basic_string<CharT,traits,Allocator>(s,n),pos).
//! <b>Returns</b>: find(basic_string<CharT,traits,allocator_type>(s,n),pos).
size_type find(const CharT* s, size_type pos, size_type n) const
{
if (pos + n > this->size())
@@ -2332,7 +2332,7 @@ class basic_string
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: find(basic_string<CharT,traits,Allocator>(1,c), pos).
//! <b>Returns</b>: find(basic_string<CharT,traits,allocator_type>(1,c), pos).
size_type find(CharT c, size_type pos = 0) const
{
const size_type sz = this->size();
@@ -2404,7 +2404,7 @@ class basic_string
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: rfind(basic_string<CharT,traits,Allocator>(1,c),pos).
//! <b>Returns</b>: rfind(basic_string<CharT,traits,allocator_type>(1,c),pos).
size_type rfind(CharT c, size_type pos = npos) const
{
const size_type len = this->size();
@@ -2472,7 +2472,7 @@ class basic_string
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: find_first_of(basic_string<CharT,traits,Allocator>(1,c), pos).
//! <b>Returns</b>: find_first_of(basic_string<CharT,traits,allocator_type>(1,c), pos).
size_type find_first_of(CharT c, size_type pos = 0) const
{ return this->find(c, pos); }
@@ -2522,7 +2522,7 @@ class basic_string
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: find_last_of(basic_string<CharT,traits,Allocator>(1,c),pos).
//! <b>Returns</b>: find_last_of(basic_string<CharT,traits,allocator_type>(1,c),pos).
size_type find_last_of(const CharT* s, size_type pos = npos) const
{ return find_last_of(s, pos, Traits::length(s)); }
@@ -2672,7 +2672,7 @@ class basic_string
//!
//! <b>Throws</b>: If memory allocation throws or out_of_range if pos > size().
//!
//! <b>Returns</b>: basic_string<CharT,traits,Allocator>(data()+pos,rlen).
//! <b>Returns</b>: basic_string<CharT,traits,allocator_type>(data()+pos,rlen).
basic_string substr(size_type pos = 0, size_type n = npos) const
{
if (pos > this->size())
@@ -3490,7 +3490,8 @@ namespace boost {
template <class C, class T, class Allocator>
struct has_trivial_destructor_after_move<boost::container::basic_string<C, T, Allocator> >
{
typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
typedef typename ::boost::container::allocator_traits
<typename boost::container::basic_string<C, T, Allocator>::allocator_type>::pointer pointer;
static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value &&
::boost::has_trivial_destructor_after_move<pointer>::value;
};