Changes during Git migration:

- Added Extended Allocator support for Boost.Container.
- Improved Doxygen generated reference
- Fixed ticket #9338 ("VS2005 compiler errors in swap() definition after including container/memory_util.hpp")
This commit is contained in:
Ion Gaztañaga
2013-12-23 10:47:20 +01:00
parent b1d4ef3a2e
commit f2947c115e
95 changed files with 2248 additions and 2692 deletions

View File

@@ -21,7 +21,7 @@ rule test_all
for local fileb in [ glob *.cpp ] for local fileb in [ glob *.cpp ]
{ {
all_rules += [ run $(fileb) /boost/timer//boost_timer all_rules += [ run $(fileb) /boost/timer//boost_timer /boost/container//boost_container
: # additional args : # additional args
: # test-files : # test-files
: # requirements : # requirements

View File

@@ -10,6 +10,7 @@
#include "boost/container/set.hpp" #include "boost/container/set.hpp"
#include "boost/container/flat_set.hpp" #include "boost/container/flat_set.hpp"
#include "boost/container/allocator.hpp"
#include <set> #include <set>
#include <vector> #include <vector>
#include <iostream> #include <iostream>
@@ -22,9 +23,9 @@ using boost::timer::cpu_times;
using boost::timer::nanosecond_type; using boost::timer::nanosecond_type;
#ifdef NDEBUG #ifdef NDEBUG
static const std::size_t N = 5000;
#else
static const std::size_t N = 500; static const std::size_t N = 500;
#else
static const std::size_t N = 50;
#endif #endif
void compare_times(cpu_times time_numerator, cpu_times time_denominator){ void compare_times(cpu_times time_numerator, cpu_times time_denominator){
@@ -334,15 +335,18 @@ int main()
{ {
//set vs std::set //set vs std::set
launch_tests< boost::container::set<int> , std::set<int> > launch_tests< boost::container::set<int> , std::set<int> >
("boost::container::set<int>", "std::set<int>");/* ("boost::container::set<int>", "std::set<int>");
//set vs set<..., allocator_v2>
launch_tests< boost::container::set<int> , boost::container::set<int, std::less<int>, boost::container::allocator<int> > >
("boost::container::set<int>", "boost::container::set<int, ..., boost::container::allocator<int>" );
//multiset vs std::set //multiset vs std::set
launch_tests< boost::container::multiset<int> , std::multiset<int> > launch_tests< boost::container::multiset<int> , std::multiset<int> >
("boost::container::multiset<int>", "std::multiset<int>");*/ ("boost::container::multiset<int>", "std::multiset<int>");
//flat_set vs set //flat_set vs set
//launch_tests< boost::container::flat_set<int> , boost::container::set<int> > launch_tests< boost::container::flat_set<int> , boost::container::set<int> >
//("boost::container::flat_set<int>", "boost::container::set<int>"); ("boost::container::flat_set<int>", "boost::container::set<int>");
//flat_multiset vs multiset //flat_multiset vs multiset
//launch_tests< boost::container::flat_multiset<int> , boost::container::multiset<int> > launch_tests< boost::container::flat_multiset<int> , boost::container::multiset<int> >
//("boost::container::flat_multiset<int>", "boost::container::multiset<int>"); ("boost::container::flat_multiset<int>", "boost::container::multiset<int>");
return 1; return 0;
} }

View File

@@ -4,8 +4,8 @@
// @date Aug 14, 2011 // @date Aug 14, 2011
// @author Andrew Hundt <ATHundt@gmail.com> // @author Andrew Hundt <ATHundt@gmail.com>
// //
// (C) 2011-2012 Andrew Hundt <ATHundt@gmail.com> // (C) 2011-2013 Andrew Hundt <ATHundt@gmail.com>
// (C) 2013 Ion Gaztanaga // (C) 2013-2013 Ion Gaztanaga
// //
// Distributed under the Boost Software License, Version 1.0. (See // Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
@@ -28,7 +28,7 @@ using boost::timer::cpu_times;
using boost::timer::nanosecond_type; using boost::timer::nanosecond_type;
#ifdef NDEBUG #ifdef NDEBUG
static const std::size_t N = 1000; static const std::size_t N = 300;
#else #else
static const std::size_t N = 100; static const std::size_t N = 100;
#endif #endif
@@ -141,5 +141,5 @@ int main()
}catch(std::exception e){ }catch(std::exception e){
std::cout << e.what(); std::cout << e.what();
} }
return 1; return 0;
} }

View File

@@ -10,7 +10,7 @@
#ifndef BOOST_CONTAINER_DETAIL_VARRAY_HPP #ifndef BOOST_CONTAINER_DETAIL_VARRAY_HPP
#define BOOST_CONTAINER_DETAIL_VARRAY_HPP #define BOOST_CONTAINER_DETAIL_VARRAY_HPP
#if (defined _MSC_VER) #if defined(_MSC_VER)
# pragma once # pragma once
#endif #endif
@@ -19,8 +19,8 @@
#include <boost/container/detail/preprocessor.hpp> #include <boost/container/detail/preprocessor.hpp>
#include "varray_util.hpp" #include "varray_util.hpp"
#include "varray_concept.hpp" //#include "varray_concept.hpp"
#include <boost/iterator/iterator_concepts.hpp> //#include <boost/iterator/iterator_concepts.hpp>
#ifndef BOOST_NO_EXCEPTIONS #ifndef BOOST_NO_EXCEPTIONS
#include <stdexcept> #include <stdexcept>
@@ -229,7 +229,7 @@ class varray
(varray) (varray)
); );
BOOST_CONCEPT_ASSERT((concept::VArrayStrategy<Strategy>)); //BOOST_CONCEPT_ASSERT((concept::VArrayStrategy<Strategy>));
typedef boost::aligned_storage< typedef boost::aligned_storage<
sizeof(Value[Capacity]), sizeof(Value[Capacity]),
@@ -353,7 +353,7 @@ public:
varray(Iterator first, Iterator last) varray(Iterator first, Iterator last)
: m_size(0) : m_size(0)
{ {
BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<Iterator>)); // Make sure you passed a ForwardIterator //BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<Iterator>)); // Make sure you passed a ForwardIterator
this->assign(first, last); // may throw this->assign(first, last); // may throw
} }
@@ -890,7 +890,7 @@ public:
template <typename Iterator> template <typename Iterator>
iterator insert(iterator position, Iterator first, Iterator last) iterator insert(iterator position, Iterator first, Iterator last)
{ {
BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<Iterator>)); // Make sure you passed a ForwardIterator //BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<Iterator>)); // Make sure you passed a ForwardIterator
typedef typename boost::iterator_traversal<Iterator>::type traversal; typedef typename boost::iterator_traversal<Iterator>::type traversal;
this->insert_dispatch(position, first, last, traversal()); this->insert_dispatch(position, first, last, traversal());
@@ -975,7 +975,7 @@ public:
template <typename Iterator> template <typename Iterator>
void assign(Iterator first, Iterator last) void assign(Iterator first, Iterator last)
{ {
BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<Iterator>)); // Make sure you passed a ForwardIterator //BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<Iterator>)); // Make sure you passed a ForwardIterator
typedef typename boost::iterator_traversal<Iterator>::type traversal; typedef typename boost::iterator_traversal<Iterator>::type traversal;
this->assign_dispatch(first, last, traversal()); // may throw this->assign_dispatch(first, last, traversal()); // may throw
@@ -1728,7 +1728,7 @@ private:
template <typename Iterator> template <typename Iterator>
void insert_dispatch(iterator position, Iterator first, Iterator last, boost::random_access_traversal_tag const&) void insert_dispatch(iterator position, Iterator first, Iterator last, boost::random_access_traversal_tag const&)
{ {
BOOST_CONCEPT_ASSERT((boost_concepts::RandomAccessTraversal<Iterator>)); // Make sure you passed a RandomAccessIterator //BOOST_CONCEPT_ASSERT((boost_concepts::RandomAccessTraversal<Iterator>)); // Make sure you passed a RandomAccessIterator
errh::check_iterator_end_eq(*this, position); errh::check_iterator_end_eq(*this, position);
@@ -2015,7 +2015,7 @@ public:
void insert(iterator, Iterator first, Iterator last) void insert(iterator, Iterator first, Iterator last)
{ {
// TODO - add MPL_ASSERT, check if Iterator is really an iterator // TODO - add MPL_ASSERT, check if Iterator is really an iterator
typedef typename boost::iterator_traversal<Iterator>::type traversal; //typedef typename boost::iterator_traversal<Iterator>::type traversal;
errh::check_capacity(*this, std::distance(first, last)); // may throw errh::check_capacity(*this, std::distance(first, last)); // may throw
} }
@@ -2039,7 +2039,7 @@ public:
void assign(Iterator first, Iterator last) void assign(Iterator first, Iterator last)
{ {
// TODO - add MPL_ASSERT, check if Iterator is really an iterator // TODO - add MPL_ASSERT, check if Iterator is really an iterator
typedef typename boost::iterator_traversal<Iterator>::type traversal; //typedef typename boost::iterator_traversal<Iterator>::type traversal;
errh::check_capacity(*this, std::distance(first, last)); // may throw errh::check_capacity(*this, std::distance(first, last)); // may throw
} }

View File

@@ -566,13 +566,6 @@ template <typename DisableTrivialInit, typename I, typename P>
inline inline
void construct(DisableTrivialInit const&, I pos, BOOST_RV_REF(P) p) void construct(DisableTrivialInit const&, I pos, BOOST_RV_REF(P) p)
{ {
typedef typename
::boost::mpl::and_<
is_corresponding_value<I, P>,
::boost::has_trivial_copy<P>
>::type
use_memcpy;
typedef typename boost::iterator_value<I>::type V; typedef typename boost::iterator_value<I>::type V;
new (static_cast<void*>(boost::addressof(*pos))) V(::boost::move(p)); // may throw new (static_cast<void*>(boost::addressof(*pos))) V(::boost::move(p)); // may throw
} }

View File

@@ -10,13 +10,14 @@
#ifndef BOOST_CONTAINER_VARRAY_HPP #ifndef BOOST_CONTAINER_VARRAY_HPP
#define BOOST_CONTAINER_VARRAY_HPP #define BOOST_CONTAINER_VARRAY_HPP
#if (defined _MSC_VER) #if defined(_MSC_VER)
# pragma once # pragma once
#endif #endif
#include <boost/container/detail/config_begin.hpp> #include <boost/container/detail/config_begin.hpp>
#include "detail/varray.hpp" #include "detail/varray.hpp"
#include <boost/move/move.hpp>
namespace boost { namespace container { namespace boost { namespace container {

View File

@@ -1,6 +1,6 @@
# Boost.Container library documentation Jamfile --------------------------------- # Boost.Container library documentation Jamfile ---------------------------------
# #
# Copyright Ion Gaztanaga 2009-2012. Use, modification and # Copyright Ion Gaztanaga 2009-2013. Use, modification and
# distribution is subject to the Boost Software License, Version # distribution is subject to the Boost Software License, Version
# 1.0. (See accompanying file LICENSE_1_0.txt or copy at # 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt) # http://www.boost.org/LICENSE_1_0.txt)

View File

@@ -49,9 +49,13 @@ In short, what does [*Boost.Container] offer?
[section:introduction_building_container Building Boost.Container] [section:introduction_building_container Building Boost.Container]
There is no need to compile [*Boost.Container], since it's There is no need to compile [*Boost.Container] if you don't use [link container.extended_functionality.extended_allocators Extended Allocators]
a header only library. Just include your Boost header directory in your since in that case it's a header-only library. Just include your Boost header directory in your compiler include path.
compiler include path.
[link container.extended_functionality.extended_allocators Extended Allocators] are
implemented as a separately compiled library, so you must install binaries in a location that can be found by your linker
when using these classes. If you followed the [@http://www.boost.org/doc/libs/release/more/getting_started/index.html Boost Getting Started] instructions,
that's already been done for you.
[endsect] [endsect]
@@ -148,12 +152,19 @@ today, in fact, implementors would have to go out of their way to prohibit it!]]
C++11 standard is also cautious about incomplete types and STL: ["['17.6.4.8 Other functions (...) 2. C++11 standard is also cautious about incomplete types and STL: ["['17.6.4.8 Other functions (...) 2.
the effects are undefined in the following cases: (...) In particular - if an incomplete type (3.9) the effects are undefined in the following cases: (...) In particular - if an incomplete type (3.9)
is used as a template argument when instantiating a template component, is used as a template argument when instantiating a template component,
unless specifically allowed for that component]]. Fortunately [*Boost.Container] containers are designed unless specifically allowed for that component]].
to support type erasure and recursive types, so let's see some examples:
Fortunately all [*Boost.Container] containers except
[classref boost::container::static_vector static_vector] and
[classref boost::container::basic_string basic_string] are designed to support incomplete types.
[classref boost::container::static_vector static_vector] is special because
it statically allocates memory for `value_type` and this requires complete types and
[classref boost::container::basic_string basic_string] implements Small String Optimization which
also requires complete types.
[section:recursive_containers Recursive containers] [section:recursive_containers Recursive containers]
All containers offered by [*Boost.Container] can be used to define recursive containers: Most [*Boost.Container] containers can be used to define recursive containers:
[import ../example/doc_recursive_containers.cpp] [import ../example/doc_recursive_containers.cpp]
[doc_recursive_containers] [doc_recursive_containers]
@@ -261,8 +272,8 @@ When dealing with user-defined classes, (e.g. when constructing user-defined cla
propagate error situations internally as no error will be propagated through [*Boost.Container]. propagate error situations internally as no error will be propagated through [*Boost.Container].
* If `BOOST_NO_EXCEPTIONS` is *not* defined, the library propagates exceptions offering the exception guarantees detailed in the documentation. * If `BOOST_NO_EXCEPTIONS` is *not* defined, the library propagates exceptions offering the exception guarantees detailed in the documentation.
When the library needs to throw an exception (such as `out_of_range` when an incorrect index is used in `vector::at`)], the library calls When the library needs to throw an exception (such as `out_of_range` when an incorrect index is used in `vector::at`), the library calls
a throw callback declared in `<boost/container/throw_exception.hpp>`: a throw-callback declared in [headerref boost/container/throw_exception.hpp]:
* If `BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS` is defined, then the programmer must provide its own definition for all * If `BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS` is defined, then the programmer must provide its own definition for all
`throw_xxx` functions. Those functions can't return, they must throw an exception or call `std::exit` or `std::abort`. `throw_xxx` functions. Those functions can't return, they must throw an exception or call `std::exit` or `std::abort`.
@@ -522,6 +533,123 @@ using [@http://en.cppreference.com/w/cpp/language/default_initialization default
[endsect] [endsect]
[section:ordered_range_insertion Ordered range insertion for associative containers (['ordered_unique_range], ['ordered_range]) ]
When filling associative containers big performance gains can be achieved if the input range to be inserted
is guaranteed by the user to be ordered according to the predicate. This can happen when inserting values from a `set` to
a `multiset` or between different associative container families (`[multi]set/map` vs. `flat_[multi]set/map`).
[*Boost.Container] has some overloads for constructors and insertions taking an `ordered_unique_range_t` or
an `ordered_range_t` tag parameters as the first argument. When an `ordered_unique_range_t` overload is used, the
user notifies the container that the input range is ordered according to the container predicate and has no
duplicates. When an `ordered_range_t` overload is used, the
user notifies the container that the input range is ordered according to the container predicate but it might
have duplicates. With this information, the container can avoid multiple predicate calls and improve insertion
times.
[endsect]
[section:constant_time_range_splice Constant-time range splice for `(s)list`]
In the first C++ standard `list::size()` was not required to be constant-time,
and that caused some controversy in the C++ community. Quoting Howard Hinnant's
[@http://home.roadrunner.com/~hinnant/On_list_size.html ['On List Size]] paper:
[: ['There is a considerable debate on whether `std::list<T>::size()` should be O(1) or O(N).
The usual argument notes that it is a tradeoff with:]
`splice(iterator position, list& x, iterator first, iterator last);`
['If size() is O(1) and this != &x, then this method must perform a linear operation so that it
can adjust the size member in each list]]
C++11 definitely required `size()` to be O(1), so range splice became O(N). However,
Howard Hinnant's paper proposed a new `splice` overload so that even O(1) `list:size()`
implementations could achieve O(1) range splice when the range size was known to the caller:
[: `void splice(iterator position, list& x, iterator first, iterator last, size_type n);`
[*Effects]: Inserts elements in the range [first, last) before position and removes the elements from x.
[*Requires]: [first, last) is a valid range in x. The result is undefined if position is an iterator in the range [first, last). Invalidates only the iterators and references to the spliced elements. n == distance(first, last).
[*Throws]: Nothing.
[*Complexity]: Constant time.
]
This new splice signature allows the client to pass the distance of the input range in.
This information is often available at the call site. If it is passed in,
then the operation is constant time, even with an O(1) size.
[*Boost.Container] implements this overload for `list` and a modified version of it for `slist`
(as `slist::size()` is also `O(1)`).
[endsect]
[section:extended_allocators Extended allocators]
Many C++ programmers have ever wondered where does good old realloc fit in C++. And that's a good question.
Could we improve [classref boost::container::vector vector] performance using memory expansion mechanisms
to avoid too many copies? But [classref boost::container::vector vector] is not the only container that
could benefit from an improved allocator interface: we could take advantage of the insertion of multiple
elements in [classref boost::container::list list] using a burst allocation mechanism that could amortize
costs (mutex locks, free memory searches...) that can't be amortized when using single node allocation
strategies.
These improvements require extending the STL allocator interface and use make use of a new
general purpose allocator since new and delete don't offer expansion and burst capabilities.
* [*Boost.Container] containers support an extended allocator interface based on an evolution of proposals
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1953.html N1953: Upgrading the Interface of Allocators using API Versioning],
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2045.html N2045: Improving STL allocators]
and the article
[@http://www.drivehq.com/web/igaztanaga/allocplus/ Applying classic memory allocation strategies to C++ containers].
The extended allocator interface is implemented by [classref boost::container::allocator allocator],
[classref boost::container::adaptive_pool adaptive_pool] and [classref boost::container::node_allocator node_allocator]
classes.
* Extended allocators use a modified [@http://g.oswego.edu/dl/html/malloc.html Doug Lea Malloc (DLMalloc)] low-level
allocator and offers an C API to implement memory expansion and burst allocations. DLmalloc is known to be very size
and speed efficient, and this allocator is used as the basis of many malloc implementations, including multithreaded
allocators built above DLmalloc (See [@http://www.malloc.de/en/ ptmalloc2, ptmalloc3] or
[@http://www.nedprod.com/programs/portable/nedmalloc/ nedmalloc]). This low-level allocator is implemented as
a separately compiled library whereas [classref boost::container::allocator allocator],
[classref boost::container::adaptive_pool adaptive_pool] and [classref boost::container::node_allocator node_allocator]
are header-only classes.
The following extended allocators are provided:
* [classref boost::container::allocator allocator]: This extended allocator offers expansion, shrink-in place
and burst allocation capabilities implemented as a thin wrapper around the modified DLMalloc.
It can be used with all containers and it should be the default choice when the programmer wants to use
extended allocator capabilities.
* [classref boost::container::node_allocator node_allocator]: It's a
[@http://www.boost.org/doc/libs/1_55_0/libs/pool/doc/html/boost_pool/pool/pooling.html#boost_pool.pool.pooling.simple Simple Segregated Storage]
allocator, similar to [*Boost.Pool] that takes advantage of the modified DLMalloc burst interface. It does not return
memory to the DLMalloc allocator (and thus, to the system), unless explicitly requested. It does offer a very small
memory overhead so it's suitable for node containers ([boost::container::list list], [boost::container::slist slist]
[boost::container::set set]...) that allocate very small `value_type`s and it offers improved node allocation times
for single node allocations with respecto to [classref boost::container::allocator allocator].
* [classref boost::container::adaptive_pool adaptive_pool]: It's a low-overhead node allocator that can return memory
to the system. The overhead can be very low (< 5% for small nodes) and it's nearly as fast as [classref boost::container::node_allocator node_allocator].
It's also suitable for node containers.
[endsect]
[/
/a__section:previous_element_slist Previous element for slist__a
/
/The C++11 `std::forward_list` class implement a singly linked list, similar to `slist`, and these
/containers only offer forward iterators and implement insertions and splice operations that operate with ranges
/to be inserted ['after] that position. In those cases, sometimes it's interesting to obtain an iterator pointing
/to the previous element of another element. This operation can be implemented
/
/a__endsect__a
]
[/ [/
/a__section:get_stored_allocator Obtain stored allocator__a /a__section:get_stored_allocator Obtain stored allocator__a
/ /
@@ -532,18 +660,6 @@ using [@http://en.cppreference.com/w/cpp/language/default_initialization default
/http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2271.html /http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2271.html
/ /
/a__endsect__a /a__endsect__a
/
/a__section:ordered_range_insertion Ordered range insertion (a__'ordered_unique_range__a, a__'ordered_range__a) __a
/
/a__endsect__a
/
/a__section:constant_time_range_splice Constant-time range splice__a
/
/a__endsect__a
/
/a__section:previous_element_slist Slist previous element__a
/
/a__endsect__a
/] /]
[endsect] [endsect]
@@ -709,9 +825,10 @@ use [*Boost.Container]? There are several reasons for that:
* Default constructors don't allocate memory at all, which improves performance and * Default constructors don't allocate memory at all, which improves performance and
usually implies a no-throw guarantee (if predicate's or allocator's default constructor doesn't throw). usually implies a no-throw guarantee (if predicate's or allocator's default constructor doesn't throw).
* Small string optimization for [classref boost::container::basic_string basic_string]. * Small string optimization for [classref boost::container::basic_string basic_string].
* New extensions beyond the standard based on user feedback to improve code performance. * [link container.extended_functionality Extended functionality] beyond the standard based
on user feedback to improve code performance.
* You need a portable implementation that works when compiling without exceptions support or * You need a portable implementation that works when compiling without exceptions support or
you need to customize the error handling when a container needs to signall an exceptional error. you need to customize the error handling when a container needs to signal an exceptional error.
[endsect] [endsect]
@@ -759,6 +876,15 @@ use [*Boost.Container]? There are several reasons for that:
[section:release_notes Release Notes] [section:release_notes Release Notes]
[section:release_notes_boost_1_56_00 Boost 1.56 Release]
* Added DlMalloc-based [link container.extended_functionality.extended_allocators Extended Allocators].
* Fixed bugs:
* [@https://svn.boost.org/trac/boost/ticket/9338 #9338: ['"VS2005 compiler errors in swap() definition after including container/memory_util.hpp"]].
[endsect]
[section:release_notes_boost_1_55_00 Boost 1.55 Release] [section:release_notes_boost_1_55_00 Boost 1.55 Release]
* Implemented [link container.main_features.scary_iterators SCARY iterators]. * Implemented [link container.main_features.scary_iterators SCARY iterators].
@@ -769,7 +895,8 @@ use [*Boost.Container]? There are several reasons for that:
[@https://svn.boost.org/trac/boost/ticket/9009 #9009], [@https://svn.boost.org/trac/boost/ticket/9009 #9009],
[@https://svn.boost.org/trac/boost/ticket/9064 #9064], [@https://svn.boost.org/trac/boost/ticket/9064 #9064],
[@https://svn.boost.org/trac/boost/ticket/9092 #9092], [@https://svn.boost.org/trac/boost/ticket/9092 #9092],
[@https://svn.boost.org/trac/boost/ticket/9108 #9108]. [@https://svn.boost.org/trac/boost/ticket/9108 #9108],
[@https://svn.boost.org/trac/boost/ticket/9166 #9166],
[endsect] [endsect]

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2009-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2009-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2009-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2009-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2009-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2009-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -11,9 +11,10 @@
#include <boost/container/detail/workaround.hpp> #include <boost/container/detail/workaround.hpp>
//[doc_recursive_containers //[doc_recursive_containers
#include <boost/container/vector.hpp> #include <boost/container/vector.hpp>
#include <boost/container/stable_vector.hpp>
#include <boost/container/deque.hpp>
#include <boost/container/list.hpp> #include <boost/container/list.hpp>
#include <boost/container/map.hpp> #include <boost/container/map.hpp>
#include <boost/container/stable_vector.hpp>
#include <boost/container/string.hpp> #include <boost/container/string.hpp>
using namespace boost::container; using namespace boost::container;
@@ -23,6 +24,10 @@ struct data
int i_; int i_;
//A vector holding still undefined class 'data' //A vector holding still undefined class 'data'
vector<data> v_; vector<data> v_;
//A stable_vector holding still undefined class 'data'
stable_vector<data> sv_;
//A stable_vector holding still undefined class 'data'
deque<data> d_;
//A list holding still undefined 'data' //A list holding still undefined 'data'
list<data> l_; list<data> l_;
//A map holding still undefined 'data' //A map holding still undefined 'data'

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2009-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2009-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //

View File

@@ -6,7 +6,7 @@
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2011-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -38,7 +38,7 @@
#include <boost/container/detail/preprocessor.hpp> #include <boost/container/detail/preprocessor.hpp>
#endif #endif
///@cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace boost { namespace boost {
namespace container { namespace container {
@@ -56,7 +56,7 @@ struct is_std_allocator< std::allocator<T> >
} //namespace container_detail { } //namespace container_detail {
///@endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! The class template allocator_traits supplies a uniform interface to all allocator types. //! The class template allocator_traits supplies a uniform interface to all allocator types.
//! This class is a C++03-compatible implementation of std::allocator_traits //! This class is a C++03-compatible implementation of std::allocator_traits
@@ -94,29 +94,29 @@ struct allocator_traits
//! //!
typedef see_documentation size_type; typedef see_documentation size_type;
//! Alloc::propagate_on_container_copy_assignment if such a type exists, otherwise an integral_constant //! Alloc::propagate_on_container_copy_assignment if such a type exists, otherwise an integral_constant
//! type with internal constant static member `value` == false. //! type with internal constant static member <code>value</code> == false.
typedef see_documentation propagate_on_container_copy_assignment; typedef see_documentation propagate_on_container_copy_assignment;
//! Alloc::propagate_on_container_move_assignment if such a type exists, otherwise an integral_constant //! Alloc::propagate_on_container_move_assignment if such a type exists, otherwise an integral_constant
//! type with internal constant static member `value` == false. //! type with internal constant static member <code>value</code> == false.
typedef see_documentation propagate_on_container_move_assignment; typedef see_documentation propagate_on_container_move_assignment;
//! Alloc::propagate_on_container_swap if such a type exists, otherwise an integral_constant //! Alloc::propagate_on_container_swap if such a type exists, otherwise an integral_constant
//! type with internal constant static member `value` == false. //! type with internal constant static member <code>value</code> == false.
typedef see_documentation propagate_on_container_swap; typedef see_documentation propagate_on_container_swap;
//! Defines an allocator: Alloc::rebind<T>::other if such a type exists; otherwise, Alloc<T, Args> //! Defines an allocator: Alloc::rebind<T>::other if such a type exists; otherwise, Alloc<T, Args>
//! if Alloc is a class template instantiation of the form Alloc<U, Args>, where Args is zero or //! if Alloc is a class template instantiation of the form Alloc<U, Args>, where Args is zero or
//! more type arguments ; otherwise, the instantiation of rebind_alloc is ill-formed. //! more type arguments ; otherwise, the instantiation of rebind_alloc is ill-formed.
//! //!
//! In C++03 compilers `rebind_alloc` is a struct derived from an allocator //! In C++03 compilers <code>rebind_alloc</code> is a struct derived from an allocator
//! deduced by previously detailed rules. //! deduced by previously detailed rules.
template <class T> using rebind_alloc = see_documentation; template <class T> using rebind_alloc = see_documentation;
//! In C++03 compilers `rebind_traits` is a struct derived from //! In C++03 compilers <code>rebind_traits</code> is a struct derived from
//! `allocator_traits<OtherAlloc>`, where `OtherAlloc` is //! <code>allocator_traits<OtherAlloc></code>, where <code>OtherAlloc</code> is
//! the allocator deduced by rules explained in `rebind_alloc`. //! the allocator deduced by rules explained in <code>rebind_alloc</code>.
template <class T> using rebind_traits = allocator_traits<rebind_alloc<T> >; template <class T> using rebind_traits = allocator_traits<rebind_alloc<T> >;
//! Non-standard extension: Portable allocator rebind for C++03 and C++11 compilers. //! Non-standard extension: Portable allocator rebind for C++03 and C++11 compilers.
//! `type` is an allocator related to Alloc deduced deduced by rules explained in `rebind_alloc`. //! <code>type</code> is an allocator related to Alloc deduced deduced by rules explained in <code>rebind_alloc</code>.
template <class T> template <class T>
struct portable_rebind_alloc struct portable_rebind_alloc
{ typedef see_documentation type; }; { typedef see_documentation type; };
@@ -206,19 +206,19 @@ struct allocator_traits
{ typedef typename boost::intrusive::detail::type_rebinder<Alloc, T>::type type; }; { typedef typename boost::intrusive::detail::type_rebinder<Alloc, T>::type type; };
#endif //BOOST_CONTAINER_DOXYGEN_INVOKED #endif //BOOST_CONTAINER_DOXYGEN_INVOKED
//! <b>Returns</b>: `a.allocate(n)` //! <b>Returns</b>: <code>a.allocate(n)</code>
//! //!
static pointer allocate(Alloc &a, size_type n) static pointer allocate(Alloc &a, size_type n)
{ return a.allocate(n); } { return a.allocate(n); }
//! <b>Returns</b>: `a.deallocate(p, n)` //! <b>Returns</b>: <code>a.deallocate(p, n)</code>
//! //!
//! <b>Throws</b>: Nothing //! <b>Throws</b>: Nothing
static void deallocate(Alloc &a, pointer p, size_type n) static void deallocate(Alloc &a, pointer p, size_type n)
{ a.deallocate(p, n); } { a.deallocate(p, n); }
//! <b>Effects</b>: calls `a.allocate(n, p)` if that call is well-formed; //! <b>Effects</b>: calls <code>a.allocate(n, p)</code> if that call is well-formed;
//! otherwise, invokes `a.allocate(n)` //! otherwise, invokes <code>a.allocate(n)</code>
static pointer allocate(Alloc &a, size_type n, const_void_pointer p) static pointer allocate(Alloc &a, size_type n, const_void_pointer p)
{ {
const bool value = boost::container::container_detail:: const bool value = boost::container::container_detail::
@@ -228,10 +228,10 @@ struct allocator_traits
return allocator_traits::priv_allocate(flag, a, n, p); return allocator_traits::priv_allocate(flag, a, n, p);
} }
//! <b>Effects</b>: calls `a.destroy(p)` if that call is well-formed; //! <b>Effects</b>: calls <code>a.destroy(p)</code> if that call is well-formed;
//! otherwise, invokes `p->~T()`. //! otherwise, invokes <code>p->~T()</code>.
template<class T> template<class T>
static void destroy(Alloc &a, T*p) static void destroy(Alloc &a, T*p) BOOST_CONTAINER_NOEXCEPT
{ {
typedef T* destroy_pointer; typedef T* destroy_pointer;
const bool value = boost::container::container_detail:: const bool value = boost::container::container_detail::
@@ -241,9 +241,9 @@ struct allocator_traits
allocator_traits::priv_destroy(flag, a, p); allocator_traits::priv_destroy(flag, a, p);
} }
//! <b>Returns</b>: `a.max_size()` if that expression is well-formed; otherwise, //! <b>Returns</b>: <code>a.max_size()</code> if that expression is well-formed; otherwise,
//! `numeric_limits<size_type>::max()`. //! <code>numeric_limits<size_type>::max()</code>.
static size_type max_size(const Alloc &a) static size_type max_size(const Alloc &a) BOOST_CONTAINER_NOEXCEPT
{ {
const bool value = boost::container::container_detail:: const bool value = boost::container::container_detail::
has_member_function_callable_with_max_size has_member_function_callable_with_max_size
@@ -252,7 +252,7 @@ struct allocator_traits
return allocator_traits::priv_max_size(flag, a); return allocator_traits::priv_max_size(flag, a);
} }
//! <b>Returns</b>: `a.select_on_container_copy_construction()` if that expression is well-formed; //! <b>Returns</b>: <code>a.select_on_container_copy_construction()</code> if that expression is well-formed;
//! otherwise, a. //! otherwise, a.
static static
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -276,8 +276,8 @@ struct allocator_traits
} }
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: calls `a.construct(p, std::forward<Args>(args)...)` if that call is well-formed; //! <b>Effects</b>: calls <code>a.construct(p, std::forward<Args>(args)...)</code> if that call is well-formed;
//! otherwise, invokes `::new (static_cast<void*>(p)) T(std::forward<Args>(args)...)` //! otherwise, invokes <code>::new (static_cast<void*>(p)) T(std::forward<Args>(args)...)</code>
template <class T, class ...Args> template <class T, class ...Args>
static void construct(Alloc & a, T* p, BOOST_FWD_REF(Args)... args) static void construct(Alloc & a, T* p, BOOST_FWD_REF(Args)... args)
{ {
@@ -285,7 +285,7 @@ struct allocator_traits
allocator_traits::priv_construct(flag, a, p, ::boost::forward<Args>(args)...); allocator_traits::priv_construct(flag, a, p, ::boost::forward<Args>(args)...);
} }
#endif #endif
///@cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
private: private:
static pointer priv_allocate(boost::true_type, Alloc &a, size_type n, const_void_pointer p) static pointer priv_allocate(boost::true_type, Alloc &a, size_type n, const_void_pointer p)
@@ -295,23 +295,23 @@ struct allocator_traits
{ return allocator_traits::allocate(a, n); } { return allocator_traits::allocate(a, n); }
template<class T> template<class T>
static void priv_destroy(boost::true_type, Alloc &a, T* p) static void priv_destroy(boost::true_type, Alloc &a, T* p) BOOST_CONTAINER_NOEXCEPT
{ a.destroy(p); } { a.destroy(p); }
template<class T> template<class T>
static void priv_destroy(boost::false_type, Alloc &, T* p) static void priv_destroy(boost::false_type, Alloc &, T* p) BOOST_CONTAINER_NOEXCEPT
{ p->~T(); (void)p; } { p->~T(); (void)p; }
static size_type priv_max_size(boost::true_type, const Alloc &a) static size_type priv_max_size(boost::true_type, const Alloc &a) BOOST_CONTAINER_NOEXCEPT
{ return a.max_size(); } { return a.max_size(); }
static size_type priv_max_size(boost::false_type, const Alloc &) static size_type priv_max_size(boost::false_type, const Alloc &) BOOST_CONTAINER_NOEXCEPT
{ return (std::numeric_limits<size_type>::max)(); } { return (std::numeric_limits<size_type>::max)(); }
static Alloc priv_select_on_container_copy_construction(boost::true_type, const Alloc &a) static Alloc priv_select_on_container_copy_construction(boost::true_type, const Alloc &a)
{ return a.select_on_container_copy_construction(); } { return a.select_on_container_copy_construction(); }
static const Alloc &priv_select_on_container_copy_construction(boost::false_type, const Alloc &a) static const Alloc &priv_select_on_container_copy_construction(boost::false_type, const Alloc &a) BOOST_CONTAINER_NOEXCEPT
{ return a; } { return a; }
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
@@ -394,7 +394,7 @@ struct allocator_traits
{ ::new((void*)p) T; } { ::new((void*)p) T; }
#endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
///@endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}; };
} //namespace container { } //namespace container {

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -15,11 +15,35 @@
# pragma once # pragma once
#endif #endif
//! \file
//! This header file forward declares the following classes:
//! - boost::container::vector
//! - boost::container::stable_vector
//! - boost::container::static_vector
//! - boost::container::slist
//! - boost::container::list
//! - boost::container::set
//! - boost::container::multiset
//! - boost::container::map
//! - boost::container::multimap
//! - boost::container::flat_set
//! - boost::container::flat_multiset
//! - boost::container::flat_map
//! - boost::container::flat_multimap
//! - boost::container::basic_string
//! - boost::container::string
//! - boost::container::wstring
//! - boost::container::allocator
//! - boost::container::node_allocator
//! - boost::container::adaptive_pool
//!
//! and defines the following types:
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// Standard predeclarations // Standard predeclarations
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace boost{ namespace boost{
namespace intrusive{ namespace intrusive{
@@ -32,13 +56,14 @@ namespace bi = boost::intrusive;
}}} }}}
#include <cstddef>
#include <utility> #include <utility>
#include <memory> #include <memory>
#include <functional> #include <functional>
#include <iosfwd> #include <iosfwd>
#include <string> #include <string>
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// Containers // Containers
@@ -47,89 +72,120 @@ namespace bi = boost::intrusive;
namespace boost { namespace boost {
namespace container { namespace container {
//vector class #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class T template <class T
,class Allocator = std::allocator<T> > ,class Allocator = std::allocator<T> >
class vector; class vector;
//vector class
template <class T template <class T
,class Allocator = std::allocator<T> > ,class Allocator = std::allocator<T> >
class stable_vector; class stable_vector;
//vector class template <class T, std::size_t Capacity>
class static_vector;
template <class T template <class T
,class Allocator = std::allocator<T> > ,class Allocator = std::allocator<T> >
class deque; class deque;
//list class
template <class T template <class T
,class Allocator = std::allocator<T> > ,class Allocator = std::allocator<T> >
class list; class list;
//slist class
template <class T template <class T
,class Allocator = std::allocator<T> > ,class Allocator = std::allocator<T> >
class slist; class slist;
//set class
template <class Key template <class Key
,class Compare = std::less<Key> ,class Compare = std::less<Key>
,class Allocator = std::allocator<Key> > ,class Allocator = std::allocator<Key> >
class set; class set;
//multiset class
template <class Key template <class Key
,class Compare = std::less<Key> ,class Compare = std::less<Key>
,class Allocator = std::allocator<Key> > ,class Allocator = std::allocator<Key> >
class multiset; class multiset;
//map class
template <class Key template <class Key
,class T ,class T
,class Compare = std::less<Key> ,class Compare = std::less<Key>
,class Allocator = std::allocator<std::pair<const Key, T> > > ,class Allocator = std::allocator<std::pair<const Key, T> > >
class map; class map;
//multimap class
template <class Key template <class Key
,class T ,class T
,class Compare = std::less<Key> ,class Compare = std::less<Key>
,class Allocator = std::allocator<std::pair<const Key, T> > > ,class Allocator = std::allocator<std::pair<const Key, T> > >
class multimap; class multimap;
//flat_set class
template <class Key template <class Key
,class Compare = std::less<Key> ,class Compare = std::less<Key>
,class Allocator = std::allocator<Key> > ,class Allocator = std::allocator<Key> >
class flat_set; class flat_set;
//flat_multiset class
template <class Key template <class Key
,class Compare = std::less<Key> ,class Compare = std::less<Key>
,class Allocator = std::allocator<Key> > ,class Allocator = std::allocator<Key> >
class flat_multiset; class flat_multiset;
//flat_map class
template <class Key template <class Key
,class T ,class T
,class Compare = std::less<Key> ,class Compare = std::less<Key>
,class Allocator = std::allocator<std::pair<Key, T> > > ,class Allocator = std::allocator<std::pair<Key, T> > >
class flat_map; class flat_map;
//flat_multimap class
template <class Key template <class Key
,class T ,class T
,class Compare = std::less<Key> ,class Compare = std::less<Key>
,class Allocator = std::allocator<std::pair<Key, T> > > ,class Allocator = std::allocator<std::pair<Key, T> > >
class flat_multimap; class flat_multimap;
//basic_string class
template <class CharT template <class CharT
,class Traits = std::char_traits<CharT> ,class Traits = std::char_traits<CharT>
,class Allocator = std::allocator<CharT> > ,class Allocator = std::allocator<CharT> >
class basic_string; class basic_string;
typedef basic_string
<char
,std::char_traits<char>
,std::allocator<char> >
string;
typedef basic_string
<wchar_t
,std::char_traits<wchar_t>
,std::allocator<wchar_t> >
wstring;
static const std::size_t ADP_nodes_per_block = 256u;
static const std::size_t ADP_max_free_blocks = 2u;
static const std::size_t ADP_overhead_percent = 1u;
static const std::size_t ADP_only_alignment = 0u;
template < class T
, std::size_t NodesPerBlock = ADP_nodes_per_block
, std::size_t MaxFreeBlocks = ADP_max_free_blocks
, std::size_t OverheadPercent = ADP_overhead_percent
, unsigned Version = 2
>
class adaptive_pool;
template < class T
, unsigned Version = 2
, unsigned int AllocationDisableMask = 0>
class allocator;
static const std::size_t NodeAlloc_nodes_per_block = 256u;
template
< class T
, std::size_t NodesPerBlock = NodeAlloc_nodes_per_block
, std::size_t Version = 2>
class node_allocator;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! Type used to tag that the input range is //! Type used to tag that the input range is
//! guaranteed to be ordered //! guaranteed to be ordered
struct ordered_range_t struct ordered_range_t
@@ -149,17 +205,27 @@ struct ordered_unique_range_t
//! guaranteed to be ordered and unique //! guaranteed to be ordered and unique
static const ordered_unique_range_t ordered_unique_range = ordered_unique_range_t(); static const ordered_unique_range_t ordered_unique_range = ordered_unique_range_t();
//! Type used to tag that the input range is //! Type used to tag that the inserted values
//! guaranteed to be ordered and unique //! should be default initialized
struct default_init_t struct default_init_t
{}; {};
//! Value used to tag that the input range is //! Value used to tag that the inserted values
//! guaranteed to be ordered and unique //! should be default initialized
static const default_init_t default_init = default_init_t(); static const default_init_t default_init = default_init_t();
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace detail_really_deep_namespace { //! Type used to tag that the inserted values
//! should be value initialized
struct value_init_t
{};
//! Value used to tag that the inserted values
//! should be value initialized
static const value_init_t value_init = value_init_t();
namespace container_detail_really_deep_namespace {
//Otherwise, gcc issues a warning of previously defined //Otherwise, gcc issues a warning of previously defined
//anonymous_instance and unique_instance //anonymous_instance and unique_instance
@@ -175,7 +241,7 @@ struct dummy
} //detail_really_deep_namespace { } //detail_really_deep_namespace {
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}} //namespace boost { namespace container { }} //namespace boost { namespace container {

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -45,7 +45,7 @@
namespace boost { namespace boost {
namespace container { namespace container {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class T, class Allocator = std::allocator<T> > template <class T, class Allocator = std::allocator<T> >
#else #else
@@ -465,7 +465,7 @@ class deque_base
const allocator_type &alloc() const BOOST_CONTAINER_NOEXCEPT const allocator_type &alloc() const BOOST_CONTAINER_NOEXCEPT
{ return members_; } { return members_; }
}; };
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! Deque class //! Deque class
//! //!
@@ -476,10 +476,10 @@ template <class T, class Allocator>
#endif #endif
class deque : protected deque_base<Allocator> class deque : protected deque_base<Allocator>
{ {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
typedef deque_base<Allocator> Base; typedef deque_base<Allocator> Base;
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public: public:
@@ -503,7 +503,7 @@ class deque : protected deque_base<Allocator>
typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<iterator>) reverse_iterator; typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<iterator>) reverse_iterator;
typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<const_iterator>) const_reverse_iterator; typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<const_iterator>) const_reverse_iterator;
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: // Internal typedefs private: // Internal typedefs
BOOST_COPYABLE_AND_MOVABLE(deque) BOOST_COPYABLE_AND_MOVABLE(deque)
@@ -512,7 +512,7 @@ class deque : protected deque_base<Allocator>
{ return Base::s_buffer_size(); } { return Base::s_buffer_size(); }
typedef allocator_traits<Allocator> allocator_traits_type; typedef allocator_traits<Allocator> allocator_traits_type;
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public: public:
////////////////////////////////////////////// //////////////////////////////////////////////
@@ -549,8 +549,8 @@ class deque : protected deque_base<Allocator>
explicit deque(size_type n) explicit deque(size_type n)
: Base(n, allocator_type()) : Base(n, allocator_type())
{ {
container_detail::insert_value_initialized_n_proxy<Allocator, iterator> proxy(this->alloc()); container_detail::insert_value_initialized_n_proxy<Allocator, iterator> proxy;
proxy.uninitialized_copy_n_and_update(this->begin(), n); proxy.uninitialized_copy_n_and_update(this->alloc(), this->begin(), n);
//deque_base will deallocate in case of exception... //deque_base will deallocate in case of exception...
} }
@@ -566,8 +566,8 @@ class deque : protected deque_base<Allocator>
deque(size_type n, default_init_t) deque(size_type n, default_init_t)
: Base(n, allocator_type()) : Base(n, allocator_type())
{ {
container_detail::insert_default_initialized_n_proxy<Allocator, iterator> proxy(this->alloc()); container_detail::insert_default_initialized_n_proxy<Allocator, iterator> proxy;
proxy.uninitialized_copy_n_and_update(this->begin(), n); proxy.uninitialized_copy_n_and_update(this->alloc(), this->begin(), n);
//deque_base will deallocate in case of exception... //deque_base will deallocate in case of exception...
} }
@@ -978,7 +978,7 @@ class deque : protected deque_base<Allocator>
this->priv_erase_last_n(len - new_size); this->priv_erase_last_n(len - new_size);
else{ else{
const size_type n = new_size - this->size(); const size_type n = new_size - this->size();
container_detail::insert_value_initialized_n_proxy<Allocator, iterator> proxy(this->alloc()); container_detail::insert_value_initialized_n_proxy<Allocator, iterator> proxy;
priv_insert_back_aux_impl(n, proxy); priv_insert_back_aux_impl(n, proxy);
} }
} }
@@ -998,7 +998,7 @@ class deque : protected deque_base<Allocator>
this->priv_erase_last_n(len - new_size); this->priv_erase_last_n(len - new_size);
else{ else{
const size_type n = new_size - this->size(); const size_type n = new_size - this->size();
container_detail::insert_default_initialized_n_proxy<Allocator, iterator> proxy(this->alloc()); container_detail::insert_default_initialized_n_proxy<Allocator, iterator> proxy;
priv_insert_back_aux_impl(n, proxy); priv_insert_back_aux_impl(n, proxy);
} }
} }
@@ -1155,7 +1155,7 @@ class deque : protected deque_base<Allocator>
} }
else{ else{
typedef container_detail::insert_non_movable_emplace_proxy<Allocator, iterator, Args...> type; typedef container_detail::insert_non_movable_emplace_proxy<Allocator, iterator, Args...> type;
this->priv_insert_front_aux_impl(1, type(this->alloc(), boost::forward<Args>(args)...)); this->priv_insert_front_aux_impl(1, type(boost::forward<Args>(args)...));
} }
} }
@@ -1177,7 +1177,7 @@ class deque : protected deque_base<Allocator>
} }
else{ else{
typedef container_detail::insert_non_movable_emplace_proxy<Allocator, iterator, Args...> type; typedef container_detail::insert_non_movable_emplace_proxy<Allocator, iterator, Args...> type;
this->priv_insert_back_aux_impl(1, type(this->alloc(), boost::forward<Args>(args)...)); this->priv_insert_back_aux_impl(1, type(boost::forward<Args>(args)...));
} }
} }
@@ -1203,7 +1203,7 @@ class deque : protected deque_base<Allocator>
} }
else{ else{
typedef container_detail::insert_emplace_proxy<Allocator, iterator, Args...> type; typedef container_detail::insert_emplace_proxy<Allocator, iterator, Args...> type;
return this->priv_insert_aux_impl(p, 1, type(this->alloc(), boost::forward<Args>(args)...)); return this->priv_insert_aux_impl(p, 1, type(boost::forward<Args>(args)...));
} }
} }
@@ -1222,10 +1222,10 @@ class deque : protected deque_base<Allocator>
priv_push_front_simple_commit(); \ priv_push_front_simple_commit(); \
} \ } \
else{ \ else{ \
container_detail::BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, n) \ typedef container_detail::BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, n) \
<Allocator, iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> proxy \ <Allocator, iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> type; \
(this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \ priv_insert_front_aux_impl \
priv_insert_front_aux_impl(1, proxy); \ (1, type(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); \
} \ } \
} \ } \
\ \
@@ -1240,10 +1240,10 @@ class deque : protected deque_base<Allocator>
priv_push_back_simple_commit(); \ priv_push_back_simple_commit(); \
} \ } \
else{ \ else{ \
container_detail::BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, n) \ typedef container_detail::BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, n) \
<Allocator, iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> proxy \ <Allocator, iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> type; \
(this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \ priv_insert_back_aux_impl \
priv_insert_back_aux_impl(1, proxy); \ (1, type(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); \
} \ } \
} \ } \
\ \
@@ -1260,10 +1260,10 @@ class deque : protected deque_base<Allocator>
return (this->end()-1); \ return (this->end()-1); \
} \ } \
else{ \ else{ \
container_detail::BOOST_PP_CAT(insert_emplace_proxy_arg, n) \ typedef container_detail::BOOST_PP_CAT(insert_emplace_proxy_arg, n) \
<Allocator, iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> proxy \ <Allocator, iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> type; \
(this->alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \ return this->priv_insert_aux_impl \
return this->priv_insert_aux_impl(p, 1, proxy); \ (p, 1, type(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); \
} \ } \
} \ } \
//! //!
@@ -1397,7 +1397,7 @@ class deque : protected deque_base<Allocator>
#endif #endif
) )
{ {
container_detail::insert_range_proxy<Allocator, FwdIt, iterator> proxy(this->alloc(), first); container_detail::insert_range_proxy<Allocator, FwdIt, iterator> proxy(first);
return priv_insert_aux_impl(p, (size_type)std::distance(first, last), proxy); return priv_insert_aux_impl(p, (size_type)std::distance(first, last), proxy);
} }
#endif #endif
@@ -1537,7 +1537,7 @@ class deque : protected deque_base<Allocator>
this->members_.m_finish = this->members_.m_start; this->members_.m_finish = this->members_.m_start;
} }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
void priv_erase_last_n(size_type n) void priv_erase_last_n(size_type n)
@@ -1570,7 +1570,8 @@ class deque : protected deque_base<Allocator>
} }
else { else {
return priv_insert_aux_impl return priv_insert_aux_impl
(position, (size_type)1, container_detail::get_insert_value_proxy<iterator>(this->alloc(), ::boost::forward<U>(x))); ( position, (size_type)1
, container_detail::get_insert_value_proxy<iterator, Allocator>(::boost::forward<U>(x)));
} }
} }
@@ -1584,7 +1585,8 @@ class deque : protected deque_base<Allocator>
} }
else{ else{
priv_insert_aux_impl priv_insert_aux_impl
(this->cbegin(), (size_type)1, container_detail::get_insert_value_proxy<iterator>(this->alloc(), ::boost::forward<U>(x))); ( this->cbegin(), (size_type)1
, container_detail::get_insert_value_proxy<iterator, Allocator>(::boost::forward<U>(x)));
} }
} }
@@ -1598,8 +1600,8 @@ class deque : protected deque_base<Allocator>
} }
else{ else{
priv_insert_aux_impl priv_insert_aux_impl
(this->cend(), (size_type)1, container_detail::get_insert_value_proxy<iterator>(this->alloc(), ::boost::forward<U>(x))); ( this->cend(), (size_type)1
container_detail::insert_copy_proxy<Allocator, iterator> proxy(this->alloc(), x); , container_detail::get_insert_value_proxy<iterator, Allocator>(::boost::forward<U>(x)));
} }
} }
@@ -1652,7 +1654,7 @@ class deque : protected deque_base<Allocator>
} }
template<class InsertProxy> template<class InsertProxy>
iterator priv_insert_aux_impl(const_iterator p, size_type n, InsertProxy interf) iterator priv_insert_aux_impl(const_iterator p, size_type n, InsertProxy proxy)
{ {
iterator pos(p.unconst()); iterator pos(p.unconst());
const size_type pos_n = p - this->cbegin(); const size_type pos_n = p - this->cbegin();
@@ -1667,7 +1669,7 @@ class deque : protected deque_base<Allocator>
const iterator new_start = this->priv_reserve_elements_at_front(n); const iterator new_start = this->priv_reserve_elements_at_front(n);
const iterator old_start = this->members_.m_start; const iterator old_start = this->members_.m_start;
if(!elemsbefore){ if(!elemsbefore){
interf.uninitialized_copy_n_and_update(new_start, n); proxy.uninitialized_copy_n_and_update(this->alloc(), new_start, n);
this->members_.m_start = new_start; this->members_.m_start = new_start;
} }
else{ else{
@@ -1678,17 +1680,17 @@ class deque : protected deque_base<Allocator>
(this->alloc(), this->members_.m_start, start_n, new_start); (this->alloc(), this->members_.m_start, start_n, new_start);
this->members_.m_start = new_start; this->members_.m_start = new_start;
boost::move(start_n, pos, old_start); boost::move(start_n, pos, old_start);
interf.copy_n_and_update(pos - n, n); proxy.copy_n_and_update(this->alloc(), pos - n, n);
} }
else { else {
const size_type mid_count = n - elemsbefore; const size_type mid_count = n - elemsbefore;
const iterator mid_start = old_start - mid_count; const iterator mid_start = old_start - mid_count;
interf.uninitialized_copy_n_and_update(mid_start, mid_count); proxy.uninitialized_copy_n_and_update(this->alloc(), mid_start, mid_count);
this->members_.m_start = mid_start; this->members_.m_start = mid_start;
::boost::container::uninitialized_move_alloc ::boost::container::uninitialized_move_alloc
(this->alloc(), old_start, pos, new_start); (this->alloc(), old_start, pos, new_start);
this->members_.m_start = new_start; this->members_.m_start = new_start;
interf.copy_n_and_update(old_start, elemsbefore); proxy.copy_n_and_update(this->alloc(), old_start, elemsbefore);
} }
} }
} }
@@ -1697,7 +1699,7 @@ class deque : protected deque_base<Allocator>
const iterator old_finish = this->members_.m_finish; const iterator old_finish = this->members_.m_finish;
const size_type elemsafter = length - elemsbefore; const size_type elemsafter = length - elemsbefore;
if(!elemsafter){ if(!elemsafter){
interf.uninitialized_copy_n_and_update(old_finish, n); proxy.uninitialized_copy_n_and_update(this->alloc(), old_finish, n);
this->members_.m_finish = new_finish; this->members_.m_finish = new_finish;
} }
else{ else{
@@ -1708,15 +1710,15 @@ class deque : protected deque_base<Allocator>
(this->alloc(), finish_n, old_finish, old_finish); (this->alloc(), finish_n, old_finish, old_finish);
this->members_.m_finish = new_finish; this->members_.m_finish = new_finish;
boost::move_backward(pos, finish_n, old_finish); boost::move_backward(pos, finish_n, old_finish);
interf.copy_n_and_update(pos, n); proxy.copy_n_and_update(this->alloc(), pos, n);
} }
else { else {
const size_type raw_gap = n - elemsafter; const size_type raw_gap = n - elemsafter;
::boost::container::uninitialized_move_alloc ::boost::container::uninitialized_move_alloc
(this->alloc(), pos, old_finish, old_finish + raw_gap); (this->alloc(), pos, old_finish, old_finish + raw_gap);
BOOST_TRY{ BOOST_TRY{
interf.copy_n_and_update(pos, elemsafter); proxy.copy_n_and_update(this->alloc(), pos, elemsafter);
interf.uninitialized_copy_n_and_update(old_finish, raw_gap); proxy.uninitialized_copy_n_and_update(this->alloc(), old_finish, raw_gap);
} }
BOOST_CATCH(...){ BOOST_CATCH(...){
this->priv_destroy_range(old_finish, old_finish + elemsafter); this->priv_destroy_range(old_finish, old_finish + elemsafter);
@@ -1731,7 +1733,7 @@ class deque : protected deque_base<Allocator>
} }
template <class InsertProxy> template <class InsertProxy>
iterator priv_insert_back_aux_impl(size_type n, InsertProxy interf) iterator priv_insert_back_aux_impl(size_type n, InsertProxy proxy)
{ {
if(!this->members_.m_map){ if(!this->members_.m_map){
this->priv_initialize_map(0); this->priv_initialize_map(0);
@@ -1739,20 +1741,20 @@ class deque : protected deque_base<Allocator>
iterator new_finish = this->priv_reserve_elements_at_back(n); iterator new_finish = this->priv_reserve_elements_at_back(n);
iterator old_finish = this->members_.m_finish; iterator old_finish = this->members_.m_finish;
interf.uninitialized_copy_n_and_update(old_finish, n); proxy.uninitialized_copy_n_and_update(this->alloc(), old_finish, n);
this->members_.m_finish = new_finish; this->members_.m_finish = new_finish;
return iterator(this->members_.m_finish - n); return iterator(this->members_.m_finish - n);
} }
template <class InsertProxy> template <class InsertProxy>
iterator priv_insert_front_aux_impl(size_type n, InsertProxy interf) iterator priv_insert_front_aux_impl(size_type n, InsertProxy proxy)
{ {
if(!this->members_.m_map){ if(!this->members_.m_map){
this->priv_initialize_map(0); this->priv_initialize_map(0);
} }
iterator new_start = this->priv_reserve_elements_at_front(n); iterator new_start = this->priv_reserve_elements_at_front(n);
interf.uninitialized_copy_n_and_update(new_start, n); proxy.uninitialized_copy_n_and_update(this->alloc(), new_start, n);
this->members_.m_start = new_start; this->members_.m_start = new_start;
return new_start; return new_start;
} }
@@ -1934,7 +1936,7 @@ class deque : protected deque_base<Allocator>
this->members_.m_start.priv_set_node(new_nstart); this->members_.m_start.priv_set_node(new_nstart);
this->members_.m_finish.priv_set_node(new_nstart + old_num_nodes - 1); this->members_.m_finish.priv_set_node(new_nstart + old_num_nodes - 1);
} }
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}; };
// Nonmember functions. // Nonmember functions.
@@ -1972,7 +1974,7 @@ inline void swap(deque<T, Allocator>& x, deque<T, Allocator>& y)
}} }}
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace boost { namespace boost {
@@ -1985,7 +1987,7 @@ struct has_trivial_destructor_after_move<boost::container::deque<T, Allocator> >
} }
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
#include <boost/container/detail/config_end.hpp> #include <boost/container/detail/config_end.hpp>

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -15,9 +15,10 @@
# pragma once # pragma once
#endif #endif
#include "config_begin.hpp" #include <boost/container/detail/config_begin.hpp>
#include <boost/container/container_fwd.hpp>
#include <boost/container/detail/workaround.hpp> #include <boost/container/detail/workaround.hpp>
#include <boost/container/container_fwd.hpp>
#include <boost/container/detail/utilities.hpp> #include <boost/container/detail/utilities.hpp>
#include <boost/intrusive/pointer_traits.hpp> #include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/set.hpp> #include <boost/intrusive/set.hpp>

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2008-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -15,8 +15,373 @@
# pragma once # pragma once
#endif #endif
#include "config_begin.hpp" #include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp> #include <boost/container/detail/workaround.hpp>
#include <boost/container/allocator_traits.hpp>
#include <boost/container/detail/destroyers.hpp>
#include <boost/aligned_storage.hpp>
#include <boost/move/utility.hpp>
#include <iterator> //std::iterator_traits
#include <boost/assert.hpp>
#include <boost/detail/no_exceptions_support.hpp>
namespace boost { namespace container { namespace container_detail {
template<class A, class FwdIt, class Iterator>
struct move_insert_range_proxy
{
typedef typename allocator_traits<A>::size_type size_type;
typedef typename allocator_traits<A>::value_type value_type;
explicit move_insert_range_proxy(FwdIt first)
: first_(first)
{}
void uninitialized_copy_n_and_update(A &a, Iterator p, size_type n)
{
this->first_ = ::boost::container::uninitialized_move_alloc_n_source
(a, this->first_, n, p);
}
void copy_n_and_update(A &, Iterator p, size_type n)
{
this->first_ = ::boost::container::move_n_source(this->first_, n, p);
}
FwdIt first_;
};
template<class A, class FwdIt, class Iterator>
struct insert_range_proxy
{
typedef typename allocator_traits<A>::size_type size_type;
typedef typename allocator_traits<A>::value_type value_type;
explicit insert_range_proxy(FwdIt first)
: first_(first)
{}
void uninitialized_copy_n_and_update(A &a, Iterator p, size_type n)
{
this->first_ = ::boost::container::uninitialized_copy_alloc_n_source(a, this->first_, n, p);
}
void copy_n_and_update(A &, Iterator p, size_type n)
{
this->first_ = ::boost::container::copy_n_source(this->first_, n, p);
}
FwdIt first_;
};
template<class A, class Iterator>
struct insert_n_copies_proxy
{
typedef typename allocator_traits<A>::size_type size_type;
typedef typename allocator_traits<A>::value_type value_type;
explicit insert_n_copies_proxy(const value_type &v)
: v_(v)
{}
void uninitialized_copy_n_and_update(A &a, Iterator p, size_type n) const
{ boost::container::uninitialized_fill_alloc_n(a, v_, n, p); }
void copy_n_and_update(A &, Iterator p, size_type n) const
{ std::fill_n(p, n, v_); }
const value_type &v_;
};
template<class A, class Iterator>
struct insert_value_initialized_n_proxy
{
typedef ::boost::container::allocator_traits<A> alloc_traits;
typedef typename allocator_traits<A>::size_type size_type;
typedef typename allocator_traits<A>::value_type value_type;
void uninitialized_copy_n_and_update(A &a, Iterator p, size_type n) const
{ boost::container::uninitialized_value_init_alloc_n(a, n, p); }
void copy_n_and_update(A &, Iterator, size_type) const
{ BOOST_ASSERT(false); }
};
template<class A, class Iterator>
struct insert_default_initialized_n_proxy
{
typedef ::boost::container::allocator_traits<A> alloc_traits;
typedef typename allocator_traits<A>::size_type size_type;
typedef typename allocator_traits<A>::value_type value_type;
void uninitialized_copy_n_and_update(A &a, Iterator p, size_type n) const
{ boost::container::uninitialized_default_init_alloc_n(a, n, p); }
void copy_n_and_update(A &, Iterator, size_type) const
{ BOOST_ASSERT(false); }
};
template<class A, class Iterator>
struct insert_copy_proxy
{
typedef boost::container::allocator_traits<A> alloc_traits;
typedef typename alloc_traits::size_type size_type;
typedef typename alloc_traits::value_type value_type;
explicit insert_copy_proxy(const value_type &v)
: v_(v)
{}
void uninitialized_copy_n_and_update(A &a, Iterator p, size_type n) const
{
BOOST_ASSERT(n == 1); (void)n;
alloc_traits::construct( a, container_detail::to_raw_pointer(&*p), v_);
}
void copy_n_and_update(A &, Iterator p, size_type n) const
{
BOOST_ASSERT(n == 1); (void)n;
*p =v_;
}
const value_type &v_;
};
template<class A, class Iterator>
struct insert_move_proxy
{
typedef boost::container::allocator_traits<A> alloc_traits;
typedef typename alloc_traits::size_type size_type;
typedef typename alloc_traits::value_type value_type;
explicit insert_move_proxy(value_type &v)
: v_(v)
{}
void uninitialized_copy_n_and_update(A &a, Iterator p, size_type n) const
{
BOOST_ASSERT(n == 1); (void)n;
alloc_traits::construct( a
, container_detail::to_raw_pointer(&*p)
, ::boost::move(v_)
);
}
void copy_n_and_update(A &, Iterator p, size_type n) const
{
BOOST_ASSERT(n == 1); (void)n;
*p = ::boost::move(v_);
}
value_type &v_;
};
template<class It, class A>
insert_move_proxy<A, It> get_insert_value_proxy(BOOST_RV_REF(typename std::iterator_traits<It>::value_type) v)
{
return insert_move_proxy<A, It>(v);
}
template<class It, class A>
insert_copy_proxy<A, It> get_insert_value_proxy(const typename std::iterator_traits<It>::value_type &v)
{
return insert_copy_proxy<A, It>(v);
}
}}} //namespace boost { namespace container { namespace container_detail {
#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
#include <boost/container/detail/variadic_templates_tools.hpp>
#include <boost/move/utility.hpp>
#include <typeinfo>
//#include <iostream> //For debugging purposes
namespace boost {
namespace container {
namespace container_detail {
template<class A, class Iterator, class ...Args>
struct insert_non_movable_emplace_proxy
{
typedef boost::container::allocator_traits<A> alloc_traits;
typedef typename alloc_traits::size_type size_type;
typedef typename alloc_traits::value_type value_type;
typedef typename build_number_seq<sizeof...(Args)>::type index_tuple_t;
explicit insert_non_movable_emplace_proxy(Args&&... args)
: args_(args...)
{}
void uninitialized_copy_n_and_update(A &a, Iterator p, size_type n)
{ this->priv_uninitialized_copy_some_and_update(a, index_tuple_t(), p, n); }
private:
template<int ...IdxPack>
void priv_uninitialized_copy_some_and_update(A &a, const index_tuple<IdxPack...>&, Iterator p, size_type n)
{
BOOST_ASSERT(n == 1); (void)n;
alloc_traits::construct( a
, container_detail::to_raw_pointer(&*p)
, ::boost::forward<Args>(get<IdxPack>(this->args_))...
);
}
protected:
tuple<Args&...> args_;
};
template<class A, class Iterator, class ...Args>
struct insert_emplace_proxy
: public insert_non_movable_emplace_proxy<A, Iterator, Args...>
{
typedef insert_non_movable_emplace_proxy<A, Iterator, Args...> base_t;
typedef boost::container::allocator_traits<A> alloc_traits;
typedef typename base_t::value_type value_type;
typedef typename base_t::size_type size_type;
typedef typename base_t::index_tuple_t index_tuple_t;
explicit insert_emplace_proxy(Args&&... args)
: base_t(::boost::forward<Args>(args)...)
{}
void copy_n_and_update(A &a, Iterator p, size_type n)
{ this->priv_copy_some_and_update(a, index_tuple_t(), p, n); }
private:
template<int ...IdxPack>
void priv_copy_some_and_update(A &a, const index_tuple<IdxPack...>&, Iterator p, size_type n)
{
BOOST_ASSERT(n ==1); (void)n;
aligned_storage<sizeof(value_type), alignment_of<value_type>::value> v;
value_type *vp = static_cast<value_type *>(static_cast<void *>(&v));
alloc_traits::construct(a, vp,
::boost::forward<Args>(get<IdxPack>(this->args_))...);
BOOST_TRY{
*p = ::boost::move(*vp);
}
BOOST_CATCH(...){
alloc_traits::destroy(a, vp);
BOOST_RETHROW
}
BOOST_CATCH_END
alloc_traits::destroy(a, vp);
}
};
}}} //namespace boost { namespace container { namespace container_detail {
#else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
#include <boost/container/detail/preprocessor.hpp>
#include <boost/container/detail/value_init.hpp>
namespace boost {
namespace container {
namespace container_detail {
#define BOOST_PP_LOCAL_MACRO(N) \
template<class A, class Iterator BOOST_PP_ENUM_TRAILING_PARAMS(N, class P) > \
struct BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, N) \
{ \
typedef boost::container::allocator_traits<A> alloc_traits; \
typedef typename alloc_traits::size_type size_type; \
typedef typename alloc_traits::value_type value_type; \
\
explicit BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, N) \
( BOOST_PP_ENUM(N, BOOST_CONTAINER_PP_PARAM_LIST, _) ) \
BOOST_PP_EXPR_IF(N, :) BOOST_PP_ENUM(N, BOOST_CONTAINER_PP_PARAM_INIT, _) \
{} \
\
void uninitialized_copy_n_and_update(A &a, Iterator p, size_type n) \
{ \
BOOST_ASSERT(n == 1); (void)n; \
alloc_traits::construct \
( a \
, container_detail::to_raw_pointer(&*p) \
BOOST_PP_ENUM_TRAILING(N, BOOST_CONTAINER_PP_MEMBER_FORWARD, _) \
); \
} \
\
void copy_n_and_update(A &, Iterator, size_type) \
{ BOOST_ASSERT(false); } \
\
protected: \
BOOST_PP_REPEAT(N, BOOST_CONTAINER_PP_PARAM_DEFINE, _) \
}; \
\
template<class A, class Iterator BOOST_PP_ENUM_TRAILING_PARAMS(N, class P) > \
struct BOOST_PP_CAT(insert_emplace_proxy_arg, N) \
: BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, N) \
< A, Iterator BOOST_PP_ENUM_TRAILING_PARAMS(N, P) > \
{ \
typedef BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, N) \
<A, Iterator BOOST_PP_ENUM_TRAILING_PARAMS(N, P) > base_t; \
typedef typename base_t::value_type value_type; \
typedef typename base_t::size_type size_type; \
typedef boost::container::allocator_traits<A> alloc_traits; \
\
explicit BOOST_PP_CAT(insert_emplace_proxy_arg, N) \
( BOOST_PP_ENUM(N, BOOST_CONTAINER_PP_PARAM_LIST, _) ) \
: base_t(BOOST_PP_ENUM(N, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ) \
{} \
\
void copy_n_and_update(A &a, Iterator p, size_type n) \
{ \
BOOST_ASSERT(n == 1); (void)n; \
aligned_storage<sizeof(value_type), alignment_of<value_type>::value> v; \
value_type *vp = static_cast<value_type *>(static_cast<void *>(&v)); \
alloc_traits::construct(a, vp \
BOOST_PP_ENUM_TRAILING(N, BOOST_CONTAINER_PP_MEMBER_FORWARD, _)); \
BOOST_TRY{ \
*p = ::boost::move(*vp); \
} \
BOOST_CATCH(...){ \
alloc_traits::destroy(a, vp); \
BOOST_RETHROW \
} \
BOOST_CATCH_END \
alloc_traits::destroy(a, vp); \
} \
}; \
//!
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
#include BOOST_PP_LOCAL_ITERATE()
}}} //namespace boost { namespace container { namespace container_detail {
#endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
#include <boost/container/detail/config_end.hpp>
#endif //#ifndef BOOST_CONTAINER_ADVANCED_INSERT_INT_HPP
/*
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2008-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/container for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_CONTAINER_ADVANCED_INSERT_INT_HPP
#define BOOST_CONTAINER_ADVANCED_INSERT_INT_HPP
#if defined(_MSC_VER)
# pragma once
#endif
#include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp>
#include <boost/container/allocator_traits.hpp> #include <boost/container/allocator_traits.hpp>
#include <boost/container/detail/destroyers.hpp> #include <boost/container/detail/destroyers.hpp>
#include <boost/aligned_storage.hpp> #include <boost/aligned_storage.hpp>
@@ -391,3 +756,4 @@ struct BOOST_PP_CAT(insert_emplace_proxy_arg, N)
#include <boost/container/detail/config_end.hpp> #include <boost/container/detail/config_end.hpp>
#endif //#ifndef BOOST_CONTAINER_ADVANCED_INSERT_INT_HPP #endif //#ifndef BOOST_CONTAINER_ADVANCED_INSERT_INT_HPP
*/

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. // (C) Copyright Ion Gaztanaga 2005-2013.
// //
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
@@ -17,7 +17,7 @@
# pragma once # pragma once
#endif #endif
#include "config_begin.hpp" #include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp> #include <boost/container/detail/workaround.hpp>
#include <boost/type_traits/has_trivial_copy.hpp> #include <boost/type_traits/has_trivial_copy.hpp>

View File

@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -15,13 +15,13 @@
# pragma once # pragma once
#endif #endif
#include "config_begin.hpp" #include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp> #include <boost/container/detail/workaround.hpp>
namespace boost { namespace boost {
namespace container { namespace container {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
enum allocation_type_v enum allocation_type_v
{ {
// constants for allocation commands // constants for allocation commands
@@ -37,7 +37,7 @@ enum allocation_type_v
}; };
typedef int allocation_type; typedef int allocation_type;
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
static const allocation_type allocate_new = (allocation_type)allocate_new_v; static const allocation_type allocate_new = (allocation_type)allocate_new_v;
static const allocation_type expand_fwd = (allocation_type)expand_fwd_v; static const allocation_type expand_fwd = (allocation_type)expand_fwd_v;
static const allocation_type expand_bwd = (allocation_type)expand_bwd_v; static const allocation_type expand_bwd = (allocation_type)expand_bwd_v;

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2012-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2012-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -17,6 +17,7 @@
#include <boost/container/detail/config_begin.hpp> #include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp> #include <boost/container/detail/workaround.hpp>
#include <boost/container/allocator_traits.hpp> //allocator_traits #include <boost/container/allocator_traits.hpp> //allocator_traits
#include <boost/container/throw_exception.hpp> #include <boost/container/throw_exception.hpp>
#include <boost/container/detail/multiallocation_chain.hpp> //multiallocation_chain #include <boost/container/detail/multiallocation_chain.hpp> //multiallocation_chain

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -18,6 +18,10 @@
#define BOOST_CONTAINER_DETAIL_CRT_SECURE_NO_DEPRECATE #define BOOST_CONTAINER_DETAIL_CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE #define _CRT_SECURE_NO_DEPRECATE
#endif #endif
#ifndef _SCL_SECURE_NO_WARNINGS
#define BOOST_CONTAINER_DETAIL_SCL_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#endif
#pragma warning (push) #pragma warning (push)
#pragma warning (disable : 4702) // unreachable code #pragma warning (disable : 4702) // unreachable code
#pragma warning (disable : 4706) // assignment within conditional expression #pragma warning (disable : 4706) // assignment within conditional expression

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -13,5 +13,9 @@
#undef BOOST_CONTAINER_DETAIL_CRT_SECURE_NO_DEPRECATE #undef BOOST_CONTAINER_DETAIL_CRT_SECURE_NO_DEPRECATE
#undef _CRT_SECURE_NO_DEPRECATE #undef _CRT_SECURE_NO_DEPRECATE
#endif #endif
#ifdef BOOST_CONTAINER_DETAIL_SCL_SECURE_NO_WARNINGS
#undef BOOST_CONTAINER_DETAIL_SCL_SECURE_NO_WARNINGS
#undef _SCL_SECURE_NO_WARNINGS
#endif
#endif #endif

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. // (C) Copyright Ion Gaztanaga 2005-2013.
// //
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
@@ -17,8 +17,9 @@
# pragma once # pragma once
#endif #endif
#include "config_begin.hpp" #include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp> #include <boost/container/detail/workaround.hpp>
#include <boost/container/detail/version_type.hpp> #include <boost/container/detail/version_type.hpp>
#include <boost/container/detail/utilities.hpp> #include <boost/container/detail/utilities.hpp>
#include <boost/container/allocator_traits.hpp> #include <boost/container/allocator_traits.hpp>
@@ -231,6 +232,9 @@ struct null_scoped_destructor_n
void increment_size_backwards(size_type) void increment_size_backwards(size_type)
{} {}
void shrink_forward(size_type)
{}
void release() void release()
{} {}
}; };

View File

@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -15,7 +15,7 @@
# pragma once # pragma once
#endif #endif
#include "config_begin.hpp" #include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp> #include <boost/container/detail/workaround.hpp>
#include <boost/container/container_fwd.hpp> #include <boost/container/container_fwd.hpp>

View File

@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2009-2012. // (C) Copyright Ion Gaztanaga 2009-2013.
// //
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. // (C) Copyright Ion Gaztanaga 2005-2013.
// (C) Copyright Gennaro Prota 2003 - 2004. // (C) Copyright Gennaro Prota 2003 - 2004.
// //
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
@@ -18,7 +18,7 @@
# pragma once # pragma once
#endif #endif
#include "config_begin.hpp" #include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp> #include <boost/container/detail/workaround.hpp>
#include <boost/move/utility.hpp> #include <boost/move/utility.hpp>
#include <boost/container/allocator_traits.hpp> #include <boost/container/allocator_traits.hpp>

View File

@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Stephen Cleary 2000. // (C) Copyright Stephen Cleary 2000.
// (C) Copyright Ion Gaztanaga 2007-2012. // (C) Copyright Ion Gaztanaga 2007-2013.
// //
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
@@ -16,7 +16,9 @@
#ifndef BOOST_CONTAINER_DETAIL_MATH_FUNCTIONS_HPP #ifndef BOOST_CONTAINER_DETAIL_MATH_FUNCTIONS_HPP
#define BOOST_CONTAINER_DETAIL_MATH_FUNCTIONS_HPP #define BOOST_CONTAINER_DETAIL_MATH_FUNCTIONS_HPP
#include "config_begin.hpp" #include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp>
#include <climits> #include <climits>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. // (C) Copyright Ion Gaztanaga 2005-2013.
// //
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
@@ -17,6 +17,9 @@
# pragma once # pragma once
#endif #endif
#include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp>
#include <cstddef> #include <cstddef>
namespace boost { namespace boost {
@@ -156,5 +159,7 @@ template <> struct unvoid<const void> { struct type { }; };
} //namespace container { } //namespace container {
} //namespace boost { } //namespace boost {
#include <boost/container/detail/config_end.hpp>
#endif //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP #endif //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -11,7 +11,9 @@
#ifndef BOOST_CONTAINER_DETAIL_MULTIALLOCATION_CHAIN_HPP #ifndef BOOST_CONTAINER_DETAIL_MULTIALLOCATION_CHAIN_HPP
#define BOOST_CONTAINER_DETAIL_MULTIALLOCATION_CHAIN_HPP #define BOOST_CONTAINER_DETAIL_MULTIALLOCATION_CHAIN_HPP
#include "config_begin.hpp" #include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp>
#include <boost/container/container_fwd.hpp> #include <boost/container/container_fwd.hpp>
#include <boost/container/detail/utilities.hpp> #include <boost/container/detail/utilities.hpp>
#include <boost/container/detail/type_traits.hpp> #include <boost/container/detail/type_traits.hpp>

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -15,7 +15,7 @@
# pragma once # pragma once
#endif #endif
#include "config_begin.hpp" #include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp> #include <boost/container/detail/workaround.hpp>
#include <utility> #include <utility>

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -15,9 +15,10 @@
# pragma once # pragma once
#endif #endif
#include "config_begin.hpp" #include <boost/container/detail/config_begin.hpp>
#include <boost/container/container_fwd.hpp>
#include <boost/container/detail/workaround.hpp> #include <boost/container/detail/workaround.hpp>
#include <boost/container/container_fwd.hpp>
#include <boost/container/detail/utilities.hpp> #include <boost/container/detail/utilities.hpp>
#include <boost/intrusive/pointer_traits.hpp> #include <boost/intrusive/pointer_traits.hpp>
#include <boost/intrusive/set.hpp> #include <boost/intrusive/set.hpp>

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. // (C) Copyright Ion Gaztanaga 2005-2013.
// //
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
@@ -17,7 +17,7 @@
# pragma once # pragma once
#endif #endif
#include "config_begin.hpp" #include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp> #include <boost/container/detail/workaround.hpp>
#include <boost/container/detail/mpl.hpp> #include <boost/container/detail/mpl.hpp>

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -8,14 +8,16 @@
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_CONTAINER_DETAIL_NODE_POOL_COMMON_HPP #ifndef BOOST_CONTAINER_DETAIL_POOL_COMMON_HPP
#define BOOST_CONTAINER_DETAIL_NODE_POOL_COMMON_HPP #define BOOST_CONTAINER_DETAIL_POOL_COMMON_HPP
#if defined(_MSC_VER) #if defined(_MSC_VER)
# pragma once # pragma once
#endif #endif
#include "config_begin.hpp" #include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp>
#include <boost/intrusive/slist.hpp> #include <boost/intrusive/slist.hpp>
#include <new> #include <new>

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2008-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. // (C) Copyright Ion Gaztanaga 2005-2013.
// (C) Copyright Gennaro Prota 2003 - 2004. // (C) Copyright Gennaro Prota 2003 - 2004.
// //
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
@@ -18,8 +18,9 @@
# pragma once # pragma once
#endif #endif
#include "config_begin.hpp" #include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp> #include <boost/container/detail/workaround.hpp>
#include <boost/container/detail/type_traits.hpp> #include <boost/container/detail/type_traits.hpp>
#include <iterator> #include <iterator>

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -11,7 +11,7 @@
#ifndef BOOST_CONTAINER_TREE_HPP #ifndef BOOST_CONTAINER_TREE_HPP
#define BOOST_CONTAINER_TREE_HPP #define BOOST_CONTAINER_TREE_HPP
#include "config_begin.hpp" #include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp> #include <boost/container/detail/workaround.hpp>
#include <boost/container/container_fwd.hpp> #include <boost/container/container_fwd.hpp>

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// (C) Copyright John Maddock 2000. // (C) Copyright John Maddock 2000.
// (C) Copyright Ion Gaztanaga 2005-2012. // (C) Copyright Ion Gaztanaga 2005-2013.
// //
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
@@ -19,7 +19,8 @@
# pragma once # pragma once
#endif #endif
#include "config_begin.hpp" #include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp>
#include <boost/move/utility.hpp> #include <boost/move/utility.hpp>

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -11,8 +11,9 @@
#ifndef BOOST_CONTAINER_DETAIL_UTILITIES_HPP #ifndef BOOST_CONTAINER_DETAIL_UTILITIES_HPP
#define BOOST_CONTAINER_DETAIL_UTILITIES_HPP #define BOOST_CONTAINER_DETAIL_UTILITIES_HPP
#include "config_begin.hpp" #include <boost/container/detail/config_begin.hpp>
#include "workaround.hpp" #include <boost/container/detail/workaround.hpp>
#include <cstdio> #include <cstdio>
#include <cstring> //for ::memcpy #include <cstring> //for ::memcpy
#include <boost/type_traits/is_fundamental.hpp> #include <boost/type_traits/is_fundamental.hpp>
@@ -110,18 +111,37 @@ template<class T>
const T &min_value(const T &a, const T &b) const T &min_value(const T &a, const T &b)
{ return a < b ? a : b; } { return a < b ? a : b; }
template <class SizeType> enum NextCapacityOption { NextCapacityDouble, NextCapacity60Percent };
SizeType
get_next_capacity(const SizeType max_size template<class SizeType, NextCapacityOption Option>
,const SizeType capacity struct next_capacity_calculator;
,const SizeType n)
template<class SizeType>
struct next_capacity_calculator<SizeType, NextCapacityDouble>
{ {
const SizeType remaining = max_size - capacity; static SizeType get(const SizeType max_size
if ( remaining < n ) ,const SizeType capacity
boost::container::throw_length_error("get_next_capacity, allocator's max_size reached"); ,const SizeType n)
const SizeType additional = max_value(n, capacity); {
return ( remaining < additional ) ? max_size : ( capacity + additional ); const SizeType remaining = max_size - capacity;
#if 0 //Alternative for 50% grow if ( remaining < n )
boost::container::throw_length_error("get_next_capacity, allocator's max_size reached");
const SizeType additional = max_value(n, capacity);
return ( remaining < additional ) ? max_size : ( capacity + additional );
}
};
template<class SizeType>
struct next_capacity_calculator<SizeType, NextCapacity60Percent>
{
static SizeType get(const SizeType max_size
,const SizeType capacity
,const SizeType n)
{
const SizeType remaining = max_size - capacity;
if ( remaining < n )
boost::container::throw_length_error("get_next_capacity, allocator's max_size reached");
const SizeType m3 = max_size/3; const SizeType m3 = max_size/3;
if (capacity < m3) if (capacity < m3)
@@ -130,8 +150,8 @@ SizeType
if (capacity < m3*2) if (capacity < m3*2)
return capacity + max_value((capacity+1)/2, n); return capacity + max_value((capacity+1)/2, n);
return max_size; return max_size;
#endif }
} };
template <class T> template <class T>
inline T* to_raw_pointer(T* p) inline T* to_raw_pointer(T* p)

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. // (C) Copyright Ion Gaztanaga 2005-2013.
// //
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at // (See accompanying file LICENSE_1_0.txt or copy at
@@ -17,7 +17,7 @@
# pragma once # pragma once
#endif #endif
#include "config_begin.hpp" #include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp> #include <boost/container/detail/workaround.hpp>
namespace boost { namespace boost {

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2008-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -15,8 +15,9 @@
# pragma once # pragma once
#endif #endif
#include "config_begin.hpp" #include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp> #include <boost/container/detail/workaround.hpp>
#include <boost/container/detail/type_traits.hpp> #include <boost/container/detail/type_traits.hpp>
#include <cstddef> //std::size_t #include <cstddef> //std::size_t

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -16,7 +16,8 @@
#ifndef BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP #ifndef BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP
#define BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP #define BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP
#include "config_begin.hpp" #include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp>
#include <boost/container/detail/mpl.hpp> #include <boost/container/detail/mpl.hpp>
#include <boost/container/detail/type_traits.hpp> #include <boost/container/detail/type_traits.hpp>
@@ -87,6 +88,6 @@ struct version
} //namespace container { } //namespace container {
} //namespace boost{ } //namespace boost{
#include "config_end.hpp" #include <boost/container/detail/config_end.hpp>
#endif //#define BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP #endif //#define BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -34,7 +34,7 @@
namespace boost { namespace boost {
namespace container { namespace container {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
// Forward declarations of operators == and <, needed for friend declarations. // Forward declarations of operators == and <, needed for friend declarations.
template <class Key, class T, class Compare, class Allocator> template <class Key, class T, class Compare, class Allocator>
class flat_map; class flat_map;
@@ -63,7 +63,7 @@ static D force_copy(S s)
} //namespace container_detail{ } //namespace container_detail{
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! A flat_map is a kind of associative container that supports unique keys (contains at //! A flat_map is a kind of associative container that supports unique keys (contains at
//! most one of each key value) and provides for fast retrieval of values of another //! most one of each key value) and provides for fast retrieval of values of another
@@ -95,7 +95,7 @@ template <class Key, class T, class Compare, class Allocator>
#endif #endif
class flat_map class flat_map
{ {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
BOOST_COPYABLE_AND_MOVABLE(flat_map) BOOST_COPYABLE_AND_MOVABLE(flat_map)
//This is the tree that we should store if pair was movable //This is the tree that we should store if pair was movable
@@ -129,7 +129,7 @@ class flat_map
<typename allocator_traits<Allocator>::pointer>::reverse_iterator reverse_iterator_impl; <typename allocator_traits<Allocator>::pointer>::reverse_iterator reverse_iterator_impl;
typedef typename container_detail::get_flat_tree_iterators typedef typename container_detail::get_flat_tree_iterators
<typename allocator_traits<Allocator>::pointer>::const_reverse_iterator const_reverse_iterator_impl; <typename allocator_traits<Allocator>::pointer>::const_reverse_iterator const_reverse_iterator_impl;
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public: public:
@@ -842,7 +842,7 @@ class flat_map
std::pair<const_iterator,const_iterator> equal_range(const key_type& x) const std::pair<const_iterator,const_iterator> equal_range(const key_type& x) const
{ return container_detail::force_copy<std::pair<const_iterator,const_iterator> >(m_flat_tree.equal_range(x)); } { return container_detail::force_copy<std::pair<const_iterator,const_iterator> >(m_flat_tree.equal_range(x)); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class K1, class T1, class C1, class A1> template <class K1, class T1, class C1, class A1>
friend bool operator== (const flat_map<K1, T1, C1, A1>&, friend bool operator== (const flat_map<K1, T1, C1, A1>&,
const flat_map<K1, T1, C1, A1>&); const flat_map<K1, T1, C1, A1>&);
@@ -872,7 +872,7 @@ class flat_map
} }
return (*i).second; return (*i).second;
} }
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}; };
template <class Key, class T, class Compare, class Allocator> template <class Key, class T, class Compare, class Allocator>
@@ -910,7 +910,7 @@ inline void swap(flat_map<Key,T,Compare,Allocator>& x,
flat_map<Key,T,Compare,Allocator>& y) flat_map<Key,T,Compare,Allocator>& y)
{ x.swap(y); } { x.swap(y); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
} //namespace container { } //namespace container {
@@ -935,7 +935,7 @@ inline bool operator==(const flat_multimap<Key,T,Compare,Allocator>& x,
template <class Key, class T, class Compare, class Allocator> template <class Key, class T, class Compare, class Allocator>
inline bool operator<(const flat_multimap<Key,T,Compare,Allocator>& x, inline bool operator<(const flat_multimap<Key,T,Compare,Allocator>& x,
const flat_multimap<Key,T,Compare,Allocator>& y); const flat_multimap<Key,T,Compare,Allocator>& y);
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! A flat_multimap is a kind of associative container that supports equivalent keys //! A flat_multimap is a kind of associative container that supports equivalent keys
//! (possibly containing multiple copies of the same key value) and provides for //! (possibly containing multiple copies of the same key value) and provides for
@@ -967,7 +967,7 @@ template <class Key, class T, class Compare, class Allocator>
#endif #endif
class flat_multimap class flat_multimap
{ {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
BOOST_COPYABLE_AND_MOVABLE(flat_multimap) BOOST_COPYABLE_AND_MOVABLE(flat_multimap)
typedef container_detail::flat_tree<Key, typedef container_detail::flat_tree<Key,
@@ -999,7 +999,7 @@ class flat_multimap
<typename allocator_traits<Allocator>::pointer>::reverse_iterator reverse_iterator_impl; <typename allocator_traits<Allocator>::pointer>::reverse_iterator reverse_iterator_impl;
typedef typename container_detail::get_flat_tree_iterators typedef typename container_detail::get_flat_tree_iterators
<typename allocator_traits<Allocator>::pointer>::const_reverse_iterator const_reverse_iterator_impl; <typename allocator_traits<Allocator>::pointer>::const_reverse_iterator const_reverse_iterator_impl;
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public: public:
@@ -1637,7 +1637,7 @@ class flat_multimap
std::pair<const_iterator,const_iterator> equal_range(const key_type& x) const std::pair<const_iterator,const_iterator> equal_range(const key_type& x) const
{ return container_detail::force_copy<std::pair<const_iterator,const_iterator> >(m_flat_tree.equal_range(x)); } { return container_detail::force_copy<std::pair<const_iterator,const_iterator> >(m_flat_tree.equal_range(x)); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class K1, class T1, class C1, class A1> template <class K1, class T1, class C1, class A1>
friend bool operator== (const flat_multimap<K1, T1, C1, A1>& x, friend bool operator== (const flat_multimap<K1, T1, C1, A1>& x,
const flat_multimap<K1, T1, C1, A1>& y); const flat_multimap<K1, T1, C1, A1>& y);
@@ -1645,7 +1645,7 @@ class flat_multimap
template <class K1, class T1, class C1, class A1> template <class K1, class T1, class C1, class A1>
friend bool operator< (const flat_multimap<K1, T1, C1, A1>& x, friend bool operator< (const flat_multimap<K1, T1, C1, A1>& x,
const flat_multimap<K1, T1, C1, A1>& y); const flat_multimap<K1, T1, C1, A1>& y);
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}; };
template <class Key, class T, class Compare, class Allocator> template <class Key, class T, class Compare, class Allocator>
@@ -1684,7 +1684,7 @@ inline void swap(flat_multimap<Key,T,Compare,Allocator>& x, flat_multimap<Key,T,
}} }}
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace boost { namespace boost {
@@ -1698,7 +1698,7 @@ struct has_trivial_destructor_after_move< boost::container::flat_multimap<K, T,
} //namespace boost { } //namespace boost {
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
#include <boost/container/detail/config_end.hpp> #include <boost/container/detail/config_end.hpp>

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -31,7 +31,7 @@
namespace boost { namespace boost {
namespace container { namespace container {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
// Forward declarations of operators < and ==, needed for friend declaration. // Forward declarations of operators < and ==, needed for friend declaration.
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
@@ -48,7 +48,7 @@ inline bool operator==(const flat_set<Key,Compare,Allocator>& x,
template <class Key, class Compare, class Allocator> template <class Key, class Compare, class Allocator>
inline bool operator<(const flat_set<Key,Compare,Allocator>& x, inline bool operator<(const flat_set<Key,Compare,Allocator>& x,
const flat_set<Key,Compare,Allocator>& y); const flat_set<Key,Compare,Allocator>& y);
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! flat_set is a Sorted Associative Container that stores objects of type Key. //! flat_set is a Sorted Associative Container that stores objects of type Key.
//! It is also a Unique Associative Container, meaning that no two elements are the same. //! It is also a Unique Associative Container, meaning that no two elements are the same.
@@ -68,12 +68,12 @@ template <class Key, class Compare, class Allocator>
#endif #endif
class flat_set class flat_set
{ {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
BOOST_COPYABLE_AND_MOVABLE(flat_set) BOOST_COPYABLE_AND_MOVABLE(flat_set)
typedef container_detail::flat_tree<Key, Key, container_detail::identity<Key>, Compare, Allocator> tree_t; typedef container_detail::flat_tree<Key, Key, container_detail::identity<Key>, Compare, Allocator> tree_t;
tree_t m_flat_tree; // flat tree representing flat_set tree_t m_flat_tree; // flat tree representing flat_set
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public: public:
////////////////////////////////////////////// //////////////////////////////////////////////
@@ -678,7 +678,7 @@ class flat_set
std::pair<iterator,iterator> equal_range(const key_type& x) std::pair<iterator,iterator> equal_range(const key_type& x)
{ return m_flat_tree.equal_range(x); } { return m_flat_tree.equal_range(x); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class K1, class C1, class A1> template <class K1, class C1, class A1>
friend bool operator== (const flat_set<K1,C1,A1>&, const flat_set<K1,C1,A1>&); friend bool operator== (const flat_set<K1,C1,A1>&, const flat_set<K1,C1,A1>&);
@@ -693,7 +693,7 @@ class flat_set
template<class KeyType> template<class KeyType>
iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x) iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x)
{ return m_flat_tree.insert_unique(p, ::boost::forward<KeyType>(x)); } { return m_flat_tree.insert_unique(p, ::boost::forward<KeyType>(x)); }
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}; };
template <class Key, class Compare, class Allocator> template <class Key, class Compare, class Allocator>
@@ -730,7 +730,7 @@ template <class Key, class Compare, class Allocator>
inline void swap(flat_set<Key,Compare,Allocator>& x, flat_set<Key,Compare,Allocator>& y) inline void swap(flat_set<Key,Compare,Allocator>& x, flat_set<Key,Compare,Allocator>& y)
{ x.swap(y); } { x.swap(y); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
} //namespace container { } //namespace container {
@@ -760,7 +760,7 @@ inline bool operator==(const flat_multiset<Key,Compare,Allocator>& x,
template <class Key, class Compare, class Allocator> template <class Key, class Compare, class Allocator>
inline bool operator<(const flat_multiset<Key,Compare,Allocator>& x, inline bool operator<(const flat_multiset<Key,Compare,Allocator>& x,
const flat_multiset<Key,Compare,Allocator>& y); const flat_multiset<Key,Compare,Allocator>& y);
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! flat_multiset is a Sorted Associative Container that stores objects of type Key. //! flat_multiset is a Sorted Associative Container that stores objects of type Key.
//! //!
@@ -781,12 +781,12 @@ template <class Key, class Compare, class Allocator>
#endif #endif
class flat_multiset class flat_multiset
{ {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
BOOST_COPYABLE_AND_MOVABLE(flat_multiset) BOOST_COPYABLE_AND_MOVABLE(flat_multiset)
typedef container_detail::flat_tree<Key, Key, container_detail::identity<Key>, Compare, Allocator> tree_t; typedef container_detail::flat_tree<Key, Key, container_detail::identity<Key>, Compare, Allocator> tree_t;
tree_t m_flat_tree; // flat tree representing flat_multiset tree_t m_flat_tree; // flat tree representing flat_multiset
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public: public:
////////////////////////////////////////////// //////////////////////////////////////////////
@@ -1353,7 +1353,7 @@ class flat_multiset
std::pair<iterator,iterator> equal_range(const key_type& x) std::pair<iterator,iterator> equal_range(const key_type& x)
{ return m_flat_tree.equal_range(x); } { return m_flat_tree.equal_range(x); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class K1, class C1, class A1> template <class K1, class C1, class A1>
friend bool operator== (const flat_multiset<K1,C1,A1>&, friend bool operator== (const flat_multiset<K1,C1,A1>&,
const flat_multiset<K1,C1,A1>&); const flat_multiset<K1,C1,A1>&);
@@ -1368,7 +1368,7 @@ class flat_multiset
template <class KeyType> template <class KeyType>
iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x) iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x)
{ return m_flat_tree.insert_equal(p, ::boost::forward<KeyType>(x)); } { return m_flat_tree.insert_equal(p, ::boost::forward<KeyType>(x)); }
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}; };
template <class Key, class Compare, class Allocator> template <class Key, class Compare, class Allocator>
@@ -1405,7 +1405,7 @@ template <class Key, class Compare, class Allocator>
inline void swap(flat_multiset<Key,Compare,Allocator>& x, flat_multiset<Key,Compare,Allocator>& y) inline void swap(flat_multiset<Key,Compare,Allocator>& x, flat_multiset<Key,Compare,Allocator>& y)
{ x.swap(y); } { x.swap(y); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
} //namespace container { } //namespace container {
@@ -1419,7 +1419,7 @@ struct has_trivial_destructor_after_move<boost::container::flat_multiset<Key, C,
namespace container { namespace container {
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}} }}

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -47,7 +47,7 @@
namespace boost { namespace boost {
namespace container { namespace container {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace container_detail { namespace container_detail {
template<class VoidPointer> template<class VoidPointer>
@@ -99,7 +99,7 @@ struct intrusive_list_type
}; };
} //namespace container_detail { } //namespace container_detail {
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! A list is a doubly linked list. That is, it is a Sequence that supports both //! A list is a doubly linked list. That is, it is a Sequence that supports both
//! forward and backward traversal, and (amortized) constant time insertion and //! forward and backward traversal, and (amortized) constant time insertion and
@@ -120,7 +120,7 @@ class list
: protected container_detail::node_alloc_holder : protected container_detail::node_alloc_holder
<Allocator, typename container_detail::intrusive_list_type<Allocator>::type> <Allocator, typename container_detail::intrusive_list_type<Allocator>::type>
{ {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef typename typedef typename
container_detail::intrusive_list_type<Allocator>::type Icont; container_detail::intrusive_list_type<Allocator>::type Icont;
typedef container_detail::node_alloc_holder<Allocator, Icont> AllocHolder; typedef container_detail::node_alloc_holder<Allocator, Icont> AllocHolder;
@@ -167,7 +167,7 @@ class list
typedef container_detail::iterator<typename Icont::iterator, false> iterator_impl; typedef container_detail::iterator<typename Icont::iterator, false> iterator_impl;
typedef container_detail::iterator<typename Icont::iterator, true> const_iterator_impl; typedef container_detail::iterator<typename Icont::iterator, true> const_iterator_impl;
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public: public:
////////////////////////////////////////////// //////////////////////////////////////////////
@@ -1216,7 +1216,7 @@ class list
void reverse() BOOST_CONTAINER_NOEXCEPT void reverse() BOOST_CONTAINER_NOEXCEPT
{ this->icont().reverse(); } { this->icont().reverse(); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
bool priv_try_shrink(size_type new_size) bool priv_try_shrink(size_type new_size)
@@ -1303,7 +1303,7 @@ class list
bool operator()(const value_type &a, const value_type &b) const bool operator()(const value_type &a, const value_type &b) const
{ return a == b; } { return a == b; }
}; };
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}; };
@@ -1362,7 +1362,7 @@ inline void swap(list<T, Allocator>& x, list<T, Allocator>& y)
x.swap(y); x.swap(y);
} }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
} //namespace container { } //namespace container {
@@ -1375,7 +1375,7 @@ struct has_trivial_destructor_after_move<boost::container::list<T, Allocator> >
namespace container { namespace container {
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}} }}

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -39,7 +39,7 @@
namespace boost { namespace boost {
namespace container { namespace container {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
// Forward declarations of operators == and <, needed for friend declarations. // Forward declarations of operators == and <, needed for friend declarations.
template <class Key, class T, class Compare, class Allocator> template <class Key, class T, class Compare, class Allocator>
inline bool operator==(const map<Key,T,Compare,Allocator>& x, inline bool operator==(const map<Key,T,Compare,Allocator>& x,
@@ -48,7 +48,7 @@ inline bool operator==(const map<Key,T,Compare,Allocator>& x,
template <class Key, class T, class Compare, class Allocator> template <class Key, class T, class Compare, class Allocator>
inline bool operator<(const map<Key,T,Compare,Allocator>& x, inline bool operator<(const map<Key,T,Compare,Allocator>& x,
const map<Key,T,Compare,Allocator>& y); const map<Key,T,Compare,Allocator>& y);
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! A map is a kind of associative container that supports unique keys (contains at //! A map is a kind of associative container that supports unique keys (contains at
//! most one of each key value) and provides for fast retrieval of values of another //! most one of each key value) and provides for fast retrieval of values of another
@@ -69,7 +69,7 @@ template <class Key, class T, class Compare, class Allocator>
#endif #endif
class map class map
{ {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
BOOST_COPYABLE_AND_MOVABLE(map) BOOST_COPYABLE_AND_MOVABLE(map)
@@ -81,7 +81,7 @@ class map
< Key, value_type_impl, Compare, container_detail::select1st<value_type_impl> < Key, value_type_impl, Compare, container_detail::select1st<value_type_impl>
> value_compare_impl; > value_compare_impl;
tree_t m_tree; // red-black tree representing map tree_t m_tree; // red-black tree representing map
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public: public:
////////////////////////////////////////////// //////////////////////////////////////////////
@@ -755,7 +755,7 @@ class map
std::pair<const_iterator,const_iterator> equal_range(const key_type& x) const std::pair<const_iterator,const_iterator> equal_range(const key_type& x) const
{ return m_tree.equal_range(x); } { return m_tree.equal_range(x); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class K1, class T1, class C1, class A1> template <class K1, class T1, class C1, class A1>
friend bool operator== (const map<K1, T1, C1, A1>&, friend bool operator== (const map<K1, T1, C1, A1>&,
const map<K1, T1, C1, A1>&); const map<K1, T1, C1, A1>&);
@@ -790,7 +790,7 @@ class map
return (*i).second; return (*i).second;
} }
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}; };
template <class Key, class T, class Compare, class Allocator> template <class Key, class T, class Compare, class Allocator>
@@ -827,7 +827,7 @@ template <class Key, class T, class Compare, class Allocator>
inline void swap(map<Key,T,Compare,Allocator>& x, map<Key,T,Compare,Allocator>& y) inline void swap(map<Key,T,Compare,Allocator>& x, map<Key,T,Compare,Allocator>& y)
{ x.swap(y); } { x.swap(y); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
// Forward declaration of operators < and ==, needed for friend declaration. // Forward declaration of operators < and ==, needed for friend declaration.
@@ -851,7 +851,7 @@ struct has_trivial_destructor_after_move<boost::container::map<K, T, C, Allocato
namespace container { namespace container {
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! A multimap is a kind of associative container that supports equivalent keys //! A multimap is a kind of associative container that supports equivalent keys
//! (possibly containing multiple copies of the same key value) and provides for //! (possibly containing multiple copies of the same key value) and provides for
@@ -873,7 +873,7 @@ template <class Key, class T, class Compare, class Allocator>
#endif #endif
class multimap class multimap
{ {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
BOOST_COPYABLE_AND_MOVABLE(multimap) BOOST_COPYABLE_AND_MOVABLE(multimap)
@@ -885,7 +885,7 @@ class multimap
< Key, value_type_impl, Compare, container_detail::select1st<value_type_impl> < Key, value_type_impl, Compare, container_detail::select1st<value_type_impl>
> value_compare_impl; > value_compare_impl;
tree_t m_tree; // red-black tree representing map tree_t m_tree; // red-black tree representing map
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public: public:
////////////////////////////////////////////// //////////////////////////////////////////////
@@ -1463,7 +1463,7 @@ class multimap
std::pair<const_iterator,const_iterator> equal_range(const key_type& x) const std::pair<const_iterator,const_iterator> equal_range(const key_type& x) const
{ return m_tree.equal_range(x); } { return m_tree.equal_range(x); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class K1, class T1, class C1, class A1> template <class K1, class T1, class C1, class A1>
friend bool operator== (const multimap<K1, T1, C1, A1>& x, friend bool operator== (const multimap<K1, T1, C1, A1>& x,
const multimap<K1, T1, C1, A1>& y); const multimap<K1, T1, C1, A1>& y);
@@ -1471,7 +1471,7 @@ class multimap
template <class K1, class T1, class C1, class A1> template <class K1, class T1, class C1, class A1>
friend bool operator< (const multimap<K1, T1, C1, A1>& x, friend bool operator< (const multimap<K1, T1, C1, A1>& x,
const multimap<K1, T1, C1, A1>& y); const multimap<K1, T1, C1, A1>& y);
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}; };
template <class Key, class T, class Compare, class Allocator> template <class Key, class T, class Compare, class Allocator>
@@ -1508,7 +1508,7 @@ template <class Key, class T, class Compare, class Allocator>
inline void swap(multimap<Key,T,Compare,Allocator>& x, multimap<Key,T,Compare,Allocator>& y) inline void swap(multimap<Key,T,Compare,Allocator>& x, multimap<Key,T,Compare,Allocator>& y)
{ x.swap(y); } { x.swap(y); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
} //namespace container { } //namespace container {
@@ -1522,7 +1522,7 @@ struct has_trivial_destructor_after_move<boost::container::multimap<K, T, C, All
namespace container { namespace container {
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}} }}

View File

@@ -6,7 +6,7 @@
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2011-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -46,7 +46,7 @@ namespace boost { namespace container {
//! and if T is used in a context where a container must call such a constructor, then the program is //! and if T is used in a context where a container must call such a constructor, then the program is
//! ill-formed. //! ill-formed.
//! //!
//! [Example: //! <code>
//! template <class T, class Allocator = allocator<T> > //! template <class T, class Allocator = allocator<T> >
//! class Z { //! class Z {
//! public: //! public:
@@ -64,7 +64,7 @@ namespace boost { namespace container {
//! template <class T, class Allocator = allocator<T> > //! template <class T, class Allocator = allocator<T> >
//! struct constructible_with_allocator_suffix<Z<T,Allocator> > //! struct constructible_with_allocator_suffix<Z<T,Allocator> >
//! : ::boost::true_type { }; //! : ::boost::true_type { };
//! -- end example] //! </code>
//! //!
//! <b>Note</b>: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)" //! <b>Note</b>: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)"
//! (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as //! (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as
@@ -90,7 +90,7 @@ struct constructible_with_allocator_suffix
//! called with these initial arguments, and if T is used in a context where a container must call such //! called with these initial arguments, and if T is used in a context where a container must call such
//! a constructor, then the program is ill-formed. //! a constructor, then the program is ill-formed.
//! //!
//! [Example: //! <code>
//! template <class T, class Allocator = allocator<T> > //! template <class T, class Allocator = allocator<T> >
//! class Y { //! class Y {
//! public: //! public:
@@ -115,7 +115,7 @@ struct constructible_with_allocator_suffix
//! struct constructible_with_allocator_prefix<Y<T,Allocator> > //! struct constructible_with_allocator_prefix<Y<T,Allocator> >
//! : ::boost::true_type { }; //! : ::boost::true_type { };
//! //!
//! -- end example] //! </code>
//! //!
//! <b>Note</b>: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)" //! <b>Note</b>: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)"
//! (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as //! (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as
@@ -130,7 +130,7 @@ struct constructible_with_allocator_prefix
: ::boost::false_type : ::boost::false_type
{}; {};
///@cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace container_detail { namespace container_detail {
@@ -159,7 +159,7 @@ struct uses_allocator_imp
} //namespace container_detail { } //namespace container_detail {
///@endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! <b>Remark</b>: Automatically detects if T has a nested allocator_type that is convertible from //! <b>Remark</b>: Automatically detects if T has a nested allocator_type that is convertible from
//! Alloc. Meets the BinaryTypeTrait requirements ([meta.rqmts] 20.4.1). A program may //! Alloc. Meets the BinaryTypeTrait requirements ([meta.rqmts] 20.4.1). A program may
@@ -173,7 +173,7 @@ struct uses_allocator
: boost::integral_constant<bool, container_detail::uses_allocator_imp<T, Alloc>::value> : boost::integral_constant<bool, container_detail::uses_allocator_imp<T, Alloc>::value>
{}; {};
///@cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace container_detail { namespace container_detail {
@@ -675,16 +675,16 @@ class scoped_allocator_adaptor_base
friend void swap(scoped_allocator_adaptor_base &l, scoped_allocator_adaptor_base &r) friend void swap(scoped_allocator_adaptor_base &l, scoped_allocator_adaptor_base &r)
{ l.swap(r); } { l.swap(r); }
inner_allocator_type& inner_allocator() inner_allocator_type& inner_allocator() BOOST_CONTAINER_NOEXCEPT
{ return m_inner; } { return m_inner; }
inner_allocator_type const& inner_allocator() const inner_allocator_type const& inner_allocator() const BOOST_CONTAINER_NOEXCEPT
{ return m_inner; } { return m_inner; }
outer_allocator_type & outer_allocator() outer_allocator_type & outer_allocator() BOOST_CONTAINER_NOEXCEPT
{ return static_cast<outer_allocator_type&>(*this); } { return static_cast<outer_allocator_type&>(*this); }
const outer_allocator_type &outer_allocator() const const outer_allocator_type &outer_allocator() const BOOST_CONTAINER_NOEXCEPT
{ return static_cast<const outer_allocator_type&>(*this); } { return static_cast<const outer_allocator_type&>(*this); }
scoped_allocator_type select_on_container_copy_construction() const scoped_allocator_type select_on_container_copy_construction() const
@@ -1008,7 +1008,7 @@ class scoped_allocator_adaptor_base
} //namespace container_detail { } //namespace container_detail {
///@endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//Scoped allocator //Scoped allocator
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -1038,14 +1038,14 @@ class scoped_allocator_adaptor_base
//! scoped_allocator_adaptor is derived from the outer allocator type so it can be //! scoped_allocator_adaptor is derived from the outer allocator type so it can be
//! substituted for the outer allocator type in most expressions. -end note] //! substituted for the outer allocator type in most expressions. -end note]
//! //!
//! In the construct member functions, `OUTERMOST(x)` is x if x does not have //! In the construct member functions, <code>OUTERMOST(x)</code> is x if x does not have
//! an `outer_allocator()` member function and //! an <code>outer_allocator()</code> member function and
//! `OUTERMOST(x.outer_allocator())` otherwise; `OUTERMOST_ALLOC_TRAITS(x)` is //! <code>OUTERMOST(x.outer_allocator())</code> otherwise; <code>OUTERMOST_ALLOC_TRAITS(x)</code> is
//! `allocator_traits<decltype(OUTERMOST(x))>`. //! <code>allocator_traits<decltype(OUTERMOST(x))></code>.
//! //!
//! [<b>Note</b>: `OUTERMOST(x)` and //! [<b>Note</b>: <code>OUTERMOST(x)</code> and
//! `OUTERMOST_ALLOC_TRAITS(x)` are recursive operations. It is incumbent upon //! <code>OUTERMOST_ALLOC_TRAITS(x)</code> are recursive operations. It is incumbent upon
//! the definition of `outer_allocator()` to ensure that the recursion terminates. //! the definition of <code>outer_allocator()</code> to ensure that the recursion terminates.
//! It will terminate for all instantiations of scoped_allocator_adaptor. -end note] //! It will terminate for all instantiations of scoped_allocator_adaptor. -end note]
template <typename OuterAlloc, typename ...InnerAllocs> template <typename OuterAlloc, typename ...InnerAllocs>
class scoped_allocator_adaptor class scoped_allocator_adaptor
@@ -1076,7 +1076,7 @@ class scoped_allocator_adaptor
BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor) BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor)
public: public:
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef container_detail::scoped_allocator_adaptor_base typedef container_detail::scoped_allocator_adaptor_base
<OuterAlloc <OuterAlloc
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
@@ -1086,13 +1086,13 @@ class scoped_allocator_adaptor
#endif #endif
> base_type; > base_type;
typedef typename base_type::internal_type_t internal_type_t; typedef typename base_type::internal_type_t internal_type_t;
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef OuterAlloc outer_allocator_type; typedef OuterAlloc outer_allocator_type;
//! Type: For exposition only //! Type: For exposition only
//! //!
typedef allocator_traits<OuterAlloc> outer_traits_type; typedef allocator_traits<OuterAlloc> outer_traits_type;
//! Type: `scoped_allocator_adaptor<OuterAlloc>` if `sizeof...(InnerAllocs)` is zero; otherwise, //! Type: <code>scoped_allocator_adaptor<OuterAlloc></code> if <code>sizeof...(InnerAllocs)</code> is zero; otherwise,
//! `scoped_allocator_adaptor<InnerAllocs...>`. //! <code>scoped_allocator_adaptor<InnerAllocs...></code>.
typedef typename base_type::inner_allocator_type inner_allocator_type; typedef typename base_type::inner_allocator_type inner_allocator_type;
typedef allocator_traits<inner_allocator_type> inner_traits_type; typedef allocator_traits<inner_allocator_type> inner_traits_type;
typedef typename outer_traits_type::value_type value_type; typedef typename outer_traits_type::value_type value_type;
@@ -1102,23 +1102,23 @@ class scoped_allocator_adaptor
typedef typename outer_traits_type::const_pointer const_pointer; typedef typename outer_traits_type::const_pointer const_pointer;
typedef typename outer_traits_type::void_pointer void_pointer; typedef typename outer_traits_type::void_pointer void_pointer;
typedef typename outer_traits_type::const_void_pointer const_void_pointer; typedef typename outer_traits_type::const_void_pointer const_void_pointer;
//! Type: `true_type` if `allocator_traits<Allocator>::propagate_on_container_copy_assignment::value` is //! Type: <code>true_type</code> if <code>allocator_traits<Allocator>::propagate_on_container_copy_assignment::value</code> is
//! true for any `Allocator` in the set of `OuterAlloc` and `InnerAllocs...`; otherwise, false_type. //! true for any <code>Allocator</code> in the set of <code>OuterAlloc</code> and <code>InnerAllocs...</code>; otherwise, false_type.
typedef typename base_type:: typedef typename base_type::
propagate_on_container_copy_assignment propagate_on_container_copy_assignment; propagate_on_container_copy_assignment propagate_on_container_copy_assignment;
//! Type: `true_type` if `allocator_traits<Allocator>::propagate_on_container_move_assignment::value` is //! Type: <code>true_type</code> if <code>allocator_traits<Allocator>::propagate_on_container_move_assignment::value</code> is
//! true for any `Allocator` in the set of `OuterAlloc` and `InnerAllocs...`; otherwise, false_type. //! true for any <code>Allocator</code> in the set of <code>OuterAlloc</code> and <code>InnerAllocs...</code>; otherwise, false_type.
typedef typename base_type:: typedef typename base_type::
propagate_on_container_move_assignment propagate_on_container_move_assignment; propagate_on_container_move_assignment propagate_on_container_move_assignment;
//! Type: `true_type` if `allocator_traits<Allocator>::propagate_on_container_swap::value` is true for any //! Type: <code>true_type</code> if <code>allocator_traits<Allocator>::propagate_on_container_swap::value</code> is true for any
//! `Allocator` in the set of `OuterAlloc` and `InnerAllocs...`; otherwise, false_type. //! <code>Allocator</code> in the set of <code>OuterAlloc</code> and <code>InnerAllocs...</code>; otherwise, false_type.
typedef typename base_type:: typedef typename base_type::
propagate_on_container_swap propagate_on_container_swap; propagate_on_container_swap propagate_on_container_swap;
//! Type: Rebinds scoped allocator to //! Type: Rebinds scoped allocator to
//! `typedef scoped_allocator_adaptor //! <code>typedef scoped_allocator_adaptor
//! < typename outer_traits_type::template portable_rebind_alloc<U>::type //! < typename outer_traits_type::template portable_rebind_alloc<U>::type
//! , InnerAllocs... >` //! , InnerAllocs... ></code>
template <class U> template <class U>
struct rebind struct rebind
{ {
@@ -1224,55 +1224,55 @@ class scoped_allocator_adaptor
friend void swap(scoped_allocator_adaptor &l, scoped_allocator_adaptor &r); friend void swap(scoped_allocator_adaptor &l, scoped_allocator_adaptor &r);
//! <b>Returns</b>: //! <b>Returns</b>:
//! `static_cast<OuterAlloc&>(*this)`. //! <code>static_cast<OuterAlloc&>(*this)</code>.
outer_allocator_type & outer_allocator(); outer_allocator_type & outer_allocator() BOOST_CONTAINER_NOEXCEPT;
//! <b>Returns</b>: //! <b>Returns</b>:
//! `static_cast<const OuterAlloc&>(*this)`. //! <code>static_cast<const OuterAlloc&>(*this)</code>.
const outer_allocator_type &outer_allocator() const; const outer_allocator_type &outer_allocator() const BOOST_CONTAINER_NOEXCEPT;
//! <b>Returns</b>: //! <b>Returns</b>:
//! *this if `sizeof...(InnerAllocs)` is zero; otherwise, inner. //! *this if <code>sizeof...(InnerAllocs)</code> is zero; otherwise, inner.
inner_allocator_type& inner_allocator(); inner_allocator_type& inner_allocator() BOOST_CONTAINER_NOEXCEPT;
//! <b>Returns</b>: //! <b>Returns</b>:
//! *this if `sizeof...(InnerAllocs)` is zero; otherwise, inner. //! *this if <code>sizeof...(InnerAllocs)</code> is zero; otherwise, inner.
inner_allocator_type const& inner_allocator() const; inner_allocator_type const& inner_allocator() const BOOST_CONTAINER_NOEXCEPT;
#endif //BOOST_CONTAINER_DOXYGEN_INVOKED #endif //BOOST_CONTAINER_DOXYGEN_INVOKED
//! <b>Returns</b>: //! <b>Returns</b>:
//! `allocator_traits<OuterAlloc>::max_size(outer_allocator())`. //! <code>allocator_traits<OuterAlloc>::max_size(outer_allocator())</code>.
size_type max_size() const size_type max_size() const BOOST_CONTAINER_NOEXCEPT
{ {
return outer_traits_type::max_size(this->outer_allocator()); return outer_traits_type::max_size(this->outer_allocator());
} }
//! <b>Effects</b>: //! <b>Effects</b>:
//! calls `OUTERMOST_ALLOC_TRAITS(*this)::destroy(OUTERMOST(*this), p)`. //! calls <code>OUTERMOST_ALLOC_TRAITS(*this)::destroy(OUTERMOST(*this), p)</code>.
template <class T> template <class T>
void destroy(T* p) void destroy(T* p) BOOST_CONTAINER_NOEXCEPT
{ {
allocator_traits<typename outermost_allocator<OuterAlloc>::type> allocator_traits<typename outermost_allocator<OuterAlloc>::type>
::destroy(get_outermost_allocator(this->outer_allocator()), p); ::destroy(get_outermost_allocator(this->outer_allocator()), p);
} }
//! <b>Returns</b>: //! <b>Returns</b>:
//! `allocator_traits<OuterAlloc>::allocate(outer_allocator(), n)`. //! <code>allocator_traits<OuterAlloc>::allocate(outer_allocator(), n)</code>.
pointer allocate(size_type n) pointer allocate(size_type n)
{ {
return outer_traits_type::allocate(this->outer_allocator(), n); return outer_traits_type::allocate(this->outer_allocator(), n);
} }
//! <b>Returns</b>: //! <b>Returns</b>:
//! `allocator_traits<OuterAlloc>::allocate(outer_allocator(), n, hint)`. //! <code>allocator_traits<OuterAlloc>::allocate(outer_allocator(), n, hint)</code>.
pointer allocate(size_type n, const_void_pointer hint) pointer allocate(size_type n, const_void_pointer hint)
{ {
return outer_traits_type::allocate(this->outer_allocator(), n, hint); return outer_traits_type::allocate(this->outer_allocator(), n, hint);
} }
//! <b>Effects</b>: //! <b>Effects</b>:
//! `allocator_traits<OuterAlloc>::deallocate(outer_allocator(), p, n)`. //! <code>allocator_traits<OuterAlloc>::deallocate(outer_allocator(), p, n)</code>.
void deallocate(pointer p, size_type n) void deallocate(pointer p, size_type n)
{ {
outer_traits_type::deallocate(this->outer_allocator(), p, n); outer_traits_type::deallocate(this->outer_allocator(), p, n);
@@ -1281,45 +1281,45 @@ class scoped_allocator_adaptor
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
//! <b>Returns</b>: Allocator new scoped_allocator_adaptor object where each allocator //! <b>Returns</b>: Allocator new scoped_allocator_adaptor object where each allocator
//! A in the adaptor is initialized from the result of calling //! A in the adaptor is initialized from the result of calling
//! `allocator_traits<Allocator>::select_on_container_copy_construction()` on //! <code>allocator_traits<Allocator>::select_on_container_copy_construction()</code> on
//! the corresponding allocator in *this. //! the corresponding allocator in *this.
scoped_allocator_adaptor select_on_container_copy_construction() const; scoped_allocator_adaptor select_on_container_copy_construction() const;
#endif //BOOST_CONTAINER_DOXYGEN_INVOKED #endif //BOOST_CONTAINER_DOXYGEN_INVOKED
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
base_type &base() { return *this; } base_type &base() { return *this; }
const base_type &base() const { return *this; } const base_type &base() const { return *this; }
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: //! <b>Effects</b>:
//! 1) If `uses_allocator<T, inner_allocator_type>::value` is false calls //! 1) If <code>uses_allocator<T, inner_allocator_type>::value</code> is false calls
//! `OUTERMOST_ALLOC_TRAITS(*this)::construct //! <code>OUTERMOST_ALLOC_TRAITS(*this)::construct
//! (OUTERMOST(*this), p, std::forward<Args>(args)...)`. //! (OUTERMOST(*this), p, std::forward<Args>(args)...)</code>.
//! //!
//! 2) Otherwise, if `uses_allocator<T, inner_allocator_type>::value` is true and //! 2) Otherwise, if <code>uses_allocator<T, inner_allocator_type>::value</code> is true and
//! `is_constructible<T, allocator_arg_t, inner_allocator_type, Args...>::value` is true, calls //! <code>is_constructible<T, allocator_arg_t, inner_allocator_type, Args...>::value</code> is true, calls
//! `OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p, allocator_arg, //! <code>OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p, allocator_arg,
//! inner_allocator(), std::forward<Args>(args)...)`. //! inner_allocator(), std::forward<Args>(args)...)</code>.
//! //!
//! [<b>Note</b>: In compilers without advanced decltype SFINAE support, `is_constructible` can't //! [<b>Note</b>: In compilers without advanced decltype SFINAE support, <code>is_constructible</code> can't
//! be implemented so that condition will be replaced by //! be implemented so that condition will be replaced by
//! constructible_with_allocator_prefix<T>::value. -end note] //! constructible_with_allocator_prefix<T>::value. -end note]
//! //!
//! 3) Otherwise, if uses_allocator<T, inner_allocator_type>::value is true and //! 3) Otherwise, if uses_allocator<T, inner_allocator_type>::value is true and
//! `is_constructible<T, Args..., inner_allocator_type>::value` is true, calls //! <code>is_constructible<T, Args..., inner_allocator_type>::value</code> is true, calls
//! `OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p, //! <code>OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p,
//! std::forward<Args>(args)..., inner_allocator())`. //! std::forward<Args>(args)..., inner_allocator())</code>.
//! //!
//! [<b>Note</b>: In compilers without advanced decltype SFINAE support, `is_constructible` can't be //! [<b>Note</b>: In compilers without advanced decltype SFINAE support, <code>is_constructible</code> can't be
//! implemented so that condition will be replaced by //! implemented so that condition will be replaced by
//! `constructible_with_allocator_suffix<T>::value`. -end note] //! <code>constructible_with_allocator_suffix<T>::value</code>. -end note]
//! //!
//! 4) Otherwise, the program is ill-formed. //! 4) Otherwise, the program is ill-formed.
//! //!
//! [<b>Note</b>: An error will result if `uses_allocator` evaluates //! [<b>Note</b>: An error will result if <code>uses_allocator</code> evaluates
//! to true but the specific constructor does not take an allocator. This definition prevents a silent //! to true but the specific constructor does not take an allocator. This definition prevents a silent
//! failure to pass an inner allocator to a contained element. -end note] //! failure to pass an inner allocator to a contained element. -end note]
template < typename T, class ...Args> template < typename T, class ...Args>
@@ -1395,7 +1395,7 @@ class scoped_allocator_adaptor
, BOOST_RV_REF_BEG container_detail::pair<U, V> BOOST_RV_REF_END x) , BOOST_RV_REF_BEG container_detail::pair<U, V> BOOST_RV_REF_END x)
{ this->construct_pair(p, x); } { this->construct_pair(p, x); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
template <class Pair> template <class Pair>
void construct_pair(Pair* p) void construct_pair(Pair* p)
@@ -1463,7 +1463,7 @@ class scoped_allocator_adaptor
: base_type(internal_type_t(), ::boost::forward<OuterA2>(outer), inner) : base_type(internal_type_t(), ::boost::forward<OuterA2>(outer), inner)
{} {}
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}; };
template <typename OuterA1, typename OuterA2 template <typename OuterA1, typename OuterA2

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2011-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -11,6 +11,10 @@
#ifndef BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP #ifndef BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP
#define BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP #define BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP
//! \file
//! This header file forward declares boost::container::scoped_allocator_adaptor
//! and defines the following types:
#if defined(_MSC_VER) #if defined(_MSC_VER)
# pragma once # pragma once
#endif #endif
@@ -25,7 +29,7 @@
namespace boost { namespace container { namespace boost { namespace container {
///@cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
@@ -55,7 +59,7 @@ class scoped_allocator_adaptor;
#endif #endif
///@endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! The allocator_arg_t struct is an empty structure type used as a unique type to //! The allocator_arg_t struct is an empty structure type used as a unique type to
//! disambiguate constructor and function overloading. Specifically, several types //! disambiguate constructor and function overloading. Specifically, several types

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -35,7 +35,7 @@
namespace boost { namespace boost {
namespace container { namespace container {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
// Forward declarations of operators < and ==, needed for friend declaration. // Forward declarations of operators < and ==, needed for friend declaration.
template <class Key, class Compare, class Allocator> template <class Key, class Compare, class Allocator>
inline bool operator==(const set<Key,Compare,Allocator>& x, inline bool operator==(const set<Key,Compare,Allocator>& x,
@@ -44,7 +44,7 @@ inline bool operator==(const set<Key,Compare,Allocator>& x,
template <class Key, class Compare, class Allocator> template <class Key, class Compare, class Allocator>
inline bool operator<(const set<Key,Compare,Allocator>& x, inline bool operator<(const set<Key,Compare,Allocator>& x,
const set<Key,Compare,Allocator>& y); const set<Key,Compare,Allocator>& y);
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! A set is a kind of associative container that supports unique keys (contains at //! A set is a kind of associative container that supports unique keys (contains at
//! most one of each key value) and provides for fast retrieval of the keys themselves. //! most one of each key value) and provides for fast retrieval of the keys themselves.
@@ -60,13 +60,13 @@ template <class Key, class Compare, class Allocator>
#endif #endif
class set class set
{ {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
BOOST_COPYABLE_AND_MOVABLE(set) BOOST_COPYABLE_AND_MOVABLE(set)
typedef container_detail::rbtree<Key, Key, typedef container_detail::rbtree<Key, Key,
container_detail::identity<Key>, Compare, Allocator> tree_t; container_detail::identity<Key>, Compare, Allocator> tree_t;
tree_t m_tree; // red-black tree representing set tree_t m_tree; // red-black tree representing set
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public: public:
////////////////////////////////////////////// //////////////////////////////////////////////
@@ -600,7 +600,7 @@ class set
std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const
{ return m_tree.equal_range(x); } { return m_tree.equal_range(x); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class K1, class C1, class A1> template <class K1, class C1, class A1>
friend bool operator== (const set<K1,C1,A1>&, const set<K1,C1,A1>&); friend bool operator== (const set<K1,C1,A1>&, const set<K1,C1,A1>&);
@@ -615,7 +615,7 @@ class set
template <class KeyType> template <class KeyType>
iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x) iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x)
{ return m_tree.insert_unique(p, ::boost::forward<KeyType>(x)); } { return m_tree.insert_unique(p, ::boost::forward<KeyType>(x)); }
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}; };
template <class Key, class Compare, class Allocator> template <class Key, class Compare, class Allocator>
@@ -652,7 +652,7 @@ template <class Key, class Compare, class Allocator>
inline void swap(set<Key,Compare,Allocator>& x, set<Key,Compare,Allocator>& y) inline void swap(set<Key,Compare,Allocator>& x, set<Key,Compare,Allocator>& y)
{ x.swap(y); } { x.swap(y); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
} //namespace container { } //namespace container {
@@ -675,7 +675,7 @@ inline bool operator==(const multiset<Key,Compare,Allocator>& x,
template <class Key, class Compare, class Allocator> template <class Key, class Compare, class Allocator>
inline bool operator<(const multiset<Key,Compare,Allocator>& x, inline bool operator<(const multiset<Key,Compare,Allocator>& x,
const multiset<Key,Compare,Allocator>& y); const multiset<Key,Compare,Allocator>& y);
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! A multiset is a kind of associative container that supports equivalent keys //! A multiset is a kind of associative container that supports equivalent keys
//! (possibly contains multiple copies of the same key value) and provides for //! (possibly contains multiple copies of the same key value) and provides for
@@ -691,13 +691,13 @@ template <class Key, class Compare, class Allocator>
#endif #endif
class multiset class multiset
{ {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
BOOST_COPYABLE_AND_MOVABLE(multiset) BOOST_COPYABLE_AND_MOVABLE(multiset)
typedef container_detail::rbtree<Key, Key, typedef container_detail::rbtree<Key, Key,
container_detail::identity<Key>, Compare, Allocator> tree_t; container_detail::identity<Key>, Compare, Allocator> tree_t;
tree_t m_tree; // red-black tree representing multiset tree_t m_tree; // red-black tree representing multiset
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public: public:
@@ -1221,7 +1221,7 @@ class multiset
std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const
{ return m_tree.equal_range(x); } { return m_tree.equal_range(x); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class K1, class C1, class A1> template <class K1, class C1, class A1>
friend bool operator== (const multiset<K1,C1,A1>&, friend bool operator== (const multiset<K1,C1,A1>&,
const multiset<K1,C1,A1>&); const multiset<K1,C1,A1>&);
@@ -1237,7 +1237,7 @@ class multiset
iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x) iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x)
{ return m_tree.insert_equal(p, ::boost::forward<KeyType>(x)); } { return m_tree.insert_equal(p, ::boost::forward<KeyType>(x)); }
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}; };
template <class Key, class Compare, class Allocator> template <class Key, class Compare, class Allocator>
@@ -1274,7 +1274,7 @@ template <class Key, class Compare, class Allocator>
inline void swap(multiset<Key,Compare,Allocator>& x, multiset<Key,Compare,Allocator>& y) inline void swap(multiset<Key,Compare,Allocator>& x, multiset<Key,Compare,Allocator>& y)
{ x.swap(y); } { x.swap(y); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
} //namespace container { } //namespace container {
@@ -1288,7 +1288,7 @@ struct has_trivial_destructor_after_move<boost::container::multiset<Key, C, Allo
namespace container { namespace container {
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}} }}

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2004-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2004-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -48,7 +48,7 @@
namespace boost { namespace boost {
namespace container { namespace container {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class T, class Allocator> template <class T, class Allocator>
class slist; class slist;
@@ -106,7 +106,7 @@ struct intrusive_slist_type
} //namespace container_detail { } //namespace container_detail {
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! An slist is a singly linked list: a list where each element is linked to the next //! An slist is a singly linked list: a list where each element is linked to the next
//! element, but not to the previous element. That is, it is a Sequence that //! element, but not to the previous element. That is, it is a Sequence that
@@ -149,7 +149,7 @@ class slist
: protected container_detail::node_alloc_holder : protected container_detail::node_alloc_holder
<Allocator, typename container_detail::intrusive_slist_type<Allocator>::type> <Allocator, typename container_detail::intrusive_slist_type<Allocator>::type>
{ {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef typename typedef typename
container_detail::intrusive_slist_type<Allocator>::type Icont; container_detail::intrusive_slist_type<Allocator>::type Icont;
typedef container_detail::node_alloc_holder<Allocator, Icont> AllocHolder; typedef container_detail::node_alloc_holder<Allocator, Icont> AllocHolder;
@@ -195,7 +195,7 @@ class slist
BOOST_COPYABLE_AND_MOVABLE(slist) BOOST_COPYABLE_AND_MOVABLE(slist)
typedef container_detail::iterator<typename Icont::iterator, false> iterator_impl; typedef container_detail::iterator<typename Icont::iterator, false> iterator_impl;
typedef container_detail::iterator<typename Icont::iterator, true > const_iterator_impl; typedef container_detail::iterator<typename Icont::iterator, true > const_iterator_impl;
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public: public:
////////////////////////////////////////////// //////////////////////////////////////////////
@@ -1423,7 +1423,7 @@ class slist
void splice(const_iterator p, BOOST_RV_REF(slist) x, const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT void splice(const_iterator p, BOOST_RV_REF(slist) x, const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT
{ this->splice(p, static_cast<slist&>(x), first, last); } { this->splice(p, static_cast<slist&>(x), first, last); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
void priv_push_front (const T &x) void priv_push_front (const T &x)
@@ -1505,7 +1505,7 @@ class slist
const value_type &m_ref; const value_type &m_ref;
}; };
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}; };
template <class T, class Allocator> template <class T, class Allocator>
@@ -1561,7 +1561,7 @@ inline void swap(slist<T,Allocator>& x, slist<T,Allocator>& y)
}} }}
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace boost { namespace boost {
@@ -1574,14 +1574,14 @@ struct has_trivial_destructor_after_move<boost::container::slist<T, Allocator> >
namespace container { namespace container {
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}} //namespace boost{ namespace container { }} //namespace boost{ namespace container {
// Specialization of insert_iterator so that insertions will be constant // Specialization of insert_iterator so that insertions will be constant
// time rather than linear time. // time rather than linear time.
///@cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//Ummm, I don't like to define things in namespace std, but //Ummm, I don't like to define things in namespace std, but
//there is no other way //there is no other way
@@ -1620,7 +1620,7 @@ class insert_iterator<boost::container::slist<T, Allocator> >
} //namespace std; } //namespace std;
///@endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
#include <boost/container/detail/config_end.hpp> #include <boost/container/detail/config_end.hpp>

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2008-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -47,18 +47,18 @@
#include <memory> #include <memory>
#include <new> //placement new #include <new> //placement new
///@cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
#include <boost/container/vector.hpp> #include <boost/container/vector.hpp>
//#define STABLE_VECTOR_ENABLE_INVARIANT_CHECKING //#define STABLE_VECTOR_ENABLE_INVARIANT_CHECKING
///@endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace boost { namespace boost {
namespace container { namespace container {
///@cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace stable_vector_detail{ namespace stable_vector_detail{
@@ -393,7 +393,7 @@ struct index_traits
#endif //#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #endif //#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! Originally developed by Joaquin M. Lopez Munoz, stable_vector is a std::vector //! Originally developed by Joaquin M. Lopez Munoz, stable_vector is a std::vector
//! drop-in replacement implemented as a node container, offering iterator and reference //! drop-in replacement implemented as a node container, offering iterator and reference
@@ -433,7 +433,7 @@ template <class T, class Allocator>
#endif #endif
class stable_vector class stable_vector
{ {
///@cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef allocator_traits<Allocator> allocator_traits_type; typedef allocator_traits<Allocator> allocator_traits_type;
typedef boost::intrusive:: typedef boost::intrusive::
pointer_traits pointer_traits
@@ -504,7 +504,7 @@ class stable_vector
typedef stable_vector_detail::iterator typedef stable_vector_detail::iterator
< typename allocator_traits<Allocator>::pointer < typename allocator_traits<Allocator>::pointer
, false> const_iterator_impl; , false> const_iterator_impl;
///@endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public: public:
////////////////////////////////////////////// //////////////////////////////////////////////
@@ -526,7 +526,7 @@ class stable_vector
typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<iterator>) reverse_iterator; typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<iterator>) reverse_iterator;
typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<const_iterator>) const_reverse_iterator; typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<const_iterator>) const_reverse_iterator;
///@cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
BOOST_COPYABLE_AND_MOVABLE(stable_vector) BOOST_COPYABLE_AND_MOVABLE(stable_vector)
static const size_type ExtraPointers = index_traits_type::ExtraPointers; static const size_type ExtraPointers = index_traits_type::ExtraPointers;
@@ -536,7 +536,7 @@ class stable_vector
class push_back_rollback; class push_back_rollback;
friend class push_back_rollback; friend class push_back_rollback;
///@endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public: public:
////////////////////////////////////////////// //////////////////////////////////////////////
@@ -1510,7 +1510,7 @@ class stable_vector
void clear() BOOST_CONTAINER_NOEXCEPT void clear() BOOST_CONTAINER_NOEXCEPT
{ this->erase(this->cbegin(),this->cend()); } { this->erase(this->cbegin(),this->cend()); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
@@ -1836,7 +1836,7 @@ class stable_vector
const node_allocator_type &priv_node_alloc() const { return internal_data; } const node_allocator_type &priv_node_alloc() const { return internal_data; }
index_type index; index_type index;
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}; };
template <typename T,typename Allocator> template <typename T,typename Allocator>
@@ -1883,11 +1883,11 @@ void swap(stable_vector<T,Allocator>& x,stable_vector<T,Allocator>& y)
x.swap(y); x.swap(y);
} }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
#undef STABLE_VECTOR_CHECK_INVARIANT #undef STABLE_VECTOR_CHECK_INVARIANT
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
/* /*

View File

@@ -21,6 +21,8 @@
namespace boost { namespace container { namespace boost { namespace container {
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace container_detail { namespace container_detail {
template<class T, std::size_t N> template<class T, std::size_t N>
@@ -61,46 +63,46 @@ class static_storage_allocator
} //namespace container_detail { } //namespace container_detail {
/** #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
* @defgroup static_vector_non_member static_vector non-member functions
*/
/** //!
* @brief A variable-size array container with fixed capacity. //!@brief A variable-size array container with fixed capacity.
* //!
* static_vector is a sequence container like boost::container::vector with contiguous storage that can //!static_vector is a sequence container like boost::container::vector with contiguous storage that can
* change in size, along with the static allocation, low overhead, and fixed capacity of boost::array. //!change in size, along with the static allocation, low overhead, and fixed capacity of boost::array.
* //!
* A static_vector is a sequence that supports random access to elements, constant time insertion and //!A static_vector is a sequence that supports random access to elements, constant time insertion and
* removal of elements at the end, and linear time insertion and removal of elements at the beginning or //!removal of elements at the end, and linear time insertion and removal of elements at the beginning or
* in the middle. The number of elements in a static_vector may vary dynamically up to a fixed capacity //!in the middle. The number of elements in a static_vector may vary dynamically up to a fixed capacity
* because elements are stored within the object itself similarly to an array. However, objects are //!because elements are stored within the object itself similarly to an array. However, objects are
* initialized as they are inserted into static_vector unlike C arrays or std::array which must construct //!initialized as they are inserted into static_vector unlike C arrays or std::array which must construct
* all elements on instantiation. The behavior of static_vector enables the use of statically allocated //!all elements on instantiation. The behavior of static_vector enables the use of statically allocated
* elements in cases with complex object lifetime requirements that would otherwise not be trivially //!elements in cases with complex object lifetime requirements that would otherwise not be trivially
* possible. //!possible.
* //!
* @par Error Handling //!@par Error Handling
* Insertion beyond the capacity result in throwing std::bad_alloc() if exceptions are enabled or //! Insertion beyond the capacity result in throwing std::bad_alloc() if exceptions are enabled or
* calling throw_bad_alloc() if not enabled. //! calling throw_bad_alloc() if not enabled.
* //!
* std::out_of_range is thrown if out of bound access is performed in `at()` if exceptions are //! std::out_of_range is thrown if out of bound access is performed in <code>at()</code> if exceptions are
* enabled, throw_out_of_range() if not enabled. //! enabled, throw_out_of_range() if not enabled.
* //!
* @tparam Value The type of element that will be stored. //!@tparam Value The type of element that will be stored.
* @tparam Capacity The maximum number of elements static_vector can store, fixed at compile time. //!@tparam Capacity The maximum number of elements static_vector can store, fixed at compile time.
*/
template <typename Value, std::size_t Capacity> template <typename Value, std::size_t Capacity>
class static_vector class static_vector
: public vector<Value, container_detail::static_storage_allocator<Value, Capacity> > : public vector<Value, container_detail::static_storage_allocator<Value, Capacity> >
{ {
typedef vector<Value, container_detail::static_storage_allocator<Value, Capacity> > base_t; #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef vector<Value, container_detail::static_storage_allocator<Value, Capacity> > base_t;
BOOST_COPYABLE_AND_MOVABLE(static_vector) BOOST_COPYABLE_AND_MOVABLE(static_vector)
template<class U, std::size_t OtherCapacity> template<class U, std::size_t OtherCapacity>
friend class static_vector; friend class static_vector;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public: public:
//! @brief The type of elements stored in the container. //! @brief The type of elements stored in the container.
typedef typename base_t::value_type value_type; typedef typename base_t::value_type value_type;

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -52,7 +52,7 @@
namespace boost { namespace boost {
namespace container { namespace container {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace container_detail { namespace container_detail {
// ------------------------------------------------------------ // ------------------------------------------------------------
// Class basic_string_base. // Class basic_string_base.
@@ -268,7 +268,12 @@ class basic_string_base
} }
size_type next_capacity(size_type additional_objects) const size_type next_capacity(size_type additional_objects) const
{ return get_next_capacity(allocator_traits_type::max_size(this->alloc()), this->priv_storage(), additional_objects); } {
return next_capacity_calculator
<size_type, NextCapacityDouble /*NextCapacity60Percent*/>::
get( allocator_traits_type::max_size(this->alloc())
, this->priv_storage(), additional_objects );
}
void deallocate(pointer p, size_type n) void deallocate(pointer p, size_type n)
{ {
@@ -433,7 +438,7 @@ class basic_string_base
} //namespace container_detail { } //namespace container_detail {
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! The basic_string class represents a Sequence of characters. It contains all the //! The basic_string class represents a Sequence of characters. It contains all the
//! usual operations of a Sequence, and, additionally, it contains standard string //! usual operations of a Sequence, and, additionally, it contains standard string
@@ -471,7 +476,7 @@ template <class CharT, class Traits, class Allocator>
class basic_string class basic_string
: private container_detail::basic_string_base<Allocator> : private container_detail::basic_string_base<Allocator>
{ {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
typedef allocator_traits<Allocator> allocator_traits_type; typedef allocator_traits<Allocator> allocator_traits_type;
BOOST_COPYABLE_AND_MOVABLE(basic_string) BOOST_COPYABLE_AND_MOVABLE(basic_string)
@@ -509,7 +514,7 @@ class basic_string
std::bind1st(Eq_traits<Tr>(), x)) == m_last; std::bind1st(Eq_traits<Tr>(), x)) == m_last;
} }
}; };
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public: public:
////////////////////////////////////////////// //////////////////////////////////////////////
@@ -533,14 +538,14 @@ class basic_string
typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<const_iterator>) const_reverse_iterator; typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<const_iterator>) const_reverse_iterator;
static const size_type npos = size_type(-1); static const size_type npos = size_type(-1);
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
typedef constant_iterator<CharT, difference_type> cvalue_iterator; typedef constant_iterator<CharT, difference_type> cvalue_iterator;
typedef typename base_t::allocator_v1 allocator_v1; typedef typename base_t::allocator_v1 allocator_v1;
typedef typename base_t::allocator_v2 allocator_v2; typedef typename base_t::allocator_v2 allocator_v2;
typedef typename base_t::alloc_version alloc_version; typedef typename base_t::alloc_version alloc_version;
typedef ::boost::intrusive::pointer_traits<pointer> pointer_traits; typedef ::boost::intrusive::pointer_traits<pointer> pointer_traits;
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public: // Constructor, destructor, assignment. public: // Constructor, destructor, assignment.
////////////////////////////////////////////// //////////////////////////////////////////////
@@ -548,7 +553,7 @@ class basic_string
// construct/copy/destroy // construct/copy/destroy
// //
////////////////////////////////////////////// //////////////////////////////////////////////
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
struct reserve_t {}; struct reserve_t {};
basic_string(reserve_t, size_type n, basic_string(reserve_t, size_type n,
@@ -559,7 +564,7 @@ class basic_string
, n + 1) , n + 1)
{ this->priv_terminate_string(); } { this->priv_terminate_string(); }
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! <b>Effects</b>: Default constructs a basic_string. //! <b>Effects</b>: Default constructs a basic_string.
//! //!
@@ -668,6 +673,15 @@ class basic_string
this->assign(n, c); this->assign(n, c);
} }
//! <b>Effects</b>: Constructs a basic_string taking the allocator as parameter,
//! and is initialized by n default-initialized characters.
basic_string(size_type n, default_init_t, const allocator_type& a = allocator_type())
: base_t(a, n + 1)
{
this->priv_size(n);
this->priv_terminate_string();
}
//! <b>Effects</b>: Constructs a basic_string taking the allocator as parameter, //! <b>Effects</b>: Constructs a basic_string taking the allocator as parameter,
//! and a range of iterators. //! and a range of iterators.
template <class InputIterator> template <class InputIterator>
@@ -945,6 +959,26 @@ class basic_string
void resize(size_type n) void resize(size_type n)
{ resize(n, CharT()); } { resize(n, CharT()); }
//! <b>Effects</b>: Inserts or erases elements at the end such that
//! the size becomes n. New elements are uninitialized.
//!
//! <b>Throws</b>: If memory allocation throws
//!
//! <b>Complexity</b>: Linear to the difference between size() and new_size.
//!
//! <b>Note</b>: Non-standard extension
void resize(size_type n, default_init_t)
{
if (n <= this->size())
this->erase(this->begin() + n, this->end());
else{
this->priv_reserve(n, false);
this->priv_size(n);
this->priv_terminate_string();
}
}
//! <b>Effects</b>: Number of elements for which memory has been allocated. //! <b>Effects</b>: Number of elements for which memory has been allocated.
//! capacity() is always greater than or equal to size(). //! capacity() is always greater than or equal to size().
//! //!
@@ -961,29 +995,7 @@ class basic_string
//! //!
//! <b>Throws</b>: If memory allocation allocation throws //! <b>Throws</b>: If memory allocation allocation throws
void reserve(size_type res_arg) void reserve(size_type res_arg)
{ { this->priv_reserve(res_arg); }
if (res_arg > this->max_size()){
throw_length_error("basic_string::reserve max_size() exceeded");
}
if (this->capacity() < res_arg){
size_type n = container_detail::max_value(res_arg, this->size()) + 1;
size_type new_cap = this->next_capacity(n);
pointer new_start = this->allocation_command
(allocate_new, n, new_cap, new_cap).first;
size_type new_length = 0;
const pointer addr = this->priv_addr();
new_length += priv_uninitialized_copy
(addr, addr + this->priv_size(), new_start);
this->priv_construct_null(new_start + new_length);
this->deallocate_block();
this->is_short(false);
this->priv_long_addr(new_start);
this->priv_long_size(new_length);
this->priv_storage(new_cap);
}
}
//! <b>Effects</b>: Tries to deallocate the excess of memory created //! <b>Effects</b>: Tries to deallocate the excess of memory created
//! with previous allocations. The size of the string is unchanged //! with previous allocations. The size of the string is unchanged
@@ -2296,8 +2308,35 @@ class basic_string
int compare(size_type pos1, size_type n1, const CharT* s) const int compare(size_type pos1, size_type n1, const CharT* s) const
{ return this->compare(pos1, n1, s, Traits::length(s)); } { return this->compare(pos1, n1, s, Traits::length(s)); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
void priv_reserve(size_type res_arg, const bool null_terminate = true)
{
if (res_arg > this->max_size()){
throw_length_error("basic_string::reserve max_size() exceeded");
}
if (this->capacity() < res_arg){
size_type n = container_detail::max_value(res_arg, this->size()) + 1;
size_type new_cap = this->next_capacity(n);
pointer new_start = this->allocation_command
(allocate_new, n, new_cap, new_cap).first;
size_type new_length = 0;
const pointer addr = this->priv_addr();
new_length += priv_uninitialized_copy
(addr, addr + this->priv_size(), new_start);
if(null_terminate){
this->priv_construct_null(new_start + new_length);
}
this->deallocate_block();
this->is_short(false);
this->priv_long_addr(new_start);
this->priv_long_size(new_length);
this->priv_storage(new_cap);
}
}
static int s_compare(const_pointer f1, const_pointer l1, static int s_compare(const_pointer f1, const_pointer l1,
const_pointer f2, const_pointer l2) const_pointer f2, const_pointer l2)
{ {
@@ -2431,9 +2470,11 @@ class basic_string
return this->priv_replace(first, last, f, l, Category()); return this->priv_replace(first, last, f, l, Category());
} }
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}; };
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
//!Typedef for a basic_string of //!Typedef for a basic_string of
//!narrow characters //!narrow characters
typedef basic_string typedef basic_string
@@ -2450,6 +2491,8 @@ typedef basic_string
,std::allocator<wchar_t> > ,std::allocator<wchar_t> >
wstring; wstring;
#endif
// ------------------------------------------------------------ // ------------------------------------------------------------
// Non-member functions. // Non-member functions.
@@ -2663,7 +2706,7 @@ template <class CharT, class Traits, class Allocator>
inline void swap(basic_string<CharT,Traits,Allocator>& x, basic_string<CharT,Traits,Allocator>& y) inline void swap(basic_string<CharT,Traits,Allocator>& x, basic_string<CharT,Traits,Allocator>& y)
{ x.swap(y); } { x.swap(y); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
// I/O. // I/O.
namespace container_detail { namespace container_detail {
@@ -2683,7 +2726,7 @@ string_fill(std::basic_ostream<CharT, Traits>& os,
} }
} //namespace container_detail { } //namespace container_detail {
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class CharT, class Traits, class Allocator> template <class CharT, class Traits, class Allocator>
std::basic_ostream<CharT, Traits>& std::basic_ostream<CharT, Traits>&
@@ -2814,7 +2857,7 @@ inline std::size_t hash_value(basic_string<Ch, std::char_traits<Ch>, Allocator>
}} }}
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace boost { namespace boost {
@@ -2827,7 +2870,7 @@ struct has_trivial_destructor_after_move<boost::container::basic_string<C, T, Al
} }
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
#include <boost/container/detail/config_end.hpp> #include <boost/container/detail/config_end.hpp>

View File

@@ -76,26 +76,82 @@ namespace container {
#else //defined(BOOST_NO_EXCEPTIONS) #else //defined(BOOST_NO_EXCEPTIONS)
//! Exception callback called by Boost.Container when fails to allocate the requested storage space.
//! <ul>
//! <li>If BOOST_NO_EXCEPTIONS is NOT defined <code>std::bad_alloc()</code> is thrown.</li>
//!
//! <li>If BOOST_NO_EXCEPTIONS is defined and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS
//! is NOT defined <code>BOOST_ASSERT(!"boost::container bad_alloc thrown")</code> is called
//! and <code>std::abort()</code> if the former returns.</li>
//!
//! <li>If BOOST_NO_EXCEPTIONS and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS are defined
//! the user must provide an implementation and the function should not return.</li>
//! </ul>
inline void throw_bad_alloc() inline void throw_bad_alloc()
{ {
throw std::bad_alloc(); throw std::bad_alloc();
} }
//! Exception callback called by Boost.Container to signal arguments out of range.
//! <ul>
//! <li>If BOOST_NO_EXCEPTIONS is NOT defined <code>std::out_of_range(str)</code> is thrown.</li>
//!
//! <li>If BOOST_NO_EXCEPTIONS is defined and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS
//! is NOT defined <code>BOOST_ASSERT_MSG(!"boost::container out_of_range thrown", str)</code> is called
//! and <code>std::abort()</code> if the former returns.</li>
//!
//! <li>If BOOST_NO_EXCEPTIONS and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS are defined
//! the user must provide an implementation and the function should not return.</li>
//! </ul>
inline void throw_out_of_range(const char* str) inline void throw_out_of_range(const char* str)
{ {
throw std::out_of_range(str); throw std::out_of_range(str);
} }
//! Exception callback called by Boost.Container to signal errors resizing.
//! <ul>
//! <li>If BOOST_NO_EXCEPTIONS is NOT defined <code>std::length_error(str)</code> is thrown.</li>
//!
//! <li>If BOOST_NO_EXCEPTIONS is defined and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS
//! is NOT defined <code>BOOST_ASSERT_MSG(!"boost::container length_error thrown", str)</code> is called
//! and <code>std::abort()</code> if the former returns.</li>
//!
//! <li>If BOOST_NO_EXCEPTIONS and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS are defined
//! the user must provide an implementation and the function should not return.</li>
//! </ul>
inline void throw_length_error(const char* str) inline void throw_length_error(const char* str)
{ {
throw std::length_error(str); throw std::length_error(str);
} }
//! Exception callback called by Boost.Container to report errors in the internal logical
//! of the program, such as violation of logical preconditions or class invariants.
//! <ul>
//! <li>If BOOST_NO_EXCEPTIONS is NOT defined <code>std::logic_error(str)</code> is thrown.</li>
//!
//! <li>If BOOST_NO_EXCEPTIONS is defined and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS
//! is NOT defined <code>BOOST_ASSERT_MSG(!"boost::container logic_error thrown", str)</code> is called
//! and <code>std::abort()</code> if the former returns.</li>
//!
//! <li>If BOOST_NO_EXCEPTIONS and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS are defined
//! the user must provide an implementation and the function should not return.</li>
//! </ul>
inline void throw_logic_error(const char* str) inline void throw_logic_error(const char* str)
{ {
throw std::logic_error(str); throw std::logic_error(str);
} }
//! Exception callback called by Boost.Container to report errors that can only be detected during runtime.
//! <ul>
//! <li>If BOOST_NO_EXCEPTIONS is NOT defined <code>std::runtime_error(str)</code> is thrown.</li>
//!
//! <li>If BOOST_NO_EXCEPTIONS is defined and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS
//! is NOT defined <code>BOOST_ASSERT_MSG(!"boost::container runtime_error thrown", str)</code> is called
//! and <code>std::abort()</code> if the former returns.</li>
//!
//! <li>If BOOST_NO_EXCEPTIONS and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS are defined
//! the user must provide an implementation and the function should not return.</li>
//! </ul>
inline void throw_runtime_error(const char* str) inline void throw_runtime_error(const char* str)
{ {
throw std::runtime_error(str); throw std::runtime_error(str);

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -53,7 +53,7 @@
namespace boost { namespace boost {
namespace container { namespace container {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//#define BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER //#define BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
@@ -80,7 +80,7 @@ class vec_iterator
, value_type& , value_type&
>::type reference; >::type reference;
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
Pointer m_ptr; Pointer m_ptr;
@@ -94,7 +94,7 @@ class vec_iterator
explicit vec_iterator(Pointer ptr) BOOST_CONTAINER_NOEXCEPT explicit vec_iterator(Pointer ptr) BOOST_CONTAINER_NOEXCEPT
: m_ptr(ptr) : m_ptr(ptr)
{} {}
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public: public:
@@ -245,17 +245,10 @@ struct vector_value_traits
<trivial_dctr <trivial_dctr
,container_detail::null_scoped_destructor_n<Allocator> ,container_detail::null_scoped_destructor_n<Allocator>
,container_detail::scoped_destructor_n<Allocator> ,container_detail::scoped_destructor_n<Allocator>
>::type OldArrayDestructor;
//This is the anti-exception array destructor
//to destroy objects created with copy construction
typedef typename container_detail::if_c
<nothrow_copy
,container_detail::null_scoped_destructor_n<Allocator>
,container_detail::scoped_destructor_n<Allocator>
>::type ArrayDestructor; >::type ArrayDestructor;
//This is the anti-exception array deallocator //This is the anti-exception array deallocator
typedef typename container_detail::if_c typedef typename container_detail::if_c
<nothrow_copy <false//nothrow_copy
,container_detail::null_scoped_array_deallocator<Allocator> ,container_detail::null_scoped_array_deallocator<Allocator>
,container_detail::scoped_array_deallocator<Allocator> ,container_detail::scoped_array_deallocator<Allocator>
>::type ArrayDeallocator; >::type ArrayDeallocator;
@@ -294,7 +287,7 @@ struct vector_alloc_holder
//Constructor, does not throw //Constructor, does not throw
template<class AllocConvertible> template<class AllocConvertible>
explicit vector_alloc_holder(uninitialized_size_t, BOOST_FWD_REF(AllocConvertible) a, size_type initial_size) vector_alloc_holder(uninitialized_size_t, BOOST_FWD_REF(AllocConvertible) a, size_type initial_size)
: Allocator(boost::forward<AllocConvertible>(a)) : Allocator(boost::forward<AllocConvertible>(a))
, m_start() , m_start()
, m_size(initial_size) //Size is initialized here so vector should only call uninitialized_xxx after this , m_size(initial_size) //Size is initialized here so vector should only call uninitialized_xxx after this
@@ -306,7 +299,7 @@ struct vector_alloc_holder
} }
//Constructor, does not throw //Constructor, does not throw
explicit vector_alloc_holder(uninitialized_size_t, size_type initial_size) vector_alloc_holder(uninitialized_size_t, size_type initial_size)
: Allocator() : Allocator()
, m_start() , m_start()
, m_size(initial_size) //Size is initialized here so vector should only call uninitialized_xxx after this , m_size(initial_size) //Size is initialized here so vector should only call uninitialized_xxx after this
@@ -347,7 +340,7 @@ struct vector_alloc_holder
} }
std::pair<pointer, bool> std::pair<pointer, bool>
allocation_command(allocation_type command, allocation_command(boost::container::allocation_type command,
size_type limit_size, size_type limit_size,
size_type preferred_size, size_type preferred_size,
size_type &received_size, const pointer &reuse = pointer()) size_type &received_size, const pointer &reuse = pointer())
@@ -358,8 +351,10 @@ struct vector_alloc_holder
size_type next_capacity(size_type additional_objects) const size_type next_capacity(size_type additional_objects) const
{ {
return get_next_capacity( allocator_traits_type::max_size(this->alloc()) return next_capacity_calculator
, this->m_capacity, additional_objects); <size_type, /*NextCapacityDouble*/NextCapacity60Percent>::
get( allocator_traits_type::max_size(this->alloc())
, this->m_capacity, additional_objects );
} }
pointer m_start; pointer m_start;
@@ -526,9 +521,8 @@ struct vector_alloc_holder<Allocator, container_detail::integral_constant<unsign
} //namespace container_detail { } //namespace container_detail {
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! \class vector
//! A vector is a sequence that supports random access to elements, constant //! A vector is a sequence that supports random access to elements, constant
//! time insertion and removal of elements at the end, and linear time insertion //! time insertion and removal of elements at the end, and linear time insertion
//! and removal of elements at the beginning or in the middle. The number of //! and removal of elements at the beginning or in the middle. The number of
@@ -542,7 +536,7 @@ template <class T, class Allocator>
#endif #endif
class vector class vector
{ {
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef container_detail::integral_constant typedef container_detail::integral_constant
<unsigned, boost::container::container_detail::version <unsigned, boost::container::container_detail::version
<Allocator>::value > alloc_version; <Allocator>::value > alloc_version;
@@ -557,7 +551,7 @@ class vector
typedef container_detail::vec_iterator<pointer_impl, false> iterator_impl; typedef container_detail::vec_iterator<pointer_impl, false> iterator_impl;
typedef container_detail::vec_iterator<pointer_impl, true > const_iterator_impl; typedef container_detail::vec_iterator<pointer_impl, true > const_iterator_impl;
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public: public:
////////////////////////////////////////////// //////////////////////////////////////////////
// //
@@ -584,7 +578,7 @@ class vector
typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<iterator>) reverse_iterator; typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<iterator>) reverse_iterator;
typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<const_iterator>) const_reverse_iterator; typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<const_iterator>) const_reverse_iterator;
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private: private:
BOOST_COPYABLE_AND_MOVABLE(vector) BOOST_COPYABLE_AND_MOVABLE(vector)
typedef container_detail::vector_value_traits<value_type, Allocator> value_traits; typedef container_detail::vector_value_traits<value_type, Allocator> value_traits;
@@ -594,7 +588,7 @@ class vector
typedef container_detail::integral_constant<unsigned, 2> allocator_v2; typedef container_detail::integral_constant<unsigned, 2> allocator_v2;
typedef constant_iterator<T, difference_type> cvalue_iterator; typedef constant_iterator<T, difference_type> cvalue_iterator;
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public: public:
////////////////////////////////////////////// //////////////////////////////////////////////
@@ -645,7 +639,7 @@ class vector
//! <b>Complexity</b>: Linear to n. //! <b>Complexity</b>: Linear to n.
//! //!
//! <b>Note</b>: Non-standard extension //! <b>Note</b>: Non-standard extension
explicit vector(size_type n, default_init_t) vector(size_type n, default_init_t)
: m_holder(container_detail::uninitialized_size, n) : m_holder(container_detail::uninitialized_size, n)
{ {
boost::container::uninitialized_default_init_alloc_n boost::container::uninitialized_default_init_alloc_n
@@ -810,7 +804,7 @@ class vector
vector& operator=(BOOST_COPY_ASSIGN_REF(vector) x) vector& operator=(BOOST_COPY_ASSIGN_REF(vector) x)
{ {
if (&x != this){ if (&x != this){
this->priv_copy_assign(boost::move(x), alloc_version()); this->priv_copy_assign(x, alloc_version());
} }
return *this; return *this;
} }
@@ -860,8 +854,9 @@ class vector
void assign(InIt first, InIt last void assign(InIt first, InIt last
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, typename container_detail::enable_if_c , typename container_detail::enable_if_c
< !container_detail::is_convertible<InIt, size_type>::value < !container_detail::is_convertible<InIt, size_type>::value &&
//&& container_detail::is_input_iterator<InIt>::value ( container_detail::is_input_iterator<InIt>::value ||
container_detail::is_same<alloc_version, allocator_v0>::value )
>::type * = 0 >::type * = 0
#endif #endif
) )
@@ -885,6 +880,64 @@ class vector
} }
} }
//! <b>Effects</b>: Assigns the the range [first, last) to *this.
//!
//! <b>Throws</b>: If memory allocation throws or T's copy/move constructor/assignment or
//! T's constructor/assignment from dereferencing InpIt throws.
//!
//! <b>Complexity</b>: Linear to n.
template <class FwdIt>
void assign(FwdIt first, FwdIt last
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, typename container_detail::enable_if_c
< !container_detail::is_convertible<FwdIt, size_type>::value &&
( !container_detail::is_input_iterator<FwdIt>::value &&
!container_detail::is_same<alloc_version, allocator_v0>::value )
>::type * = 0
#endif
)
{
//For Fwd iterators the standard only requires EmplaceConstructible and assignble from *first
//so we can't do any backwards allocation
const size_type input_sz = static_cast<size_type>(std::distance(first, last));
const size_type old_capacity = this->capacity();
if(input_sz > old_capacity){ //If input range is too big, we need to reallocate
size_type real_cap;
std::pair<pointer, bool> ret =
this->m_holder.allocation_command(allocate_new, input_sz, input_sz, real_cap, this->m_holder.start());
if(!ret.second){ //New allocation, just emplace new values
pointer const old_p = this->m_holder.start();
if(old_p){
this->priv_destroy_all();
this->m_holder.alloc().deallocate(old_p, old_capacity);
}
this->m_holder.start(ret.first);
this->m_holder.capacity(real_cap);
this->m_holder.m_size = 0;
this->priv_uninitialized_construct_at_end(first, last);
return;
}
else{
//Forward expansion, use assignment + back deletion/construction that comes later
}
}
//Overwrite all elements we can from [first, last)
iterator cur = this->begin();
const iterator end_it = this->end();
for ( ; first != last && cur != end_it; ++cur, ++first){
*cur = *first;
}
if (first == last){
//There are no more elements in the sequence, erase remaining
this->priv_destroy_last_n(this->size() - input_sz);
}
else{
//Uninitialized construct at end the remaining range
this->priv_uninitialized_construct_at_end(first, last);
}
}
//! <b>Effects</b>: Assigns the n copies of val to *this. //! <b>Effects</b>: Assigns the n copies of val to *this.
//! //!
//! <b>Throws</b>: If memory allocation throws or //! <b>Throws</b>: If memory allocation throws or
@@ -1067,18 +1120,7 @@ class vector
//! //!
//! <b>Complexity</b>: Linear to the difference between size() and new_size. //! <b>Complexity</b>: Linear to the difference between size() and new_size.
void resize(size_type new_size) void resize(size_type new_size)
{ { this->priv_resize(new_size, value_init); }
const size_type sz = this->size();
if (new_size < sz){
//Destroy last elements
this->priv_destroy_last_n(sz - new_size);
}
else{
const size_type n = new_size - this->size();
container_detail::insert_value_initialized_n_proxy<Allocator, T*> proxy(this->m_holder.alloc());
this->priv_forward_range_insert_at_end(n, proxy, alloc_version());
}
}
//! <b>Effects</b>: Inserts or erases elements at the end such that //! <b>Effects</b>: Inserts or erases elements at the end such that
//! the size becomes n. New elements are value initialized. //! the size becomes n. New elements are value initialized.
@@ -1089,18 +1131,7 @@ class vector
//! //!
//! <b>Note</b>: Non-standard extension //! <b>Note</b>: Non-standard extension
void resize(size_type new_size, default_init_t) void resize(size_type new_size, default_init_t)
{ { this->priv_resize(new_size, default_init); }
const size_type sz = this->size();
if (new_size < sz){
//Destroy last elements
this->priv_destroy_last_n(sz - new_size);
}
else{
const size_type n = new_size - this->size();
container_detail::insert_default_initialized_n_proxy<Allocator, T*> proxy(this->m_holder.alloc());
this->priv_forward_range_insert_at_end(n, proxy, alloc_version());
}
}
//! <b>Effects</b>: Inserts or erases elements at the end such that //! <b>Effects</b>: Inserts or erases elements at the end such that
//! the size becomes n. New elements are copy constructed from x. //! the size becomes n. New elements are copy constructed from x.
@@ -1109,18 +1140,7 @@ class vector
//! //!
//! <b>Complexity</b>: Linear to the difference between size() and new_size. //! <b>Complexity</b>: Linear to the difference between size() and new_size.
void resize(size_type new_size, const T& x) void resize(size_type new_size, const T& x)
{ { this->priv_resize(new_size, x); }
const size_type sz = this->size();
if (new_size < sz){
//Destroy last elements
this->priv_destroy_last_n(sz - new_size);
}
else{
const size_type n = new_size - this->size();
container_detail::insert_n_copies_proxy<Allocator, T*> proxy(this->m_holder.alloc(), x);
this->priv_forward_range_insert_at_end(n, proxy, alloc_version());
}
}
//! <b>Effects</b>: Number of elements for which memory has been allocated. //! <b>Effects</b>: Number of elements for which memory has been allocated.
//! capacity() is always greater than or equal to size(). //! capacity() is always greater than or equal to size().
@@ -1297,7 +1317,7 @@ class vector
else{ else{
typedef container_detail::insert_emplace_proxy<Allocator, T*, Args...> type; typedef container_detail::insert_emplace_proxy<Allocator, T*, Args...> type;
this->priv_forward_range_insert_no_capacity this->priv_forward_range_insert_no_capacity
(vector_iterator_get_ptr(this->cend()), 1, type(this->m_holder.alloc(), ::boost::forward<Args>(args)...), alloc_version()); (vector_iterator_get_ptr(this->cend()), 1, type(::boost::forward<Args>(args)...), alloc_version());
} }
} }
@@ -1316,8 +1336,8 @@ class vector
{ {
//Just call more general insert(pos, size, value) and return iterator //Just call more general insert(pos, size, value) and return iterator
typedef container_detail::insert_emplace_proxy<Allocator, T*, Args...> type; typedef container_detail::insert_emplace_proxy<Allocator, T*, Args...> type;
return this->priv_forward_range_insert( vector_iterator_get_ptr(position), 1, type(this->m_holder.alloc() return this->priv_forward_range_insert( vector_iterator_get_ptr(position), 1
, ::boost::forward<Args>(args)...), alloc_version()); , type(::boost::forward<Args>(args)...), alloc_version());
} }
#else #else
@@ -1334,11 +1354,11 @@ class vector
++this->m_holder.m_size; \ ++this->m_holder.m_size; \
} \ } \
else{ \ else{ \
container_detail::BOOST_PP_CAT(insert_emplace_proxy_arg, n) \ typedef container_detail::BOOST_PP_CAT(insert_emplace_proxy_arg, n) \
<Allocator, T* BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> proxy \ <Allocator, T* BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> type; \
(this->m_holder.alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
this->priv_forward_range_insert_no_capacity \ this->priv_forward_range_insert_no_capacity \
(vector_iterator_get_ptr(this->cend()), 1, proxy, alloc_version()); \ ( vector_iterator_get_ptr(this->cend()), 1 \
, type(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)), alloc_version()); \
} \ } \
} \ } \
\ \
@@ -1346,11 +1366,11 @@ class vector
iterator emplace(const_iterator pos \ iterator emplace(const_iterator pos \
BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
{ \ { \
container_detail::BOOST_PP_CAT(insert_emplace_proxy_arg, n) \ typedef container_detail::BOOST_PP_CAT(insert_emplace_proxy_arg, n) \
<Allocator, T* BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> proxy \ <Allocator, T* BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> type; \
(this->m_holder.alloc() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \
return this->priv_forward_range_insert \ return this->priv_forward_range_insert \
(container_detail::to_raw_pointer(vector_iterator_get_ptr(pos)), 1, proxy, alloc_version()); \ ( container_detail::to_raw_pointer(vector_iterator_get_ptr(pos)), 1 \
, type(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)), alloc_version()); \
} \ } \
//! //!
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
@@ -1414,7 +1434,7 @@ class vector
//! <b>Complexity</b>: Linear to n. //! <b>Complexity</b>: Linear to n.
iterator insert(const_iterator p, size_type n, const T& x) iterator insert(const_iterator p, size_type n, const T& x)
{ {
container_detail::insert_n_copies_proxy<Allocator, T*> proxy(this->m_holder.alloc(), x); container_detail::insert_n_copies_proxy<Allocator, T*> proxy(x);
return this->priv_forward_range_insert(vector_iterator_get_ptr(p), n, proxy, alloc_version()); return this->priv_forward_range_insert(vector_iterator_get_ptr(p), n, proxy, alloc_version());
} }
@@ -1456,7 +1476,7 @@ class vector
>::type * = 0 >::type * = 0
) )
{ {
container_detail::insert_range_proxy<Allocator, FwdIt, T*> proxy(this->m_holder.alloc(), first); container_detail::insert_range_proxy<Allocator, FwdIt, T*> proxy(first);
return this->priv_forward_range_insert(vector_iterator_get_ptr(pos), std::distance(first, last), proxy, alloc_version()); return this->priv_forward_range_insert(vector_iterator_get_ptr(pos), std::distance(first, last), proxy, alloc_version());
} }
#endif #endif
@@ -1536,9 +1556,7 @@ class vector
//! <b>Note</b>: non-standard extension. //! <b>Note</b>: non-standard extension.
template<class OtherAllocator> template<class OtherAllocator>
void swap(vector<T, OtherAllocator> & x) void swap(vector<T, OtherAllocator> & x)
{ { this->m_holder.swap(x.m_holder); }
this->m_holder.swap(x.m_holder);
}
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
@@ -1550,7 +1568,7 @@ class vector
void clear() BOOST_CONTAINER_NOEXCEPT void clear() BOOST_CONTAINER_NOEXCEPT
{ this->priv_destroy_all(); } { this->priv_destroy_all(); }
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//Absolutely experimental. This function might change, disappear or simply crash! //Absolutely experimental. This function might change, disappear or simply crash!
template<class BiDirPosConstIt, class BiDirValueIt> template<class BiDirPosConstIt, class BiDirValueIt>
@@ -1590,9 +1608,7 @@ class vector
< !container_detail::is_same<AllocVersion, allocator_v0>::value || < !container_detail::is_same<AllocVersion, allocator_v0>::value ||
container_detail::is_same<OtherAllocator, allocator_type>::value container_detail::is_same<OtherAllocator, allocator_type>::value
>::type * = 0) >::type * = 0)
{ { this->priv_move_assign_impl(boost::move(x), AllocVersion()); }
this->priv_move_assign_impl(boost::move(x), AllocVersion());
}
template<class OtherAllocator, class AllocVersion> template<class OtherAllocator, class AllocVersion>
void priv_move_assign_impl(BOOST_RV_REF_BEG vector<T, OtherAllocator> BOOST_RV_REF_END x void priv_move_assign_impl(BOOST_RV_REF_BEG vector<T, OtherAllocator> BOOST_RV_REF_END x
@@ -1671,29 +1687,23 @@ class vector
} }
void priv_reserve(size_type, allocator_v0) void priv_reserve(size_type, allocator_v0)
{ throw_bad_alloc(); }
container_detail::insert_range_proxy<Allocator, boost::move_iterator<T*>, T*> priv_dummy_empty_proxy()
{ {
throw_bad_alloc(); return container_detail::insert_range_proxy<Allocator, boost::move_iterator<T*>, T*>
(::boost::make_move_iterator((T *)0));
} }
void priv_reserve(size_type new_cap, allocator_v1) void priv_reserve(size_type new_cap, allocator_v1)
{ {
//There is not enough memory, allocate a new buffer //There is not enough memory, allocate a new buffer
pointer p = this->m_holder.allocate(new_cap); pointer p = this->m_holder.allocate(new_cap);
//Backwards (and possibly forward) expansion //We will reuse insert code, so create a dummy input iterator
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS this->priv_forward_range_insert_new_allocation
++this->num_alloc; ( container_detail::to_raw_pointer(p), new_cap
#endif , container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size
T * const raw_beg = container_detail::to_raw_pointer(this->m_holder.start()); , 0, this->priv_dummy_empty_proxy());
const size_type sz = m_holder.m_size;
::boost::container::uninitialized_move_alloc_n_source
( this->m_holder.alloc(), raw_beg, sz, container_detail::to_raw_pointer(p) );
if(this->m_holder.capacity()){
if(!value_traits::trivial_dctr_after_move)
boost::container::destroy_alloc_n(this->m_holder.alloc(), raw_beg, sz);
this->m_holder.deallocate(this->m_holder.start(), this->m_holder.capacity());
}
this->m_holder.start(p);
this->m_holder.capacity(new_cap);
} }
void priv_reserve(size_type new_cap, allocator_v2) void priv_reserve(size_type new_cap, allocator_v2)
@@ -1702,10 +1712,8 @@ class vector
//buffer or expand the old one. //buffer or expand the old one.
bool same_buffer_start; bool same_buffer_start;
size_type real_cap = 0; size_type real_cap = 0;
std::pair<pointer, bool> ret = std::pair<pointer, bool> ret = this->m_holder.allocation_command
this->m_holder.allocation_command (allocate_new | expand_fwd | expand_bwd, new_cap, new_cap, real_cap, this->m_holder.start());
(allocate_new | expand_fwd | expand_bwd,
new_cap, new_cap, real_cap, this->m_holder.start());
//Check for forward expansion //Check for forward expansion
same_buffer_start = ret.second && this->m_holder.start() == ret.first; same_buffer_start = ret.second && this->m_holder.start() == ret.first;
@@ -1715,52 +1723,26 @@ class vector
#endif #endif
this->m_holder.capacity(real_cap); this->m_holder.capacity(real_cap);
} }
//If there is no forward expansion, move objects else{ //If there is no forward expansion, move objects, we will reuse insertion code
else{ T * const new_mem = container_detail::to_raw_pointer(ret.first);
//Backwards (and possibly forward) expansion T * const ins_pos = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size;
if(ret.second){ if(ret.second){ //Backwards (and possibly forward) expansion
//We will reuse insert code, so create a dummy input iterator
container_detail::insert_range_proxy<Allocator, boost::move_iterator<T*>, T*>
proxy(this->m_holder.alloc(), ::boost::make_move_iterator((T *)0));
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
++this->num_expand_bwd; ++this->num_expand_bwd;
#endif #endif
this->priv_forward_range_insert_expand_backwards this->priv_forward_range_insert_expand_backwards
( container_detail::to_raw_pointer(ret.first) ( new_mem , real_cap, ins_pos, 0, this->priv_dummy_empty_proxy());
, real_cap
, container_detail::to_raw_pointer(this->m_holder.start())
, 0
, proxy);
} }
//New buffer else{ //New buffer
else{
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
++this->num_alloc; ++this->num_alloc;
#endif #endif
T * const raw_beg = container_detail::to_raw_pointer(this->m_holder.start()); this->priv_forward_range_insert_new_allocation
const size_type sz = m_holder.m_size; ( new_mem, real_cap, ins_pos, 0, this->priv_dummy_empty_proxy());
::boost::container::uninitialized_move_alloc_n_source
( this->m_holder.alloc(), raw_beg, sz, container_detail::to_raw_pointer(ret.first) );
if(this->m_holder.capacity()){
if(!value_traits::trivial_dctr_after_move)
boost::container::destroy_alloc_n(this->m_holder.alloc(), raw_beg, sz);
this->m_holder.deallocate(this->m_holder.start(), this->m_holder.capacity());
}
this->m_holder.start(ret.first);
this->m_holder.capacity(real_cap);
} }
} }
} }
template<class Proxy>
void priv_uninitialized_fill(Proxy proxy, size_type n) const
{
//Copy first new elements in pos
proxy.uninitialized_copy_n_and_update
(container_detail::to_raw_pointer(this->m_holder.start()), n);
//m_holder.size was already initialized to n in vector_alloc_holder's constructor
}
void priv_destroy(value_type* p) BOOST_CONTAINER_NOEXCEPT void priv_destroy(value_type* p) BOOST_CONTAINER_NOEXCEPT
{ {
if(!value_traits::trivial_dctr) if(!value_traits::trivial_dctr)
@@ -1774,6 +1756,16 @@ class vector
this->m_holder.m_size -= n; this->m_holder.m_size -= n;
} }
template<class InpIt>
void priv_uninitialized_construct_at_end(InpIt first, InpIt last)
{
T* end_pos = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size;
for(; first != last; ++first, ++end_pos, ++this->m_holder.m_size){
//There is more memory, just construct a new object at the end
allocator_traits_type::construct(this->m_holder.alloc(), end_pos, *first);
}
}
void priv_destroy_all() BOOST_CONTAINER_NOEXCEPT void priv_destroy_all() BOOST_CONTAINER_NOEXCEPT
{ {
boost::container::destroy_alloc_n boost::container::destroy_alloc_n
@@ -1785,39 +1777,54 @@ class vector
iterator priv_insert(const const_iterator &p, BOOST_FWD_REF(U) x) iterator priv_insert(const const_iterator &p, BOOST_FWD_REF(U) x)
{ {
return this->priv_forward_range_insert return this->priv_forward_range_insert
( vector_iterator_get_ptr(p), 1, container_detail::get_insert_value_proxy<T*>(this->m_holder.alloc() ( vector_iterator_get_ptr(p), 1, container_detail::get_insert_value_proxy<T*, Allocator>
, ::boost::forward<U>(x)), alloc_version()); (::boost::forward<U>(x)), alloc_version());
} }
void priv_push_back(const T &x) container_detail::insert_copy_proxy<Allocator, T*> priv_single_insert_proxy(const T &x)
{ return container_detail::insert_copy_proxy<Allocator, T*> (x); }
container_detail::insert_move_proxy<Allocator, T*> priv_single_insert_proxy(BOOST_RV_REF(T) x)
{ return container_detail::insert_move_proxy<Allocator, T*> (x); }
template <class U>
void priv_push_back(BOOST_FWD_REF(U) u)
{ {
if (this->m_holder.m_size < this->m_holder.capacity()){ if (this->m_holder.m_size < this->m_holder.capacity()){
//There is more memory, just construct a new object at the end //There is more memory, just construct a new object at the end
allocator_traits_type::construct allocator_traits_type::construct
( this->m_holder.alloc() ( this->m_holder.alloc()
, container_detail::to_raw_pointer(this->m_holder.start() + this->m_holder.m_size) , container_detail::to_raw_pointer(this->m_holder.start() + this->m_holder.m_size)
, x ); , ::boost::forward<U>(u) );
++this->m_holder.m_size; ++this->m_holder.m_size;
} }
else{ else{
container_detail::insert_copy_proxy<Allocator, T*> proxy(this->m_holder.alloc(), x); this->priv_forward_range_insert_no_capacity
this->priv_forward_range_insert_no_capacity(vector_iterator_get_ptr(this->cend()), 1, proxy, alloc_version()); ( vector_iterator_get_ptr(this->cend()), 1
, this->priv_single_insert_proxy(::boost::forward<U>(u)), alloc_version());
} }
} }
void priv_push_back(BOOST_RV_REF(T) x) container_detail::insert_n_copies_proxy<Allocator, T*> priv_resize_proxy(const T &x)
{ return container_detail::insert_n_copies_proxy<Allocator, T*>(x); }
container_detail::insert_default_initialized_n_proxy<Allocator, T*> priv_resize_proxy(default_init_t)
{ return container_detail::insert_default_initialized_n_proxy<Allocator, T*>(); }
container_detail::insert_value_initialized_n_proxy<Allocator, T*> priv_resize_proxy(value_init_t)
{ return container_detail::insert_value_initialized_n_proxy<Allocator, T*>(); }
template <class U>
void priv_resize(size_type new_size, const U& u)
{ {
if (this->m_holder.m_size < this->m_holder.capacity()){ const size_type sz = this->size();
//There is more memory, just construct a new object at the end if (new_size < sz){
allocator_traits_type::construct //Destroy last elements
( this->m_holder.alloc() this->priv_destroy_last_n(sz - new_size);
, container_detail::to_raw_pointer(this->m_holder.start() + this->m_holder.m_size)
, ::boost::move(x) );
++this->m_holder.m_size;
} }
else{ else{
container_detail::insert_move_proxy<Allocator, T*> proxy(this->m_holder.alloc(), x); const size_type n = new_size - this->size();
this->priv_forward_range_insert_no_capacity(vector_iterator_get_ptr(this->cend()), 1, proxy, alloc_version()); this->priv_forward_range_insert_at_end(n, this->priv_resize_proxy(u), alloc_version());
} }
} }
@@ -1839,17 +1846,13 @@ class vector
pointer p = this->m_holder.allocate(sz); pointer p = this->m_holder.allocate(sz);
//We will reuse insert code, so create a dummy input iterator //We will reuse insert code, so create a dummy input iterator
container_detail::insert_range_proxy<Allocator, boost::move_iterator<T*>, T*>
proxy(this->m_holder.alloc(), ::boost::make_move_iterator((T *)0));
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
++this->num_alloc; ++this->num_alloc;
#endif #endif
this->priv_forward_range_insert_new_allocation this->priv_forward_range_insert_new_allocation
( container_detail::to_raw_pointer(p) ( container_detail::to_raw_pointer(p), sz
, sz
, container_detail::to_raw_pointer(this->m_holder.start()) , container_detail::to_raw_pointer(this->m_holder.start())
, 0 , 0, this->priv_dummy_empty_proxy());
, proxy);
} }
} }
} }
@@ -1981,8 +1984,7 @@ class vector
if (n <= remaining){ if (n <= remaining){
const size_type n_pos = raw_pos - container_detail::to_raw_pointer(this->m_holder.start()); const size_type n_pos = raw_pos - container_detail::to_raw_pointer(this->m_holder.start());
this->priv_forward_range_insert_expand_forward this->priv_forward_range_insert_expand_forward(raw_pos, n, insert_range_proxy);
(raw_pos, n, insert_range_proxy);
return iterator(this->m_holder.start() + n_pos); return iterator(this->m_holder.start() + n_pos);
} }
else{ else{
@@ -2164,7 +2166,7 @@ class vector
T* const last_ptr = begin_ptr + last_pos; T* const last_ptr = begin_ptr + last_pos;
size_type hole_size = 0; size_type hole_size = 0;
//Case Allocator: //Case A:
if((last_pos + shift_count) <= limit_pos){ if((last_pos + shift_count) <= limit_pos){
//All move assigned //All move assigned
boost::move_backward(first_ptr, last_ptr, last_ptr + shift_count); boost::move_backward(first_ptr, last_ptr, last_ptr + shift_count);
@@ -2193,7 +2195,7 @@ class vector
void priv_forward_range_insert_at_end_expand_forward(const size_type n, InsertionProxy insert_range_proxy) void priv_forward_range_insert_at_end_expand_forward(const size_type n, InsertionProxy insert_range_proxy)
{ {
T* const old_finish = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size; T* const old_finish = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size;
insert_range_proxy.uninitialized_copy_n_and_update(old_finish, n); insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), old_finish, n);
this->m_holder.m_size += n; this->m_holder.m_size += n;
} }
@@ -2207,7 +2209,7 @@ class vector
const size_type elems_after = old_finish - pos; const size_type elems_after = old_finish - pos;
if (!elems_after){ if (!elems_after){
insert_range_proxy.uninitialized_copy_n_and_update(old_finish, n); insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), old_finish, n);
this->m_holder.m_size += n; this->m_holder.m_size += n;
} }
else if (elems_after >= n){ else if (elems_after >= n){
@@ -2219,7 +2221,7 @@ class vector
//Copy previous to last objects to the initialized end //Copy previous to last objects to the initialized end
boost::move_backward(pos, old_finish - n, old_finish); boost::move_backward(pos, old_finish - n, old_finish);
//Insert new objects in the pos //Insert new objects in the pos
insert_range_proxy.copy_n_and_update(pos, n); insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), pos, n);
} }
else { else {
//The new elements don't fit in the [pos, end()) range. //The new elements don't fit in the [pos, end()) range.
@@ -2228,9 +2230,9 @@ class vector
::boost::container::uninitialized_move_alloc(this->m_holder.alloc(), pos, old_finish, pos + n); ::boost::container::uninitialized_move_alloc(this->m_holder.alloc(), pos, old_finish, pos + n);
BOOST_TRY{ BOOST_TRY{
//Copy first new elements in pos (gap is still there) //Copy first new elements in pos (gap is still there)
insert_range_proxy.copy_n_and_update(pos, elems_after); insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), pos, elems_after);
//Copy to the beginning of the unallocated zone the last new elements (the gap is closed). //Copy to the beginning of the unallocated zone the last new elements (the gap is closed).
insert_range_proxy.uninitialized_copy_n_and_update(old_finish, n - elems_after); insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), old_finish, n - elems_after);
this->m_holder.m_size += n; this->m_holder.m_size += n;
} }
BOOST_CATCH(...){ BOOST_CATCH(...){
@@ -2249,21 +2251,22 @@ class vector
T *new_finish = new_start; T *new_finish = new_start;
T *old_finish; T *old_finish;
//Anti-exception rollbacks //Anti-exception rollbacks
typename value_traits::ArrayDeallocator scoped_alloc(new_start, this->m_holder.alloc(), new_cap); typename value_traits::ArrayDeallocator new_buffer_deallocator(new_start, this->m_holder.alloc(), new_cap);
typename value_traits::ArrayDestructor constructed_values_destroyer(new_start, this->m_holder.alloc(), 0u); typename value_traits::ArrayDestructor new_values_destroyer(new_start, this->m_holder.alloc(), 0u);
//Initialize with [begin(), pos) old buffer //Initialize with [begin(), pos) old buffer
//the start of the new buffer //the start of the new buffer
T *old_buffer = container_detail::to_raw_pointer(this->m_holder.start()); T * const old_buffer = container_detail::to_raw_pointer(this->m_holder.start());
if(old_buffer){ if(old_buffer){
new_finish = ::boost::container::uninitialized_move_alloc new_finish = ::boost::container::uninitialized_move_alloc
(this->m_holder.alloc(), container_detail::to_raw_pointer(this->m_holder.start()), pos, old_finish = new_finish); (this->m_holder.alloc(), container_detail::to_raw_pointer(this->m_holder.start()), pos, old_finish = new_finish);
constructed_values_destroyer.increment_size(new_finish - old_finish); new_values_destroyer.increment_size(new_finish - old_finish);
} }
//Initialize new objects, starting from previous point //Initialize new objects, starting from previous point
insert_range_proxy.uninitialized_copy_n_and_update(old_finish = new_finish, n); old_finish = new_finish;
insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), old_finish, n);
new_finish += n; new_finish += n;
constructed_values_destroyer.increment_size(new_finish - old_finish); new_values_destroyer.increment_size(new_finish - old_finish);
//Initialize from the rest of the old buffer, //Initialize from the rest of the old buffer,
//starting from previous point //starting from previous point
if(old_buffer){ if(old_buffer){
@@ -2279,8 +2282,8 @@ class vector
this->m_holder.m_size = new_finish - new_start; this->m_holder.m_size = new_finish - new_start;
this->m_holder.capacity(new_cap); this->m_holder.capacity(new_cap);
//All construction successful, disable rollbacks //All construction successful, disable rollbacks
constructed_values_destroyer.release(); new_values_destroyer.release();
scoped_alloc.release(); new_buffer_deallocator.release();
} }
template <class InsertionProxy> template <class InsertionProxy>
@@ -2291,8 +2294,8 @@ class vector
//n can be zero to just expand capacity //n can be zero to just expand capacity
//Backup old data //Backup old data
T* const old_start = container_detail::to_raw_pointer(this->m_holder.start()); T* const old_start = container_detail::to_raw_pointer(this->m_holder.start());
T* const old_finish = old_start + this->m_holder.m_size;
const size_type old_size = this->m_holder.m_size; const size_type old_size = this->m_holder.m_size;
T* const old_finish = old_start + old_size;
//We can have 8 possibilities: //We can have 8 possibilities:
const size_type elemsbefore = static_cast<size_type>(pos - old_start); const size_type elemsbefore = static_cast<size_type>(pos - old_start);
@@ -2306,17 +2309,18 @@ class vector
//If anything goes wrong, this object will destroy //If anything goes wrong, this object will destroy
//all the old objects to fulfill previous vector state //all the old objects to fulfill previous vector state
typename value_traits::OldArrayDestructor old_values_destroyer(old_start, this->m_holder.alloc(), old_size); typename value_traits::ArrayDestructor old_values_destroyer(old_start, this->m_holder.alloc(), old_size);
//Check if s_before is big enough to hold the beginning of old data + new data //Check if s_before is big enough to hold the beginning of old data + new data
if(s_before >= before_plus_new){ if(s_before >= before_plus_new){
//Copy first old values before pos, after that the new objects //Copy first old values before pos, after that the new objects
T *const new_elem_pos = ::boost::container::uninitialized_move_alloc(this->m_holder.alloc(), old_start, pos, new_start); T *const new_elem_pos =
::boost::container::uninitialized_move_alloc(this->m_holder.alloc(), old_start, pos, new_start);
this->m_holder.m_size = elemsbefore; this->m_holder.m_size = elemsbefore;
insert_range_proxy.uninitialized_copy_n_and_update(new_elem_pos, n); insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), new_elem_pos, n);
this->m_holder.m_size += n; this->m_holder.m_size = before_plus_new;
const size_type new_size = old_size + n;
//Check if s_before is so big that even copying the old data + new data //Check if s_before is so big that even copying the old data + new data
//there is a gap between the new data and the old data //there is a gap between the new data and the old data
const size_type new_size = old_size + n;
if(s_before >= new_size){ if(s_before >= new_size){
//Old situation: //Old situation:
// _________________________________________________________ // _________________________________________________________
@@ -2329,10 +2333,12 @@ class vector
//|___________|__________|_________|________________________| //|___________|__________|_________|________________________|
// //
//Now initialize the rest of memory with the last old values //Now initialize the rest of memory with the last old values
::boost::container::uninitialized_move_alloc if(before_plus_new != new_size){ //Special case to avoid operations in back insertion
(this->m_holder.alloc(), pos, old_finish, new_start + before_plus_new); ::boost::container::uninitialized_move_alloc
//All new elements correctly constructed, avoid new element destruction (this->m_holder.alloc(), pos, old_finish, new_start + before_plus_new);
this->m_holder.m_size = new_size; //All new elements correctly constructed, avoid new element destruction
this->m_holder.m_size = new_size;
}
//Old values destroyed automatically with "old_values_destroyer" //Old values destroyed automatically with "old_values_destroyer"
//when "old_values_destroyer" goes out of scope unless the have trivial //when "old_values_destroyer" goes out of scope unless the have trivial
//destructor after move. //destructor after move.
@@ -2354,22 +2360,28 @@ class vector
//Now initialize the rest of memory with the last old values //Now initialize the rest of memory with the last old values
//All new elements correctly constructed, avoid new element destruction //All new elements correctly constructed, avoid new element destruction
const size_type raw_gap = s_before - before_plus_new; const size_type raw_gap = s_before - before_plus_new;
//Now initialize the rest of s_before memory with the if(!value_traits::trivial_dctr){
//first of elements after new values //Now initialize the rest of s_before memory with the
::boost::container::uninitialized_move_alloc_n //first of elements after new values
(this->m_holder.alloc(), pos, raw_gap, new_start + before_plus_new); ::boost::container::uninitialized_move_alloc_n
//Update size since we have a contiguous buffer (this->m_holder.alloc(), pos, raw_gap, new_start + before_plus_new);
this->m_holder.m_size = old_size + s_before; //Now we have a contiguous buffer so program trailing element destruction
//All new elements correctly constructed, avoid old element destruction //and update size to the final size.
old_values_destroyer.release(); old_values_destroyer.shrink_forward(elemsbefore + raw_gap);
//Now copy remaining last objects in the old buffer begin this->m_holder.m_size = new_size;
T * const to_destroy = ::boost::move(pos + raw_gap, old_finish, old_start); //Now move remaining last objects in the old buffer begin
//Now destroy redundant elements except if they were moved and ::boost::move(pos + raw_gap, old_finish, old_start);
//they have trivial destructor after move //Once moved, avoid calling the destructors if trivial after move
size_type n_destroy = old_finish - to_destroy; if(value_traits::trivial_dctr_after_move){
if(!value_traits::trivial_dctr_after_move) old_values_destroyer.release();
boost::container::destroy_alloc_n(this->get_stored_allocator(), to_destroy, n_destroy); }
this->m_holder.m_size -= n_destroy; }
else{ //If trivial destructor, we can uninitialized copy + copy in a single uninitialized copy
::boost::container::uninitialized_move_alloc_n
(this->m_holder.alloc(), pos, old_finish - pos, new_start + before_plus_new);
this->m_holder.m_size = new_size;
old_values_destroyer.release();
}
} }
} }
else{ else{
@@ -2423,27 +2435,30 @@ class vector
//Copy the first part of old_begin to raw_mem //Copy the first part of old_begin to raw_mem
::boost::container::uninitialized_move_alloc_n ::boost::container::uninitialized_move_alloc_n
(this->m_holder.alloc(), old_start, s_before, new_start); (this->m_holder.alloc(), old_start, s_before, new_start);
//The buffer is all constructed until old_end, //The buffer is all constructed until old_end
//release destroyer and update size
old_values_destroyer.release();
this->m_holder.m_size = old_size + s_before;
//Now copy the second part of old_begin overwriting itself
T *const next = ::boost::move(old_start + s_before, pos, old_start);
if(do_after){ if(do_after){
//release destroyer and update size
old_values_destroyer.release();
this->m_holder.m_size = old_size + s_before;
//Now copy the second part of old_begin overwriting itself
T *const next = ::boost::move(old_start + s_before, pos, old_start);
//Now copy the new_beg elements //Now copy the new_beg elements
insert_range_proxy.copy_n_and_update(next, s_before); insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), next, s_before);
} }
else{ else{
//Now copy the all the new elements //The buffer is all constructed until old_end,
insert_range_proxy.copy_n_and_update(next, n); //so program trailing destruction and assign final size
//Now displace old_end elements this->m_holder.m_size = old_size + n;
T* const move_end = ::boost::move(pos, old_finish, next + n);
//Destroy remaining moved elements from old_end except if
//they have trivial destructor after being moved
const size_type n_destroy = s_before - n; const size_type n_destroy = s_before - n;
if(!value_traits::trivial_dctr_after_move) old_values_destroyer.shrink_forward(old_size - n_destroy);
boost::container::destroy_alloc_n(this->get_stored_allocator(), move_end, n_destroy); //Now copy the second part of old_begin overwriting itself
this->m_holder.m_size -= n_destroy; T *const next = ::boost::move(old_start + s_before, pos, old_start);
//Now copy the all the new elements
insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), next, n);
//Now displace old_end elements
::boost::move(pos, old_finish, next + n);
if(value_traits::trivial_dctr_after_move)
old_values_destroyer.release();
} }
} }
else { else {
@@ -2477,7 +2492,7 @@ class vector
(this->m_holder.alloc(), old_start, pos, new_start); (this->m_holder.alloc(), old_start, pos, new_start);
this->m_holder.m_size = elemsbefore; this->m_holder.m_size = elemsbefore;
const size_type mid_n = s_before - elemsbefore; const size_type mid_n = s_before - elemsbefore;
insert_range_proxy.uninitialized_copy_n_and_update(new_pos, mid_n); insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), new_pos, mid_n);
//The buffer is all constructed until old_end, //The buffer is all constructed until old_end,
//release destroyer //release destroyer
this->m_holder.m_size = old_size + s_before; this->m_holder.m_size = old_size + s_before;
@@ -2485,15 +2500,15 @@ class vector
if(do_after){ if(do_after){
//Copy new_beg part //Copy new_beg part
insert_range_proxy.copy_n_and_update(old_start, elemsbefore); insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), old_start, elemsbefore);
} }
else{ else{
//Copy all new elements //Copy all new elements
const size_type rest_new = n - mid_n; const size_type rest_new = n - mid_n;
insert_range_proxy.copy_n_and_update(old_start, rest_new); insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), old_start, rest_new);
T* move_start = old_start + rest_new; T* const move_start = old_start + rest_new;
//Displace old_end //Displace old_end
T* move_end = ::boost::move(pos, old_finish, move_start); T* const move_end = ::boost::move(pos, old_finish, move_start);
//Destroy remaining moved elements from old_end except if they //Destroy remaining moved elements from old_end except if they
//have trivial destructor after being moved //have trivial destructor after being moved
size_type n_destroy = s_before - n; size_type n_destroy = s_before - n;
@@ -2548,7 +2563,7 @@ class vector
boost::move_backward(pos, finish_n, old_finish); boost::move_backward(pos, finish_n, old_finish);
//Now overwrite with new_end //Now overwrite with new_end
//The new_end part is [first + (n - n_after), last) //The new_end part is [first + (n - n_after), last)
insert_range_proxy.copy_n_and_update(pos, n_after); insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), pos, n_after);
} }
else { else {
//The raw_mem from end will divide new_end part //The raw_mem from end will divide new_end part
@@ -2573,9 +2588,9 @@ class vector
BOOST_TRY{ BOOST_TRY{
//Copy the first part to the already constructed old_end zone //Copy the first part to the already constructed old_end zone
insert_range_proxy.copy_n_and_update(pos, elemsafter); insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), pos, elemsafter);
//Copy the rest to the uninitialized zone filling the gap //Copy the rest to the uninitialized zone filling the gap
insert_range_proxy.uninitialized_copy_n_and_update(old_finish, mid_last_dist); insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), old_finish, mid_last_dist);
this->m_holder.m_size += n_after; this->m_holder.m_size += n_after;
} }
BOOST_CATCH(...){ BOOST_CATCH(...){
@@ -2617,7 +2632,7 @@ class vector
void reset_alloc_stats() void reset_alloc_stats()
{ num_expand_fwd = num_expand_bwd = num_alloc = 0, num_shrink = 0; } { num_expand_fwd = num_expand_bwd = num_alloc = 0, num_shrink = 0; }
#endif #endif
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}; };
template <class T, class Allocator> template <class T, class Allocator>
@@ -2649,7 +2664,7 @@ inline void swap(vector<T, Allocator>& x, vector<T, Allocator>& y)
}} }}
/// @cond #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace boost { namespace boost {
@@ -2678,9 +2693,8 @@ inline void swap(boost::container::vector<T, Allocator>& x, boost::container::ve
#endif #endif
/// @endcond #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
#include <boost/container/detail/config_end.hpp> #include <boost/container/detail/config_end.hpp>
#endif // #ifndef BOOST_CONTAINER_CONTAINER_VECTOR_HPP #endif // #ifndef BOOST_CONTAINER_CONTAINER_VECTOR_HPP

View File

@@ -1,5 +1,5 @@
<!-- <!--
Copyright 2005-2012 Ion Gaztanaga Copyright 2005-2013 Ion Gaztanaga
Distributed under the Boost Software License, Version 1.0. (See accompanying Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
--> -->

View File

@@ -20,7 +20,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
GeneratePreprocessedFile="0" GeneratePreprocessedFile="0"
MinimalRebuild="TRUE" MinimalRebuild="TRUE"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@@ -74,7 +74,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2" RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="FALSE" ForceConformanceInForLoopScope="FALSE"
@@ -128,14 +128,6 @@
RelativePath="..\..\test\allocator_traits_test.cpp"> RelativePath="..\..\test\allocator_traits_test.cpp">
</File> </File>
</Filter> </Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93815995-89BD-b043-5E8B-65FBE52E2AFB}">
<File
RelativePath="..\..\..\..\boost\container\detail\node_alloc_holder.hpp">
</File>
</Filter>
</Files> </Files>
<Globals> <Globals>
</Globals> </Globals>

View File

@@ -20,7 +20,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE" MinimalRebuild="TRUE"
ExceptionHandling="TRUE" ExceptionHandling="TRUE"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@@ -74,7 +74,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2" RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="FALSE" ForceConformanceInForLoopScope="FALSE"

View File

@@ -20,7 +20,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE" MinimalRebuild="TRUE"
ExceptionHandling="TRUE" ExceptionHandling="TRUE"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@@ -74,7 +74,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2" RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="FALSE" ForceConformanceInForLoopScope="FALSE"

View File

@@ -1,41 +1,9 @@
Microsoft Visual Studio Solution File, Format Version 8.00 Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_containerlib", "container.vcproj", "{FF56BAF1-32EC-4B22-B6BD-95A3A67C3135}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "allocator_traits_test", "allocator_traits_test.vcproj", "{5CE11C83-096A-84FE-4FA2-D3A6BA792002}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "deque_test", "deque_test.vcproj", "{58CCE183-6092-48FE-A4F7-BA0D3A792655}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "deque_test", "deque_test.vcproj", "{58CCE183-6092-48FE-A4F7-BA0D3A792655}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flat_tree_test", "flat_tree_test.vcproj", "{58CCE183-6092-48FE-A4F7-BA0D3A792637}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hash_table_test", "hash_table_test.vcproj", "{58CCE183-6092-48FE-A4F7-BA0D3A792606}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "slist_test", "slist_test.vcproj", "{58CCE183-6092-48FE-A4F7-BA0D3A792608}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stable_vector_test", "stable_vector_test.vcproj", "{5E11C8D3-FA52-760A-84FE-943A6BA05A21}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "string_test", "string_test.vcproj", "{58CCE183-6092-48FE-A4F7-BA0D4A792607}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tree_test", "tree_test.vcproj", "{58CCE183-6092-48FE-A4F7-BA0D3A792606}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vector_test", "vector_test.vcproj", "{5CE11C83-096A-84FE-4FA2-D3A6BA792002}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pair_test", "pair_test.vcproj", "{58CA17C5-A74F-9602-48FE-B06310DA7FA6}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
EndProjectSection EndProjectSection
EndProject EndProject
@@ -43,6 +11,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "list_test", "list_test.vcpr
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pair_test", "pair_test.vcproj", "{58CA17C5-A74F-9602-48FE-B06310DA7FA6}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scoped_allocator_adaptor_test", "scoped_allocator_adaptor.vcproj", "{B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scoped_allocator_adaptor_test", "scoped_allocator_adaptor.vcproj", "{B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
EndProjectSection EndProjectSection
@@ -51,11 +23,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scoped_allocator_usage_test
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hash_table_test", "hash_table_test.vcproj", "{58CCE183-6092-48FE-A4F7-BA0D3A792606}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "slist_test", "slist_test.vcproj", "{58CCE183-6092-48FE-A4F7-BA0D3A792608}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "throw_exception_test", "throw_exception_test.vcproj", "{5A8D91E0-FA57-284F-84FE-D3A6BA792002}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stable_vector_test", "stable_vector_test.vcproj", "{5E11C8D3-FA52-760A-84FE-943A6BA05A21}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
EndProjectSection EndProjectSection
EndProject EndProject
@@ -63,7 +35,87 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "static_vector_test", "stati
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bench_static_vector", "bench_static_vector.vcproj", "{58E1C1C3-096A-84FE-4FA2-D6BA79201C02}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "string_test", "string_test.vcproj", "{58CCE183-6092-48FE-A4F7-BA0D4A792607}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "throw_exception_test", "throw_exception_test.vcproj", "{5A8D91E0-FA57-284F-84FE-D3A6BA792002}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vector_test", "vector_test.vcproj", "{5CE11C83-096A-84FE-4FA2-D3A6BA792002}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flat_map_test", "flat_map_test.vcproj", "{5188ECE3-6092-8FE0-44A7-BAD3A7926329}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flat_set_test", "flat_set_test.vcproj", "{58CCE183-6092-48FE-A4F7-BA0D3A792637}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "set_test", "set_test.vcproj", "{58CCE183-6092-48FE-A4F7-BA0D3A792606}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "map_test", "map_test.vcproj", "{58CCE183-6092-48FE-A4F7-BA0D3A792606}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doc_emplace", "doc_emplace.vcproj", "{5CE11C83-FA84-295A-4FA2-D7921A0BAB02}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doc_move_containers", "doc_move_containers.vcproj", "{5D1C8E13-255A-FA84-4FA2-DA92100BAD42}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doc_recursive_containers", "doc_recursive_containers.vcproj", "{5D1C8E13-255A-FA84-4FA2-DA92100BAD42}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doc_type_erasure", "doc_type_erasure.vcproj", "{5C8E1C13-A4F4-2C55-4FA2-D100BA6A9041}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "alloc_basic_test", "alloc_basic_test.vcproj", "{CD57C283-1862-42FE-BF87-B96D3A2A7912}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "alloc_full_test", "alloc_full_test.vcproj", "{CD57C283-1862-9FE5-BF87-BA91293A76D3}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "alloc_lib", "alloc_lib.vcproj", "{685AC59C-E667-4096-9DAA-AB76083C7092}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "allocator_traits_test", "allocator_traits_test.vcproj", "{5CE11C83-096A-84FE-4FA2-D3A6BA792002}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bench_adaptive_node_pool", "bench_adaptive_node_pool.vcproj", "{C8AD2618-79EB-8612-42FE-2A3AC9667A13}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bench_alloc_expand_bwd", "bench_alloc_expand_bwd.vcproj", "{C7C283A2-7BF8-8612-42FE-B9D26A0793A1}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bench_alloc", "bench_alloc.vcproj", "{7CC83A22-8612-7BF8-2F4E-BD9493C6A071}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bench_alloc_expand_fwd", "bench_alloc_expand_fwd.vcproj", "{C7C283A2-7BF8-8612-42FE-B9D26A0793A1}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bench_alloc_shrink_to_fit", "bench_alloc_shrink_to_fit.vcproj", "{C7C283A2-7BF8-8612-42FE-B9D26A0793A1}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bench_alloc_stable_vector_burst_allocation", "bench_alloc_stable_vector_burst_allocation.vcproj", "{C3AD2582-79BF-2FE1-8612-BD707552A6A1}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
EndProjectSection EndProjectSection
EndProject EndProject
@@ -71,6 +123,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bench_set", "bench_set.vcpr
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bench_static_vector", "bench_static_vector.vcproj", "{55E1C1C3-84FE-26A9-4A2E-D7901C32BA02}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_containerlib", "container.vcproj", "{FF56BAF1-32EC-4B22-B6BD-95A3A67C3135}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfiguration) = preSolution GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug Debug = Debug
@@ -79,22 +139,30 @@ Global
GlobalSection(ProjectDependencies) = postSolution GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution GlobalSection(ProjectConfiguration) = postSolution
{FF56BAF1-32EC-4B22-B6BD-95A3A67C3135}.Debug.ActiveCfg = Debug|Win32
{FF56BAF1-32EC-4B22-B6BD-95A3A67C3135}.Debug.Build.0 = Debug|Win32
{FF56BAF1-32EC-4B22-B6BD-95A3A67C3135}.Release.ActiveCfg = Release|Win32
{FF56BAF1-32EC-4B22-B6BD-95A3A67C3135}.Release.Build.0 = Release|Win32
{5CE11C83-096A-84FE-4FA2-D3A6BA792002}.Debug.ActiveCfg = Debug|Win32
{5CE11C83-096A-84FE-4FA2-D3A6BA792002}.Debug.Build.0 = Debug|Win32
{5CE11C83-096A-84FE-4FA2-D3A6BA792002}.Release.ActiveCfg = Release|Win32
{5CE11C83-096A-84FE-4FA2-D3A6BA792002}.Release.Build.0 = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792655}.Debug.ActiveCfg = Debug|Win32 {58CCE183-6092-48FE-A4F7-BA0D3A792655}.Debug.ActiveCfg = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792655}.Debug.Build.0 = Debug|Win32 {58CCE183-6092-48FE-A4F7-BA0D3A792655}.Debug.Build.0 = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792655}.Release.ActiveCfg = Release|Win32 {58CCE183-6092-48FE-A4F7-BA0D3A792655}.Release.ActiveCfg = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792655}.Release.Build.0 = Release|Win32 {58CCE183-6092-48FE-A4F7-BA0D3A792655}.Release.Build.0 = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792637}.Debug.ActiveCfg = Debug|Win32 {58CCE183-6092-48FE-A4F7-BA0D3A792606}.Debug.ActiveCfg = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792637}.Debug.Build.0 = Debug|Win32 {58CCE183-6092-48FE-A4F7-BA0D3A792606}.Debug.Build.0 = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792637}.Release.ActiveCfg = Release|Win32 {58CCE183-6092-48FE-A4F7-BA0D3A792606}.Release.ActiveCfg = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792637}.Release.Build.0 = Release|Win32 {58CCE183-6092-48FE-A4F7-BA0D3A792606}.Release.Build.0 = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792632}.Debug.ActiveCfg = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792632}.Debug.Build.0 = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792632}.Release.ActiveCfg = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792632}.Release.Build.0 = Release|Win32
{58CA17C5-A74F-9602-48FE-B06310DA7FA6}.Debug.ActiveCfg = Debug|Win32
{58CA17C5-A74F-9602-48FE-B06310DA7FA6}.Debug.Build.0 = Debug|Win32
{58CA17C5-A74F-9602-48FE-B06310DA7FA6}.Release.ActiveCfg = Release|Win32
{58CA17C5-A74F-9602-48FE-B06310DA7FA6}.Release.Build.0 = Release|Win32
{B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}.Debug.ActiveCfg = Debug|Win32
{B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}.Debug.Build.0 = Debug|Win32
{B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}.Release.ActiveCfg = Release|Win32
{B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}.Release.Build.0 = Release|Win32
{B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}.Debug.ActiveCfg = Debug|Win32
{B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}.Debug.Build.0 = Debug|Win32
{B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}.Release.ActiveCfg = Release|Win32
{B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}.Release.Build.0 = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792608}.Debug.ActiveCfg = Debug|Win32 {58CCE183-6092-48FE-A4F7-BA0D3A792608}.Debug.ActiveCfg = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792608}.Debug.Build.0 = Debug|Win32 {58CCE183-6092-48FE-A4F7-BA0D3A792608}.Debug.Build.0 = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792608}.Release.ActiveCfg = Release|Win32 {58CCE183-6092-48FE-A4F7-BA0D3A792608}.Release.ActiveCfg = Release|Win32
@@ -103,52 +171,106 @@ Global
{5E11C8D3-FA52-760A-84FE-943A6BA05A21}.Debug.Build.0 = Debug|Win32 {5E11C8D3-FA52-760A-84FE-943A6BA05A21}.Debug.Build.0 = Debug|Win32
{5E11C8D3-FA52-760A-84FE-943A6BA05A21}.Release.ActiveCfg = Release|Win32 {5E11C8D3-FA52-760A-84FE-943A6BA05A21}.Release.ActiveCfg = Release|Win32
{5E11C8D3-FA52-760A-84FE-943A6BA05A21}.Release.Build.0 = Release|Win32 {5E11C8D3-FA52-760A-84FE-943A6BA05A21}.Release.Build.0 = Release|Win32
{58E1C1C3-096A-84FE-4FA2-D6BA79201C02}.Debug.ActiveCfg = Debug|Win32
{58E1C1C3-096A-84FE-4FA2-D6BA79201C02}.Debug.Build.0 = Debug|Win32
{58E1C1C3-096A-84FE-4FA2-D6BA79201C02}.Release.ActiveCfg = Release|Win32
{58E1C1C3-096A-84FE-4FA2-D6BA79201C02}.Release.Build.0 = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D4A792607}.Debug.ActiveCfg = Debug|Win32 {58CCE183-6092-48FE-A4F7-BA0D4A792607}.Debug.ActiveCfg = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D4A792607}.Debug.Build.0 = Debug|Win32 {58CCE183-6092-48FE-A4F7-BA0D4A792607}.Debug.Build.0 = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D4A792607}.Release.ActiveCfg = Release|Win32 {58CCE183-6092-48FE-A4F7-BA0D4A792607}.Release.ActiveCfg = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D4A792607}.Release.Build.0 = Release|Win32 {58CCE183-6092-48FE-A4F7-BA0D4A792607}.Release.Build.0 = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792606}.Debug.ActiveCfg = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792606}.Debug.Build.0 = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792606}.Release.ActiveCfg = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792606}.Release.Build.0 = Release|Win32
{5CE11C83-096A-84FE-4FA2-D3A6BA792002}.Debug.ActiveCfg = Debug|Win32
{5CE11C83-096A-84FE-4FA2-D3A6BA792002}.Debug.Build.0 = Debug|Win32
{5CE11C83-096A-84FE-4FA2-D3A6BA792002}.Release.ActiveCfg = Release|Win32
{5CE11C83-096A-84FE-4FA2-D3A6BA792002}.Release.Build.0 = Release|Win32
{58CA17C5-A74F-9602-48FE-B06310DA7FA6}.Debug.ActiveCfg = Debug|Win32
{58CA17C5-A74F-9602-48FE-B06310DA7FA6}.Debug.Build.0 = Debug|Win32
{58CA17C5-A74F-9602-48FE-B06310DA7FA6}.Release.ActiveCfg = Release|Win32
{58CA17C5-A74F-9602-48FE-B06310DA7FA6}.Release.Build.0 = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792632}.Debug.ActiveCfg = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792632}.Debug.Build.0 = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792632}.Release.ActiveCfg = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792632}.Release.Build.0 = Release|Win32
{B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}.Debug.ActiveCfg = Debug|Win32
{B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}.Debug.Build.0 = Debug|Win32
{B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}.Release.ActiveCfg = Release|Win32
{B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}.Release.Build.0 = Release|Win32
{B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}.Debug.ActiveCfg = Debug|Win32
{B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}.Debug.Build.0 = Debug|Win32
{B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}.Release.ActiveCfg = Release|Win32
{B4E9FB12-7D7C-4461-83A9-5EB2C78E608F}.Release.Build.0 = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792606}.Debug.ActiveCfg = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792606}.Debug.Build.0 = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792606}.Release.ActiveCfg = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792606}.Release.Build.0 = Release|Win32
{5A8D91E0-FA57-284F-84FE-D3A6BA792002}.Debug.ActiveCfg = Debug|Win32 {5A8D91E0-FA57-284F-84FE-D3A6BA792002}.Debug.ActiveCfg = Debug|Win32
{5A8D91E0-FA57-284F-84FE-D3A6BA792002}.Debug.Build.0 = Debug|Win32 {5A8D91E0-FA57-284F-84FE-D3A6BA792002}.Debug.Build.0 = Debug|Win32
{5A8D91E0-FA57-284F-84FE-D3A6BA792002}.Release.ActiveCfg = Release|Win32 {5A8D91E0-FA57-284F-84FE-D3A6BA792002}.Release.ActiveCfg = Release|Win32
{5A8D91E0-FA57-284F-84FE-D3A6BA792002}.Release.Build.0 = Release|Win32 {5A8D91E0-FA57-284F-84FE-D3A6BA792002}.Release.Build.0 = Release|Win32
{58E1C1C3-096A-84FE-4FA2-D6BA79201C02}.Debug.ActiveCfg = Debug|Win32 {5CE11C83-096A-84FE-4FA2-D3A6BA792002}.Debug.ActiveCfg = Debug|Win32
{58E1C1C3-096A-84FE-4FA2-D6BA79201C02}.Debug.Build.0 = Debug|Win32 {5CE11C83-096A-84FE-4FA2-D3A6BA792002}.Debug.Build.0 = Debug|Win32
{58E1C1C3-096A-84FE-4FA2-D6BA79201C02}.Release.ActiveCfg = Release|Win32 {5CE11C83-096A-84FE-4FA2-D3A6BA792002}.Release.ActiveCfg = Release|Win32
{58E1C1C3-096A-84FE-4FA2-D6BA79201C02}.Debug.ActiveCfg = Debug|Win32 {5CE11C83-096A-84FE-4FA2-D3A6BA792002}.Release.Build.0 = Release|Win32
{58E1C1C3-096A-84FE-4FA2-D6BA79201C02}.Debug.Build.0 = Debug|Win32 {5188ECE3-6092-8FE0-44A7-BAD3A7926329}.Debug.ActiveCfg = Debug|Win32
{58E1C1C3-096A-84FE-4FA2-D6BA79201C02}.Release.ActiveCfg = Release|Win32 {5188ECE3-6092-8FE0-44A7-BAD3A7926329}.Debug.Build.0 = Debug|Win32
{5188ECE3-6092-8FE0-44A7-BAD3A7926329}.Release.ActiveCfg = Release|Win32
{5188ECE3-6092-8FE0-44A7-BAD3A7926329}.Release.Build.0 = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792637}.Debug.ActiveCfg = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792637}.Debug.Build.0 = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792637}.Release.ActiveCfg = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792637}.Release.Build.0 = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792606}.Debug.ActiveCfg = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792606}.Debug.Build.0 = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792606}.Release.ActiveCfg = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792606}.Release.Build.0 = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792606}.Debug.ActiveCfg = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792606}.Debug.Build.0 = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792606}.Release.ActiveCfg = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792606}.Release.Build.0 = Release|Win32
{5CE11C83-FA84-295A-4FA2-D7921A0BAB02}.Debug.ActiveCfg = Debug|Win32
{5CE11C83-FA84-295A-4FA2-D7921A0BAB02}.Debug.Build.0 = Debug|Win32
{5CE11C83-FA84-295A-4FA2-D7921A0BAB02}.Release.ActiveCfg = Release|Win32
{5CE11C83-FA84-295A-4FA2-D7921A0BAB02}.Release.Build.0 = Release|Win32
{5D1C8E13-255A-FA84-4FA2-DA92100BAD42}.Debug.ActiveCfg = Debug|Win32
{5D1C8E13-255A-FA84-4FA2-DA92100BAD42}.Debug.Build.0 = Debug|Win32
{5D1C8E13-255A-FA84-4FA2-DA92100BAD42}.Release.ActiveCfg = Release|Win32
{5D1C8E13-255A-FA84-4FA2-DA92100BAD42}.Release.Build.0 = Release|Win32
{5D1C8E13-255A-FA84-4FA2-DA92100BAD42}.Debug.ActiveCfg = Debug|Win32
{5D1C8E13-255A-FA84-4FA2-DA92100BAD42}.Debug.Build.0 = Debug|Win32
{5D1C8E13-255A-FA84-4FA2-DA92100BAD42}.Release.ActiveCfg = Release|Win32
{5D1C8E13-255A-FA84-4FA2-DA92100BAD42}.Release.Build.0 = Release|Win32
{5C8E1C13-A4F4-2C55-4FA2-D100BA6A9041}.Debug.ActiveCfg = Debug|Win32
{5C8E1C13-A4F4-2C55-4FA2-D100BA6A9041}.Debug.Build.0 = Debug|Win32
{5C8E1C13-A4F4-2C55-4FA2-D100BA6A9041}.Release.ActiveCfg = Release|Win32
{5C8E1C13-A4F4-2C55-4FA2-D100BA6A9041}.Release.Build.0 = Release|Win32
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Debug.ActiveCfg = Debug|Win32
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Debug.Build.0 = Debug|Win32
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Release.ActiveCfg = Release|Win32
{CD57C283-1862-42FE-BF87-B96D3A2A7912}.Release.Build.0 = Release|Win32
{CD57C283-1862-9FE5-BF87-BA91293A76D3}.Debug.ActiveCfg = Debug|Win32
{CD57C283-1862-9FE5-BF87-BA91293A76D3}.Debug.Build.0 = Debug|Win32
{CD57C283-1862-9FE5-BF87-BA91293A76D3}.Release.ActiveCfg = Release|Win32
{CD57C283-1862-9FE5-BF87-BA91293A76D3}.Release.Build.0 = Release|Win32
{685AC59C-E667-4096-9DAA-AB76083C7092}.Debug.ActiveCfg = Debug|Win32
{685AC59C-E667-4096-9DAA-AB76083C7092}.Debug.Build.0 = Debug|Win32
{685AC59C-E667-4096-9DAA-AB76083C7092}.Release.ActiveCfg = Release|Win32
{685AC59C-E667-4096-9DAA-AB76083C7092}.Release.Build.0 = Release|Win32
{5CE11C83-096A-84FE-4FA2-D3A6BA792002}.Debug.ActiveCfg = Debug|Win32
{5CE11C83-096A-84FE-4FA2-D3A6BA792002}.Debug.Build.0 = Debug|Win32
{5CE11C83-096A-84FE-4FA2-D3A6BA792002}.Release.ActiveCfg = Release|Win32
{5CE11C83-096A-84FE-4FA2-D3A6BA792002}.Release.Build.0 = Release|Win32
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Debug.ActiveCfg = Debug|Win32
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Debug.Build.0 = Debug|Win32
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Release.ActiveCfg = Release|Win32
{C8AD2618-79EB-8612-42FE-2A3AC9667A13}.Release.Build.0 = Release|Win32
{C7C283A2-7BF8-8612-42FE-B9D26A0793A1}.Debug.ActiveCfg = Debug|Win32
{C7C283A2-7BF8-8612-42FE-B9D26A0793A1}.Debug.Build.0 = Debug|Win32
{C7C283A2-7BF8-8612-42FE-B9D26A0793A1}.Release.ActiveCfg = Release|Win32
{C7C283A2-7BF8-8612-42FE-B9D26A0793A1}.Release.Build.0 = Release|Win32
{7CC83A22-8612-7BF8-2F4E-BD9493C6A071}.Debug.ActiveCfg = Debug|Win32
{7CC83A22-8612-7BF8-2F4E-BD9493C6A071}.Debug.Build.0 = Debug|Win32
{7CC83A22-8612-7BF8-2F4E-BD9493C6A071}.Release.ActiveCfg = Release|Win32
{7CC83A22-8612-7BF8-2F4E-BD9493C6A071}.Release.Build.0 = Release|Win32
{C7C283A2-7BF8-8612-42FE-B9D26A0793A1}.Debug.ActiveCfg = Debug|Win32
{C7C283A2-7BF8-8612-42FE-B9D26A0793A1}.Debug.Build.0 = Debug|Win32
{C7C283A2-7BF8-8612-42FE-B9D26A0793A1}.Release.ActiveCfg = Release|Win32
{C7C283A2-7BF8-8612-42FE-B9D26A0793A1}.Release.Build.0 = Release|Win32
{C7C283A2-7BF8-8612-42FE-B9D26A0793A1}.Debug.ActiveCfg = Debug|Win32
{C7C283A2-7BF8-8612-42FE-B9D26A0793A1}.Debug.Build.0 = Debug|Win32
{C7C283A2-7BF8-8612-42FE-B9D26A0793A1}.Release.ActiveCfg = Release|Win32
{C7C283A2-7BF8-8612-42FE-B9D26A0793A1}.Release.Build.0 = Release|Win32
{C3AD2582-79BF-2FE1-8612-BD707552A6A1}.Debug.ActiveCfg = Debug|Win32
{C3AD2582-79BF-2FE1-8612-BD707552A6A1}.Debug.Build.0 = Debug|Win32
{C3AD2582-79BF-2FE1-8612-BD707552A6A1}.Release.ActiveCfg = Release|Win32
{C3AD2582-79BF-2FE1-8612-BD707552A6A1}.Release.Build.0 = Release|Win32
{5E1C1C23-26A9-4FE5-A24E-DA735271C32B}.Debug.ActiveCfg = Debug|Win32 {5E1C1C23-26A9-4FE5-A24E-DA735271C32B}.Debug.ActiveCfg = Debug|Win32
{5E1C1C23-26A9-4FE5-A24E-DA735271C32B}.Debug.Build.0 = Debug|Win32 {5E1C1C23-26A9-4FE5-A24E-DA735271C32B}.Debug.Build.0 = Debug|Win32
{5E1C1C23-26A9-4FE5-A24E-DA735271C32B}.Release.ActiveCfg = Release|Win32 {5E1C1C23-26A9-4FE5-A24E-DA735271C32B}.Release.ActiveCfg = Release|Win32
{5E1C1C23-26A9-4FE5-A24E-DA735271C32B}.Release.Build.0 = Release|Win32 {5E1C1C23-26A9-4FE5-A24E-DA735271C32B}.Release.Build.0 = Release|Win32
{55E1C1C3-84FE-26A9-4A2E-D7901C32BA02}.Debug.ActiveCfg = Debug|Win32
{55E1C1C3-84FE-26A9-4A2E-D7901C32BA02}.Debug.Build.0 = Debug|Win32
{55E1C1C3-84FE-26A9-4A2E-D7901C32BA02}.Release.ActiveCfg = Release|Win32
{55E1C1C3-84FE-26A9-4A2E-D7901C32BA02}.Release.Build.0 = Release|Win32
{FF56BAF1-32EC-4B22-B6BD-95A3A67C3135}.Debug.ActiveCfg = Debug|Win32
{FF56BAF1-32EC-4B22-B6BD-95A3A67C3135}.Debug.Build.0 = Debug|Win32
{FF56BAF1-32EC-4B22-B6BD-95A3A67C3135}.Release.ActiveCfg = Release|Win32
{FF56BAF1-32EC-4B22-B6BD-95A3A67C3135}.Release.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection EndGlobalSection

View File

@@ -20,7 +20,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE" MinimalRebuild="TRUE"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@@ -61,7 +61,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2" RuntimeLibrary="2"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
@@ -99,10 +99,13 @@
Name="container" Name="container"
Filter=""> Filter="">
<File <File
RelativePath="..\..\..\..\boost\container\allocator_traits.hpp"> RelativePath="..\..\..\..\boost\container\adaptive_pool.hpp">
</File> </File>
<File <File
RelativePath="..\..\..\..\boost\container\container_exceptions.hpp"> RelativePath="..\..\..\..\boost\container\allocator.hpp">
</File>
<File
RelativePath="..\..\..\..\boost\container\allocator_traits.hpp">
</File> </File>
<File <File
RelativePath="..\..\..\..\boost\container\container_fwd.hpp"> RelativePath="..\..\..\..\boost\container\container_fwd.hpp">
@@ -122,6 +125,9 @@
<File <File
RelativePath="..\..\..\..\boost\container\map.hpp"> RelativePath="..\..\..\..\boost\container\map.hpp">
</File> </File>
<File
RelativePath="..\..\..\..\boost\container\node_allocator.hpp">
</File>
<File <File
RelativePath="..\..\..\..\boost\container\scoped_allocator.hpp"> RelativePath="..\..\..\..\boost\container\scoped_allocator.hpp">
</File> </File>
@@ -155,6 +161,9 @@
<Filter <Filter
Name="detail" Name="detail"
Filter=""> Filter="">
<File
RelativePath="..\..\..\..\boost\container\detail\adaptive_node_pool.hpp">
</File>
<File <File
RelativePath="..\..\..\..\boost\container\detail\adaptive_node_pool_impl.hpp"> RelativePath="..\..\..\..\boost\container\detail\adaptive_node_pool_impl.hpp">
</File> </File>
@@ -164,12 +173,21 @@
<File <File
RelativePath="..\..\..\..\boost\container\detail\algorithms.hpp"> RelativePath="..\..\..\..\boost\container\detail\algorithms.hpp">
</File> </File>
<File
RelativePath="..\..\..\..\boost\container\detail\alloc_lib.h">
</File>
<File <File
RelativePath="..\..\..\..\boost\container\detail\allocation_type.hpp"> RelativePath="..\..\..\..\boost\container\detail\allocation_type.hpp">
</File> </File>
<File <File
RelativePath="..\..\..\..\boost\container\detail\allocator_version_traits.hpp"> RelativePath="..\..\..\..\boost\container\detail\allocator_version_traits.hpp">
</File> </File>
<File
RelativePath="..\..\..\..\boost\container\detail\auto_link.hpp">
</File>
<File
RelativePath="..\..\..\..\boost\container\detail\boost_cont_ext_auto_link.hpp">
</File>
<File <File
RelativePath="..\..\..\..\boost\container\detail\config_begin.hpp"> RelativePath="..\..\..\..\boost\container\detail\config_begin.hpp">
</File> </File>
@@ -203,9 +221,15 @@
<File <File
RelativePath="..\..\..\..\boost\container\detail\multiallocation_chain.hpp"> RelativePath="..\..\..\..\boost\container\detail\multiallocation_chain.hpp">
</File> </File>
<File
RelativePath="..\..\..\..\boost\container\detail\mutex.hpp">
</File>
<File <File
RelativePath="..\..\..\..\boost\container\detail\node_alloc_holder.hpp"> RelativePath="..\..\..\..\boost\container\detail\node_alloc_holder.hpp">
</File> </File>
<File
RelativePath="..\..\..\..\boost\container\detail\node_pool.hpp">
</File>
<File <File
RelativePath="..\..\..\..\boost\container\detail\node_pool_impl.hpp"> RelativePath="..\..\..\..\boost\container\detail\node_pool_impl.hpp">
</File> </File>
@@ -215,9 +239,15 @@
<File <File
RelativePath="..\..\..\..\boost\container\detail\pool_common.hpp"> RelativePath="..\..\..\..\boost\container\detail\pool_common.hpp">
</File> </File>
<File
RelativePath="..\..\..\..\boost\container\detail\pool_common_alloc.hpp">
</File>
<File <File
RelativePath="..\..\..\..\boost\container\detail\preprocessor.hpp"> RelativePath="..\..\..\..\boost\container\detail\preprocessor.hpp">
</File> </File>
<File
RelativePath="..\..\..\..\boost\container\detail\singleton.hpp">
</File>
<File <File
RelativePath="..\..\..\..\boost\container\detail\transform_iterator.hpp"> RelativePath="..\..\..\..\boost\container\detail\transform_iterator.hpp">
</File> </File>
@@ -282,6 +312,9 @@
<File <File
RelativePath="..\..\test\check_equal_containers.hpp"> RelativePath="..\..\test\check_equal_containers.hpp">
</File> </File>
<File
RelativePath="..\..\test\default_init_test.hpp">
</File>
<File <File
RelativePath="..\..\test\dummy_test_allocator.hpp"> RelativePath="..\..\test\dummy_test_allocator.hpp">
</File> </File>

View File

@@ -20,7 +20,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE" MinimalRebuild="TRUE"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@@ -73,7 +73,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2" RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="FALSE" ForceConformanceInForLoopScope="FALSE"
@@ -127,11 +127,6 @@
RelativePath="..\..\test\deque_test.cpp"> RelativePath="..\..\test\deque_test.cpp">
</File> </File>
</Filter> </Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
</Filter>
</Files> </Files>
<Globals> <Globals>
</Globals> </Globals>

View File

@@ -1,140 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="flat_tree_test"
ProjectGUID="{58CCE183-6092-48FE-A4F7-BA0D3A792637}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../Bin/Win32/Debug"
IntermediateDirectory="Debug/flat_tree_test"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
GeneratePreprocessedFile="0"
KeepComments="FALSE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="FALSE"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="winmm.lib"
OutputFile="$(OutDir)/flat_tree_test_d.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../../stage/lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/flat_tree_test.pdb"
SubSystem="1"
TargetMachine="1"
FixedBaseAddress="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../Bin/Win32/Release"
IntermediateDirectory="Release/flat_tree_test"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="FALSE"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="winmm.lib"
OutputFile="$(OutDir)/flat_tree_test.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../../stage/lib"
GenerateDebugInformation="TRUE"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath="..\..\test\flat_tree_test.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -20,7 +20,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
GeneratePreprocessedFile="0" GeneratePreprocessedFile="0"
KeepComments="FALSE" KeepComments="FALSE"
MinimalRebuild="TRUE" MinimalRebuild="TRUE"
@@ -75,7 +75,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2" RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="FALSE" ForceConformanceInForLoopScope="FALSE"

View File

@@ -20,7 +20,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE" MinimalRebuild="TRUE"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@@ -73,7 +73,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2" RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="FALSE" ForceConformanceInForLoopScope="FALSE"

View File

@@ -20,7 +20,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
GeneratePreprocessedFile="0" GeneratePreprocessedFile="0"
MinimalRebuild="TRUE" MinimalRebuild="TRUE"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@@ -74,7 +74,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2" RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="FALSE" ForceConformanceInForLoopScope="FALSE"
@@ -128,11 +128,6 @@
RelativePath="..\..\test\scoped_allocator_adaptor_test.cpp"> RelativePath="..\..\test\scoped_allocator_adaptor_test.cpp">
</File> </File>
</Filter> </Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93815995-89BD-b043-5E8B-65FBE52E2AFB}">
</Filter>
</Files> </Files>
<Globals> <Globals>
</Globals> </Globals>

View File

@@ -20,7 +20,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
GeneratePreprocessedFile="0" GeneratePreprocessedFile="0"
MinimalRebuild="TRUE" MinimalRebuild="TRUE"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@@ -74,7 +74,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2" RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="FALSE" ForceConformanceInForLoopScope="FALSE"
@@ -128,11 +128,6 @@
RelativePath="..\..\test\scoped_allocator_usage_test.cpp"> RelativePath="..\..\test\scoped_allocator_usage_test.cpp">
</File> </File>
</Filter> </Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93815995-89BD-b043-5E8B-65FBE52E2AFB}">
</Filter>
</Files> </Files>
<Globals> <Globals>
</Globals> </Globals>

View File

@@ -20,7 +20,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE" MinimalRebuild="TRUE"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@@ -73,7 +73,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2" RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="FALSE" ForceConformanceInForLoopScope="FALSE"
@@ -127,11 +127,6 @@
RelativePath="..\..\test\slist_test.cpp"> RelativePath="..\..\test\slist_test.cpp">
</File> </File>
</Filter> </Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
</Filter>
</Files> </Files>
<Globals> <Globals>
</Globals> </Globals>

View File

@@ -20,7 +20,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE" MinimalRebuild="TRUE"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
@@ -73,7 +73,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2" RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="FALSE" ForceConformanceInForLoopScope="FALSE"

View File

@@ -20,7 +20,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE" MinimalRebuild="TRUE"
ExceptionHandling="TRUE" ExceptionHandling="TRUE"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@@ -74,7 +74,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2" RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="FALSE" ForceConformanceInForLoopScope="FALSE"
@@ -128,11 +128,6 @@
RelativePath="..\..\test\static_vector_test.cpp"> RelativePath="..\..\test\static_vector_test.cpp">
</File> </File>
</Filter> </Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93815995-89BD-b043-5E8B-65FBE52E2AFB}">
</Filter>
</Files> </Files>
<Globals> <Globals>
</Globals> </Globals>

View File

@@ -20,7 +20,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
GeneratePreprocessedFile="0" GeneratePreprocessedFile="0"
MinimalRebuild="TRUE" MinimalRebuild="TRUE"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@@ -74,7 +74,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2" RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="FALSE" ForceConformanceInForLoopScope="FALSE"
@@ -128,11 +128,6 @@
RelativePath="..\..\test\string_test.cpp"> RelativePath="..\..\test\string_test.cpp">
</File> </File>
</Filter> </Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
</Filter>
</Files> </Files>
<Globals> <Globals>
</Globals> </Globals>

View File

@@ -20,7 +20,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE" MinimalRebuild="TRUE"
ExceptionHandling="TRUE" ExceptionHandling="TRUE"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@@ -74,7 +74,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2" RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="FALSE" ForceConformanceInForLoopScope="FALSE"

View File

@@ -1,138 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="tree_test"
ProjectGUID="{58CCE183-6092-48FE-A4F7-BA0D3A792606}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../Bin/Win32/Debug"
IntermediateDirectory="Debug/tree_test"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="FALSE"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="winmm.lib"
OutputFile="$(OutDir)/tree_test_d.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../../stage/lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/tree_test.pdb"
SubSystem="1"
TargetMachine="1"
FixedBaseAddress="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../Bin/Win32/Release"
IntermediateDirectory="Release/tree_test"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="FALSE"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="winmm.lib"
OutputFile="$(OutDir)/tree_test.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="../../../../stage/lib"
GenerateDebugInformation="TRUE"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath="..\..\test\tree_test.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -20,7 +20,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE" MinimalRebuild="TRUE"
ExceptionHandling="TRUE" ExceptionHandling="TRUE"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@@ -74,7 +74,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="../../../.." AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2" RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="FALSE" ForceConformanceInForLoopScope="FALSE"
@@ -128,11 +128,6 @@
RelativePath="..\..\test\vector_test.cpp"> RelativePath="..\..\test\vector_test.cpp">
</File> </File>
</Filter> </Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93815995-89BD-b043-5E8B-65FBE52E2AFB}">
</Filter>
</Files> </Files>
<Globals> <Globals>
</Globals> </Globals>

View File

@@ -1,6 +1,6 @@
# Boost Container Library Test Jamfile # Boost Container Library Test Jamfile
# (C) Copyright Ion Gaztanaga 2009. # (C) Copyright Ion Gaztanaga 2009-2013.
# Use, modification and distribution are subject to the # Use, modification and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file # Boost Software License, Version 1.0. (See accompanying file
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -21,7 +21,7 @@ rule test_all
for local fileb in [ glob *.cpp ] for local fileb in [ glob *.cpp ]
{ {
all_rules += [ run $(fileb) all_rules += [ run $(fileb) /boost/container//boost_container /boost/timer//boost_timer
: # additional args : # additional args
: # test-files : # test-files
: # requirements : # requirements

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2011-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2004-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2004-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -17,6 +17,10 @@
#include <list> #include <list>
#include <boost/container/deque.hpp> #include <boost/container/deque.hpp>
#include <boost/container/allocator.hpp>
#include <boost/container/node_allocator.hpp>
#include <boost/container/adaptive_pool.hpp>
#include "print_container.hpp" #include "print_container.hpp"
#include "check_equal_containers.hpp" #include "check_equal_containers.hpp"
#include "dummy_test_allocator.hpp" #include "dummy_test_allocator.hpp"
@@ -29,6 +33,7 @@
#include "emplace_test.hpp" #include "emplace_test.hpp"
#include "propagate_allocator_test.hpp" #include "propagate_allocator_test.hpp"
#include "vector_test.hpp" #include "vector_test.hpp"
#include "default_init_test.hpp"
#include <boost/detail/no_exceptions_support.hpp> #include <boost/detail/no_exceptions_support.hpp>
using namespace boost::container; using namespace boost::container;
@@ -49,6 +54,18 @@ template class boost::container::deque
< test::movable_and_copyable_int < test::movable_and_copyable_int
, std::allocator<test::movable_and_copyable_int> >; , std::allocator<test::movable_and_copyable_int> >;
template class boost::container::deque
< test::movable_and_copyable_int
, allocator<test::movable_and_copyable_int> >;
template class boost::container::deque
< test::movable_and_copyable_int
, adaptive_pool<test::movable_and_copyable_int> >;
template class boost::container::deque
< test::movable_and_copyable_int
, node_allocator<test::movable_and_copyable_int> >;
}} }}
//Function to check if both sets are equal //Function to check if both sets are equal
@@ -145,11 +162,8 @@ bool do_test()
typedef std::deque<int> MyStdDeque; typedef std::deque<int> MyStdDeque;
const int max = 100; const int max = 100;
BOOST_TRY{ BOOST_TRY{
//Shared memory allocator must be always be initialized
//since it has no default constructor
MyCntDeque *cntdeque = new MyCntDeque; MyCntDeque *cntdeque = new MyCntDeque;
MyStdDeque *stddeque = new MyStdDeque; MyStdDeque *stddeque = new MyStdDeque;
//Compare several shared memory deque operations with std::deque
for(int i = 0; i < max*100; ++i){ for(int i = 0; i < max*100; ++i){
IntType move_me(i); IntType move_me(i);
cntdeque->insert(cntdeque->end(), boost::move(move_me)); cntdeque->insert(cntdeque->end(), boost::move(move_me));
@@ -295,6 +309,38 @@ bool do_test()
return true; return true;
} }
template<class VoidAllocator>
struct GetAllocatorCont
{
template<class ValueType>
struct apply
{
typedef deque< ValueType
, typename allocator_traits<VoidAllocator>
::template portable_rebind_alloc<ValueType>::type
> type;
};
};
template<class VoidAllocator>
int test_cont_variants()
{
typedef typename GetAllocatorCont<VoidAllocator>::template apply<int>::type MyCont;
typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::movable_int>::type MyMoveCont;
typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::movable_and_copyable_int>::type MyCopyMoveCont;
typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::copyable_int>::type MyCopyCont;
if(test::vector_test<MyCont>())
return 1;
if(test::vector_test<MyMoveCont>())
return 1;
if(test::vector_test<MyCopyMoveCont>())
return 1;
if(test::vector_test<MyCopyCont>())
return 1;
return 0;
}
int main () int main ()
{ {
@@ -320,18 +366,26 @@ int main ()
} }
{ {
typedef deque<int> MyDeque; if(test_cont_variants< std::allocator<void> >()){
typedef deque<test::movable_int> MyMoveDeque; std::cerr << "test_cont_variants< std::allocator<void> > failed" << std::endl;
typedef deque<test::movable_and_copyable_int> MyCopyMoveDeque;
typedef deque<test::copyable_int> MyCopyDeque;
if(test::vector_test<MyDeque>())
return 1; return 1;
if(test::vector_test<MyMoveDeque>()) }
if(test_cont_variants< allocator<void> >()){
std::cerr << "test_cont_variants< allocator<void> > failed" << std::endl;
return 1; return 1;
if(test::vector_test<MyCopyMoveDeque>()) }
if(test_cont_variants< node_allocator<void> >()){
std::cerr << "test_cont_variants< node_allocator<void> > failed" << std::endl;
return 1; return 1;
if(test::vector_test<MyCopyDeque>()) }
if(test_cont_variants< adaptive_pool<void> >()){
std::cerr << "test_cont_variants< adaptive_pool<void> > failed" << std::endl;
return 1; return 1;
}
if(!test::default_init_test< deque<int, test::default_init_allocator<int> > >()){ if(!test::default_init_test< deque<int, test::default_init_allocator<int> > >()){
std::cerr << "Default init test failed" << std::endl; std::cerr << "Default init test failed" << std::endl;
return 1; return 1;

View File

@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -11,7 +11,7 @@
#ifndef BOOST_CONTAINER_DUMMY_TEST_ALLOCATOR_HPP #ifndef BOOST_CONTAINER_DUMMY_TEST_ALLOCATOR_HPP
#define BOOST_CONTAINER_DUMMY_TEST_ALLOCATOR_HPP #define BOOST_CONTAINER_DUMMY_TEST_ALLOCATOR_HPP
#if (defined _MSC_VER) #if defined(_MSC_VER)
# pragma once # pragma once
#endif #endif
@@ -33,9 +33,6 @@
#include <cstddef> #include <cstddef>
#include <cassert> #include <cassert>
//!\file
//!Describes an allocator to test expand capabilities
namespace boost { namespace boost {
namespace container { namespace container {
namespace test { namespace test {

View File

@@ -1,6 +1,6 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -11,7 +11,7 @@
#ifndef BOOST_CONTAINER_EXPAND_BWD_TEST_ALLOCATOR_HPP #ifndef BOOST_CONTAINER_EXPAND_BWD_TEST_ALLOCATOR_HPP
#define BOOST_CONTAINER_EXPAND_BWD_TEST_ALLOCATOR_HPP #define BOOST_CONTAINER_EXPAND_BWD_TEST_ALLOCATOR_HPP
#if (defined _MSC_VER) #if defined(_MSC_VER)
# pragma once # pragma once
#endif #endif
@@ -29,9 +29,6 @@
#include <cstddef> #include <cstddef>
#include <cassert> #include <cassert>
//!\file
//!Describes an allocator to test expand capabilities
namespace boost { namespace boost {
namespace container { namespace container {
namespace test { namespace test {

View File

@@ -187,8 +187,8 @@ bool test_assign_with_expand_bwd()
const int Offset[] = { 50, 50, 50}; const int Offset[] = { 50, 50, 50};
const int InitialSize[] = { 25, 25, 25}; const int InitialSize[] = { 25, 25, 25};
const int AssignSize[] = { 40, 60, 80}; const int InsertSize[] = { 15, 35, 55};
const int Iterations = sizeof(AssignSize)/sizeof(int); const int Iterations = sizeof(InsertSize)/sizeof(int);
for(int iteration = 0; iteration <Iterations; ++iteration) for(int iteration = 0; iteration <Iterations; ++iteration)
{ {
@@ -202,10 +202,10 @@ bool test_assign_with_expand_bwd()
} }
//Create data to assign //Create data to assign
std::vector<non_volatile_value_type> data_to_assign; std::vector<non_volatile_value_type> data_to_insert;
data_to_assign.resize(AssignSize[iteration]); data_to_insert.resize(InsertSize[iteration]);
for(int i = 0; i < AssignSize[iteration]; ++i){ for(int i = 0; i < InsertSize[iteration]; ++i){
data_to_assign[i] = -i; data_to_insert[i] = -i;
} }
//Insert initial data to the vector to test //Insert initial data to the vector to test
@@ -216,8 +216,8 @@ bool test_assign_with_expand_bwd()
, initial_data.begin(), initial_data.end()); , initial_data.begin(), initial_data.end());
//Assign data //Assign data
vector.assign(data_to_assign.begin(), data_to_assign.end()); vector.insert(vector.cbegin(), data_to_insert.begin(), data_to_insert.end());
initial_data.assign(data_to_assign.begin(), data_to_assign.end()); initial_data.insert(initial_data.begin(), data_to_insert.begin(), data_to_insert.end());
//Now check that values are equal //Now check that values are equal
if(!CheckEqualVector(vector, initial_data)){ if(!CheckEqualVector(vector, initial_data)){

View File

@@ -1,640 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2004-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)
//
// See http://www.boost.org/libs/container for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#include <boost/container/detail/config_begin.hpp>
#include <set>
#include <boost/container/flat_set.hpp>
#include <boost/container/flat_map.hpp>
#include "print_container.hpp"
#include "dummy_test_allocator.hpp"
#include "movable_int.hpp"
#include "set_test.hpp"
#include "map_test.hpp"
#include "propagate_allocator_test.hpp"
#include "emplace_test.hpp"
#include <vector>
#include <boost/container/detail/flat_tree.hpp>
using namespace boost::container;
namespace boost {
namespace container {
//Explicit instantiation to detect compilation errors
//flat_map
template class flat_map
< test::movable_and_copyable_int
, test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, test::dummy_test_allocator
< std::pair<test::movable_and_copyable_int, test::movable_and_copyable_int> >
>;
template class flat_map
< test::movable_and_copyable_int
, test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, test::simple_allocator
< std::pair<test::movable_and_copyable_int, test::movable_and_copyable_int> >
>;
template class flat_map
< test::movable_and_copyable_int
, test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, std::allocator
< std::pair<test::movable_and_copyable_int, test::movable_and_copyable_int> >
>;
//flat_multimap
template class flat_multimap
< test::movable_and_copyable_int
, test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, test::dummy_test_allocator
< std::pair<test::movable_and_copyable_int, test::movable_and_copyable_int> >
>;
template class flat_multimap
< test::movable_and_copyable_int
, test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, test::simple_allocator
< std::pair<test::movable_and_copyable_int, test::movable_and_copyable_int> >
>;
template class flat_multimap
< test::movable_and_copyable_int
, test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, std::allocator
< std::pair<test::movable_and_copyable_int, test::movable_and_copyable_int> >
>;
//flat_set
template class flat_set
< test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, test::dummy_test_allocator<test::movable_and_copyable_int>
>;
template class flat_set
< test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, test::simple_allocator<test::movable_and_copyable_int>
>;
template class flat_set
< test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, std::allocator<test::movable_and_copyable_int>
>;
//flat_multiset
template class flat_multiset
< test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, test::dummy_test_allocator<test::movable_and_copyable_int>
>;
template class flat_multiset
< test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, test::simple_allocator<test::movable_and_copyable_int>
>;
template class flat_multiset
< test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, std::allocator<test::movable_and_copyable_int>
>;
//As flat container iterators are typedefs for vector::[const_]iterator,
//no need to explicit instantiate them
}} //boost::container
//Alias allocator type
typedef std::allocator<int> allocator_t;
typedef std::allocator<test::movable_int>
movable_allocator_t;
typedef std::allocator<std::pair<int, int> >
pair_allocator_t;
typedef std::allocator<std::pair<test::movable_int, test::movable_int> >
movable_pair_allocator_t;
typedef std::allocator<test::movable_and_copyable_int >
move_copy_allocator_t;
typedef std::allocator<std::pair<test::movable_and_copyable_int, test::movable_and_copyable_int> >
move_copy_pair_allocator_t;
typedef std::allocator<test::copyable_int >
copy_allocator_t;
typedef std::allocator<std::pair<test::copyable_int, test::copyable_int> >
copy_pair_allocator_t;
//Alias set types
typedef std::set<int> MyStdSet;
typedef std::multiset<int> MyStdMultiSet;
typedef std::map<int, int> MyStdMap;
typedef std::multimap<int, int> MyStdMultiMap;
typedef flat_set<int, std::less<int>, allocator_t> MyBoostSet;
typedef flat_multiset<int, std::less<int>, allocator_t> MyBoostMultiSet;
typedef flat_map<int, int, std::less<int>, pair_allocator_t> MyBoostMap;
typedef flat_multimap<int, int, std::less<int>, pair_allocator_t> MyBoostMultiMap;
typedef flat_set<test::movable_int, std::less<test::movable_int>
,movable_allocator_t> MyMovableBoostSet;
typedef flat_multiset<test::movable_int,std::less<test::movable_int>
,movable_allocator_t> MyMovableBoostMultiSet;
typedef flat_map<test::movable_int, test::movable_int
,std::less<test::movable_int>
,movable_pair_allocator_t> MyMovableBoostMap;
typedef flat_multimap<test::movable_int, test::movable_int
,std::less<test::movable_int>
,movable_pair_allocator_t> MyMovableBoostMultiMap;
typedef flat_set<test::movable_and_copyable_int, std::less<test::movable_and_copyable_int>
,move_copy_allocator_t> MyMoveCopyBoostSet;
typedef flat_multiset<test::movable_and_copyable_int,std::less<test::movable_and_copyable_int>
,move_copy_allocator_t> MyMoveCopyBoostMultiSet;
typedef flat_map<test::movable_and_copyable_int, test::movable_and_copyable_int
,std::less<test::movable_and_copyable_int>
,move_copy_pair_allocator_t> MyMoveCopyBoostMap;
typedef flat_multimap<test::movable_and_copyable_int, test::movable_and_copyable_int
,std::less<test::movable_and_copyable_int>
,move_copy_pair_allocator_t> MyMoveCopyBoostMultiMap;
typedef flat_set<test::copyable_int, std::less<test::copyable_int>
,copy_allocator_t> MyCopyBoostSet;
typedef flat_multiset<test::copyable_int,std::less<test::copyable_int>
,copy_allocator_t> MyCopyBoostMultiSet;
typedef flat_map<test::copyable_int, test::copyable_int
,std::less<test::copyable_int>
,copy_pair_allocator_t> MyCopyBoostMap;
typedef flat_multimap<test::copyable_int, test::copyable_int
,std::less<test::copyable_int>
,copy_pair_allocator_t> MyCopyBoostMultiMap;
//Test recursive structures
class recursive_flat_set
{
public:
recursive_flat_set(const recursive_flat_set &c)
: id_(c.id_), flat_set_(c.flat_set_)
{}
recursive_flat_set & operator =(const recursive_flat_set &c)
{
id_ = c.id_;
flat_set_= c.flat_set_;
return *this;
}
int id_;
flat_set<recursive_flat_set> flat_set_;
friend bool operator< (const recursive_flat_set &a, const recursive_flat_set &b)
{ return a.id_ < b.id_; }
};
class recursive_flat_map
{
public:
recursive_flat_map(const recursive_flat_map &c)
: id_(c.id_), map_(c.map_)
{}
recursive_flat_map & operator =(const recursive_flat_map &c)
{
id_ = c.id_;
map_= c.map_;
return *this;
}
int id_;
flat_map<recursive_flat_map, recursive_flat_map> map_;
friend bool operator< (const recursive_flat_map &a, const recursive_flat_map &b)
{ return a.id_ < b.id_; }
};
//Test recursive structures
class recursive_flat_multiset
{
public:
recursive_flat_multiset(const recursive_flat_multiset &c)
: id_(c.id_), flat_multiset_(c.flat_multiset_)
{}
recursive_flat_multiset & operator =(const recursive_flat_multiset &c)
{
id_ = c.id_;
flat_multiset_= c.flat_multiset_;
return *this;
}
int id_;
flat_multiset<recursive_flat_multiset> flat_multiset_;
friend bool operator< (const recursive_flat_multiset &a, const recursive_flat_multiset &b)
{ return a.id_ < b.id_; }
};
class recursive_flat_multimap
{
public:
recursive_flat_multimap(const recursive_flat_multimap &c)
: id_(c.id_), map_(c.map_)
{}
recursive_flat_multimap & operator =(const recursive_flat_multimap &c)
{
id_ = c.id_;
map_= c.map_;
return *this;
}
int id_;
flat_map<recursive_flat_multimap, recursive_flat_multimap> map_;
friend bool operator< (const recursive_flat_multimap &a, const recursive_flat_multimap &b)
{ return a.id_ < b.id_; }
};
template<class C>
void test_move()
{
//Now test move semantics
C original;
C move_ctor(boost::move(original));
C move_assign;
move_assign = boost::move(move_ctor);
move_assign.swap(original);
}
template<class T, class A>
class flat_tree_propagate_test_wrapper
: public container_detail::flat_tree<T, T, container_detail::identity<T>, std::less<T>, A>
{
BOOST_COPYABLE_AND_MOVABLE(flat_tree_propagate_test_wrapper)
typedef container_detail::flat_tree<T, T, container_detail::identity<T>, std::less<T>, A> Base;
public:
flat_tree_propagate_test_wrapper()
: Base()
{}
flat_tree_propagate_test_wrapper(const flat_tree_propagate_test_wrapper &x)
: Base(x)
{}
flat_tree_propagate_test_wrapper(BOOST_RV_REF(flat_tree_propagate_test_wrapper) x)
: Base(boost::move(static_cast<Base&>(x)))
{}
flat_tree_propagate_test_wrapper &operator=(BOOST_COPY_ASSIGN_REF(flat_tree_propagate_test_wrapper) x)
{ this->Base::operator=(x); return *this; }
flat_tree_propagate_test_wrapper &operator=(BOOST_RV_REF(flat_tree_propagate_test_wrapper) x)
{ this->Base::operator=(boost::move(static_cast<Base&>(x))); return *this; }
void swap(flat_tree_propagate_test_wrapper &x)
{ this->Base::swap(x); }
};
namespace boost{
namespace container {
namespace test{
bool flat_tree_ordered_insertion_test()
{
using namespace boost::container;
const std::size_t NumElements = 100;
//Ordered insertion multiset
{
std::multiset<int> int_mset;
for(std::size_t i = 0; i != NumElements; ++i){
int_mset.insert(static_cast<int>(i));
}
//Construction insertion
flat_multiset<int> fmset(ordered_range, int_mset.begin(), int_mset.end());
if(!CheckEqualContainers(&int_mset, &fmset))
return false;
//Insertion when empty
fmset.clear();
fmset.insert(ordered_range, int_mset.begin(), int_mset.end());
if(!CheckEqualContainers(&int_mset, &fmset))
return false;
//Re-insertion
fmset.insert(ordered_range, int_mset.begin(), int_mset.end());
std::multiset<int> int_mset2(int_mset);
int_mset2.insert(int_mset.begin(), int_mset.end());
if(!CheckEqualContainers(&int_mset2, &fmset))
return false;
//Re-re-insertion
fmset.insert(ordered_range, int_mset2.begin(), int_mset2.end());
std::multiset<int> int_mset4(int_mset2);
int_mset4.insert(int_mset2.begin(), int_mset2.end());
if(!CheckEqualContainers(&int_mset4, &fmset))
return false;
//Re-re-insertion of even
std::multiset<int> int_even_mset;
for(std::size_t i = 0; i < NumElements; i+=2){
int_mset.insert(static_cast<int>(i));
}
fmset.insert(ordered_range, int_even_mset.begin(), int_even_mset.end());
int_mset4.insert(int_even_mset.begin(), int_even_mset.end());
if(!CheckEqualContainers(&int_mset4, &fmset))
return false;
}
//Ordered insertion multimap
{
std::multimap<int, int> int_mmap;
for(std::size_t i = 0; i != NumElements; ++i){
int_mmap.insert(std::multimap<int, int>::value_type(static_cast<int>(i), static_cast<int>(i)));
}
//Construction insertion
flat_multimap<int, int> fmmap(ordered_range, int_mmap.begin(), int_mmap.end());
if(!CheckEqualContainers(&int_mmap, &fmmap))
return false;
//Insertion when empty
fmmap.clear();
fmmap.insert(ordered_range, int_mmap.begin(), int_mmap.end());
if(!CheckEqualContainers(&int_mmap, &fmmap))
return false;
//Re-insertion
fmmap.insert(ordered_range, int_mmap.begin(), int_mmap.end());
std::multimap<int, int> int_mmap2(int_mmap);
int_mmap2.insert(int_mmap.begin(), int_mmap.end());
if(!CheckEqualContainers(&int_mmap2, &fmmap))
return false;
//Re-re-insertion
fmmap.insert(ordered_range, int_mmap2.begin(), int_mmap2.end());
std::multimap<int, int> int_mmap4(int_mmap2);
int_mmap4.insert(int_mmap2.begin(), int_mmap2.end());
if(!CheckEqualContainers(&int_mmap4, &fmmap))
return false;
//Re-re-insertion of even
std::multimap<int, int> int_even_mmap;
for(std::size_t i = 0; i < NumElements; i+=2){
int_mmap.insert(std::multimap<int, int>::value_type(static_cast<int>(i), static_cast<int>(i)));
}
fmmap.insert(ordered_range, int_even_mmap.begin(), int_even_mmap.end());
int_mmap4.insert(int_even_mmap.begin(), int_even_mmap.end());
if(!CheckEqualContainers(&int_mmap4, &fmmap))
return false;
}
//Ordered insertion set
{
std::set<int> int_set;
for(std::size_t i = 0; i != NumElements; ++i){
int_set.insert(static_cast<int>(i));
}
//Construction insertion
flat_set<int> fset(ordered_unique_range, int_set.begin(), int_set.end());
if(!CheckEqualContainers(&int_set, &fset))
return false;
//Insertion when empty
fset.clear();
fset.insert(ordered_unique_range, int_set.begin(), int_set.end());
if(!CheckEqualContainers(&int_set, &fset))
return false;
//Re-insertion
fset.insert(ordered_unique_range, int_set.begin(), int_set.end());
std::set<int> int_set2(int_set);
int_set2.insert(int_set.begin(), int_set.end());
if(!CheckEqualContainers(&int_set2, &fset))
return false;
//Re-re-insertion
fset.insert(ordered_unique_range, int_set2.begin(), int_set2.end());
std::set<int> int_set4(int_set2);
int_set4.insert(int_set2.begin(), int_set2.end());
if(!CheckEqualContainers(&int_set4, &fset))
return false;
//Re-re-insertion of even
std::set<int> int_even_set;
for(std::size_t i = 0; i < NumElements; i+=2){
int_set.insert(static_cast<int>(i));
}
fset.insert(ordered_unique_range, int_even_set.begin(), int_even_set.end());
int_set4.insert(int_even_set.begin(), int_even_set.end());
if(!CheckEqualContainers(&int_set4, &fset))
return false;
}
//Ordered insertion map
{
std::map<int, int> int_map;
for(std::size_t i = 0; i != NumElements; ++i){
int_map.insert(std::map<int, int>::value_type(static_cast<int>(i), static_cast<int>(i)));
}
//Construction insertion
flat_map<int, int> fmap(ordered_unique_range, int_map.begin(), int_map.end());
if(!CheckEqualContainers(&int_map, &fmap))
return false;
//Insertion when empty
fmap.clear();
fmap.insert(ordered_unique_range, int_map.begin(), int_map.end());
if(!CheckEqualContainers(&int_map, &fmap))
return false;
//Re-insertion
fmap.insert(ordered_unique_range, int_map.begin(), int_map.end());
std::map<int, int> int_map2(int_map);
int_map2.insert(int_map.begin(), int_map.end());
if(!CheckEqualContainers(&int_map2, &fmap))
return false;
//Re-re-insertion
fmap.insert(ordered_unique_range, int_map2.begin(), int_map2.end());
std::map<int, int> int_map4(int_map2);
int_map4.insert(int_map2.begin(), int_map2.end());
if(!CheckEqualContainers(&int_map4, &fmap))
return false;
//Re-re-insertion of even
std::map<int, int> int_even_map;
for(std::size_t i = 0; i < NumElements; i+=2){
int_map.insert(std::map<int, int>::value_type(static_cast<int>(i), static_cast<int>(i)));
}
fmap.insert(ordered_unique_range, int_even_map.begin(), int_even_map.end());
int_map4.insert(int_even_map.begin(), int_even_map.end());
if(!CheckEqualContainers(&int_map4, &fmap))
return false;
}
return true;
}
}}}
int main()
{
using namespace boost::container::test;
//Allocator argument container
{
flat_set<int> set_((std::allocator<int>()));
flat_multiset<int> multiset_((std::allocator<int>()));
flat_map<int, int> map_((std::allocator<std::pair<int, int> >()));
flat_multimap<int, int> multimap_((std::allocator<std::pair<int, int> >()));
}
//Now test move semantics
{
test_move<flat_set<recursive_flat_set> >();
test_move<flat_multiset<recursive_flat_multiset> >();
test_move<flat_map<recursive_flat_map, recursive_flat_map> >();
test_move<flat_multimap<recursive_flat_multimap, recursive_flat_multimap> >();
}
if(!flat_tree_ordered_insertion_test()){
return 1;
}
if (0 != set_test<
MyBoostSet
,MyStdSet
,MyBoostMultiSet
,MyStdMultiSet>()){
std::cout << "Error in set_test<MyBoostSet>" << std::endl;
return 1;
}
if (0 != set_test_copyable<
MyBoostSet
,MyStdSet
,MyBoostMultiSet
,MyStdMultiSet>()){
std::cout << "Error in set_test<MyBoostSet>" << std::endl;
return 1;
}
if (0 != set_test<
MyMovableBoostSet
,MyStdSet
,MyMovableBoostMultiSet
,MyStdMultiSet>()){
std::cout << "Error in set_test<MyMovableBoostSet>" << std::endl;
return 1;
}
if (0 != set_test<
MyMoveCopyBoostSet
,MyStdSet
,MyMoveCopyBoostMultiSet
,MyStdMultiSet>()){
std::cout << "Error in set_test<MyMoveCopyBoostSet>" << std::endl;
return 1;
}
if (0 != set_test_copyable<
MyMoveCopyBoostSet
,MyStdSet
,MyMoveCopyBoostMultiSet
,MyStdMultiSet>()){
std::cout << "Error in set_test<MyBoostSet>" << std::endl;
return 1;
}
if (0 != set_test<
MyCopyBoostSet
,MyStdSet
,MyCopyBoostMultiSet
,MyStdMultiSet>()){
std::cout << "Error in set_test<MyCopyBoostSet>" << std::endl;
return 1;
}
if (0 != set_test_copyable<
MyCopyBoostSet
,MyStdSet
,MyCopyBoostMultiSet
,MyStdMultiSet>()){
std::cout << "Error in set_test<MyBoostSet>" << std::endl;
return 1;
}
if (0 != map_test<
MyBoostMap
,MyStdMap
,MyBoostMultiMap
,MyStdMultiMap>()){
std::cout << "Error in set_test<MyBoostMap>" << std::endl;
return 1;
}
if (0 != map_test_copyable<
MyBoostMap
,MyStdMap
,MyBoostMultiMap
,MyStdMultiMap>()){
std::cout << "Error in set_test<MyBoostMap>" << std::endl;
return 1;
}
if (0 != map_test<
MyMovableBoostMap
,MyStdMap
,MyMovableBoostMultiMap
,MyStdMultiMap>()){
return 1;
}
if (0 != map_test<
MyMoveCopyBoostMap
,MyStdMap
,MyMoveCopyBoostMultiMap
,MyStdMultiMap>()){
std::cout << "Error in set_test<MyMoveCopyBoostMap>" << std::endl;
return 1;
}
if (0 != map_test_copyable<
MyMoveCopyBoostMap
,MyStdMap
,MyMoveCopyBoostMultiMap
,MyStdMultiMap>()){
std::cout << "Error in set_test<MyBoostMap>" << std::endl;
return 1;
}
if (0 != map_test<
MyCopyBoostMap
,MyStdMap
,MyCopyBoostMultiMap
,MyStdMultiMap>()){
std::cout << "Error in set_test<MyCopyBoostMap>" << std::endl;
return 1;
}
if (0 != map_test_copyable<
MyCopyBoostMap
,MyStdMap
,MyCopyBoostMultiMap
,MyStdMultiMap>()){
std::cout << "Error in set_test<MyBoostMap>" << std::endl;
return 1;
}
const test::EmplaceOptions SetOptions = (test::EmplaceOptions)(test::EMPLACE_HINT | test::EMPLACE_ASSOC);
const test::EmplaceOptions MapOptions = (test::EmplaceOptions)(test::EMPLACE_HINT_PAIR | test::EMPLACE_ASSOC_PAIR);
if(!boost::container::test::test_emplace<flat_map<test::EmplaceInt, test::EmplaceInt>, MapOptions>())
return 1;
if(!boost::container::test::test_emplace<flat_multimap<test::EmplaceInt, test::EmplaceInt>, MapOptions>())
return 1;
if(!boost::container::test::test_emplace<flat_set<test::EmplaceInt>, SetOptions>())
return 1;
if(!boost::container::test::test_emplace<flat_multiset<test::EmplaceInt>, SetOptions>())
return 1;
if(!boost::container::test::test_propagate_allocator<flat_tree_propagate_test_wrapper>())
return 1;
return 0;
}
#include <boost/container/detail/config_end.hpp>

View File

@@ -1,158 +0,0 @@
///////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2005-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)
//
// See http://www.boost.org/libs/container for documentation.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_CONTAINER_HEAP_ALLOCATOR_V1_HPP
#define BOOST_CONTAINER_HEAP_ALLOCATOR_V1_HPP
#if (defined _MSC_VER)
# pragma once
#endif
#include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/container/container_fwd.hpp>
#include <boost/container/detail/allocation_type.hpp>
#include <boost/container/detail/utilities.hpp>
#include <boost/container/detail/version_type.hpp>
#include <boost/container/exceptions.hpp>
#include <memory>
#include <algorithm>
#include <cstddef>
//!\file
//!Describes an heap_allocator_v1 that allocates portions of fixed size
//!memory buffer (shared memory, mapped file...)
namespace boost {
namespace container {
namespace test {
//!An STL compatible heap_allocator_v1 that uses a segment manager as
//!memory source. The internal pointer type will of the same type (raw, smart) as
//!"typename SegmentManager::void_pointer" type. This allows
//!placing the heap_allocator_v1 in shared memory, memory mapped-files, etc...*/
template<class T, class SegmentManager>
class heap_allocator_v1
{
private:
typedef heap_allocator_v1<T, SegmentManager> self_t;
typedef SegmentManager segment_manager;
typedef typename segment_manager::void_pointer aux_pointer_t;
typedef typename
boost::pointer_to_other
<aux_pointer_t, const void>::type cvoid_ptr;
typedef typename boost::pointer_to_other
<cvoid_ptr, segment_manager>::type alloc_ptr_t;
template<class T2, class SegmentManager2>
heap_allocator_v1& operator=(const heap_allocator_v1<T2, SegmentManager2>&);
heap_allocator_v1& operator=(const heap_allocator_v1&);
alloc_ptr_t mp_mngr;
public:
typedef T value_type;
typedef typename boost::pointer_to_other
<cvoid_ptr, T>::type pointer;
typedef typename boost::
pointer_to_other<pointer, const T>::type const_pointer;
typedef typename detail::add_reference
<value_type>::type reference;
typedef typename detail::add_reference
<const value_type>::type const_reference;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
//!Obtains an heap_allocator_v1 of other type
template<class T2>
struct rebind
{
typedef heap_allocator_v1<T2, SegmentManager> other;
};
//!Returns the segment manager. Never throws
segment_manager* get_segment_manager()const
{ return detail::get_pointer(mp_mngr); }
/*
//!Returns address of mutable object. Never throws
pointer address(reference value) const
{ return pointer(addressof(value)); }
//!Returns address of non mutable object. Never throws
const_pointer address(const_reference value) const
{ return const_pointer(addressof(value)); }
*/
//!Constructor from the segment manager. Never throws
heap_allocator_v1(segment_manager *segment_mngr)
: mp_mngr(segment_mngr) { }
//!Constructor from other heap_allocator_v1. Never throws
heap_allocator_v1(const heap_allocator_v1 &other)
: mp_mngr(other.get_segment_manager()){ }
//!Constructor from related heap_allocator_v1. Never throws
template<class T2>
heap_allocator_v1(const heap_allocator_v1<T2, SegmentManager> &other)
: mp_mngr(other.get_segment_manager()){}
//!Allocates memory for an array of count elements.
//!Throws boost::container::bad_alloc if there is no enough memory
pointer allocate(size_type count, cvoid_ptr hint = 0)
{ (void)hint; return ::new value_type[count]; }
//!Deallocates memory previously allocated. Never throws
void deallocate(const pointer &ptr, size_type)
{ return ::delete[] detail::get_pointer(ptr) ; }
//!Construct object, calling constructor.
//!Throws if T(const T&) throws
void construct(const pointer &ptr, const_reference value)
{ new((void*)detail::get_pointer(ptr)) value_type(value); }
//!Destroys object. Throws if object's destructor throws
void destroy(const pointer &ptr)
{ BOOST_ASSERT(ptr != 0); (*ptr).~value_type(); }
//!Returns the number of elements that could be allocated. Never throws
size_type max_size() const
{ return mp_mngr->get_size(); }
//!Swap segment manager. Does not throw. If each heap_allocator_v1 is placed in
//!different memory segments, the result is undefined.
friend void swap(self_t &alloc1, self_t &alloc2)
{ boost::container::boost::container::swap_dispatch(alloc1.mp_mngr, alloc2.mp_mngr); }
};
//!Equality test for same type of heap_allocator_v1
template<class T, class SegmentManager> inline
bool operator==(const heap_allocator_v1<T , SegmentManager> &alloc1,
const heap_allocator_v1<T, SegmentManager> &alloc2)
{ return alloc1.get_segment_manager() == alloc2.get_segment_manager(); }
//!Inequality test for same type of heap_allocator_v1
template<class T, class SegmentManager> inline
bool operator!=(const heap_allocator_v1<T, SegmentManager> &alloc1,
const heap_allocator_v1<T, SegmentManager> &alloc2)
{ return alloc1.get_segment_manager() != alloc2.get_segment_manager(); }
} //namespace test {
} //namespace container {
} //namespace boost {
#include <boost/container/detail/config_end.hpp>
#endif //BOOST_CONTAINER_HEAP_ALLOCATOR_V1_HPP

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2012-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2012-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2004-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2004-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -10,6 +10,10 @@
#include <boost/container/detail/config_begin.hpp> #include <boost/container/detail/config_begin.hpp>
#include <boost/container/list.hpp> #include <boost/container/list.hpp>
#include <boost/container/allocator.hpp>
#include <boost/container/node_allocator.hpp>
#include <boost/container/adaptive_pool.hpp>
#include "dummy_test_allocator.hpp" #include "dummy_test_allocator.hpp"
#include <memory> #include <memory>
#include "movable_int.hpp" #include "movable_int.hpp"
@@ -23,14 +27,29 @@ namespace boost {
namespace container { namespace container {
//Explicit instantiation to detect compilation errors //Explicit instantiation to detect compilation errors
template class boost::container::list<test::movable_and_copyable_int, template class boost::container::list
test::simple_allocator<test::movable_and_copyable_int> >; < test::movable_and_copyable_int
, test::simple_allocator<test::movable_and_copyable_int> >;
template class boost::container::list<test::movable_and_copyable_int, template class boost::container::list
test::dummy_test_allocator<test::movable_and_copyable_int> >; < test::movable_and_copyable_int
, test::dummy_test_allocator<test::movable_and_copyable_int> >;
template class boost::container::list<test::movable_and_copyable_int, template class boost::container::list
std::allocator<test::movable_and_copyable_int> >; < test::movable_and_copyable_int
, std::allocator<test::movable_and_copyable_int> >;
template class boost::container::list
< test::movable_and_copyable_int
, allocator<test::movable_and_copyable_int> >;
template class boost::container::list
< test::movable_and_copyable_int
, adaptive_pool<test::movable_and_copyable_int> >;
template class boost::container::list
< test::movable_and_copyable_int
, node_allocator<test::movable_and_copyable_int> >;
namespace container_detail { namespace container_detail {
@@ -43,12 +62,6 @@ template class iterator
}} }}
typedef list<int> MyList;
typedef list<test::movable_int> MyMoveList;
typedef list<test::movable_and_copyable_int> MyCopyMoveList;
typedef list<test::copyable_int> MyCopyList;
class recursive_list class recursive_list
{ {
public: public:
@@ -67,6 +80,42 @@ void recursive_list_test()//Test for recursive types
} }
} }
template<class VoidAllocator>
struct GetAllocatorCont
{
template<class ValueType>
struct apply
{
typedef list< ValueType
, typename allocator_traits<VoidAllocator>
::template portable_rebind_alloc<ValueType>::type
> type;
};
};
template<class VoidAllocator>
int test_cont_variants()
{
typedef typename GetAllocatorCont<VoidAllocator>::template apply<int>::type MyCont;
typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::movable_int>::type MyMoveCont;
typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::movable_and_copyable_int>::type MyCopyMoveCont;
typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::copyable_int>::type MyCopyCont;
if(test::list_test<MyCont, true>())
return 1;
if(test::list_test<MyMoveCont, true>())
return 1;
if(test::list_test<MyCopyMoveCont, true>())
return 1;
if(test::list_test<MyCopyMoveCont, true>())
return 1;
if(test::list_test<MyCopyCont, true>())
return 1;
return 0;
}
int main () int main ()
{ {
recursive_list_test(); recursive_list_test();
@@ -78,17 +127,26 @@ int main ()
move_assign = boost::move(move_ctor); move_assign = boost::move(move_ctor);
move_assign.swap(original); move_assign.swap(original);
} }
if(test::list_test<MyList, true>())
return 1;
if(test::list_test<MyMoveList, true>()) if(test_cont_variants< std::allocator<void> >()){
std::cerr << "test_cont_variants< std::allocator<void> > failed" << std::endl;
return 1; return 1;
}
if(test::list_test<MyCopyMoveList, true>()) if(test_cont_variants< allocator<void> >()){
std::cerr << "test_cont_variants< allocator<void> > failed" << std::endl;
return 1; return 1;
}
if(test::list_test<MyCopyList, true>()) if(test_cont_variants< node_allocator<void> >()){
std::cerr << "test_cont_variants< node_allocator<void> > failed" << std::endl;
return 1; return 1;
}
if(test_cont_variants< adaptive_pool<void> >()){
std::cerr << "test_cont_variants< adaptive_pool<void> > failed" << std::endl;
return 1;
}
const test::EmplaceOptions Options = (test::EmplaceOptions)(test::EMPLACE_BACK | test::EMPLACE_FRONT | test::EMPLACE_BEFORE); const test::EmplaceOptions Options = (test::EmplaceOptions)(test::EMPLACE_BACK | test::EMPLACE_FRONT | test::EMPLACE_BEFORE);

View File

@@ -37,7 +37,85 @@ template<class MyBoostMap
,class MyStdMap ,class MyStdMap
,class MyBoostMultiMap ,class MyBoostMultiMap
,class MyStdMultiMap> ,class MyStdMultiMap>
int map_test () int map_test_copyable(boost::container::container_detail::false_type)
{ return 0; }
template<class MyBoostMap
,class MyStdMap
,class MyBoostMultiMap
,class MyStdMultiMap>
int map_test_copyable(boost::container::container_detail::true_type)
{
typedef typename MyBoostMap::key_type IntType;
typedef container_detail::pair<IntType, IntType> IntPairType;
typedef typename MyStdMap::value_type StdPairType;
const int max = 100;
BOOST_TRY{
MyBoostMap *boostmap = new MyBoostMap;
MyStdMap *stdmap = new MyStdMap;
MyBoostMultiMap *boostmultimap = new MyBoostMultiMap;
MyStdMultiMap *stdmultimap = new MyStdMultiMap;
int i;
for(i = 0; i < max; ++i){
{
IntType i1(i), i2(i);
IntPairType intpair1(boost::move(i1), boost::move(i2));
boostmap->insert(boost::move(intpair1));
stdmap->insert(StdPairType(i, i));
}
{
IntType i1(i), i2(i);
IntPairType intpair2(boost::move(i1), boost::move(i2));
boostmultimap->insert(boost::move(intpair2));
stdmultimap->insert(StdPairType(i, i));
}
}
if(!CheckEqualContainers(boostmap, stdmap)) return 1;
if(!CheckEqualContainers(boostmultimap, stdmultimap)) return 1;
{
//Now, test copy constructor
MyBoostMap boostmapcopy(*boostmap);
MyStdMap stdmapcopy(*stdmap);
MyBoostMultiMap boostmmapcopy(*boostmultimap);
MyStdMultiMap stdmmapcopy(*stdmultimap);
if(!CheckEqualContainers(&boostmapcopy, &stdmapcopy))
return 1;
if(!CheckEqualContainers(&boostmmapcopy, &stdmmapcopy))
return 1;
//And now assignment
boostmapcopy = *boostmap;
stdmapcopy = *stdmap;
boostmmapcopy = *boostmultimap;
stdmmapcopy = *stdmultimap;
if(!CheckEqualContainers(&boostmapcopy, &stdmapcopy))
return 1;
if(!CheckEqualContainers(&boostmmapcopy, &stdmmapcopy))
return 1;
delete boostmap;
delete boostmultimap;
delete stdmap;
delete stdmultimap;
}
}
BOOST_CATCH(...){
BOOST_RETHROW;
}
BOOST_CATCH_END
return 0;
}
template<class MyBoostMap
,class MyStdMap
,class MyBoostMultiMap
,class MyStdMultiMap>
int map_test()
{ {
typedef typename MyBoostMap::key_type IntType; typedef typename MyBoostMap::key_type IntType;
typedef container_detail::pair<IntType, IntType> IntPairType; typedef container_detail::pair<IntType, IntType> IntPairType;
@@ -471,77 +549,11 @@ int map_test ()
BOOST_RETHROW; BOOST_RETHROW;
} }
BOOST_CATCH_END BOOST_CATCH_END
return 0;
}
template<class MyBoostMap if(map_test_copyable<MyBoostMap, MyStdMap, MyBoostMultiMap, MyStdMultiMap>
,class MyStdMap (container_detail::bool_<boost::container::test::is_copyable<IntType>::value>())){
,class MyBoostMultiMap return 1;
,class MyStdMultiMap>
int map_test_copyable ()
{
typedef typename MyBoostMap::key_type IntType;
typedef container_detail::pair<IntType, IntType> IntPairType;
typedef typename MyStdMap::value_type StdPairType;
const int max = 100;
BOOST_TRY{
MyBoostMap *boostmap = new MyBoostMap;
MyStdMap *stdmap = new MyStdMap;
MyBoostMultiMap *boostmultimap = new MyBoostMultiMap;
MyStdMultiMap *stdmultimap = new MyStdMultiMap;
int i;
for(i = 0; i < max; ++i){
{
IntType i1(i), i2(i);
IntPairType intpair1(boost::move(i1), boost::move(i2));
boostmap->insert(boost::move(intpair1));
stdmap->insert(StdPairType(i, i));
}
{
IntType i1(i), i2(i);
IntPairType intpair2(boost::move(i1), boost::move(i2));
boostmultimap->insert(boost::move(intpair2));
stdmultimap->insert(StdPairType(i, i));
}
} }
if(!CheckEqualContainers(boostmap, stdmap)) return 1;
if(!CheckEqualContainers(boostmultimap, stdmultimap)) return 1;
{
//Now, test copy constructor
MyBoostMap boostmapcopy(*boostmap);
MyStdMap stdmapcopy(*stdmap);
MyBoostMultiMap boostmmapcopy(*boostmultimap);
MyStdMultiMap stdmmapcopy(*stdmultimap);
if(!CheckEqualContainers(&boostmapcopy, &stdmapcopy))
return 1;
if(!CheckEqualContainers(&boostmmapcopy, &stdmmapcopy))
return 1;
//And now assignment
boostmapcopy = *boostmap;
stdmapcopy = *stdmap;
boostmmapcopy = *boostmultimap;
stdmmapcopy = *stdmultimap;
if(!CheckEqualContainers(&boostmapcopy, &stdmapcopy))
return 1;
if(!CheckEqualContainers(&boostmmapcopy, &stdmmapcopy))
return 1;
delete boostmap;
delete boostmultimap;
delete stdmap;
delete stdmultimap;
}
}
BOOST_CATCH(...){
BOOST_RETHROW;
}
BOOST_CATCH_END
return 0; return 0;
} }

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2011-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2004-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2004-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2011-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //

View File

@@ -1,6 +1,6 @@
//////////////////////////////////////// ////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2004-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2004-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -25,6 +25,77 @@ namespace boost{
namespace container { namespace container {
namespace test{ namespace test{
template<class MyBoostSet
,class MyStdSet
,class MyBoostMultiSet
,class MyStdMultiSet>
int set_test_copyable(boost::container::container_detail::false_type)
{ return 0; }
template<class MyBoostSet
,class MyStdSet
,class MyBoostMultiSet
,class MyStdMultiSet>
int set_test_copyable(boost::container::container_detail::true_type)
{
typedef typename MyBoostSet::value_type IntType;
const int max = 100;
BOOST_TRY{
MyBoostSet *boostset = new MyBoostSet;
MyStdSet *stdset = new MyStdSet;
MyBoostMultiSet *boostmultiset = new MyBoostMultiSet;
MyStdMultiSet *stdmultiset = new MyStdMultiSet;
for(int i = 0; i < max; ++i){
IntType move_me(i);
boostset->insert(boost::move(move_me));
stdset->insert(i);
IntType move_me2(i);
boostmultiset->insert(boost::move(move_me2));
stdmultiset->insert(i);
}
if(!CheckEqualContainers(boostset, stdset)) return 1;
if(!CheckEqualContainers(boostmultiset, stdmultiset)) return 1;
{
//Now, test copy constructor
MyBoostSet boostsetcopy(*boostset);
MyStdSet stdsetcopy(*stdset);
if(!CheckEqualContainers(&boostsetcopy, &stdsetcopy))
return 1;
MyBoostMultiSet boostmsetcopy(*boostmultiset);
MyStdMultiSet stdmsetcopy(*stdmultiset);
if(!CheckEqualContainers(&boostmsetcopy, &stdmsetcopy))
return 1;
//And now assignment
boostsetcopy = *boostset;
stdsetcopy = *stdset;
if(!CheckEqualContainers(&boostsetcopy, &stdsetcopy))
return 1;
boostmsetcopy = *boostmultiset;
stdmsetcopy = *stdmultiset;
if(!CheckEqualContainers(&boostmsetcopy, &stdmsetcopy))
return 1;
}
delete boostset;
delete boostmultiset;
}
BOOST_CATCH(...){
BOOST_RETHROW;
}
BOOST_CATCH_END
return 0;
}
template<class MyBoostSet template<class MyBoostSet
,class MyStdSet ,class MyStdSet
,class MyBoostMultiSet ,class MyBoostMultiSet
@@ -34,8 +105,6 @@ int set_test ()
typedef typename MyBoostSet::value_type IntType; typedef typename MyBoostSet::value_type IntType;
const int max = 100; const int max = 100;
//Shared memory allocator must be always be initialized
//since it has no default constructor
MyBoostSet *boostset = new MyBoostSet; MyBoostSet *boostset = new MyBoostSet;
MyStdSet *stdset = new MyStdSet; MyStdSet *stdset = new MyStdSet;
MyBoostMultiSet *boostmultiset = new MyBoostMultiSet; MyBoostMultiSet *boostmultiset = new MyBoostMultiSet;
@@ -431,71 +500,12 @@ int set_test ()
delete stdset; delete stdset;
delete boostmultiset; delete boostmultiset;
delete stdmultiset; delete stdmultiset;
return 0;
}
template<class MyBoostSet if(set_test_copyable<MyBoostSet, MyStdSet, MyBoostMultiSet, MyStdMultiSet>
,class MyStdSet (container_detail::bool_<boost::container::test::is_copyable<IntType>::value>())){
,class MyBoostMultiSet return 1;
,class MyStdMultiSet>
int set_test_copyable ()
{
typedef typename MyBoostSet::value_type IntType;
const int max = 100;
BOOST_TRY{
//Shared memory allocator must be always be initialized
//since it has no default constructor
MyBoostSet *boostset = new MyBoostSet;
MyStdSet *stdset = new MyStdSet;
MyBoostMultiSet *boostmultiset = new MyBoostMultiSet;
MyStdMultiSet *stdmultiset = new MyStdMultiSet;
for(int i = 0; i < max; ++i){
IntType move_me(i);
boostset->insert(boost::move(move_me));
stdset->insert(i);
IntType move_me2(i);
boostmultiset->insert(boost::move(move_me2));
stdmultiset->insert(i);
}
if(!CheckEqualContainers(boostset, stdset)) return 1;
if(!CheckEqualContainers(boostmultiset, stdmultiset)) return 1;
{
//Now, test copy constructor
MyBoostSet boostsetcopy(*boostset);
MyStdSet stdsetcopy(*stdset);
if(!CheckEqualContainers(&boostsetcopy, &stdsetcopy))
return 1;
MyBoostMultiSet boostmsetcopy(*boostmultiset);
MyStdMultiSet stdmsetcopy(*stdmultiset);
if(!CheckEqualContainers(&boostmsetcopy, &stdmsetcopy))
return 1;
//And now assignment
boostsetcopy = *boostset;
stdsetcopy = *stdset;
if(!CheckEqualContainers(&boostsetcopy, &stdsetcopy))
return 1;
boostmsetcopy = *boostmultiset;
stdmsetcopy = *stdmultiset;
if(!CheckEqualContainers(&boostmsetcopy, &stdmsetcopy))
return 1;
}
delete boostset;
delete boostmultiset;
} }
BOOST_CATCH(...){
BOOST_RETHROW;
}
BOOST_CATCH_END
return 0; return 0;
} }

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2004-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2004-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -9,6 +9,10 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
#include <boost/container/detail/config_begin.hpp> #include <boost/container/detail/config_begin.hpp>
#include <boost/container/slist.hpp> #include <boost/container/slist.hpp>
#include <boost/container/allocator.hpp>
#include <boost/container/node_allocator.hpp>
#include <boost/container/adaptive_pool.hpp>
#include <memory> #include <memory>
#include "dummy_test_allocator.hpp" #include "dummy_test_allocator.hpp"
#include "movable_int.hpp" #include "movable_int.hpp"
@@ -22,22 +26,32 @@ namespace boost {
namespace container { namespace container {
//Explicit instantiation to detect compilation errors //Explicit instantiation to detect compilation errors
template class boost::container::slist<test::movable_and_copyable_int, template class boost::container::slist
test::simple_allocator<test::movable_and_copyable_int> >; < test::movable_and_copyable_int
, test::simple_allocator<test::movable_and_copyable_int> >;
template class boost::container::slist<test::movable_and_copyable_int, template class boost::container::slist
test::dummy_test_allocator<test::movable_and_copyable_int> >; < test::movable_and_copyable_int
, test::dummy_test_allocator<test::movable_and_copyable_int> >;
template class boost::container::slist<test::movable_and_copyable_int, template class boost::container::slist
std::allocator<test::movable_and_copyable_int> >; < test::movable_and_copyable_int
, std::allocator<test::movable_and_copyable_int> >;
template class boost::container::slist
< test::movable_and_copyable_int
, allocator<test::movable_and_copyable_int> >;
template class boost::container::slist
< test::movable_and_copyable_int
, adaptive_pool<test::movable_and_copyable_int> >;
template class boost::container::slist
< test::movable_and_copyable_int
, node_allocator<test::movable_and_copyable_int> >;
}} }}
typedef slist<int> MyList;
typedef slist<test::movable_int> MyMoveList;
typedef slist<test::movable_and_copyable_int> MyCopyMoveList;
typedef slist<test::copyable_int> MyCopyList;
class recursive_slist class recursive_slist
{ {
public: public:
@@ -52,6 +66,42 @@ void recursive_slist_test()//Test for recursive types
slist<recursive_slist> recursive_list_list; slist<recursive_slist> recursive_list_list;
} }
template<class VoidAllocator>
struct GetAllocatorCont
{
template<class ValueType>
struct apply
{
typedef slist< ValueType
, typename allocator_traits<VoidAllocator>
::template portable_rebind_alloc<ValueType>::type
> type;
};
};
template<class VoidAllocator>
int test_cont_variants()
{
typedef typename GetAllocatorCont<VoidAllocator>::template apply<int>::type MyCont;
typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::movable_int>::type MyMoveCont;
typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::movable_and_copyable_int>::type MyCopyMoveCont;
typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::copyable_int>::type MyCopyCont;
if(test::list_test<MyCont, false>())
return 1;
if(test::list_test<MyMoveCont, false>())
return 1;
if(test::list_test<MyCopyMoveCont, false>())
return 1;
if(test::list_test<MyCopyMoveCont, false>())
return 1;
if(test::list_test<MyCopyCont, false>())
return 1;
return 0;
}
int main () int main ()
{ {
recursive_slist_test(); recursive_slist_test();
@@ -71,17 +121,25 @@ int main ()
} }
} }
if(test::list_test<MyList, false>()) if(test_cont_variants< std::allocator<void> >()){
std::cerr << "test_cont_variants< std::allocator<void> > failed" << std::endl;
return 1; return 1;
}
if(test::list_test<MyMoveList, false>()) if(test_cont_variants< allocator<void> >()){
std::cerr << "test_cont_variants< allocator<void> > failed" << std::endl;
return 1; return 1;
}
if(test::list_test<MyCopyMoveList, false>()) if(test_cont_variants< node_allocator<void> >()){
std::cerr << "test_cont_variants< node_allocator<void> > failed" << std::endl;
return 1; return 1;
}
if(test::list_test<MyCopyList, false>()) if(test_cont_variants< adaptive_pool<void> >()){
std::cerr << "test_cont_variants< adaptive_pool<void> > failed" << std::endl;
return 1; return 1;
}
const test::EmplaceOptions Options = (test::EmplaceOptions) const test::EmplaceOptions Options = (test::EmplaceOptions)
(test::EMPLACE_FRONT | test::EMPLACE_AFTER | test::EMPLACE_BEFORE | test::EMPLACE_AFTER); (test::EMPLACE_FRONT | test::EMPLACE_AFTER | test::EMPLACE_BEFORE | test::EMPLACE_AFTER);

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2004-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2004-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -16,6 +16,10 @@
#include <functional> #include <functional>
#include <boost/container/stable_vector.hpp> #include <boost/container/stable_vector.hpp>
#include <boost/container/allocator.hpp>
#include <boost/container/node_allocator.hpp>
#include <boost/container/adaptive_pool.hpp>
#include "check_equal_containers.hpp" #include "check_equal_containers.hpp"
#include "movable_int.hpp" #include "movable_int.hpp"
#include "expand_bwd_test_allocator.hpp" #include "expand_bwd_test_allocator.hpp"
@@ -23,6 +27,7 @@
#include "dummy_test_allocator.hpp" #include "dummy_test_allocator.hpp"
#include "propagate_allocator_test.hpp" #include "propagate_allocator_test.hpp"
#include "vector_test.hpp" #include "vector_test.hpp"
#include "default_init_test.hpp"
using namespace boost::container; using namespace boost::container;
@@ -39,6 +44,18 @@ template class stable_vector<test::movable_and_copyable_int,
template class stable_vector<test::movable_and_copyable_int, template class stable_vector<test::movable_and_copyable_int,
std::allocator<test::movable_and_copyable_int> >; std::allocator<test::movable_and_copyable_int> >;
template class stable_vector
< test::movable_and_copyable_int
, allocator<test::movable_and_copyable_int> >;
template class stable_vector
< test::movable_and_copyable_int
, adaptive_pool<test::movable_and_copyable_int> >;
template class stable_vector
< test::movable_and_copyable_int
, node_allocator<test::movable_and_copyable_int> >;
namespace stable_vector_detail{ namespace stable_vector_detail{
template class iterator<int*, false>; template class iterator<int*, false>;
@@ -66,34 +83,37 @@ void recursive_vector_test()//Test for recursive types
} }
} }
bool default_init_test()//Test for default initialization template<class VoidAllocator>
struct GetAllocatorCont
{ {
typedef stable_vector<int, test::default_init_allocator<int> > svector_t; template<class ValueType>
struct apply
const std::size_t Capacity = 100;
{ {
test::default_init_allocator<int>::reset_pattern(0); typedef stable_vector< ValueType
svector_t v(Capacity, default_init); , typename allocator_traits<VoidAllocator>
svector_t::iterator it = v.begin(); ::template portable_rebind_alloc<ValueType>::type
//Compare with the pattern > type;
for(std::size_t i = 0; i != Capacity; ++i, ++it){ };
if(*it != static_cast<int>(i)) };
return false;
} template<class VoidAllocator>
} int test_cont_variants()
{ {
test::default_init_allocator<int>::reset_pattern(100); typedef typename GetAllocatorCont<VoidAllocator>::template apply<int>::type MyCont;
svector_t v; typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::movable_int>::type MyMoveCont;
v.resize(Capacity, default_init); typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::movable_and_copyable_int>::type MyCopyMoveCont;
svector_t::iterator it = v.begin(); typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::copyable_int>::type MyCopyCont;
//Compare with the pattern
for(std::size_t i = 0; i != Capacity; ++i, ++it){ if(test::vector_test<MyCont>())
if(*it != static_cast<int>(i+100)) return 1;
return false; if(test::vector_test<MyMoveCont>())
} return 1;
} if(test::vector_test<MyCopyMoveCont>())
return true; return 1;
if(test::vector_test<MyCopyCont>())
return 1;
return 0;
} }
int main() int main()
@@ -115,22 +135,26 @@ int main()
sv.resize(10); sv.resize(10);
sv.resize(1); sv.resize(1);
} }
typedef stable_vector<int> MyVector;
typedef stable_vector<test::movable_int> MyMoveVector;
typedef stable_vector<test::movable_and_copyable_int> MyCopyMoveVector;
typedef stable_vector<test::copyable_int> MyCopyVector;
if(test::vector_test<MyVector>()) if(test_cont_variants< std::allocator<void> >()){
std::cerr << "test_cont_variants< std::allocator<void> > failed" << std::endl;
return 1; return 1;
}
if(test::vector_test<MyMoveVector>()) if(test_cont_variants< allocator<void> >()){
std::cerr << "test_cont_variants< allocator<void> > failed" << std::endl;
return 1; return 1;
}
if(test::vector_test<MyCopyMoveVector>()) if(test_cont_variants< node_allocator<void> >()){
std::cerr << "test_cont_variants< node_allocator<void> > failed" << std::endl;
return 1; return 1;
}
if(test::vector_test<MyCopyVector>()) if(test_cont_variants< adaptive_pool<void> >()){
std::cerr << "test_cont_variants< adaptive_pool<void> > failed" << std::endl;
return 1; return 1;
}
if(!test::default_init_test< stable_vector<int, test::default_init_allocator<int> > >()){ if(!test::default_init_test< stable_vector<int, test::default_init_allocator<int> > >()){
std::cerr << "Default init test failed" << std::endl; std::cerr << "Default init test failed" << std::endl;

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2004-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2004-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -23,6 +23,7 @@
#include "expand_bwd_test_allocator.hpp" #include "expand_bwd_test_allocator.hpp"
#include "expand_bwd_test_template.hpp" #include "expand_bwd_test_template.hpp"
#include "propagate_allocator_test.hpp" #include "propagate_allocator_test.hpp"
#include "default_init_test.hpp"
using namespace boost::container; using namespace boost::container;
@@ -137,7 +138,6 @@ int string_test()
const int MaxSize = 100; const int MaxSize = 100;
//Create shared memory
{ {
BoostStringVector *boostStringVect = new BoostStringVector; BoostStringVector *boostStringVect = new BoostStringVector;
StdStringVector *stdStringVect = new StdStringVector; StdStringVector *stdStringVect = new StdStringVector;
@@ -477,6 +477,16 @@ int main()
if(!boost::container::test::test_propagate_allocator<string_propagate_test_wrapper>()) if(!boost::container::test::test_propagate_allocator<string_propagate_test_wrapper>())
return 1; return 1;
if(!test::default_init_test< basic_string<char, std::char_traits<char>, test::default_init_allocator<char> > >()){
std::cerr << "Default init test failed" << std::endl;
return 1;
}
if(!test::default_init_test< basic_string<wchar_t, std::char_traits<wchar_t>, test::default_init_allocator<wchar_t> > >()){
std::cerr << "Default init test failed" << std::endl;
return 1;
}
return 0; return 0;
} }

View File

@@ -1,380 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2004-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)
//
// See http://www.boost.org/libs/container for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#include <boost/container/detail/config_begin.hpp>
#include <set>
#include <boost/container/set.hpp>
#include <boost/container/map.hpp>
#include "print_container.hpp"
#include "movable_int.hpp"
#include "dummy_test_allocator.hpp"
#include "set_test.hpp"
#include "map_test.hpp"
#include "propagate_allocator_test.hpp"
#include "emplace_test.hpp"
using namespace boost::container;
//Alias standard types
typedef std::set<int> MyStdSet;
typedef std::multiset<int> MyStdMultiSet;
typedef std::map<int, int> MyStdMap;
typedef std::multimap<int, int> MyStdMultiMap;
//Alias non-movable types
typedef set<int> MyBoostSet;
typedef multiset<int> MyBoostMultiSet;
typedef map<int, int> MyBoostMap;
typedef multimap<int, int> MyBoostMultiMap;
//Alias movable types
typedef set<test::movable_int> MyMovableBoostSet;
typedef multiset<test::movable_int> MyMovableBoostMultiSet;
typedef map<test::movable_int, test::movable_int> MyMovableBoostMap;
typedef multimap<test::movable_int, test::movable_int> MyMovableBoostMultiMap;
typedef set<test::movable_and_copyable_int> MyMoveCopyBoostSet;
typedef set<test::copyable_int> MyCopyBoostSet;
typedef multiset<test::movable_and_copyable_int> MyMoveCopyBoostMultiSet;
typedef multiset<test::copyable_int> MyCopyBoostMultiSet;
typedef map<test::movable_and_copyable_int
,test::movable_and_copyable_int> MyMoveCopyBoostMap;
typedef multimap<test::movable_and_copyable_int
,test::movable_and_copyable_int> MyMoveCopyBoostMultiMap;
typedef map<test::copyable_int
,test::copyable_int> MyCopyBoostMap;
typedef multimap<test::copyable_int
,test::copyable_int> MyCopyBoostMultiMap;
namespace boost {
namespace container {
//Explicit instantiation to detect compilation errors
//map
template class map
< test::movable_and_copyable_int
, test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, test::dummy_test_allocator
< std::pair<const test::movable_and_copyable_int, test::movable_and_copyable_int> >
>;
template class map
< test::movable_and_copyable_int
, test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, test::simple_allocator
< std::pair<const test::movable_and_copyable_int, test::movable_and_copyable_int> >
>;
template class map
< test::movable_and_copyable_int
, test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, std::allocator
< std::pair<const test::movable_and_copyable_int, test::movable_and_copyable_int> >
>;
//multimap
template class multimap
< test::movable_and_copyable_int
, test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, test::dummy_test_allocator
< std::pair<const test::movable_and_copyable_int, test::movable_and_copyable_int> >
>;
template class multimap
< test::movable_and_copyable_int
, test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, test::simple_allocator
< std::pair<const test::movable_and_copyable_int, test::movable_and_copyable_int> >
>;
template class multimap
< test::movable_and_copyable_int
, test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, std::allocator
< std::pair<const test::movable_and_copyable_int, test::movable_and_copyable_int> >
>;
//set
template class set
< test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, test::dummy_test_allocator<test::movable_and_copyable_int>
>;
template class set
< test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, test::simple_allocator<test::movable_and_copyable_int>
>;
template class set
< test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, std::allocator<test::movable_and_copyable_int>
>;
//multiset
template class multiset
< test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, test::dummy_test_allocator<test::movable_and_copyable_int>
>;
template class multiset
< test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, test::simple_allocator<test::movable_and_copyable_int>
>;
template class multiset
< test::movable_and_copyable_int
, std::less<test::movable_and_copyable_int>
, std::allocator<test::movable_and_copyable_int>
>;
}} //boost::container
//Test recursive structures
class recursive_set
{
public:
recursive_set & operator=(const recursive_set &x)
{ id_ = x.id_; set_ = x.set_; return *this; }
int id_;
set<recursive_set> set_;
friend bool operator< (const recursive_set &a, const recursive_set &b)
{ return a.id_ < b.id_; }
};
class recursive_map
{
public:
recursive_map & operator=(const recursive_map &x)
{ id_ = x.id_; map_ = x.map_; return *this; }
int id_;
map<recursive_map, recursive_map> map_;
friend bool operator< (const recursive_map &a, const recursive_map &b)
{ return a.id_ < b.id_; }
};
//Test recursive structures
class recursive_multiset
{
public:
recursive_multiset & operator=(const recursive_multiset &x)
{ id_ = x.id_; multiset_ = x.multiset_; return *this; }
int id_;
multiset<recursive_multiset> multiset_;
friend bool operator< (const recursive_multiset &a, const recursive_multiset &b)
{ return a.id_ < b.id_; }
};
class recursive_multimap
{
public:
recursive_multimap & operator=(const recursive_multimap &x)
{ id_ = x.id_; multimap_ = x.multimap_; return *this; }
int id_;
multimap<recursive_multimap, recursive_multimap> multimap_;
friend bool operator< (const recursive_multimap &a, const recursive_multimap &b)
{ return a.id_ < b.id_; }
};
template<class C>
void test_move()
{
//Now test move semantics
C original;
original.emplace();
C move_ctor(boost::move(original));
C move_assign;
move_assign.emplace();
move_assign = boost::move(move_ctor);
move_assign.swap(original);
}
template<class T, class A>
class tree_propagate_test_wrapper
: public container_detail::rbtree<T, T, container_detail::identity<T>, std::less<T>, A>
{
BOOST_COPYABLE_AND_MOVABLE(tree_propagate_test_wrapper)
typedef container_detail::rbtree<T, T, container_detail::identity<T>, std::less<T>, A> Base;
public:
tree_propagate_test_wrapper()
: Base()
{}
tree_propagate_test_wrapper(const tree_propagate_test_wrapper &x)
: Base(x)
{}
tree_propagate_test_wrapper(BOOST_RV_REF(tree_propagate_test_wrapper) x)
: Base(boost::move(static_cast<Base&>(x)))
{}
tree_propagate_test_wrapper &operator=(BOOST_COPY_ASSIGN_REF(tree_propagate_test_wrapper) x)
{ this->Base::operator=(x); return *this; }
tree_propagate_test_wrapper &operator=(BOOST_RV_REF(tree_propagate_test_wrapper) x)
{ this->Base::operator=(boost::move(static_cast<Base&>(x))); return *this; }
void swap(tree_propagate_test_wrapper &x)
{ this->Base::swap(x); }
};
int main ()
{
//Recursive container instantiation
{
set<recursive_set> set_;
multiset<recursive_multiset> multiset_;
map<recursive_map, recursive_map> map_;
multimap<recursive_multimap, recursive_multimap> multimap_;
}
//Allocator argument container
{
set<int> set_((std::allocator<int>()));
multiset<int> multiset_((std::allocator<int>()));
map<int, int> map_((std::allocator<std::pair<const int, int> >()));
multimap<int, int> multimap_((std::allocator<std::pair<const int, int> >()));
}
//Now test move semantics
{
test_move<set<recursive_set> >();
test_move<multiset<recursive_multiset> >();
test_move<map<recursive_map, recursive_map> >();
test_move<multimap<recursive_multimap, recursive_multimap> >();
}
if(0 != test::set_test<MyBoostSet
,MyStdSet
,MyBoostMultiSet
,MyStdMultiSet>()){
return 1;
}
if(0 != test::set_test_copyable<MyBoostSet
,MyStdSet
,MyBoostMultiSet
,MyStdMultiSet>()){
return 1;
}
if(0 != test::set_test<MyMovableBoostSet
,MyStdSet
,MyMovableBoostMultiSet
,MyStdMultiSet>()){
return 1;
}
if(0 != test::set_test<MyMoveCopyBoostSet
,MyStdSet
,MyMoveCopyBoostMultiSet
,MyStdMultiSet>()){
return 1;
}
if(0 != test::set_test_copyable<MyMoveCopyBoostSet
,MyStdSet
,MyMoveCopyBoostMultiSet
,MyStdMultiSet>()){
return 1;
}
if(0 != test::set_test<MyCopyBoostSet
,MyStdSet
,MyCopyBoostMultiSet
,MyStdMultiSet>()){
return 1;
}
if(0 != test::set_test_copyable<MyCopyBoostSet
,MyStdSet
,MyCopyBoostMultiSet
,MyStdMultiSet>()){
return 1;
}
if (0 != test::map_test<MyBoostMap
,MyStdMap
,MyBoostMultiMap
,MyStdMultiMap>()){
return 1;
}
if(0 != test::map_test_copyable<MyBoostMap
,MyStdMap
,MyBoostMultiMap
,MyStdMultiMap>()){
return 1;
}
if (0 != test::map_test<MyMovableBoostMap
,MyStdMap
,MyMovableBoostMultiMap
,MyStdMultiMap>()){
return 1;
}
if (0 != test::map_test<MyMoveCopyBoostMap
,MyStdMap
,MyMoveCopyBoostMultiMap
,MyStdMultiMap>()){
return 1;
}
if (0 != test::map_test_copyable<MyMoveCopyBoostMap
,MyStdMap
,MyMoveCopyBoostMultiMap
,MyStdMultiMap>()){
return 1;
}
if (0 != test::map_test<MyCopyBoostMap
,MyStdMap
,MyCopyBoostMultiMap
,MyStdMultiMap>()){
return 1;
}
if (0 != test::map_test_copyable<MyCopyBoostMap
,MyStdMap
,MyCopyBoostMultiMap
,MyStdMultiMap>()){
return 1;
}
const test::EmplaceOptions SetOptions = (test::EmplaceOptions)(test::EMPLACE_HINT | test::EMPLACE_ASSOC);
if(!boost::container::test::test_emplace<set<test::EmplaceInt>, SetOptions>())
return 1;
if(!boost::container::test::test_emplace<multiset<test::EmplaceInt>, SetOptions>())
return 1;
const test::EmplaceOptions MapOptions = (test::EmplaceOptions)(test::EMPLACE_HINT_PAIR | test::EMPLACE_ASSOC_PAIR);
if(!boost::container::test::test_emplace<map<test::EmplaceInt, test::EmplaceInt>, MapOptions>())
return 1;
if(!boost::container::test::test_emplace<multimap<test::EmplaceInt, test::EmplaceInt>, MapOptions>())
return 1;
if(!boost::container::test::test_propagate_allocator<tree_propagate_test_wrapper>())
return 1;
return 0;
}
#include <boost/container/detail/config_end.hpp>

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2004-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2004-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -15,6 +15,10 @@
#include <functional> #include <functional>
#include <boost/container/vector.hpp> #include <boost/container/vector.hpp>
#include <boost/container/allocator.hpp>
#include <boost/container/node_allocator.hpp>
#include <boost/container/adaptive_pool.hpp>
#include <boost/move/utility.hpp> #include <boost/move/utility.hpp>
#include "check_equal_containers.hpp" #include "check_equal_containers.hpp"
#include "movable_int.hpp" #include "movable_int.hpp"
@@ -23,6 +27,7 @@
#include "dummy_test_allocator.hpp" #include "dummy_test_allocator.hpp"
#include "propagate_allocator_test.hpp" #include "propagate_allocator_test.hpp"
#include "vector_test.hpp" #include "vector_test.hpp"
#include "default_init_test.hpp"
using namespace boost::container; using namespace boost::container;
@@ -30,14 +35,29 @@ namespace boost {
namespace container { namespace container {
//Explicit instantiation to detect compilation errors //Explicit instantiation to detect compilation errors
template class boost::container::vector<test::movable_and_copyable_int, template class boost::container::vector
test::simple_allocator<test::movable_and_copyable_int> >; < test::movable_and_copyable_int
, test::simple_allocator<test::movable_and_copyable_int> >;
template class boost::container::vector<test::movable_and_copyable_int, template class boost::container::vector
test::dummy_test_allocator<test::movable_and_copyable_int> >; < test::movable_and_copyable_int
, test::dummy_test_allocator<test::movable_and_copyable_int> >;
template class boost::container::vector<test::movable_and_copyable_int, template class boost::container::vector
std::allocator<test::movable_and_copyable_int> >; < test::movable_and_copyable_int
, std::allocator<test::movable_and_copyable_int> >;
template class boost::container::vector
< test::movable_and_copyable_int
, allocator<test::movable_and_copyable_int> >;
template class boost::container::vector
< test::movable_and_copyable_int
, adaptive_pool<test::movable_and_copyable_int> >;
template class boost::container::vector
< test::movable_and_copyable_int
, node_allocator<test::movable_and_copyable_int> >;
namespace container_detail { namespace container_detail {
@@ -104,6 +124,39 @@ enum Test
zero, one, two, three, four, five, six zero, one, two, three, four, five, six
}; };
template<class VoidAllocator>
struct GetAllocatorCont
{
template<class ValueType>
struct apply
{
typedef vector< ValueType
, typename allocator_traits<VoidAllocator>
::template portable_rebind_alloc<ValueType>::type
> type;
};
};
template<class VoidAllocator>
int test_cont_variants()
{
typedef typename GetAllocatorCont<VoidAllocator>::template apply<int>::type MyCont;
typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::movable_int>::type MyMoveCont;
typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::movable_and_copyable_int>::type MyCopyMoveCont;
typedef typename GetAllocatorCont<VoidAllocator>::template apply<test::copyable_int>::type MyCopyCont;
if(test::vector_test<MyCont>())
return 1;
if(test::vector_test<MyMoveCont>())
return 1;
if(test::vector_test<MyCopyMoveCont>())
return 1;
if(test::vector_test<MyCopyCont>())
return 1;
return 0;
}
int main() int main()
{ {
{ {
@@ -135,33 +188,44 @@ int main()
move_assign = boost::move(move_ctor); move_assign = boost::move(move_ctor);
move_assign.swap(original); move_assign.swap(original);
} }
typedef vector<int> MyVector;
typedef vector<test::movable_int> MyMoveVector;
typedef vector<test::movable_and_copyable_int> MyCopyMoveVector;
typedef vector<test::copyable_int> MyCopyVector;
typedef vector<Test> MyEnumVector;
if(test::vector_test<MyVector>()) if(test_cont_variants< std::allocator<void> >()){
std::cerr << "test_cont_variants< std::allocator<void> > failed" << std::endl;
return 1; return 1;
if(test::vector_test<MyMoveVector>()) }
if(test_cont_variants< allocator<void> >()){
std::cerr << "test_cont_variants< allocator<void> > failed" << std::endl;
return 1; return 1;
if(test::vector_test<MyCopyMoveVector>()) }
if(test_cont_variants< node_allocator<void> >()){
std::cerr << "test_cont_variants< node_allocator<void> > failed" << std::endl;
return 1; return 1;
if(test::vector_test<MyCopyVector>()) }
if(test_cont_variants< adaptive_pool<void> >()){
std::cerr << "test_cont_variants< adaptive_pool<void> > failed" << std::endl;
return 1; return 1;
}
{
typedef vector<Test, std::allocator<Test> > MyEnumCont;
MyEnumCont v;
Test t;
v.push_back(t);
v.push_back(::boost::move(t));
v.push_back(Test());
}
if(test_expand_bwd()) if(test_expand_bwd())
return 1; return 1;
if(!test::default_init_test< vector<int, test::default_init_allocator<int> > >()){ if(!test::default_init_test< vector<int, test::default_init_allocator<int> > >()){
std::cerr << "Default init test failed" << std::endl; std::cerr << "Default init test failed" << std::endl;
return 1; return 1;
} }
MyEnumVector v;
Test t;
v.push_back(t);
v.push_back(::boost::move(t));
v.push_back(Test());
const test::EmplaceOptions Options = (test::EmplaceOptions)(test::EMPLACE_BACK | test::EMPLACE_BEFORE); const test::EmplaceOptions Options = (test::EmplaceOptions)(test::EMPLACE_BACK | test::EMPLACE_BEFORE);
if(!boost::container::test::test_emplace< vector<test::EmplaceInt>, Options>()){ if(!boost::container::test::test_emplace< vector<test::EmplaceInt>, Options>()){
return 1; return 1;

View File

@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2004-2012. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2004-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file // Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
@@ -38,123 +38,6 @@ namespace boost{
namespace container { namespace container {
namespace test{ namespace test{
//
template<int Dummy = 0>
class default_init_allocator_base
{
protected:
static unsigned char s_pattern;
static bool s_ascending;
public:
static void reset_pattern(unsigned char value)
{ s_pattern = value; }
static void set_ascending(bool enable)
{ s_ascending = enable; }
};
template<int Dummy>
unsigned char default_init_allocator_base<Dummy>::s_pattern = 0u;
template<int Dummy>
bool default_init_allocator_base<Dummy>::s_ascending = true;
template<class T>
class default_init_allocator
: public default_init_allocator_base<0>
{
typedef default_init_allocator_base<0> base_t;
public:
typedef T value_type;
default_init_allocator()
{}
template <class U>
default_init_allocator(default_init_allocator<U>)
{}
T* allocate(std::size_t n)
{
//Initialize memory to a pattern
const std::size_t max = sizeof(T)*n;
unsigned char *puc_raw = ::new unsigned char[max];
if(base_t::s_ascending){
for(std::size_t i = 0; i != max; ++i){
puc_raw[i] = static_cast<unsigned char>(s_pattern++);
}
}
else{
for(std::size_t i = 0; i != max; ++i){
puc_raw[i] = static_cast<unsigned char>(s_pattern--);
}
}
return (T*)puc_raw;;
}
void deallocate(T *p, std::size_t)
{ delete[] (unsigned char*)p; }
};
template<class T>
inline bool check_ascending_byte_pattern(const T&t)
{
const unsigned char *pch = &reinterpret_cast<const unsigned char &>(t);
const std::size_t max = sizeof(T);
for(std::size_t i = 1; i != max; ++i){
if( (pch[i-1] != ((unsigned char)(pch[i]-1u))) ){
return false;
}
}
return true;
}
template<class T>
inline bool check_descending_byte_pattern(const T&t)
{
const unsigned char *pch = &reinterpret_cast<const unsigned char &>(t);
const std::size_t max = sizeof(T);
for(std::size_t i = 1; i != max; ++i){
if( (pch[i-1] != ((unsigned char)(pch[i]+1u))) ){
return false;
}
}
return true;
}
template<class IntDefaultInitAllocVector>
bool default_init_test()//Test for default initialization
{
const std::size_t Capacity = 100;
{
test::default_init_allocator<int>::reset_pattern(0);
test::default_init_allocator<int>::set_ascending(true);
IntDefaultInitAllocVector v(Capacity, default_init);
typename IntDefaultInitAllocVector::iterator it = v.begin();
//Compare with the pattern
for(std::size_t i = 0; i != Capacity; ++i, ++it){
if(!test::check_ascending_byte_pattern(*it))
return false;
}
}
{
test::default_init_allocator<int>::reset_pattern(100);
test::default_init_allocator<int>::set_ascending(false);
IntDefaultInitAllocVector v;
v.resize(Capacity, default_init);
typename IntDefaultInitAllocVector::iterator it = v.begin();
//Compare with the pattern
for(std::size_t i = 0; i != Capacity; ++i, ++it){
if(!test::check_descending_byte_pattern(*it))
return false;
}
}
return true;
}
template<class V1, class V2> template<class V1, class V2>
bool vector_copyable_only(V1 *, V2 *, boost::container::container_detail::false_type) bool vector_copyable_only(V1 *, V2 *, boost::container::container_detail::false_type)
{ {