forked from boostorg/container
Trailing whitespaces
[SVN r78519]
This commit is contained in:
@ -36,8 +36,8 @@ doxygen autodoc
|
|||||||
<xsl:param>"boost.doxygen.reftitle=Boost.Container Header Reference"
|
<xsl:param>"boost.doxygen.reftitle=Boost.Container Header Reference"
|
||||||
;
|
;
|
||||||
|
|
||||||
xml container : container.qbk
|
xml container : container.qbk
|
||||||
:
|
:
|
||||||
<include>../../../tools/auto_index/include
|
<include>../../../tools/auto_index/include
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -54,26 +54,26 @@ boostbook standalone
|
|||||||
<format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html
|
<format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html
|
||||||
|
|
||||||
# Build requirements go here:
|
# Build requirements go here:
|
||||||
|
|
||||||
# <auto-index>on (or off) one turns on (or off) indexing:
|
# <auto-index>on (or off) one turns on (or off) indexing:
|
||||||
<auto-index>on
|
<auto-index>on
|
||||||
|
|
||||||
# Turns on (or off) auto-index-verbose for diagnostic info.
|
# Turns on (or off) auto-index-verbose for diagnostic info.
|
||||||
# This is highly recommended until you have got all the many details correct!
|
# This is highly recommended until you have got all the many details correct!
|
||||||
<auto-index-verbose>on
|
<auto-index-verbose>on
|
||||||
|
|
||||||
# Choose the indexing method (separately for html and PDF) - see manual.
|
# Choose the indexing method (separately for html and PDF) - see manual.
|
||||||
# Choose indexing method for PDFs:
|
# Choose indexing method for PDFs:
|
||||||
<format>pdf:<auto-index-internal>off
|
<format>pdf:<auto-index-internal>off
|
||||||
|
|
||||||
# Choose indexing method for html:
|
# Choose indexing method for html:
|
||||||
<format>html:<auto-index-internal>on
|
<format>html:<auto-index-internal>on
|
||||||
|
|
||||||
# Set the name of the script file to use (index.idx is popular):
|
# Set the name of the script file to use (index.idx is popular):
|
||||||
<auto-index-script>index.idx
|
<auto-index-script>index.idx
|
||||||
# Commands in the script file should all use RELATIVE PATHS
|
# Commands in the script file should all use RELATIVE PATHS
|
||||||
# otherwise the script will not be portable to other machines.
|
# otherwise the script will not be portable to other machines.
|
||||||
# Relative paths are normally taken as relative to the location
|
# Relative paths are normally taken as relative to the location
|
||||||
# of the script file, but we can add a prefix to all
|
# of the script file, but we can add a prefix to all
|
||||||
# those relative paths using the <auto-index-prefix> feature.
|
# those relative paths using the <auto-index-prefix> feature.
|
||||||
# The path specified by <auto-index-prefix> may be either relative or
|
# The path specified by <auto-index-prefix> may be either relative or
|
||||||
|
@ -225,7 +225,7 @@ want to advance it by n positions, we simply do:
|
|||||||
|
|
||||||
it.p = *(it.p->up+n);
|
it.p = *(it.p->up+n);
|
||||||
|
|
||||||
That is, we go "up" to the pointer array, add n there and then go "down" to the resulting node.
|
That is, we go "up" to the pointer array, add n there and then go "down" to the resulting node.
|
||||||
|
|
||||||
[*General properties]. `stable_vector` satisfies all the requirements of a container, a reversible container and a sequence
|
[*General properties]. `stable_vector` satisfies all the requirements of a container, a reversible container and a sequence
|
||||||
and provides all the optional operations present in vector. Like vector, iterators are random access. `stable_vector`
|
and provides all the optional operations present in vector. Like vector, iterators are random access. `stable_vector`
|
||||||
@ -291,8 +291,8 @@ C++ world. Matt Austern's classic article
|
|||||||
|
|
||||||
["['Red-black trees aren't the only way to organize data that permits lookup in logarithmic time. One of the basic
|
["['Red-black trees aren't the only way to organize data that permits lookup in logarithmic time. One of the basic
|
||||||
algorithms of computer science is binary search, which works by successively dividing a range in half. Binary
|
algorithms of computer science is binary search, which works by successively dividing a range in half. Binary
|
||||||
search is log N and it doesn't require any fancy data structures, just a sorted collection of elements.
|
search is log N and it doesn't require any fancy data structures, just a sorted collection of elements.
|
||||||
(...) You can use whatever data structure is convenient, so long as it provides STL iterator;
|
(...) You can use whatever data structure is convenient, so long as it provides STL iterator;
|
||||||
usually it's easiest to use a C array, or a vector.]]
|
usually it's easiest to use a C array, or a vector.]]
|
||||||
|
|
||||||
["['Both std::lower_bound and set::find take time proportional to log N, but the constants of proportionality
|
["['Both std::lower_bound and set::find take time proportional to log N, but the constants of proportionality
|
||||||
@ -317,12 +317,12 @@ showed `AssocVector`, a `std::map` drop-in
|
|||||||
replacement designed in his [@http://loki-lib.sourceforge.net/ Loki] library:
|
replacement designed in his [@http://loki-lib.sourceforge.net/ Loki] library:
|
||||||
|
|
||||||
["['It seems as if we're better off with a sorted vector. The disadvantages of a sorted
|
["['It seems as if we're better off with a sorted vector. The disadvantages of a sorted
|
||||||
vector are linear-time insertions and linear-time deletions (...). In exchange, a vector
|
vector are linear-time insertions and linear-time deletions (...). In exchange, a vector
|
||||||
offers about twice the lookup speed and a much smaller working set (...).
|
offers about twice the lookup speed and a much smaller working set (...).
|
||||||
Loki saves the trouble of maintaining a sorted vector by hand by defining an AssocVector class
|
Loki saves the trouble of maintaining a sorted vector by hand by defining an AssocVector class
|
||||||
template. AssocVector is a drop-in replacement for std::map (it supports the same set of member
|
template. AssocVector is a drop-in replacement for std::map (it supports the same set of member
|
||||||
functions), implemented on top of std::vector. AssocVector differs from a map in the behavior of
|
functions), implemented on top of std::vector. AssocVector differs from a map in the behavior of
|
||||||
its erase functions (AssocVector::erase invalidates all iterators into the object) and in the
|
its erase functions (AssocVector::erase invalidates all iterators into the object) and in the
|
||||||
complexity guarantees of insert and erase (linear as opposed to constant). ]]
|
complexity guarantees of insert and erase (linear as opposed to constant). ]]
|
||||||
|
|
||||||
[*Boost.Container] `flat_[multi]map/set` containers are ordered-vector based associative containers
|
[*Boost.Container] `flat_[multi]map/set` containers are ordered-vector based associative containers
|
||||||
@ -380,7 +380,7 @@ should probably use list instead of slist.]]
|
|||||||
[*Boost.Container] updates the classic `slist` container with C++11 features like move semantics and placement
|
[*Boost.Container] updates the classic `slist` container with C++11 features like move semantics and placement
|
||||||
insertion and implements it a bit differently than the standard C++ `forward_list`. `forward_list` has no `size()`
|
insertion and implements it a bit differently than the standard C++ `forward_list`. `forward_list` has no `size()`
|
||||||
method, so it's been designed to allow (or in practice, encourage) implementations without tracking list size
|
method, so it's been designed to allow (or in practice, encourage) implementations without tracking list size
|
||||||
with every insertion/erasure, allowing constant-time
|
with every insertion/erasure, allowing constant-time
|
||||||
`splice_after(iterator, forward_list &, iterator, iterator)`-based list merging. On the other hand `slist` offers
|
`splice_after(iterator, forward_list &, iterator, iterator)`-based list merging. On the other hand `slist` offers
|
||||||
constant-time `size()` for those that don't care about linear-time `splice_after(iterator, slist &, iterator, iterator)`
|
constant-time `size()` for those that don't care about linear-time `splice_after(iterator, slist &, iterator, iterator)`
|
||||||
`size()` and offers an additional `splice_after(iterator, slist &, iterator, iterator, size_type)` method that
|
`size()` and offers an additional `splice_after(iterator, slist &, iterator, iterator, size_type)` method that
|
||||||
@ -422,16 +422,16 @@ to suppose two allocators of the same type always compare equal (that means that
|
|||||||
by one allocator object could be deallocated by another instance of the same type) and
|
by one allocator object could be deallocated by another instance of the same type) and
|
||||||
allocators were not swapped when the container was swapped.
|
allocators were not swapped when the container was swapped.
|
||||||
|
|
||||||
C++11 further improves stateful allocator support through
|
C++11 further improves stateful allocator support through
|
||||||
[@http://en.cppreference.com/w/cpp/memory/allocator_traits `std::allocator_traits`].
|
[@http://en.cppreference.com/w/cpp/memory/allocator_traits `std::allocator_traits`].
|
||||||
`std::allocator_traits` is the protocol between a container and an allocator, and
|
`std::allocator_traits` is the protocol between a container and an allocator, and
|
||||||
an allocator writer can customize its behaviour (should the container propagate it in
|
an allocator writer can customize its behaviour (should the container propagate it in
|
||||||
move constructor, swap, etc.?) following `allocator_traits` requirements. [*Boost.Container]
|
move constructor, swap, etc.?) following `allocator_traits` requirements. [*Boost.Container]
|
||||||
not only supports this model with C++11 but also [*backports it to C++03].
|
not only supports this model with C++11 but also [*backports it to C++03].
|
||||||
|
|
||||||
If possible, a single allocator is hold to construct `value_type`. If the container needs an auxiliary
|
If possible, a single allocator is hold to construct `value_type`. If the container needs an auxiliary
|
||||||
allocator (e.g. a array allocator used by `deque` or `stable_vector`), that allocator is also
|
allocator (e.g. a array allocator used by `deque` or `stable_vector`), that allocator is also
|
||||||
constructed from the user-supplied allocator when the container is constructed (i.e. it's
|
constructed from the user-supplied allocator when the container is constructed (i.e. it's
|
||||||
not constructed on the fly when auxiliary memory is needed).
|
not constructed on the fly when auxiliary memory is needed).
|
||||||
|
|
||||||
[endsect]
|
[endsect]
|
||||||
@ -453,14 +453,14 @@ container's elements, and, if the elements themselves are containers, the third
|
|||||||
elements' elements, and so on.
|
elements' elements, and so on.
|
||||||
|
|
||||||
[*Boost.Container] implements its own `scoped_allocator_adaptor` class and [*backports this feature also
|
[*Boost.Container] implements its own `scoped_allocator_adaptor` class and [*backports this feature also
|
||||||
to C++03 compilers]. Due to C++03 limitations, in those compilers
|
to C++03 compilers]. Due to C++03 limitations, in those compilers
|
||||||
the allocator propagation implemented by `scoped_allocator_adaptor::construct` functions
|
the allocator propagation implemented by `scoped_allocator_adaptor::construct` functions
|
||||||
will be based on traits([classref boost::container::constructible_with_allocator_suffix constructible_with_allocator_suffix]
|
will be based on traits([classref boost::container::constructible_with_allocator_suffix constructible_with_allocator_suffix]
|
||||||
and [classref boost::container::constructible_with_allocator_prefix constructible_with_allocator_prefix])
|
and [classref boost::container::constructible_with_allocator_prefix constructible_with_allocator_prefix])
|
||||||
proposed in [@http://www.open-std.org/jtc1/sc22/WG21/docs/papers/2008/n2554.pdf
|
proposed in [@http://www.open-std.org/jtc1/sc22/WG21/docs/papers/2008/n2554.pdf
|
||||||
N2554: The Scoped Allocator Model (Rev 2) proposal]. In conforming C++11 compilers or compilers supporting SFINAE
|
N2554: The Scoped Allocator Model (Rev 2) proposal]. In conforming C++11 compilers or compilers supporting SFINAE
|
||||||
expressions (when `BOOST_NO_SFINAE_EXPR` is NOT defined), traits are ignored and C++11 rules
|
expressions (when `BOOST_NO_SFINAE_EXPR` is NOT defined), traits are ignored and C++11 rules
|
||||||
(`is_constructible<T, Args..., inner_allocator_type>::value` and
|
(`is_constructible<T, Args..., inner_allocator_type>::value` and
|
||||||
`is_constructible<T, allocator_arg_t, inner_allocator_type, Args...>::value`)
|
`is_constructible<T, allocator_arg_t, inner_allocator_type, Args...>::value`)
|
||||||
will be used to detect if the allocator must be propagated with suffix or prefix allocator arguments.
|
will be used to detect if the allocator must be propagated with suffix or prefix allocator arguments.
|
||||||
|
|
||||||
@ -487,7 +487,7 @@ versions.
|
|||||||
unsuccessful tries to deprecate or remove it from the standard. [*Boost.Container] does not implement it
|
unsuccessful tries to deprecate or remove it from the standard. [*Boost.Container] does not implement it
|
||||||
as there is a superior [@http://www.boost.org/libs/dynamic_bitset/ Boost.DynamicBitset]
|
as there is a superior [@http://www.boost.org/libs/dynamic_bitset/ Boost.DynamicBitset]
|
||||||
solution. For issues with `vector<bool>` see papers
|
solution. For issues with `vector<bool>` see papers
|
||||||
[@http://www.gotw.ca/publications/N1211.pdf vector<bool>: N1211: More Problems, Better Solutions],
|
[@http://www.gotw.ca/publications/N1211.pdf vector<bool>: N1211: More Problems, Better Solutions],
|
||||||
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2160.html N2160: Library Issue 96: Fixing vector<bool>],
|
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2160.html N2160: Library Issue 96: Fixing vector<bool>],
|
||||||
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2204.html N2204 A Specification to deprecate vector<bool>].
|
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2204.html N2204 A Specification to deprecate vector<bool>].
|
||||||
|
|
||||||
@ -539,7 +539,7 @@ code tweaked to support non-raw `allocator::pointer` types and stateful allocato
|
|||||||
Shmem was accepted as [@http://www.boost.org/libs/interprocess/ Boost.Interprocess] and this library
|
Shmem was accepted as [@http://www.boost.org/libs/interprocess/ Boost.Interprocess] and this library
|
||||||
continued to refine and improve those containers.
|
continued to refine and improve those containers.
|
||||||
|
|
||||||
In 2007, container code from node containers (`map`, `list`, `slist`) was rewritten, refactored
|
In 2007, container code from node containers (`map`, `list`, `slist`) was rewritten, refactored
|
||||||
and expanded to build the intrusive container library [@http://www.boost.org/libs/intrusive/ Boost.Intrusive].
|
and expanded to build the intrusive container library [@http://www.boost.org/libs/intrusive/ Boost.Intrusive].
|
||||||
[*Boost.Interprocess] containers were refactored to take advantage of [*Boost.Intrusive] containers and
|
[*Boost.Interprocess] containers were refactored to take advantage of [*Boost.Intrusive] containers and
|
||||||
code duplication was minimized. Both libraries continued to gain support and bug fixes for years.
|
code duplication was minimized. Both libraries continued to gain support and bug fixes for years.
|
||||||
@ -603,7 +603,7 @@ use [*Boost.Container]? There are several reasons for that:
|
|||||||
[@http://bannalia.blogspot.com/2008/09/introducing-stablevector.html Joaqu\u00EDn M. L\u00F3pez Mu\u00F1oz],
|
[@http://bannalia.blogspot.com/2008/09/introducing-stablevector.html Joaqu\u00EDn M. L\u00F3pez Mu\u00F1oz],
|
||||||
then adapted for [*Boost.Interprocess]. Thanks for such a great container.
|
then adapted for [*Boost.Interprocess]. Thanks for such a great container.
|
||||||
|
|
||||||
* Howard Hinnant's help and advices were essential when implementing move semantics,
|
* Howard Hinnant's help and advices were essential when implementing move semantics,
|
||||||
improving allocator support or implementing small string optimization. Thanks Howard
|
improving allocator support or implementing small string optimization. Thanks Howard
|
||||||
for your wonderful standard library implementations.
|
for your wonderful standard library implementations.
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
!scan-path "boost/container" ".*.hpp" false
|
!scan-path "boost/container" ".*.hpp" false
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
# Boost Container Library Example Jamfile
|
# Boost Container Library Example Jamfile
|
||||||
|
|
||||||
# (C) Copyright Ion Gaztanaga 2009
|
# (C) Copyright Ion Gaztanaga 2009
|
||||||
# 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)
|
||||||
|
|
||||||
# Adapted from John Maddock's TR1 Jamfile.v2
|
# Adapted from John Maddock's TR1 Jamfile.v2
|
||||||
# Copyright John Maddock 2005.
|
# Copyright John Maddock 2005.
|
||||||
# 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)
|
||||||
|
|
||||||
# this rule enumerates through all the sources and invokes
|
# this rule enumerates through all the sources and invokes
|
||||||
@ -31,4 +31,4 @@ rule test_all
|
|||||||
return $(all_rules) ;
|
return $(all_rules) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
test-suite container_example : [ test_all r ] : <threading>multi ;
|
test-suite container_example : [ test_all r ] : <threading>multi ;
|
||||||
|
@ -49,7 +49,7 @@ int main()
|
|||||||
stable_vector<data> sv;
|
stable_vector<data> sv;
|
||||||
sv.resize(100);
|
sv.resize(100);
|
||||||
|
|
||||||
//Let's build a tree based in
|
//Let's build a tree based in
|
||||||
//a recursive data type
|
//a recursive data type
|
||||||
tree_node root;
|
tree_node root;
|
||||||
root.name = "root";
|
root.name = "root";
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
//MyClassHolder.h
|
//MyClassHolder.h
|
||||||
|
|
||||||
//We don't need to include "MyClass.h"
|
//We don't need to include "MyClass.h"
|
||||||
//to store vector<MyClass>
|
//to store vector<MyClass>
|
||||||
class MyClass;
|
class MyClass;
|
||||||
|
|
||||||
class MyClassHolder
|
class MyClassHolder
|
||||||
@ -44,7 +44,7 @@ class MyClass
|
|||||||
MyClass(int val = 0) : value_(val){}
|
MyClass(int val = 0) : value_(val){}
|
||||||
|
|
||||||
friend bool operator==(const MyClass &l, const MyClass &r)
|
friend bool operator==(const MyClass &l, const MyClass &r)
|
||||||
{ return l.value_ == r.value_; }
|
{ return l.value_ == r.value_; }
|
||||||
//...
|
//...
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
# Boost Container Library Test Jamfile
|
# Boost Container Library Test Jamfile
|
||||||
|
|
||||||
# (C) Copyright Ion Gaztanaga 2009.
|
# (C) Copyright Ion Gaztanaga 2009.
|
||||||
# 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)
|
||||||
|
|
||||||
# Adapted from John Maddock's TR1 Jamfile.v2
|
# Adapted from John Maddock's TR1 Jamfile.v2
|
||||||
# Copyright John Maddock 2005.
|
# Copyright John Maddock 2005.
|
||||||
# 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)
|
||||||
|
|
||||||
# this rule enumerates through all the sources and invokes
|
# this rule enumerates through all the sources and invokes
|
||||||
@ -31,4 +31,4 @@ rule test_all
|
|||||||
return $(all_rules) ;
|
return $(all_rules) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
test-suite container_test : [ test_all r ] ;
|
test-suite container_test : [ test_all r ] ;
|
||||||
|
@ -23,17 +23,17 @@ namespace test{
|
|||||||
//Function to check if both containers are equal
|
//Function to check if both containers are equal
|
||||||
template<class MyBoostCont
|
template<class MyBoostCont
|
||||||
,class MyStdCont>
|
,class MyStdCont>
|
||||||
bool CheckEqualContainers(MyBoostCont *boostcont, MyStdCont *stdcont)
|
bool CheckEqualContainers(const MyBoostCont *boostcont, const MyStdCont *stdcont)
|
||||||
{
|
{
|
||||||
if(boostcont->size() != stdcont->size())
|
if(boostcont->size() != stdcont->size())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
typedef typename MyBoostCont::value_type value_type;
|
typedef typename MyBoostCont::value_type value_type;
|
||||||
|
|
||||||
typename MyBoostCont::iterator itboost(boostcont->begin()), itboostend(boostcont->end());
|
typename MyBoostCont::const_iterator itboost(boostcont->begin()), itboostend(boostcont->end());
|
||||||
typename MyStdCont::iterator itstd(stdcont->begin());
|
typename MyStdCont::const_iterator itstd(stdcont->begin());
|
||||||
typename MyStdCont::size_type dist = (typename MyStdCont::size_type)std::distance(itboost, itboostend);
|
typename MyStdCont::size_type dist = (typename MyStdCont::size_type)std::distance(itboost, itboostend);
|
||||||
if(dist != boostcont->size()){
|
if(dist != boostcont->size()){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::size_t i = 0;
|
std::size_t i = 0;
|
||||||
@ -48,7 +48,7 @@ bool CheckEqualContainers(MyBoostCont *boostcont, MyStdCont *stdcont)
|
|||||||
|
|
||||||
template<class MyBoostCont
|
template<class MyBoostCont
|
||||||
,class MyStdCont>
|
,class MyStdCont>
|
||||||
bool CheckEqualPairContainers(MyBoostCont *boostcont, MyStdCont *stdcont)
|
bool CheckEqualPairContainers(const MyBoostCont *boostcont, const MyStdCont *stdcont)
|
||||||
{
|
{
|
||||||
if(boostcont->size() != stdcont->size())
|
if(boostcont->size() != stdcont->size())
|
||||||
return false;
|
return false;
|
||||||
@ -56,8 +56,8 @@ bool CheckEqualPairContainers(MyBoostCont *boostcont, MyStdCont *stdcont)
|
|||||||
typedef typename MyBoostCont::key_type key_type;
|
typedef typename MyBoostCont::key_type key_type;
|
||||||
typedef typename MyBoostCont::mapped_type mapped_type;
|
typedef typename MyBoostCont::mapped_type mapped_type;
|
||||||
|
|
||||||
typename MyBoostCont::iterator itboost(boostcont->begin()), itboostend(boostcont->end());
|
typename MyBoostCont::const_iterator itboost(boostcont->begin()), itboostend(boostcont->end());
|
||||||
typename MyStdCont::iterator itstd(stdcont->begin());
|
typename MyStdCont::const_iterator itstd(stdcont->begin());
|
||||||
for(; itboost != itboostend; ++itboost, ++itstd){
|
for(; itboost != itboostend; ++itboost, ++itstd){
|
||||||
if(itboost->first != key_type(itstd->first))
|
if(itboost->first != key_type(itstd->first))
|
||||||
return false;
|
return false;
|
||||||
|
@ -259,11 +259,11 @@ bool do_test()
|
|||||||
|
|
||||||
cntdeque->resize(100);
|
cntdeque->resize(100);
|
||||||
stddeque->resize(100);
|
stddeque->resize(100);
|
||||||
if(!test::CheckEqualContainers(cntdeque, stddeque)) return 1;
|
if(!test::CheckEqualContainers(cntdeque, stddeque)) return 1;
|
||||||
|
|
||||||
cntdeque->resize(200);
|
cntdeque->resize(200);
|
||||||
stddeque->resize(200);
|
stddeque->resize(200);
|
||||||
if(!test::CheckEqualContainers(cntdeque, stddeque)) return 1;
|
if(!test::CheckEqualContainers(cntdeque, stddeque)) return 1;
|
||||||
|
|
||||||
delete cntdeque;
|
delete cntdeque;
|
||||||
delete stddeque;
|
delete stddeque;
|
||||||
@ -272,7 +272,7 @@ bool do_test()
|
|||||||
std::cout << ex.what() << std::endl;
|
std::cout << ex.what() << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << std::endl << "Test OK!" << std::endl;
|
std::cout << std::endl << "Test OK!" << std::endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ class simple_allocator
|
|||||||
|
|
||||||
//Version 2 allocator with rebind
|
//Version 2 allocator with rebind
|
||||||
template<class T>
|
template<class T>
|
||||||
class dummy_test_allocator
|
class dummy_test_allocator
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
typedef dummy_test_allocator<T> self_t;
|
typedef dummy_test_allocator<T> self_t;
|
||||||
@ -100,7 +100,7 @@ class dummy_test_allocator
|
|||||||
|
|
||||||
//!Default constructor. Never throws
|
//!Default constructor. Never throws
|
||||||
dummy_test_allocator()
|
dummy_test_allocator()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//!Constructor from other dummy_test_allocator. Never throws
|
//!Constructor from other dummy_test_allocator. Never throws
|
||||||
dummy_test_allocator(const dummy_test_allocator &)
|
dummy_test_allocator(const dummy_test_allocator &)
|
||||||
@ -111,7 +111,7 @@ class dummy_test_allocator
|
|||||||
dummy_test_allocator(const dummy_test_allocator<T2> &)
|
dummy_test_allocator(const dummy_test_allocator<T2> &)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
pointer address(reference value)
|
pointer address(reference value)
|
||||||
{ return pointer(container_detail::addressof(value)); }
|
{ return pointer(container_detail::addressof(value)); }
|
||||||
|
|
||||||
const_pointer address(const_reference value) const
|
const_pointer address(const_reference value) const
|
||||||
@ -140,7 +140,7 @@ class dummy_test_allocator
|
|||||||
|
|
||||||
std::pair<pointer, bool>
|
std::pair<pointer, bool>
|
||||||
allocation_command(boost::container::allocation_type,
|
allocation_command(boost::container::allocation_type,
|
||||||
size_type,
|
size_type,
|
||||||
size_type,
|
size_type,
|
||||||
size_type &, const pointer & = 0)
|
size_type &, const pointer & = 0)
|
||||||
{ return std::pair<pointer, bool>(pointer(), true); }
|
{ return std::pair<pointer, bool>(pointer(), true); }
|
||||||
@ -192,19 +192,19 @@ class dummy_test_allocator
|
|||||||
|
|
||||||
//!Equality test for same type of dummy_test_allocator
|
//!Equality test for same type of dummy_test_allocator
|
||||||
template<class T> inline
|
template<class T> inline
|
||||||
bool operator==(const dummy_test_allocator<T> &,
|
bool operator==(const dummy_test_allocator<T> &,
|
||||||
const dummy_test_allocator<T> &)
|
const dummy_test_allocator<T> &)
|
||||||
{ return true; }
|
{ return true; }
|
||||||
|
|
||||||
//!Inequality test for same type of dummy_test_allocator
|
//!Inequality test for same type of dummy_test_allocator
|
||||||
template<class T> inline
|
template<class T> inline
|
||||||
bool operator!=(const dummy_test_allocator<T> &,
|
bool operator!=(const dummy_test_allocator<T> &,
|
||||||
const dummy_test_allocator<T> &)
|
const dummy_test_allocator<T> &)
|
||||||
{ return false; }
|
{ return false; }
|
||||||
|
|
||||||
|
|
||||||
template< class T
|
template< class T
|
||||||
, bool PropagateOnContCopyAssign
|
, bool PropagateOnContCopyAssign
|
||||||
, bool PropagateOnContMoveAssign
|
, bool PropagateOnContMoveAssign
|
||||||
, bool PropagateOnContSwap
|
, bool PropagateOnContSwap
|
||||||
, bool CopyOnPropagateOnContSwap
|
, bool CopyOnPropagateOnContSwap
|
||||||
@ -335,7 +335,7 @@ class propagation_test_allocator
|
|||||||
};
|
};
|
||||||
|
|
||||||
template< class T
|
template< class T
|
||||||
, bool PropagateOnContCopyAssign
|
, bool PropagateOnContCopyAssign
|
||||||
, bool PropagateOnContMoveAssign
|
, bool PropagateOnContMoveAssign
|
||||||
, bool PropagateOnContSwap
|
, bool PropagateOnContSwap
|
||||||
, bool CopyOnPropagateOnContSwap
|
, bool CopyOnPropagateOnContSwap
|
||||||
|
@ -36,11 +36,11 @@ namespace boost {
|
|||||||
namespace container {
|
namespace container {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
|
||||||
//This allocator just allows two allocations. The first one will return
|
//This allocator just allows two allocations. The first one will return
|
||||||
//mp_buffer + m_offset configured in the constructor. The second one
|
//mp_buffer + m_offset configured in the constructor. The second one
|
||||||
//will return mp_buffer.
|
//will return mp_buffer.
|
||||||
template<class T>
|
template<class T>
|
||||||
class expand_bwd_test_allocator
|
class expand_bwd_test_allocator
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
typedef expand_bwd_test_allocator<T> self_t;
|
typedef expand_bwd_test_allocator<T> self_t;
|
||||||
@ -70,12 +70,12 @@ class expand_bwd_test_allocator
|
|||||||
{ typedef expand_bwd_test_allocator<T2> other; };
|
{ typedef expand_bwd_test_allocator<T2> other; };
|
||||||
|
|
||||||
//!Constructor from the segment manager. Never throws
|
//!Constructor from the segment manager. Never throws
|
||||||
expand_bwd_test_allocator(T *buffer, size_type size, difference_type offset)
|
expand_bwd_test_allocator(T *buffer, size_type size, difference_type offset)
|
||||||
: mp_buffer(buffer), m_size(size)
|
: mp_buffer(buffer), m_size(size)
|
||||||
, m_offset(offset), m_allocations(0){ }
|
, m_offset(offset), m_allocations(0){ }
|
||||||
|
|
||||||
//!Constructor from other expand_bwd_test_allocator. Never throws
|
//!Constructor from other expand_bwd_test_allocator. Never throws
|
||||||
expand_bwd_test_allocator(const expand_bwd_test_allocator &other)
|
expand_bwd_test_allocator(const expand_bwd_test_allocator &other)
|
||||||
: mp_buffer(other.mp_buffer), m_size(other.m_size)
|
: mp_buffer(other.mp_buffer), m_size(other.m_size)
|
||||||
, m_offset(other.m_offset), m_allocations(0){ }
|
, m_offset(other.m_offset), m_allocations(0){ }
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ class expand_bwd_test_allocator
|
|||||||
{ return m_size; }
|
{ return m_size; }
|
||||||
|
|
||||||
friend void swap(self_t &alloc1, self_t &alloc2)
|
friend void swap(self_t &alloc1, self_t &alloc2)
|
||||||
{
|
{
|
||||||
container_detail::do_swap(alloc1.mp_buffer, alloc2.mp_buffer);
|
container_detail::do_swap(alloc1.mp_buffer, alloc2.mp_buffer);
|
||||||
container_detail::do_swap(alloc1.m_size, alloc2.m_size);
|
container_detail::do_swap(alloc1.m_size, alloc2.m_size);
|
||||||
container_detail::do_swap(alloc1.m_offset, alloc2.m_offset);
|
container_detail::do_swap(alloc1.m_offset, alloc2.m_offset);
|
||||||
@ -118,14 +118,14 @@ class expand_bwd_test_allocator
|
|||||||
|
|
||||||
std::pair<pointer, bool>
|
std::pair<pointer, bool>
|
||||||
allocation_command(boost::container::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 = 0)
|
size_type &received_size, const pointer &reuse = 0)
|
||||||
{
|
{
|
||||||
(void)preferred_size; (void)reuse; (void)command;
|
(void)preferred_size; (void)reuse; (void)command;
|
||||||
//This allocator only expands backwards!
|
//This allocator only expands backwards!
|
||||||
assert(m_allocations == 0 || (command & boost::container::expand_bwd));
|
assert(m_allocations == 0 || (command & boost::container::expand_bwd));
|
||||||
|
|
||||||
received_size = limit_size;
|
received_size = limit_size;
|
||||||
|
|
||||||
if(m_allocations == 0){
|
if(m_allocations == 0){
|
||||||
@ -173,13 +173,13 @@ class expand_bwd_test_allocator
|
|||||||
|
|
||||||
//!Equality test for same type of expand_bwd_test_allocator
|
//!Equality test for same type of expand_bwd_test_allocator
|
||||||
template<class T> inline
|
template<class T> inline
|
||||||
bool operator==(const expand_bwd_test_allocator<T> &alloc1,
|
bool operator==(const expand_bwd_test_allocator<T> &alloc1,
|
||||||
const expand_bwd_test_allocator<T> &alloc2)
|
const expand_bwd_test_allocator<T> &alloc2)
|
||||||
{ return false; }
|
{ return false; }
|
||||||
|
|
||||||
//!Inequality test for same type of expand_bwd_test_allocator
|
//!Inequality test for same type of expand_bwd_test_allocator
|
||||||
template<class T> inline
|
template<class T> inline
|
||||||
bool operator!=(const expand_bwd_test_allocator<T> &alloc1,
|
bool operator!=(const expand_bwd_test_allocator<T> &alloc1,
|
||||||
const expand_bwd_test_allocator<T> &alloc2)
|
const expand_bwd_test_allocator<T> &alloc2)
|
||||||
{ return true; }
|
{ return true; }
|
||||||
|
|
||||||
|
@ -114,19 +114,19 @@ bool test_insert_with_expand_bwd()
|
|||||||
const int MemorySize = 1000;
|
const int MemorySize = 1000;
|
||||||
|
|
||||||
//Distance old and new buffer
|
//Distance old and new buffer
|
||||||
const int Offset[] =
|
const int Offset[] =
|
||||||
{ 350, 250, 150, 150,
|
{ 350, 250, 150, 150,
|
||||||
150, 50, 50, 50 };
|
150, 50, 50, 50 };
|
||||||
//Insert position
|
//Insert position
|
||||||
const int Position[] =
|
const int Position[] =
|
||||||
{ 100, 100, 100, 100,
|
{ 100, 100, 100, 100,
|
||||||
100, 100, 100, 100 };
|
100, 100, 100, 100 };
|
||||||
//Initial vector size
|
//Initial vector size
|
||||||
const int InitialSize[] =
|
const int InitialSize[] =
|
||||||
{ 200, 200, 200, 200,
|
{ 200, 200, 200, 200,
|
||||||
200, 200, 200, 200 };
|
200, 200, 200, 200 };
|
||||||
//Size of the data to insert
|
//Size of the data to insert
|
||||||
const int InsertSize[] =
|
const int InsertSize[] =
|
||||||
{ 100, 100, 100, 200,
|
{ 100, 100, 100, 200,
|
||||||
300, 25, 100, 200 };
|
300, 25, 100, 200 };
|
||||||
//Number of tests
|
//Number of tests
|
||||||
@ -159,7 +159,7 @@ bool test_insert_with_expand_bwd()
|
|||||||
, data_to_insert.begin(), data_to_insert.end());
|
, 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)){
|
||||||
std::cout << "test_assign_with_expand_bwd::CheckEqualVector failed." << std::endl
|
std::cout << "test_assign_with_expand_bwd::CheckEqualVector failed." << std::endl
|
||||||
<< " Class: " << typeid(VectorWithExpandBwdAllocator).name() << std::endl
|
<< " Class: " << typeid(VectorWithExpandBwdAllocator).name() << std::endl
|
||||||
<< " Iteration: " << iteration << std::endl;
|
<< " Iteration: " << iteration << std::endl;
|
||||||
return false;
|
return false;
|
||||||
@ -215,13 +215,13 @@ bool test_assign_with_expand_bwd()
|
|||||||
vector.insert( vector.begin()
|
vector.insert( vector.begin()
|
||||||
, 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.assign(data_to_assign.begin(), data_to_assign.end());
|
||||||
initial_data.assign(data_to_assign.begin(), data_to_assign.end());
|
initial_data.assign(data_to_assign.begin(), data_to_assign.end());
|
||||||
|
|
||||||
//Now check that values are equal
|
//Now check that values are equal
|
||||||
if(!CheckEqualVector(vector, initial_data)){
|
if(!CheckEqualVector(vector, initial_data)){
|
||||||
std::cout << "test_assign_with_expand_bwd::CheckEqualVector failed." << std::endl
|
std::cout << "test_assign_with_expand_bwd::CheckEqualVector failed." << std::endl
|
||||||
<< " Class: " << typeid(VectorWithExpandBwdAllocator).name() << std::endl
|
<< " Class: " << typeid(VectorWithExpandBwdAllocator).name() << std::endl
|
||||||
<< " Iteration: " << iteration << std::endl;
|
<< " Iteration: " << iteration << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -19,12 +19,14 @@
|
|||||||
#include "map_test.hpp"
|
#include "map_test.hpp"
|
||||||
#include "propagate_allocator_test.hpp"
|
#include "propagate_allocator_test.hpp"
|
||||||
#include "emplace_test.hpp"
|
#include "emplace_test.hpp"
|
||||||
|
#include <vector>
|
||||||
|
#include <boost/container/detail/flat_tree.hpp>
|
||||||
|
|
||||||
using namespace boost::container;
|
using namespace boost::container;
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
namespace container {
|
namespace container {
|
||||||
|
/*
|
||||||
//Explicit instantiation to detect compilation errors
|
//Explicit instantiation to detect compilation errors
|
||||||
|
|
||||||
//flat_map
|
//flat_map
|
||||||
@ -113,25 +115,25 @@ template class flat_multiset
|
|||||||
, std::less<test::movable_and_copyable_int>
|
, std::less<test::movable_and_copyable_int>
|
||||||
, std::allocator<test::movable_and_copyable_int>
|
, std::allocator<test::movable_and_copyable_int>
|
||||||
>;
|
>;
|
||||||
|
*/
|
||||||
}} //boost::container
|
}} //boost::container
|
||||||
|
|
||||||
|
|
||||||
//Alias allocator type
|
//Alias allocator type
|
||||||
typedef std::allocator<int> allocator_t;
|
typedef std::allocator<int> allocator_t;
|
||||||
typedef std::allocator<test::movable_int>
|
typedef std::allocator<test::movable_int>
|
||||||
movable_allocator_t;
|
movable_allocator_t;
|
||||||
typedef std::allocator<std::pair<int, int> >
|
typedef std::allocator<std::pair<int, int> >
|
||||||
pair_allocator_t;
|
pair_allocator_t;
|
||||||
typedef std::allocator<std::pair<test::movable_int, test::movable_int> >
|
typedef std::allocator<std::pair<test::movable_int, test::movable_int> >
|
||||||
movable_pair_allocator_t;
|
movable_pair_allocator_t;
|
||||||
typedef std::allocator<test::movable_and_copyable_int >
|
typedef std::allocator<test::movable_and_copyable_int >
|
||||||
move_copy_allocator_t;
|
move_copy_allocator_t;
|
||||||
typedef std::allocator<std::pair<test::movable_and_copyable_int, test::movable_and_copyable_int> >
|
typedef std::allocator<std::pair<test::movable_and_copyable_int, test::movable_and_copyable_int> >
|
||||||
move_copy_pair_allocator_t;
|
move_copy_pair_allocator_t;
|
||||||
typedef std::allocator<test::copyable_int >
|
typedef std::allocator<test::copyable_int >
|
||||||
copy_allocator_t;
|
copy_allocator_t;
|
||||||
typedef std::allocator<std::pair<test::copyable_int, test::copyable_int> >
|
typedef std::allocator<std::pair<test::copyable_int, test::copyable_int> >
|
||||||
copy_pair_allocator_t;
|
copy_pair_allocator_t;
|
||||||
|
|
||||||
|
|
||||||
@ -302,6 +304,169 @@ class flat_tree_propagate_test_wrapper
|
|||||||
{ this->Base::swap(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()
|
int main()
|
||||||
{
|
{
|
||||||
@ -315,6 +480,9 @@ int main()
|
|||||||
test_move<flat_multimap<recursive_flat_multimap, recursive_flat_multimap> >();
|
test_move<flat_multimap<recursive_flat_multimap, recursive_flat_multimap> >();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!flat_tree_ordered_insertion_test()){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (0 != set_test<
|
if (0 != set_test<
|
||||||
MyBoostSet
|
MyBoostSet
|
||||||
@ -459,3 +627,55 @@ int main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#include <boost/container/detail/config_end.hpp>
|
#include <boost/container/detail/config_end.hpp>
|
||||||
|
|
||||||
|
/*
|
||||||
|
#include <boost/container/map.hpp>
|
||||||
|
#include <boost/container/flat_map.hpp>
|
||||||
|
#include <boost/container/vector.hpp>
|
||||||
|
#include <boost/move/move.hpp>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
struct Request
|
||||||
|
{
|
||||||
|
Request() {};
|
||||||
|
|
||||||
|
//Move semantics...
|
||||||
|
Request(BOOST_RV_REF(Request) r) : rvals() //Move constructor
|
||||||
|
{
|
||||||
|
rvals.swap(r.rvals);
|
||||||
|
};
|
||||||
|
|
||||||
|
Request& operator=(BOOST_RV_REF(Request) r) //Move assignment
|
||||||
|
{
|
||||||
|
if (this != &r){
|
||||||
|
rvals.swap(r.rvals);
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Values I want to be moved, not copied.
|
||||||
|
boost::container::vector<int> rvals;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Mark this class movable but not copyable
|
||||||
|
BOOST_MOVABLE_BUT_NOT_COPYABLE(Request)
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef boost::container::flat_map<int, Request> Requests;
|
||||||
|
//typedef boost::container::map<int, Request> Requests2;
|
||||||
|
|
||||||
|
int
|
||||||
|
main() {
|
||||||
|
Requests req;
|
||||||
|
|
||||||
|
Requests::value_type v;
|
||||||
|
std::pair<Requests::iterator, bool> ret = req.insert( boost::move(v));
|
||||||
|
//std::cout << "Insert success for req: " << ret.second << std::endl;
|
||||||
|
|
||||||
|
//Requests2 req2;
|
||||||
|
//std::pair<Requests::iterator, bool> ret2 = req2.insert( Requests2::value_type( 7, Request() ) );
|
||||||
|
//std::cout << "Insert success for req2: " << ret2.second << std::endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
@ -38,19 +38,19 @@ namespace boost {
|
|||||||
namespace container {
|
namespace container {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
|
||||||
//!An STL compatible heap_allocator_v1 that uses a segment manager as
|
//!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
|
//!memory source. The internal pointer type will of the same type (raw, smart) as
|
||||||
//!"typename SegmentManager::void_pointer" type. This allows
|
//!"typename SegmentManager::void_pointer" type. This allows
|
||||||
//!placing the heap_allocator_v1 in shared memory, memory mapped-files, etc...*/
|
//!placing the heap_allocator_v1 in shared memory, memory mapped-files, etc...*/
|
||||||
template<class T, class SegmentManager>
|
template<class T, class SegmentManager>
|
||||||
class heap_allocator_v1
|
class heap_allocator_v1
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
typedef heap_allocator_v1<T, SegmentManager> self_t;
|
typedef heap_allocator_v1<T, SegmentManager> self_t;
|
||||||
typedef SegmentManager segment_manager;
|
typedef SegmentManager segment_manager;
|
||||||
typedef typename segment_manager::void_pointer aux_pointer_t;
|
typedef typename segment_manager::void_pointer aux_pointer_t;
|
||||||
|
|
||||||
typedef typename
|
typedef typename
|
||||||
boost::pointer_to_other
|
boost::pointer_to_other
|
||||||
<aux_pointer_t, const void>::type cvoid_ptr;
|
<aux_pointer_t, const void>::type cvoid_ptr;
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ class heap_allocator_v1
|
|||||||
//!Obtains an heap_allocator_v1 of other type
|
//!Obtains an heap_allocator_v1 of other type
|
||||||
template<class T2>
|
template<class T2>
|
||||||
struct rebind
|
struct rebind
|
||||||
{
|
{
|
||||||
typedef heap_allocator_v1<T2, SegmentManager> other;
|
typedef heap_allocator_v1<T2, SegmentManager> other;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -97,19 +97,19 @@ class heap_allocator_v1
|
|||||||
{ return const_pointer(addressof(value)); }
|
{ return const_pointer(addressof(value)); }
|
||||||
*/
|
*/
|
||||||
//!Constructor from the segment manager. Never throws
|
//!Constructor from the segment manager. Never throws
|
||||||
heap_allocator_v1(segment_manager *segment_mngr)
|
heap_allocator_v1(segment_manager *segment_mngr)
|
||||||
: mp_mngr(segment_mngr) { }
|
: mp_mngr(segment_mngr) { }
|
||||||
|
|
||||||
//!Constructor from other heap_allocator_v1. Never throws
|
//!Constructor from other heap_allocator_v1. Never throws
|
||||||
heap_allocator_v1(const heap_allocator_v1 &other)
|
heap_allocator_v1(const heap_allocator_v1 &other)
|
||||||
: mp_mngr(other.get_segment_manager()){ }
|
: mp_mngr(other.get_segment_manager()){ }
|
||||||
|
|
||||||
//!Constructor from related heap_allocator_v1. Never throws
|
//!Constructor from related heap_allocator_v1. Never throws
|
||||||
template<class T2>
|
template<class T2>
|
||||||
heap_allocator_v1(const heap_allocator_v1<T2, SegmentManager> &other)
|
heap_allocator_v1(const heap_allocator_v1<T2, SegmentManager> &other)
|
||||||
: mp_mngr(other.get_segment_manager()){}
|
: mp_mngr(other.get_segment_manager()){}
|
||||||
|
|
||||||
//!Allocates memory for an array of count elements.
|
//!Allocates memory for an array of count elements.
|
||||||
//!Throws boost::container::bad_alloc if there is no enough memory
|
//!Throws boost::container::bad_alloc if there is no enough memory
|
||||||
pointer allocate(size_type count, cvoid_ptr hint = 0)
|
pointer allocate(size_type count, cvoid_ptr hint = 0)
|
||||||
{ (void)hint; return ::new value_type[count]; }
|
{ (void)hint; return ::new value_type[count]; }
|
||||||
@ -118,7 +118,7 @@ class heap_allocator_v1
|
|||||||
void deallocate(const pointer &ptr, size_type)
|
void deallocate(const pointer &ptr, size_type)
|
||||||
{ return ::delete[] detail::get_pointer(ptr) ; }
|
{ return ::delete[] detail::get_pointer(ptr) ; }
|
||||||
|
|
||||||
//!Construct object, calling constructor.
|
//!Construct object, calling constructor.
|
||||||
//!Throws if T(const T&) throws
|
//!Throws if T(const T&) throws
|
||||||
void construct(const pointer &ptr, const_reference value)
|
void construct(const pointer &ptr, const_reference value)
|
||||||
{ new((void*)detail::get_pointer(ptr)) value_type(value); }
|
{ new((void*)detail::get_pointer(ptr)) value_type(value); }
|
||||||
@ -139,13 +139,13 @@ class heap_allocator_v1
|
|||||||
|
|
||||||
//!Equality test for same type of heap_allocator_v1
|
//!Equality test for same type of heap_allocator_v1
|
||||||
template<class T, class SegmentManager> inline
|
template<class T, class SegmentManager> inline
|
||||||
bool operator==(const heap_allocator_v1<T , SegmentManager> &alloc1,
|
bool operator==(const heap_allocator_v1<T , SegmentManager> &alloc1,
|
||||||
const heap_allocator_v1<T, SegmentManager> &alloc2)
|
const heap_allocator_v1<T, SegmentManager> &alloc2)
|
||||||
{ return alloc1.get_segment_manager() == alloc2.get_segment_manager(); }
|
{ return alloc1.get_segment_manager() == alloc2.get_segment_manager(); }
|
||||||
|
|
||||||
//!Inequality test for same type of heap_allocator_v1
|
//!Inequality test for same type of heap_allocator_v1
|
||||||
template<class T, class SegmentManager> inline
|
template<class T, class SegmentManager> inline
|
||||||
bool operator!=(const heap_allocator_v1<T, SegmentManager> &alloc1,
|
bool operator!=(const heap_allocator_v1<T, SegmentManager> &alloc1,
|
||||||
const heap_allocator_v1<T, SegmentManager> &alloc2)
|
const heap_allocator_v1<T, SegmentManager> &alloc2)
|
||||||
{ return alloc1.get_segment_manager() != alloc2.get_segment_manager(); }
|
{ return alloc1.get_segment_manager() != alloc2.get_segment_manager(); }
|
||||||
|
|
||||||
|
@ -23,13 +23,13 @@ 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::movable_and_copyable_int,
|
||||||
test::simple_allocator<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::movable_and_copyable_int,
|
||||||
test::dummy_test_allocator<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<test::movable_and_copyable_int,
|
||||||
std::allocator<test::movable_and_copyable_int> >;
|
std::allocator<test::movable_and_copyable_int> >;
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
@ -258,7 +258,7 @@ int list_test (bool copied_allocators_equal = true)
|
|||||||
boostlist->splice(boostlist->begin(), otherboostlist);
|
boostlist->splice(boostlist->begin(), otherboostlist);
|
||||||
stdlist->splice(stdlist->begin(), otherstdlist);
|
stdlist->splice(stdlist->begin(), otherstdlist);
|
||||||
if(!CheckEqualContainers(boostlist, stdlist))
|
if(!CheckEqualContainers(boostlist, stdlist))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
listsize = (int)boostlist->size();
|
listsize = (int)boostlist->size();
|
||||||
|
@ -48,7 +48,7 @@ int map_test ()
|
|||||||
MyBoostMultiMap *boostmultimap = new MyBoostMultiMap;
|
MyBoostMultiMap *boostmultimap = new MyBoostMultiMap;
|
||||||
MyStdMultiMap *stdmultimap = new MyStdMultiMap;
|
MyStdMultiMap *stdmultimap = new MyStdMultiMap;
|
||||||
|
|
||||||
//Test construction from a range
|
//Test construction from a range
|
||||||
{
|
{
|
||||||
//This is really nasty, but we have no other simple choice
|
//This is really nasty, but we have no other simple choice
|
||||||
IntPairType aux_vect[50];
|
IntPairType aux_vect[50];
|
||||||
@ -105,7 +105,7 @@ int map_test ()
|
|||||||
if(!CheckEqualContainers(boostmultimap2, stdmultimap2)) return 1;
|
if(!CheckEqualContainers(boostmultimap2, stdmultimap2)) return 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
MyBoostMap *boostmap3 = new MyBoostMap
|
MyBoostMap *boostmap3 = new MyBoostMap
|
||||||
( ordered_unique_range
|
( ordered_unique_range
|
||||||
, boost::make_move_iterator(&aux_vect[0])
|
, boost::make_move_iterator(&aux_vect[0])
|
||||||
, boost::make_move_iterator(aux_vect + 50));
|
, boost::make_move_iterator(aux_vect + 50));
|
||||||
@ -393,7 +393,7 @@ int map_test ()
|
|||||||
|
|
||||||
std::pair<typename MyStdMultiMap::iterator, typename MyStdMultiMap::iterator> sret =
|
std::pair<typename MyStdMultiMap::iterator, typename MyStdMultiMap::iterator> sret =
|
||||||
stdmultimap->equal_range(stdmultimap->begin()->first);
|
stdmultimap->equal_range(stdmultimap->begin()->first);
|
||||||
|
|
||||||
if( std::distance(bret.first, bret.second) !=
|
if( std::distance(bret.first, bret.second) !=
|
||||||
std::distance(sret.first, sret.second) ){
|
std::distance(sret.first, sret.second) ){
|
||||||
return 1;
|
return 1;
|
||||||
@ -523,7 +523,7 @@ int map_test_copyable ()
|
|||||||
stdmapcopy = *stdmap;
|
stdmapcopy = *stdmap;
|
||||||
boostmmapcopy = *boostmultimap;
|
boostmmapcopy = *boostmultimap;
|
||||||
stdmmapcopy = *stdmultimap;
|
stdmmapcopy = *stdmultimap;
|
||||||
|
|
||||||
if(!CheckEqualContainers(&boostmapcopy, &stdmapcopy))
|
if(!CheckEqualContainers(&boostmapcopy, &stdmapcopy))
|
||||||
return 1;
|
return 1;
|
||||||
if(!CheckEqualContainers(&boostmmapcopy, &stdmmapcopy))
|
if(!CheckEqualContainers(&boostmmapcopy, &stdmmapcopy))
|
||||||
|
@ -77,8 +77,8 @@ class movable_int
|
|||||||
int m_int;
|
int m_int;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class E, class T>
|
template<class E, class T>
|
||||||
std::basic_ostream<E, T> & operator<<
|
std::basic_ostream<E, T> & operator<<
|
||||||
(std::basic_ostream<E, T> & os, movable_int const & p)
|
(std::basic_ostream<E, T> & os, movable_int const & p)
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -109,7 +109,7 @@ class movable_and_copyable_int
|
|||||||
movable_and_copyable_int(const movable_and_copyable_int& mmi)
|
movable_and_copyable_int(const movable_and_copyable_int& mmi)
|
||||||
: m_int(mmi.m_int)
|
: m_int(mmi.m_int)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
movable_and_copyable_int(BOOST_RV_REF(movable_and_copyable_int) mmi)
|
movable_and_copyable_int(BOOST_RV_REF(movable_and_copyable_int) mmi)
|
||||||
: m_int(mmi.m_int)
|
: m_int(mmi.m_int)
|
||||||
{ mmi.m_int = 0; }
|
{ mmi.m_int = 0; }
|
||||||
@ -148,8 +148,8 @@ class movable_and_copyable_int
|
|||||||
int m_int;
|
int m_int;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class E, class T>
|
template<class E, class T>
|
||||||
std::basic_ostream<E, T> & operator<<
|
std::basic_ostream<E, T> & operator<<
|
||||||
(std::basic_ostream<E, T> & os, movable_and_copyable_int const & p)
|
(std::basic_ostream<E, T> & os, movable_and_copyable_int const & p)
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -177,7 +177,7 @@ class copyable_int
|
|||||||
copyable_int(const copyable_int& mmi)
|
copyable_int(const copyable_int& mmi)
|
||||||
: m_int(mmi.m_int)
|
: m_int(mmi.m_int)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
copyable_int & operator= (int i)
|
copyable_int & operator= (int i)
|
||||||
{ this->m_int = i; return *this; }
|
{ this->m_int = i; return *this; }
|
||||||
|
|
||||||
@ -206,8 +206,8 @@ class copyable_int
|
|||||||
int m_int;
|
int m_int;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class E, class T>
|
template<class E, class T>
|
||||||
std::basic_ostream<E, T> & operator<<
|
std::basic_ostream<E, T> & operator<<
|
||||||
(std::basic_ostream<E, T> & os, copyable_int const & p)
|
(std::basic_ostream<E, T> & os, copyable_int const & p)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -48,8 +48,8 @@ void PrintContainers(MyBoostCont *boostcont, MyStdCont *stdcont)
|
|||||||
for(; itboost != itboostend; ++itboost){
|
for(; itboost != itboostend; ++itboost){
|
||||||
std::cout << *itboost << std::endl;
|
std::cout << *itboost << std::endl;
|
||||||
}
|
}
|
||||||
std::cout << "MyStdCont" << std::endl;
|
std::cout << "MyStdCont" << std::endl;
|
||||||
|
|
||||||
for(; itstd != itstdend; ++itstd){
|
for(; itstd != itstdend; ++itstd){
|
||||||
std::cout << *itstd << std::endl;
|
std::cout << *itstd << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -644,7 +644,7 @@ int main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
vector<int, scoped_allocator_adaptor< test_allocator<int, 0> > > dummy;
|
vector<int, scoped_allocator_adaptor< test_allocator<int, 0> > > dummy;
|
||||||
dummy.push_back(0);
|
dummy.push_back(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -682,15 +682,15 @@ int main()
|
|||||||
|
|
||||||
BOOST_STATIC_ASSERT(( !boost::container::uses_allocator
|
BOOST_STATIC_ASSERT(( !boost::container::uses_allocator
|
||||||
< ::mark_on_scoped_allocation<NotUsesAllocator, 0>
|
< ::mark_on_scoped_allocation<NotUsesAllocator, 0>
|
||||||
, test_allocator<float, 0>
|
, test_allocator<float, 0>
|
||||||
>::value ));
|
>::value ));
|
||||||
BOOST_STATIC_ASSERT(( boost::container::uses_allocator
|
BOOST_STATIC_ASSERT(( boost::container::uses_allocator
|
||||||
< ::mark_on_scoped_allocation<ConstructiblePrefix, 0>
|
< ::mark_on_scoped_allocation<ConstructiblePrefix, 0>
|
||||||
, test_allocator<float, 0>
|
, test_allocator<float, 0>
|
||||||
>::value ));
|
>::value ));
|
||||||
BOOST_STATIC_ASSERT(( boost::container::uses_allocator
|
BOOST_STATIC_ASSERT(( boost::container::uses_allocator
|
||||||
< ::mark_on_scoped_allocation<ConstructibleSuffix, 0>
|
< ::mark_on_scoped_allocation<ConstructibleSuffix, 0>
|
||||||
, test_allocator<float, 0>
|
, test_allocator<float, 0>
|
||||||
>::value ));
|
>::value ));
|
||||||
BOOST_STATIC_ASSERT(( boost::container::constructible_with_allocator_prefix
|
BOOST_STATIC_ASSERT(( boost::container::constructible_with_allocator_prefix
|
||||||
< ::mark_on_scoped_allocation<ConstructiblePrefix, 0> >::value ));
|
< ::mark_on_scoped_allocation<ConstructiblePrefix, 0> >::value ));
|
||||||
|
@ -240,7 +240,7 @@ struct container_wrapper
|
|||||||
: public Container
|
: public Container
|
||||||
{
|
{
|
||||||
typedef typename Container::allocator_type allocator_type;
|
typedef typename Container::allocator_type allocator_type;
|
||||||
|
|
||||||
container_wrapper(const allocator_type &a)
|
container_wrapper(const allocator_type &a)
|
||||||
: Container(a)
|
: Container(a)
|
||||||
{}
|
{}
|
||||||
|
@ -40,7 +40,7 @@ int set_test ()
|
|||||||
MyBoostMultiSet *boostmultiset = new MyBoostMultiSet;
|
MyBoostMultiSet *boostmultiset = new MyBoostMultiSet;
|
||||||
MyStdMultiSet *stdmultiset = new MyStdMultiSet;
|
MyStdMultiSet *stdmultiset = new MyStdMultiSet;
|
||||||
|
|
||||||
//Test construction from a range
|
//Test construction from a range
|
||||||
{
|
{
|
||||||
IntType aux_vect[50];
|
IntType aux_vect[50];
|
||||||
for(int i = 0; i < 50; ++i){
|
for(int i = 0; i < 50; ++i){
|
||||||
@ -483,7 +483,7 @@ int set_test_copyable ()
|
|||||||
|
|
||||||
boostmsetcopy = *boostmultiset;
|
boostmsetcopy = *boostmultiset;
|
||||||
stdmsetcopy = *stdmultiset;
|
stdmsetcopy = *stdmultiset;
|
||||||
|
|
||||||
if(!CheckEqualContainers(&boostmsetcopy, &stdmsetcopy))
|
if(!CheckEqualContainers(&boostmsetcopy, &stdmsetcopy))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -22,13 +22,13 @@ 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::movable_and_copyable_int,
|
||||||
test::simple_allocator<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::movable_and_copyable_int,
|
||||||
test::dummy_test_allocator<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<test::movable_and_copyable_int,
|
||||||
std::allocator<test::movable_and_copyable_int> >;
|
std::allocator<test::movable_and_copyable_int> >;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
@ -30,13 +30,13 @@ namespace boost {
|
|||||||
namespace container {
|
namespace container {
|
||||||
|
|
||||||
//Explicit instantiation to detect compilation errors
|
//Explicit instantiation to detect compilation errors
|
||||||
template class stable_vector<test::movable_and_copyable_int,
|
template class stable_vector<test::movable_and_copyable_int,
|
||||||
test::dummy_test_allocator<test::movable_and_copyable_int> >;
|
test::dummy_test_allocator<test::movable_and_copyable_int> >;
|
||||||
|
|
||||||
template class stable_vector<test::movable_and_copyable_int,
|
template class stable_vector<test::movable_and_copyable_int,
|
||||||
test::simple_allocator<test::movable_and_copyable_int> >;
|
test::simple_allocator<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> >;
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
@ -26,10 +26,10 @@
|
|||||||
|
|
||||||
using namespace boost::container;
|
using namespace boost::container;
|
||||||
|
|
||||||
typedef test::dummy_test_allocator<char> DummyCharAllocator;
|
typedef test::dummy_test_allocator<char> DummyCharAllocator;
|
||||||
typedef basic_string<char, std::char_traits<char>, DummyCharAllocator> DummyString;
|
typedef basic_string<char, std::char_traits<char>, DummyCharAllocator> DummyString;
|
||||||
typedef test::dummy_test_allocator<DummyString> DummyStringAllocator;
|
typedef test::dummy_test_allocator<DummyString> DummyStringAllocator;
|
||||||
typedef test::dummy_test_allocator<wchar_t> DummyWCharAllocator;
|
typedef test::dummy_test_allocator<wchar_t> DummyWCharAllocator;
|
||||||
typedef basic_string<wchar_t, std::char_traits<wchar_t>, DummyWCharAllocator> DummyWString;
|
typedef basic_string<wchar_t, std::char_traits<wchar_t>, DummyWCharAllocator> DummyWString;
|
||||||
typedef test::dummy_test_allocator<DummyWString> DummyWStringAllocator;
|
typedef test::dummy_test_allocator<DummyWString> DummyWStringAllocator;
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ template<class StrVector1, class StrVector2>
|
|||||||
bool CheckEqualStringVector(StrVector1 *strvect1, StrVector2 *strvect2)
|
bool CheckEqualStringVector(StrVector1 *strvect1, StrVector2 *strvect2)
|
||||||
{
|
{
|
||||||
StringEqual comp;
|
StringEqual comp;
|
||||||
return std::equal(strvect1->begin(), strvect1->end(),
|
return std::equal(strvect1->begin(), strvect1->end(),
|
||||||
strvect2->begin(), comp);
|
strvect2->begin(), comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ int string_test()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Now push back moving
|
//Now push back moving
|
||||||
for(int i = 0; i < MaxSize; ++i){
|
for(int i = 0; i < MaxSize; ++i){
|
||||||
auxBoostString = string_literals<CharType>::String();
|
auxBoostString = string_literals<CharType>::String();
|
||||||
auxStdString = string_literals<CharType>::String();
|
auxStdString = string_literals<CharType>::String();
|
||||||
@ -189,7 +189,7 @@ int string_test()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Now push front moving
|
//Now push front moving
|
||||||
for(int i = 0; i < MaxSize; ++i){
|
for(int i = 0; i < MaxSize; ++i){
|
||||||
auxBoostString = string_literals<CharType>::String();
|
auxBoostString = string_literals<CharType>::String();
|
||||||
auxStdString = string_literals<CharType>::String();
|
auxStdString = string_literals<CharType>::String();
|
||||||
@ -214,15 +214,15 @@ int string_test()
|
|||||||
boost_swapper.swap(auxBoostString);
|
boost_swapper.swap(auxBoostString);
|
||||||
std_swapper.swap(auxStdString);
|
std_swapper.swap(auxStdString);
|
||||||
if(!StringEqual()(auxBoostString, auxStdString))
|
if(!StringEqual()(auxBoostString, auxStdString))
|
||||||
return 1;
|
return 1;
|
||||||
if(!StringEqual()(boost_swapper, std_swapper))
|
if(!StringEqual()(boost_swapper, std_swapper))
|
||||||
return 1;
|
return 1;
|
||||||
boost_swapper.swap(auxBoostString);
|
boost_swapper.swap(auxBoostString);
|
||||||
std_swapper.swap(auxStdString);
|
std_swapper.swap(auxStdString);
|
||||||
if(!StringEqual()(auxBoostString, auxStdString))
|
if(!StringEqual()(auxBoostString, auxStdString))
|
||||||
return 1;
|
return 1;
|
||||||
if(!StringEqual()(boost_swapper, std_swapper))
|
if(!StringEqual()(boost_swapper, std_swapper))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
//Shrink_to_fit
|
//Shrink_to_fit
|
||||||
auxBoostString.shrink_to_fit();
|
auxBoostString.shrink_to_fit();
|
||||||
@ -249,7 +249,7 @@ int string_test()
|
|||||||
boost_swapper.swap(auxBoostString);
|
boost_swapper.swap(auxBoostString);
|
||||||
std_swapper.swap(auxStdString);
|
std_swapper.swap(auxStdString);
|
||||||
if(!StringEqual()(auxBoostString, auxStdString))
|
if(!StringEqual()(auxBoostString, auxStdString))
|
||||||
return 1;
|
return 1;
|
||||||
if(!StringEqual()(boost_swapper, std_swapper))
|
if(!StringEqual()(boost_swapper, std_swapper))
|
||||||
return 1;
|
return 1;
|
||||||
boost_swapper.swap(auxBoostString);
|
boost_swapper.swap(auxBoostString);
|
||||||
@ -280,9 +280,9 @@ int string_test()
|
|||||||
for(int i = 0; i < MaxSize; ++i){
|
for(int i = 0; i < MaxSize; ++i){
|
||||||
(*boostStringVect)[i].append(sufix);
|
(*boostStringVect)[i].append(sufix);
|
||||||
(*stdStringVect)[i].append(sufix);
|
(*stdStringVect)[i].append(sufix);
|
||||||
(*boostStringVect)[i].insert((*boostStringVect)[i].begin(),
|
(*boostStringVect)[i].insert((*boostStringVect)[i].begin(),
|
||||||
prefix, prefix + prefix_size);
|
prefix, prefix + prefix_size);
|
||||||
(*stdStringVect)[i].insert((*stdStringVect)[i].begin(),
|
(*stdStringVect)[i].insert((*stdStringVect)[i].begin(),
|
||||||
prefix, prefix + prefix_size);
|
prefix, prefix + prefix_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,10 +310,10 @@ int string_test()
|
|||||||
if(!CheckEqualStringVector(boostStringVect, stdStringVect)) return 1;
|
if(!CheckEqualStringVector(boostStringVect, stdStringVect)) return 1;
|
||||||
|
|
||||||
for(int i = 0; i < MaxSize; ++i){
|
for(int i = 0; i < MaxSize; ++i){
|
||||||
(*boostStringVect)[i].replace((*boostStringVect)[i].begin(),
|
(*boostStringVect)[i].replace((*boostStringVect)[i].begin(),
|
||||||
(*boostStringVect)[i].end(),
|
(*boostStringVect)[i].end(),
|
||||||
string_literals<CharType>::String());
|
string_literals<CharType>::String());
|
||||||
(*stdStringVect)[i].replace((*stdStringVect)[i].begin(),
|
(*stdStringVect)[i].replace((*stdStringVect)[i].begin(),
|
||||||
(*stdStringVect)[i].end(),
|
(*stdStringVect)[i].end(),
|
||||||
string_literals<CharType>::String());
|
string_literals<CharType>::String());
|
||||||
}
|
}
|
||||||
@ -330,7 +330,7 @@ int string_test()
|
|||||||
{
|
{
|
||||||
typedef std::basic_string<CharType> StdString;
|
typedef std::basic_string<CharType> StdString;
|
||||||
typedef basic_string<CharType> BoostString;
|
typedef basic_string<CharType> BoostString;
|
||||||
|
|
||||||
BoostString bs2 = string_literals<CharType>::String();
|
BoostString bs2 = string_literals<CharType>::String();
|
||||||
StdString ss2 = string_literals<CharType>::String();
|
StdString ss2 = string_literals<CharType>::String();
|
||||||
BoostString bs3 = string_literals<CharType>::Suffix();
|
BoostString bs3 = string_literals<CharType>::Suffix();
|
||||||
|
@ -30,13 +30,13 @@ 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::movable_and_copyable_int,
|
||||||
test::simple_allocator<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::movable_and_copyable_int,
|
||||||
test::dummy_test_allocator<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<test::movable_and_copyable_int,
|
||||||
std::allocator<test::movable_and_copyable_int> >;
|
std::allocator<test::movable_and_copyable_int> >;
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
@ -90,15 +90,15 @@ int vector_test()
|
|||||||
MyStdVector *stdvector = new MyStdVector;
|
MyStdVector *stdvector = new MyStdVector;
|
||||||
boostvector->resize(100);
|
boostvector->resize(100);
|
||||||
stdvector->resize(100);
|
stdvector->resize(100);
|
||||||
if(!test::CheckEqualContainers(boostvector, stdvector)) return 1;
|
if(!test::CheckEqualContainers(boostvector, stdvector)) return 1;
|
||||||
|
|
||||||
boostvector->resize(200);
|
boostvector->resize(200);
|
||||||
stdvector->resize(200);
|
stdvector->resize(200);
|
||||||
if(!test::CheckEqualContainers(boostvector, stdvector)) return 1;
|
if(!test::CheckEqualContainers(boostvector, stdvector)) return 1;
|
||||||
|
|
||||||
boostvector->resize(0);
|
boostvector->resize(0);
|
||||||
stdvector->resize(0);
|
stdvector->resize(0);
|
||||||
if(!test::CheckEqualContainers(boostvector, stdvector)) return 1;
|
if(!test::CheckEqualContainers(boostvector, stdvector)) return 1;
|
||||||
|
|
||||||
for(int i = 0; i < max; ++i){
|
for(int i = 0; i < max; ++i){
|
||||||
IntType new_int(i);
|
IntType new_int(i);
|
||||||
|
Reference in New Issue
Block a user