Updated copyright and fixed trailing whitespaces

[SVN r79435]
This commit is contained in:
Ion Gaztañaga
2012-07-12 07:21:17 +00:00
parent 30215558ae
commit a74f5d8942
74 changed files with 283 additions and 324 deletions

View File

@ -49,7 +49,7 @@ doxygen autodoc
xml intrusive : intrusive.qbk xml intrusive : intrusive.qbk
: :
<include>../../../tools/auto_index/include <include>../../../tools/auto_index/include
; ;
boostbook standalone boostbook standalone
: :
@ -62,21 +62,21 @@ boostbook standalone
<dependency>autodoc <dependency>autodoc
# 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>$(here)/index.idx <auto-index-script>$(here)/index.idx
# Commands in the script file should all use RELATIVE PATHS # Commands in the script file should all use RELATIVE PATHS

View File

@ -1,5 +1,5 @@
[/ [/
/ Copyright (c) 2006-2011 Ion Gaztanaga / Copyright (c) 2006-2012 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)
@ -8,7 +8,7 @@
[library Boost.Intrusive [library Boost.Intrusive
[quickbook 1.4] [quickbook 1.4]
[authors [Krzikalla, Olaf], [Gaztanaga, Ion]] [authors [Krzikalla, Olaf], [Gaztanaga, Ion]]
[copyright 2005 Olaf Krzikalla, 2006-2011 Ion Gaztanaga] [copyright 2005 Olaf Krzikalla, 2006-2012 Ion Gaztanaga]
[id intrusive] [id intrusive]
[dirname intrusive] [dirname intrusive]
[purpose Intrusive containers] [purpose Intrusive containers]
@ -262,7 +262,7 @@ For [classref boost::intrusive::list list], you can publicly derive from
class list_base_hook; class list_base_hook;
The class can take several options. [*Boost.Intrusive] classes receive arguments in the The class can take several options. [*Boost.Intrusive] classes receive arguments in the
form `option_name<option_value>`. You can specify the following options: form `option_name<option_value>`. You can specify the following options:
* [*`tag<class Tag>`]: this argument serves as a tag, so you can derive from more than one * [*`tag<class Tag>`]: this argument serves as a tag, so you can derive from more than one
[classref boost::intrusive::list_base_hook list_base_hook] and hence put an object in [classref boost::intrusive::list_base_hook list_base_hook] and hence put an object in
@ -323,7 +323,7 @@ and optionally, the user can specify options. We have 3 option types:
container to store an additional member to keep track of the current size of the container to store an additional member to keep track of the current size of the
container. By default, constant-time size is activated. container. By default, constant-time size is activated.
* [*`size_type<bool Enabled>`]: Specifies a type that can hold * [*`size_type<class SizeType>`]: Specifies an unsigned type that can hold
the size of the container. This type will be the type returned by `list.size()` the size of the container. This type will be the type returned by `list.size()`
and the type stored in the intrusive container if `constant_time_size<true>` and the type stored in the intrusive container if `constant_time_size<true>`
is requested. is requested.
@ -340,28 +340,33 @@ the base hook with the default tag:
typedef list<Foo> FooList; typedef list<Foo> FooList;
Example of a intrusive list with non constant-time size that will store Foo objects: Example of an intrusive list with non constant-time size that will store Foo objects:
[c++] [c++]
typedef list<Foo, constant_time_size<false> > FooList; typedef list<Foo, constant_time_size<false> > FooList;
Remember that the user must specify the base hook if the base hook has no default tag Remember that the user must specify the base hook in the container declaration
(e.g: if more than one base hook is used): if the base hook has no default tag, because that usually means that the type
has more than one base hook, and a container shall know which hook will be
using:
[c++] [c++]
#include <boost/intrusive/list.hpp> #include <boost/intrusive/list.hpp>
using namespace boost::intrusive; using namespace boost::intrusive;
struct my_tag;
typedef list_base_hook< tag<my_tag> > BaseHook; struct my_tag1;
class Foo : public BaseHook struct my_tag2;
typedef list_base_hook< tag<my_tag> > BaseHook;
typedef list_base_hook< tag<my_tag2> > BaseHook2;
class Foo : public BaseHook, public BaseHook2
{ /**/ }; { /**/ };
typedef list< Foo, base_hook<BaseHook> > FooList; typedef list< Foo, base_hook<BaseHook> > FooList;
typedef list< Foo, base_hook<BaseHook2> > FooList2;
Once the list is defined, we can use it: Once the list is defined, we can use it:
@ -400,7 +405,7 @@ Example:
class Foo class Foo
{ {
public: public:
list_member_hook<> hook_; list_member_hook<> hook_;
//... //...
}; };
@ -448,7 +453,7 @@ stored object is not bound to or managed by the container:
* When the container gets destroyed before the object, the object is not destroyed, * When the container gets destroyed before the object, the object is not destroyed,
so you have to be careful to avoid resource leaks. so you have to be careful to avoid resource leaks.
* When the object is destroyed before the container, your program is likely to crash, * When the object is destroyed before the container, your program is likely to crash,
because the container contains a pointer to an non-existing object. because the container contains a pointer to an non-existing object.
@ -508,11 +513,11 @@ chapters:
[variablelist Brief Concepts Summary [variablelist Brief Concepts Summary
[[Node Algorithms][A class containing typedefs and static functions that define [[Node Algorithms][A class containing typedefs and static functions that define
basic operations that can be applied to a group of nodes. It's independent basic operations that can be applied to a group of `node`s. It's independent
from the node definition and configured using a NodeTraits template from the node definition and configured using a NodeTraits template
parameter that describes the node.]] parameter that describes the node.]]
[[Node Traits][A class that stores basic information and operations to insert a node into a group of nodes.]] [[Node Traits][A class that stores basic information and operations to insert a node into a group of nodes.]]
[[Hook][A class that a user must add as a base class or as a member to make the user class compatible with intrusive containers.]] [[Hook][A class that a user must add as a base class or as a member to make the user class compatible with intrusive containers. A Hook encapsulates a `node`]]
[[Intrusive Container][A class that stores user classes that have the needed hooks. It takes a ValueTraits template parameter as configuration information.]] [[Intrusive Container][A class that stores user classes that have the needed hooks. It takes a ValueTraits template parameter as configuration information.]]
[[Semi-Intrusive Container][Similar to an intrusive container but a semi-intrusive container needs additional memory (e.g. an auxiliary array) to work.]] [[Semi-Intrusive Container][Similar to an intrusive container but a semi-intrusive container needs additional memory (e.g. an auxiliary array) to work.]]
[[Value Traits][A class containing typedefs and operations to obtain the node to be used by Node Algorithms from the user class and the inverse.]] [[Value Traits][A class containing typedefs and operations to obtain the node to be used by Node Algorithms from the user class and the inverse.]]
@ -543,7 +548,7 @@ chapters:
Many operations have logarithmic time complexity. Many operations have logarithmic time complexity.
* [*splay_set/splay_multiset/splaytree]: `std::set/std::multiset` like intrusive associative * [*splay_set/splay_multiset/splaytree]: `std::set/std::multiset` like intrusive associative
containers based on splay trees. Splay trees have no constant operations, but they containers based on splay trees. Splay trees have no constant operations, but they
have some interesting caching properties. have some interesting caching properties.
The size overhead is moderate for user classes (usually the size of three pointers). The size overhead is moderate for user classes (usually the size of three pointers).
Many operations have logarithmic time complexity. Many operations have logarithmic time complexity.
@ -584,12 +589,12 @@ offers two types of hooks for each container type:
Apart from that, [*Boost.Intrusive] offers additional features: Apart from that, [*Boost.Intrusive] offers additional features:
* [*Safe mode hooks]: Hook constructor initializes the internal data to a well-known * [*Safe mode hooks]: Hook constructor initializes the internal `node` to a well-known
safe state and intrusive containers check that state before inserting a value in the safe state and intrusive containers check that state before inserting a value in the
container. When erasing an element from the container, the container puts the hook container using that hook. When erasing an element from the container, the container
in the safe state again. This allows a safer use mode and it can be used to detect puts the `node` of the hook in the safe state again. This allows a safer use mode and it can
programming errors. It implies a slight performance overhead in some operations be used to detect programming errors. It implies a slight performance overhead in some
and can convert some constant time operations to linear time operations. operations and can convert some constant time operations to linear time operations.
* [*Auto-unlink hooks]: The hook destructor removes the object from the container * [*Auto-unlink hooks]: The hook destructor removes the object from the container
automatically and the user can safely unlink the object from the container without automatically and the user can safely unlink the object from the container without
@ -734,7 +739,7 @@ that have constant-time `size()`, so if you try to define such container with an
auto-unlink hook's value_traits, you will get a static assertion: auto-unlink hook's value_traits, you will get a static assertion:
[c++] [c++]
#include <boost/intrusive/list.hpp> #include <boost/intrusive/list.hpp>
using boost::intrusive; using boost::intrusive;
@ -2169,7 +2174,7 @@ Apart from the container to be cloned, `clone_from` takes two function objects a
template <class Cloner, class Disposer> template <class Cloner, class Disposer>
void clone_from(const list &src, Cloner cloner, Disposer disposer); void clone_from(const list &src, Cloner cloner, Disposer disposer);
This function will make `*this` a clone of `src`. Let's explain the arguments: This function will make `*this` a clone of `src`. Let's explain the arguments:
* The first parameter is the list to be cloned. * The first parameter is the list to be cloned.
@ -2178,7 +2183,7 @@ This function will make `*this` a clone of `src`. Let's explain the arguments:
`pointer operator()(const value_type &)`. `pointer operator()(const value_type &)`.
* The second parameter is a function object that will dispose `value_type` objects. It's used first * The second parameter is a function object that will dispose `value_type` objects. It's used first
to empty the container before cloning and to dispose the elements if an exception is thrown. to empty the container before cloning and to dispose the elements if an exception is thrown.
The cloning function works as follows: The cloning function works as follows:
* First it clears and disposes all the elements from *this using the disposer function object. * First it clears and disposes all the elements from *this using the disposer function object.
@ -2315,11 +2320,11 @@ and [*Boost.Intrusive]:
Not every smart pointer is compatible with [*Boost.Intrusive]: Not every smart pointer is compatible with [*Boost.Intrusive]:
* It must be compatible with C++11 [@http://en.cppreference.com/w/cpp/memory/pointer_traits `std::pointer_traits`] * It must be compatible with C++11 [@http://en.cppreference.com/w/cpp/memory/pointer_traits `std::pointer_traits`]
requirements. [*Boost.Intrusive] uses its own [classref boost::intrusive::pointer_traits pointer_traits] requirements. [*Boost.Intrusive] uses its own [classref boost::intrusive::pointer_traits pointer_traits]
class to implement those features in both C++11 and C++03 compilers. class to implement those features in both C++11 and C++03 compilers.
* It must have the same ownership semantics as a raw pointer. This means that * It must have the same ownership semantics as a raw pointer. This means that
resource management smart pointers (like `boost::shared_ptr`) can't be used. resource management smart pointers (like `boost::shared_ptr`) can't be used.
The conversion from the smart pointer to a raw pointer will be implemented as a recursive call to The conversion from the smart pointer to a raw pointer will be implemented as a recursive call to
`operator->()` until the function returns a raw pointer. `operator->()` until the function returns a raw pointer.
@ -2431,7 +2436,7 @@ before explaining the customization options of [*Boost.Intrusive].
singly linked list is a group of nodes, where each node has a pointer to the singly linked list is a group of nodes, where each node has a pointer to the
next node. [*Node Algorithms] just require a [*NodeTraits] next node. [*Node Algorithms] just require a [*NodeTraits]
template parameter and they can work with any [*NodeTraits] class that fulfills template parameter and they can work with any [*NodeTraits] class that fulfills
the needed interface. As an example, here is a class that implements operations7' the needed interface. As an example, here is a class that implements operations
to manage a group of nodes forming a circular singly linked list: to manage a group of nodes forming a circular singly linked list:
[c++] [c++]
@ -2484,18 +2489,18 @@ before explaining the customization options of [*Boost.Intrusive].
struct node struct node
{ {
node *next_; node *next_;
}; };
typedef node * node_ptr; typedef node * node_ptr;
typedef const node * const_node_ptr; typedef const node * const_node_ptr;
//A function to obtain a pointer to the next node //A function to obtain a pointer to the next node
static node_ptr get_next(const_node_ptr n) static node_ptr get_next(const_node_ptr n)
{ return n->next_; } { return n->next_; }
//A function to set the pointer to the next node //A function to set the pointer to the next node
static void set_next(node_ptr n, node_ptr next) static void set_next(node_ptr n, node_ptr next)
{ n->next_ = next; } { n->next_ = next; }
}; };
@ -2584,7 +2589,7 @@ before explaining the customization options of [*Boost.Intrusive].
that will be inserted in a group of nodes. [*Node Algorithms] just work that will be inserted in a group of nodes. [*Node Algorithms] just work
with nodes and don't know anything about user classes. On the other with nodes and don't know anything about user classes. On the other
hand, an intrusive container needs to know how to obtain a node from a user class, hand, an intrusive container needs to know how to obtain a node from a user class,
and also the inverse operation. and also the inverse operation.
So we can define [*ValueTraits] as the glue between user classes and nodes So we can define [*ValueTraits] as the glue between user classes and nodes
required by [*Node Algorithms]. required by [*Node Algorithms].
Let's see a possible implementation of a value traits class that glues MyClass Let's see a possible implementation of a value traits class that glues MyClass
@ -3111,23 +3116,23 @@ Let's explain each type and function:
* [*['node_ptr]]: A typedef for `node_traits::node_ptr`. * [*['node_ptr]]: A typedef for `node_traits::node_ptr`.
* [*['const_node_ptr]]: A typedef for `node_traits::const_node_ptr`. * [*['const_node_ptr]]: A typedef for `node_traits::const_node_ptr`.
* [*['value_type]]: The type that the user wants to insert in the container. This type can be * [*['value_type]]: The type that the user wants to insert in the container. This type can be
the same as `node_traits::node` but it can be different (for example, `node_traits::node` the same as `node_traits::node` but it can be different (for example, `node_traits::node`
can be a member type of `value_type`). If `value_type` and `node_traits::node` are the can be a member type of `value_type`). If `value_type` and `node_traits::node` are the
same type, the `to_node_ptr` and `to_value_ptr` functions are trivial. same type, the `to_node_ptr` and `to_value_ptr` functions are trivial.
* [*['pointer]]: The type of a pointer to a `value_type`. It must be the same pointer type * [*['pointer]]: The type of a pointer to a `value_type`. It must be the same pointer type
as `node_ptr`: If `node_ptr` is `node*`, `pointer` must be `value_type*`. If as `node_ptr`: If `node_ptr` is `node*`, `pointer` must be `value_type*`. If
`node_ptr` is `smart_ptr<node_traits::node>`, `pointer` must be `smart_ptr<value_type>`. `node_ptr` is `smart_ptr<node_traits::node>`, `pointer` must be `smart_ptr<value_type>`.
This can be generically achieved using `boost::intrusive::pointer_traits` (portable implementation of C++11 This can be generically achieved using `boost::intrusive::pointer_traits` (portable implementation of C++11
`std::pointer_traits`) or `boost::pointer_to_other` utility from [*Boost SmartPointers] `std::pointer_traits`) or `boost::pointer_to_other` utility from [*Boost SmartPointers]
defined in `<boost/pointer_to_other.hpp>`. defined in `<boost/pointer_to_other.hpp>`.
* [*['const_pointer]]: The type of a pointer to a `const value_type`. It must be the same pointer type * [*['const_pointer]]: The type of a pointer to a `const value_type`. It must be the same pointer type
as `node_ptr`: If `node_ptr` is `node*`, `const_pointer` must be `const value_type*`. If as `node_ptr`: If `node_ptr` is `node*`, `const_pointer` must be `const value_type*`. If
`node_ptr` is `smart_ptr<node_traits::node>`, `const_pointer` must be `smart_ptr<const value_type>`. `node_ptr` is `smart_ptr<node_traits::node>`, `const_pointer` must be `smart_ptr<const value_type>`.
* [*['link_mode]]: Indicates that `value_traits` needs some additional work or checks from the * [*['link_mode]]: Indicates that `value_traits` needs some additional work or checks from the
container. The types are enumerations defined in the `link_mode.hpp` header. container. The types are enumerations defined in the `link_mode.hpp` header.
These are the possible types: These are the possible types:
@ -3188,13 +3193,13 @@ intrusive containers, so [*Boost.Intrusive] offers a templatized
that does exactly what we want: that does exactly what we want:
[c++] [c++]
#include <boost/intrusive/trivial_value_traits.hpp> #include <boost/intrusive/trivial_value_traits.hpp>
//Now we can define legacy_value_traits just with a single line //Now we can define legacy_value_traits just with a single line
using namespace boost::intrusive; using namespace boost::intrusive;
typedef trivial_value_traits<legacy_node_traits, normal_link> legacy_value_traits; typedef trivial_value_traits<legacy_node_traits, normal_link> legacy_value_traits;
Now we can just define the containers that will store the legacy abi objects and write Now we can just define the containers that will store the legacy abi objects and write
a little test: a little test:
@ -3373,7 +3378,7 @@ has a couple of downsides:
//Implicitly specify constant-time size and size type //Implicitly specify constant-time size and size type
typedef list<T> List2; typedef list<T> List2;
* Option specifiers lead to long template symbols for classes and functions. Option specifiers themselves * Option specifiers lead to long template symbols for classes and functions. Option specifiers themselves
are verbose and without variadic templates, several default template parameters are assigned for are verbose and without variadic templates, several default template parameters are assigned for
non-specified options. Object and debugging information files can grow and compilation times non-specified options. Object and debugging information files can grow and compilation times

View File

@ -1,6 +1,6 @@
# Boost Intrusive Library Example Jamfile # Boost Intrusive Library Example Jamfile
# (C) Copyright Ion Gaztanaga 2006-2007. # (C) Copyright Ion Gaztanaga 2006-2012.
# 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)

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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
@ -26,7 +26,7 @@ struct simple_node
class base_1{}; class base_1{};
class base_2{}; class base_2{};
struct value_1 : public base_1, public simple_node struct value_1 : public base_1, public simple_node
{ int id_; }; { int id_; };
struct value_2 : public base_1, public base_2, public simple_node struct value_2 : public base_1, public base_2, public simple_node
@ -38,10 +38,10 @@ struct simple_node_traits
typedef simple_node node; typedef simple_node node;
typedef node * node_ptr; typedef node * node_ptr;
typedef const node * const_node_ptr; typedef const node * const_node_ptr;
static node *get_next(const node *n) { return n->next_; } static node *get_next(const node *n) { return n->next_; }
static void set_next(node *n, node *next) { n->next_ = next; } static void set_next(node *n, node *next) { n->next_ = next; }
static node *get_previous(const node *n) { return n->prev_; } static node *get_previous(const node *n) { return n->prev_; }
static void set_previous(node *n, node *prev) { n->prev_ = prev; } static void set_previous(node *n, node *prev) { n->prev_ = prev; }
}; };
//A templatized value traits for value_1 and value_2 //A templatized value traits for value_1 and value_2

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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
@ -26,17 +26,17 @@ struct simple_node_traits
typedef simple_node node; typedef simple_node node;
typedef node * node_ptr; typedef node * node_ptr;
typedef const node * const_node_ptr; typedef const node * const_node_ptr;
static node *get_next(const node *n) { return n->next_; } static node *get_next(const node *n) { return n->next_; }
static void set_next(node *n, node *next) { n->next_ = next; } static void set_next(node *n, node *next) { n->next_ = next; }
static node *get_previous(const node *n) { return n->prev_; } static node *get_previous(const node *n) { return n->prev_; }
static void set_previous(node *n, node *prev) { n->prev_ = prev; } static void set_previous(node *n, node *prev) { n->prev_ = prev; }
}; };
//[doc_advanced_value_traits2_value_traits //[doc_advanced_value_traits2_value_traits
class base_1{}; class base_1{};
class base_2{}; class base_2{};
struct value_1 : public base_1, public simple_node struct value_1 : public base_1, public simple_node
{ {
int id_; int id_;
simple_node node_; simple_node node_;

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2008 // (C) Copyright Ion Gaztanaga 2008-2012
// //
// 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 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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
@ -20,7 +20,7 @@ using namespace boost::intrusive;
struct StrHasher struct StrHasher
{ {
std::size_t operator()(const char *str) const std::size_t operator()(const char *str) const
{ {
std::size_t seed = 0; std::size_t seed = 0;
for(; *str; ++str) boost::hash_combine(seed, *str); for(; *str; ++str) boost::hash_combine(seed, *str);
return seed; return seed;
@ -31,7 +31,7 @@ class Expensive : public set_base_hook<>, public unordered_set_base_hook<>
{ {
std::string key_; std::string key_;
// Other members... // Other members...
public: public:
Expensive(const char *key) Expensive(const char *key)
: key_(key) : key_(key)

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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
@ -55,7 +55,7 @@ int main()
BaseSet baseset; BaseSet baseset;
MemberMultiset membermultiset; MemberMultiset membermultiset;
//Check that size optimization is activated in the base hook //Check that size optimization is activated in the base hook
assert(sizeof(avl_set_base_hook<optimize_size<true> >) == 3*sizeof(void*)); assert(sizeof(avl_set_base_hook<optimize_size<true> >) == 3*sizeof(void*));
//Check that size optimization is deactivated in the member hook //Check that size optimization is deactivated in the member hook

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2007-2009 // (C) Copyright Ion Gaztanaga 2007-2012
// //
// 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
@ -32,13 +32,13 @@ struct my_avltree_node_traits
typedef const my_node * const_node_ptr; typedef const my_node * const_node_ptr;
typedef int balance; typedef int balance;
static node_ptr get_parent(const_node_ptr n) { return n->parent_; } static node_ptr get_parent(const_node_ptr n) { return n->parent_; }
static void set_parent(node_ptr n, node_ptr parent){ n->parent_ = parent; } static void set_parent(node_ptr n, node_ptr parent){ n->parent_ = parent; }
static node_ptr get_left(const_node_ptr n) { return n->left_; } static node_ptr get_left(const_node_ptr n) { return n->left_; }
static void set_left(node_ptr n, node_ptr left) { n->left_ = left; } static void set_left(node_ptr n, node_ptr left) { n->left_ = left; }
static node_ptr get_right(const_node_ptr n) { return n->right_; } static node_ptr get_right(const_node_ptr n) { return n->right_; }
static void set_right(node_ptr n, node_ptr right) { n->right_ = right; } static void set_right(node_ptr n, node_ptr right) { n->right_ = right; }
static balance get_balance(const_node_ptr n) { return n->balance_; } static balance get_balance(const_node_ptr n) { return n->balance_; }
static void set_balance(node_ptr n, balance b) { n->balance_ = b; } static void set_balance(node_ptr n, balance b) { n->balance_ = b; }
static balance negative() { return -1; } static balance negative() { return -1; }
static balance zero() { return 0; } static balance zero() { return 0; }
@ -72,7 +72,7 @@ int main()
//Now go to the next node //Now go to the next node
n = algo::next_node(n); n = algo::next_node(n);
assert(n == &three); assert(n == &three);
//Erase a node just using a pointer to it //Erase a node just using a pointer to it
algo::unlink(&two); algo::unlink(&two);

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2007-2009 // (C) Copyright Ion Gaztanaga 2007-2012
// //
// 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 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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
@ -45,7 +45,7 @@ void clear_list ()
{ {
// entity's destructor removes itself from the global list implicitly // entity's destructor removes itself from the global list implicitly
while (!global_list.empty()) while (!global_list.empty())
delete &global_list.front(); delete &global_list.front();
} }
int main() int main()

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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 2007-2009 // (C) Copyright Ion Gaztanaga 2007-2012
// //
// 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 2010-2010 // (C) Copyright Ion Gaztanaga 2010-2012
// //
// 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 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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
@ -25,10 +25,10 @@ struct my_list_node_traits
typedef my_node node; typedef my_node node;
typedef my_node * node_ptr; typedef my_node * node_ptr;
typedef const my_node * const_node_ptr; typedef const my_node * const_node_ptr;
static node_ptr get_next(const_node_ptr n) { return n->next_; } static node_ptr get_next(const_node_ptr n) { return n->next_; }
static void set_next(node_ptr n, node_ptr next) { n->next_ = next; } static void set_next(node_ptr n, node_ptr next) { n->next_ = next; }
static node *get_previous(const_node_ptr n) { return n->prev_; } static node *get_previous(const_node_ptr n) { return n->prev_; }
static void set_previous(node_ptr n, node_ptr prev){ n->prev_ = prev; } static void set_previous(node_ptr n, node_ptr prev){ n->prev_ = prev; }
}; };
int main() int main()

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2006-2011 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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 2009-2009 // (C) Copyright Ion Gaztanaga 2009-2012
// //
// 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 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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
@ -31,13 +31,13 @@ struct my_rbtree_node_traits
typedef my_node * node_ptr; typedef my_node * node_ptr;
typedef const my_node * const_node_ptr; typedef const my_node * const_node_ptr;
typedef int color; typedef int color;
static node_ptr get_parent(const_node_ptr n) { return n->parent_; } static node_ptr get_parent(const_node_ptr n) { return n->parent_; }
static void set_parent(node_ptr n, node_ptr parent){ n->parent_ = parent; } static void set_parent(node_ptr n, node_ptr parent){ n->parent_ = parent; }
static node_ptr get_left(const_node_ptr n) { return n->left_; } static node_ptr get_left(const_node_ptr n) { return n->left_; }
static void set_left(node_ptr n, node_ptr left) { n->left_ = left; } static void set_left(node_ptr n, node_ptr left) { n->left_ = left; }
static node_ptr get_right(const_node_ptr n) { return n->right_; } static node_ptr get_right(const_node_ptr n) { return n->right_; }
static void set_right(node_ptr n, node_ptr right) { n->right_ = right; } static void set_right(node_ptr n, node_ptr right) { n->right_ = right; }
static color get_color(const_node_ptr n) { return n->color_; } static color get_color(const_node_ptr n) { return n->color_; }
static void set_color(node_ptr n, color c) { n->color_ = c; } static void set_color(node_ptr n, color c) { n->color_ = c; }
static color black() { return color(0); } static color black() { return color(0); }
static color red() { return color(1); } static color red() { return color(1); }
@ -70,7 +70,7 @@ int main()
//Now go to the next node //Now go to the next node
n = algo::next_node(n); n = algo::next_node(n);
assert(n == &three); assert(n == &three);
//Erase a node just using a pointer to it //Erase a node just using a pointer to it
algo::unlink(&two); algo::unlink(&two);

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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 2010-2010 // (C) Copyright Ion Gaztanaga 2010-2012
// //
// 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 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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
@ -55,7 +55,7 @@ int main()
BaseSet baseset; BaseSet baseset;
MemberMultiset membermultiset; MemberMultiset membermultiset;
//Check that size optimization is activated in the base hook //Check that size optimization is activated in the base hook
assert(sizeof(set_base_hook<optimize_size<true> >) == 3*sizeof(void*)); assert(sizeof(set_base_hook<optimize_size<true> >) == 3*sizeof(void*));
//Check that size optimization is deactivated in the member hook //Check that size optimization is deactivated in the member hook

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2007-2009 // (C) Copyright Ion Gaztanaga 2007-2012
// //
// 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
@ -56,7 +56,7 @@ int main()
BaseSet baseset; BaseSet baseset;
MemberMultiset membermultiset; MemberMultiset membermultiset;
//Now insert them in the reverse order in the base hook sg_set //Now insert them in the reverse order in the base hook sg_set
for(VectIt it(values.begin()), itend(values.end()); it != itend; ++it){ for(VectIt it(values.begin()), itend(values.end()); it != itend; ++it){
baseset.insert(*it); baseset.insert(*it);

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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
@ -25,8 +25,8 @@ struct my_slist_node_traits
typedef my_node node; typedef my_node node;
typedef my_node * node_ptr; typedef my_node * node_ptr;
typedef const my_node * const_node_ptr; typedef const my_node * const_node_ptr;
static node_ptr get_next(const_node_ptr n) { return n->next_; } static node_ptr get_next(const_node_ptr n) { return n->next_; }
static void set_next(node_ptr n, node_ptr next) { n->next_ = next; } static void set_next(node_ptr n, node_ptr next) { n->next_ = next; }
}; };
int main() int main()

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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
@ -31,12 +31,12 @@ struct my_splaytree_node_traits
typedef my_node * node_ptr; typedef my_node * node_ptr;
typedef const my_node * const_node_ptr; typedef const my_node * const_node_ptr;
static node_ptr get_parent(const_node_ptr n) { return n->parent_; } static node_ptr get_parent(const_node_ptr n) { return n->parent_; }
static void set_parent(node_ptr n, node_ptr parent){ n->parent_ = parent; } static void set_parent(node_ptr n, node_ptr parent){ n->parent_ = parent; }
static node_ptr get_left(const_node_ptr n) { return n->left_; } static node_ptr get_left(const_node_ptr n) { return n->left_; }
static void set_left(node_ptr n, node_ptr left) { n->left_ = left; } static void set_left(node_ptr n, node_ptr left) { n->left_ = left; }
static node_ptr get_right(const_node_ptr n) { return n->right_; } static node_ptr get_right(const_node_ptr n) { return n->right_; }
static void set_right(node_ptr n, node_ptr right) { n->right_ = right; } static void set_right(node_ptr n, node_ptr right) { n->right_ = right; }
}; };
struct node_ptr_compare struct node_ptr_compare
@ -66,7 +66,7 @@ int main()
//Now go to the next node //Now go to the next node
n = algo::next_node(n); n = algo::next_node(n);
assert(n == &three); assert(n == &three);
//Erase a node just using a pointer to it //Erase a node just using a pointer to it
algo::unlink(&two); algo::unlink(&two);

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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
@ -20,7 +20,7 @@ using namespace boost::intrusive;
class MyClass class MyClass
: public splay_set_base_hook<> //This is an splay tree base hook : public splay_set_base_hook<> //This is an splay tree base hook
, public bs_set_base_hook<> //This is a binary search tree base hook , public bs_set_base_hook<> //This is a binary search tree base hook
{ {
int int_; int int_;

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2007-2009 // (C) Copyright Ion Gaztanaga 2007-2012
// //
// 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
@ -30,12 +30,12 @@ struct my_splaytree_node_traits
typedef my_node * node_ptr; typedef my_node * node_ptr;
typedef const my_node * const_node_ptr; typedef const my_node * const_node_ptr;
static node_ptr get_parent(const_node_ptr n) { return n->parent_; } static node_ptr get_parent(const_node_ptr n) { return n->parent_; }
static void set_parent(node_ptr n, node_ptr parent){ n->parent_ = parent; } static void set_parent(node_ptr n, node_ptr parent){ n->parent_ = parent; }
static node_ptr get_left(const_node_ptr n) { return n->left_; } static node_ptr get_left(const_node_ptr n) { return n->left_; }
static void set_left(node_ptr n, node_ptr left) { n->left_ = left; } static void set_left(node_ptr n, node_ptr left) { n->left_ = left; }
static node_ptr get_right(const_node_ptr n) { return n->right_; } static node_ptr get_right(const_node_ptr n) { return n->right_; }
static void set_right(node_ptr n, node_ptr right) { n->right_ = right; } static void set_right(node_ptr n, node_ptr right) { n->right_ = right; }
}; };
struct node_ptr_compare struct node_ptr_compare
@ -65,7 +65,7 @@ int main()
//Now go to the next node //Now go to the next node
n = algo::next_node(n); n = algo::next_node(n);
assert(n == &three); assert(n == &three);
//Erase a node just using a pointer to it //Erase a node just using a pointer to it
algo::unlink(&two); algo::unlink(&two);

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2007-2009 // (C) Copyright Ion Gaztanaga 2007-2012
// //
// 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 2007-2009 // (C) Copyright Ion Gaztanaga 2007-2012
// //
// 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
@ -31,12 +31,12 @@ struct my_treap_node_traits
typedef my_node * node_ptr; typedef my_node * node_ptr;
typedef const my_node * const_node_ptr; typedef const my_node * const_node_ptr;
static node_ptr get_parent(const_node_ptr n) { return n->parent_; } static node_ptr get_parent(const_node_ptr n) { return n->parent_; }
static void set_parent(node_ptr n, node_ptr parent){ n->parent_ = parent; } static void set_parent(node_ptr n, node_ptr parent){ n->parent_ = parent; }
static node_ptr get_left(const_node_ptr n) { return n->left_; } static node_ptr get_left(const_node_ptr n) { return n->left_; }
static void set_left(node_ptr n, node_ptr left) { n->left_ = left; } static void set_left(node_ptr n, node_ptr left) { n->left_ = left; }
static node_ptr get_right(const_node_ptr n) { return n->right_; } static node_ptr get_right(const_node_ptr n) { return n->right_; }
static void set_right(node_ptr n, node_ptr right) { n->right_ = right; } static void set_right(node_ptr n, node_ptr right) { n->right_ = right; }
}; };
struct node_ptr_compare struct node_ptr_compare
@ -66,7 +66,7 @@ int main()
//Now go to the next node //Now go to the next node
n = algo::next_node(n); n = algo::next_node(n);
assert(n == &three); assert(n == &three);
//Erase a node just using a pointer to it //Erase a node just using a pointer to it
algo::unlink(&two, node_ptr_priority()); algo::unlink(&two, node_ptr_priority());

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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
@ -70,7 +70,7 @@ int main()
BaseSet baseset; BaseSet baseset;
MemberMultiset membermultiset; MemberMultiset membermultiset;
//Now insert them in the sets //Now insert them in the sets
for(VectIt it(values.begin()), itend(values.end()); it != itend; ++it){ for(VectIt it(values.begin()), itend(values.end()); it != itend; ++it){
baseset.insert(*it); baseset.insert(*it);

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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
@ -39,10 +39,10 @@ struct legacy_node_traits
typedef legacy_value * node_ptr; typedef legacy_value * node_ptr;
typedef const legacy_value * const_node_ptr; typedef const legacy_value * const_node_ptr;
static node *get_next(const node *n) { return n->next_; } static node *get_next(const node *n) { return n->next_; }
static void set_next(node *n, node *next) { n->next_ = next; } static void set_next(node *n, node *next) { n->next_ = next; }
static node *get_previous(const node *n) { return n->prev_; } static node *get_previous(const node *n) { return n->prev_; }
static void set_previous(node *n, node *prev) { n->prev_ = prev; } static void set_previous(node *n, node *prev) { n->prev_ = prev; }
}; };
//This ValueTraits will configure list and slist. In this case, //This ValueTraits will configure list and slist. In this case,

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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 @@
# Boost Intrusive Library Performance test Jamfile # Boost Intrusive Library Performance test Jamfile
# (C) Copyright Ion Gaztanaga 2006-2007. # (C) Copyright Ion Gaztanaga 2006-2012.
# 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)

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2007-2009 // (C) Copyright Ion Gaztanaga 2007-2012
// //
// 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 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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
@ -18,6 +18,8 @@
-> Take all pointers by const reference to optimize shared memory pointers -> Take all pointers by const reference to optimize shared memory pointers
-> Return pointers by const reference if node traits return them by const reference to optimize shared memory pointers -> Return pointers by const reference if node traits return them by const reference to optimize shared memory pointers
-> Detect call signatures by has_member_function_callable_with instead of exact match to allow taking by const reference -> Detect call signatures by has_member_function_callable_with instead of exact match to allow taking by const reference
-> Optimize operations taking const_node_pointer using template parameters and SFINAE to allow node_ptr
The article explains it quite well: Linear Hashing The cost of hash table expansion is spread out across each hash table insertion operation, as opposed to being incurred all at once. Linear hashing is therefore well suited for interactive applications. The article explains it quite well: Linear Hashing The cost of hash table expansion is spread out across each hash table insertion operation, as opposed to being incurred all at once. Linear hashing is therefore well suited for interactive applications.

View File

@ -1,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Olaf Krzikalla 2004-2006. // (C) Copyright Olaf Krzikalla 2004-2006.
// (C) Copyright Ion Gaztanaga 2006-2009. // (C) Copyright Ion Gaztanaga 2006-2012.
// //
// 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,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Olaf Krzikalla 2004-2006. // (C) Copyright Olaf Krzikalla 2004-2006.
// (C) Copyright Ion Gaztanaga 2006-2009. // (C) Copyright Ion Gaztanaga 2006-2012.
// //
// 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,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Olaf Krzikalla 2004-2006. // (C) Copyright Olaf Krzikalla 2004-2006.
// (C) Copyright Ion Gaztanaga 2006-2009. // (C) Copyright Ion Gaztanaga 2006-2012.
// //
// 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 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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 2007-2009 // (C) Copyright Ion Gaztanaga 2007-2012
// //
// 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 2007-2009 // (C) Copyright Ion Gaztanaga 2007-2012
// //
// 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 2007-2009 // (C) Copyright Ion Gaztanaga 2007-2012
// //
// 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 2010-2010 // (C) Copyright Ion Gaztanaga 2010-2012
// //
// 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,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Olaf Krzikalla 2004-2006. // (C) Copyright Olaf Krzikalla 2004-2006.
// (C) Copyright Ion Gaztanaga 2006-2009. // (C) Copyright Ion Gaztanaga 2006-2012.
// //
// 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
@ -134,7 +134,7 @@ void test_generic_assoc<ValueTraits, ContainerDefiner>::test_insert_erase_burst(
typedef typename std::vector<value_type>::const_iterator cvec_iterator; typedef typename std::vector<value_type>::const_iterator cvec_iterator;
//Random erasure //Random erasure
std::vector<cvec_iterator> it_vector; std::vector<cvec_iterator> it_vector;
for(cvec_iterator it(values.begin()), itend(values.end()) for(cvec_iterator it(values.begin()), itend(values.end())
; it != itend ; it != itend
; ++it){ ; ++it){
@ -396,7 +396,7 @@ void test_generic_assoc<ValueTraits, ContainerDefiner>::test_insert_before
{ {
assoc_type testset; assoc_type testset;
typedef typename std::vector<value_type>::iterator vec_iterator; typedef typename std::vector<value_type>::iterator vec_iterator;
for(vec_iterator it(--values.end()); true; --it){ for(vec_iterator it(--values.end()); true; --it){
testset.push_front(*it); testset.push_front(*it);
if(it == values.begin()){ if(it == values.begin()){

View File

@ -1,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Olaf Krzikalla 2004-2006. // (C) Copyright Olaf Krzikalla 2004-2006.
// (C) Copyright Ion Gaztanaga 2006-2009. // (C) Copyright Ion Gaztanaga 2006-2012.
// //
// 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
@ -92,7 +92,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_impl()
testset.erase (testset.iterator_to (values[0])); testset.erase (testset.iterator_to (values[0]));
testset.erase (testset.iterator_to (values[1])); testset.erase (testset.iterator_to (values[1]));
testset.insert (values[1]); testset.insert (values[1]);
testset.erase (testset.iterator_to (values[2])); testset.erase (testset.iterator_to (values[2]));
testset.erase (testset.iterator_to (values[3])); testset.erase (testset.iterator_to (values[3]));
} }
@ -127,8 +127,8 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_sort(std::vector
BOOST_TEST (testset2.begin()->value_ == 2); BOOST_TEST (testset2.begin()->value_ == 2);
BOOST_TEST (testset2.rbegin()->value_ == 5); BOOST_TEST (testset2.rbegin()->value_ == 5);
} }
//test: insert, const_iterator, const_reverse_iterator, erase, iterator_to: //test: insert, const_iterator, const_reverse_iterator, erase, iterator_to:
template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner> template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner>
void test_generic_multiset<ValueTraits, ContainerDefiner>::test_insert(std::vector<typename ValueTraits::value_type>& values) void test_generic_multiset<ValueTraits, ContainerDefiner>::test_insert(std::vector<typename ValueTraits::value_type>& values)
@ -165,7 +165,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_insert(std::vect
{ int init_values [] = { 1, 3, 5 }; { int init_values [] = { 1, 3, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testset.begin() ); } TEST_INTRUSIVE_SEQUENCE( init_values, testset.begin() ); }
} }
//test: insert (seq-version), swap, erase (seq-version), size: //test: insert (seq-version), swap, erase (seq-version), size:
template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner> template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner>
@ -191,7 +191,7 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_swap(std::vector
testset1.erase (testset1.iterator_to(values[5]), testset1.end()); testset1.erase (testset1.iterator_to(values[5]), testset1.end());
BOOST_TEST (testset1.size() == 1); BOOST_TEST (testset1.size() == 1);
BOOST_TEST (&*testset1.begin() == &values[3]); BOOST_TEST (&*testset1.begin() == &values[3]);
} }
//test: find, equal_range (lower_bound, upper_bound): //test: find, equal_range (lower_bound, upper_bound):
template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner> template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner>
@ -207,19 +207,21 @@ void test_generic_multiset<ValueTraits, ContainerDefiner>::test_find(std::vector
multiset_type testset (values.begin(), values.end()); multiset_type testset (values.begin(), values.end());
typedef typename multiset_type::iterator iterator; typedef typename multiset_type::iterator iterator;
value_type cmp_val; {
cmp_val.value_ = 2; value_type cmp_val;
iterator i = testset.find (cmp_val); cmp_val.value_ = 2;
BOOST_TEST (i->value_ == 2); iterator i = testset.find (cmp_val);
BOOST_TEST ((++i)->value_ == 2); BOOST_TEST (i->value_ == 2);
std::pair<iterator,iterator> range = testset.equal_range (cmp_val); BOOST_TEST ((++i)->value_ == 2);
std::pair<iterator,iterator> range = testset.equal_range (cmp_val);
BOOST_TEST (range.first->value_ == 2);
BOOST_TEST (range.second->value_ == 3);
BOOST_TEST (std::distance (range.first, range.second) == 2);
cmp_val.value_ = 7; BOOST_TEST (range.first->value_ == 2);
BOOST_TEST (testset.find (cmp_val) == testset.end()); BOOST_TEST (range.second->value_ == 3);
BOOST_TEST (std::distance (range.first, range.second) == 2);
cmp_val.value_ = 7;
BOOST_TEST (testset.find (cmp_val) == testset.end());
}
} }
}}} //namespace boost::intrusive::test }}} //namespace boost::intrusive::test

View File

@ -1,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Olaf Krzikalla 2004-2006. // (C) Copyright Olaf Krzikalla 2004-2006.
// (C) Copyright Ion Gaztanaga 2006-2009. // (C) Copyright Ion Gaztanaga 2006-2012.
// //
// 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
@ -103,7 +103,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_impl()
testset.erase (testset.iterator_to (values[0])); testset.erase (testset.iterator_to (values[0]));
testset.erase (testset.iterator_to (values[1])); testset.erase (testset.iterator_to (values[1]));
testset.insert (values[1]); testset.insert (values[1]);
testset.erase (testset.iterator_to (values[2])); testset.erase (testset.iterator_to (values[2]));
testset.erase (testset.iterator_to (values[3])); testset.erase (testset.iterator_to (values[3]));
} }
@ -137,8 +137,8 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_sort(std::vector<type
TEST_INTRUSIVE_SEQUENCE( init_values, testset2.rbegin() ); } TEST_INTRUSIVE_SEQUENCE( init_values, testset2.rbegin() ); }
BOOST_TEST (testset2.begin()->value_ == 2); BOOST_TEST (testset2.begin()->value_ == 2);
BOOST_TEST (testset2.rbegin()->value_ == 5); BOOST_TEST (testset2.rbegin()->value_ == 5);
} }
//test: insert, const_iterator, const_reverse_iterator, erase, s_iterator_to: //test: insert, const_iterator, const_reverse_iterator, erase, s_iterator_to:
template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner> template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner>
void test_generic_set<ValueTraits, ContainerDefiner>::test_insert(std::vector<typename ValueTraits::value_type>& values) void test_generic_set<ValueTraits, ContainerDefiner>::test_insert(std::vector<typename ValueTraits::value_type>& values)
@ -263,7 +263,7 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_swap(std::vector<type
BOOST_TEST (testset1.size() == 1); BOOST_TEST (testset1.size() == 1);
// BOOST_TEST (&testset1.front() == &values[3]); // BOOST_TEST (&testset1.front() == &values[3]);
BOOST_TEST (&*testset1.begin() == &values[3]); BOOST_TEST (&*testset1.begin() == &values[3]);
} }
//test: find, equal_range (lower_bound, upper_bound): //test: find, equal_range (lower_bound, upper_bound):
template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner> template<class ValueTraits, template <class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none, class = ::boost::intrusive::none> class ContainerDefiner>
@ -278,19 +278,21 @@ void test_generic_set<ValueTraits, ContainerDefiner>::test_find(std::vector<type
set_type testset (values.begin(), values.end()); set_type testset (values.begin(), values.end());
typedef typename set_type::iterator iterator; typedef typename set_type::iterator iterator;
value_type cmp_val; {
cmp_val.value_ = 2; value_type cmp_val;
iterator i = testset.find (cmp_val); cmp_val.value_ = 2;
BOOST_TEST (i->value_ == 2); iterator i = testset.find (cmp_val);
BOOST_TEST ((++i)->value_ != 2); BOOST_TEST (i->value_ == 2);
std::pair<iterator,iterator> range = testset.equal_range (cmp_val); BOOST_TEST ((++i)->value_ != 2);
std::pair<iterator,iterator> range = testset.equal_range (cmp_val);
BOOST_TEST (range.first->value_ == 2);
BOOST_TEST (range.second->value_ == 3);
BOOST_TEST (std::distance (range.first, range.second) == 1);
cmp_val.value_ = 7; BOOST_TEST (range.first->value_ == 2);
BOOST_TEST (testset.find (cmp_val) == testset.end()); BOOST_TEST (range.second->value_ == 3);
BOOST_TEST (std::distance (range.first, range.second) == 1);
cmp_val.value_ = 7;
BOOST_TEST (testset.find (cmp_val) == testset.end());
}
} }
}}} //namespace boost::intrusive::test }}} //namespace boost::intrusive::test

View File

@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2011-2011. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2011-2012. 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,14 +31,14 @@ struct private_type
private_type const &operator,(int) const; private_type const &operator,(int) const;
}; };
typedef char yes_type; typedef char yes_type;
struct no_type{ char dummy[2]; }; struct no_type{ char dummy[2]; };
template<typename T> template<typename T>
no_type is_private_type(T const &); no_type is_private_type(T const &);
yes_type is_private_type(private_type const &); yes_type is_private_type(private_type const &);
}}}} }}}}
namespace boost{ namespace boost{
@ -123,7 +123,7 @@ class has_member_function_named_func
template <class U> template <class U>
static has_member_function_callable_with::no_type Test(...); static has_member_function_callable_with::no_type Test(...);
static const bool value static const bool value
= sizeof(Test< Fun >(0)) == sizeof(has_member_function_callable_with::yes_type); = sizeof(Test< Fun >(0)) == sizeof(has_member_function_callable_with::yes_type);
}; };
@ -186,7 +186,7 @@ class has_member_function_named_func
); );
}; };
}}} }}}
namespace boost{ namespace boost{
namespace intrusive{ namespace intrusive{
@ -216,7 +216,7 @@ class has_member_function_named_func
) )
); );
}; };
}}} }}}
namespace boost{ namespace boost{
namespace intrusive{ namespace intrusive{
@ -308,7 +308,7 @@ class has_member_function_named_func
template <class U> template <class U>
static has_member_function_callable_with::no_type Test(...); static has_member_function_callable_with::no_type Test(...);
static const bool value = sizeof(Test< Fun >(0)) static const bool value = sizeof(Test< Fun >(0))
== sizeof(has_member_function_callable_with::yes_type); == sizeof(has_member_function_callable_with::yes_type);
}; };
@ -460,7 +460,7 @@ int main()
(void)check5; (void)check5;
(void)check6; (void)check6;
(void)check7; (void)check7;
} }
return 0; return 0;

View File

@ -1,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Olaf Krzikalla 2004-2006. // (C) Copyright Olaf Krzikalla 2004-2006.
// (C) Copyright Ion Gaztanaga 2006-2009. // (C) Copyright Ion Gaztanaga 2006-2012.
// //
// 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
@ -141,7 +141,7 @@ struct even_odd
return v1.value_ < v2.value_; return v1.value_ < v2.value_;
else else
return v2.value_ & 1; return v2.value_ & 1;
} }
}; };
struct is_even struct is_even
@ -149,7 +149,7 @@ struct is_even
template<class Hooks, bool constant_time_size> template<class Hooks, bool constant_time_size>
bool operator() bool operator()
(const testvalue<Hooks, constant_time_size>& v1) const (const testvalue<Hooks, constant_time_size>& v1) const
{ return (v1.value_ & 1) == 0; } { return (v1.value_ & 1) == 0; }
}; };
/* /*
struct int_testvalue_comp struct int_testvalue_comp

View File

@ -1,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Olaf Krzikalla 2004-2006. // (C) Copyright Olaf Krzikalla 2004-2006.
// (C) Copyright Ion Gaztanaga 2006-2009. // (C) Copyright Ion Gaztanaga 2006-2012.
// //
// 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
@ -114,7 +114,7 @@ void test_list<ValueTraits>
testlist.pop_front(); testlist.pop_front();
BOOST_TEST (testlist.empty()); BOOST_TEST (testlist.empty());
} }
//test: constructor, iterator, reverse_iterator, sort, reverse: //test: constructor, iterator, reverse_iterator, sort, reverse:
@ -196,7 +196,7 @@ void test_list<ValueTraits>
int init_values [] = { 1, 3, 4, 5 }; int init_values [] = { 1, 3, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testlist1.begin() ); TEST_INTRUSIVE_SEQUENCE( init_values, testlist1.begin() );
} }
//test: assign, insert, const_iterator, const_reverse_iterator, erase, s_iterator_to: //test: assign, insert, const_iterator, const_reverse_iterator, erase, s_iterator_to:
template<class ValueTraits> template<class ValueTraits>
void test_list<ValueTraits> void test_list<ValueTraits>

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2007-2009 // (C) Copyright Ion Gaztanaga 2007-2012
// //
// 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,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Olaf Krzikalla 2004-2006. // (C) Copyright Olaf Krzikalla 2004-2006.
// (C) Copyright Ion Gaztanaga 2006-2009. // (C) Copyright Ion Gaztanaga 2006-2012.
// //
// 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 2011-2011. Distributed under the Boost // (C) Copyright Ion Gaztanaga 2011-2012. 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 2007-2010 // (C) Copyright Ion Gaztanaga 2007-2012
// //
// 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
@ -49,7 +49,7 @@ void instantiate()
list< Foo, base_hook<ListBaseHook> > list_; list_.clear(); list< Foo, base_hook<ListBaseHook> > list_; list_.clear();
slist< Foo, base_hook<SListBaseHook> > slist_; slist_.clear(); slist< Foo, base_hook<SListBaseHook> > slist_; slist_.clear();
set< Foo, base_hook<SetBaseHook> > set_; set_.clear(); set< Foo, base_hook<SetBaseHook> > set_; set_.clear();
USet::bucket_type buckets[1]; USet::bucket_type buckets[1];
USet unordered_set_(USet::bucket_traits(buckets, 1)); unordered_set_.clear(); USet unordered_set_(USet::bucket_traits(buckets, 1)); unordered_set_.clear();
} }

View File

@ -1,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Olaf Krzikalla 2004-2006. // (C) Copyright Olaf Krzikalla 2004-2006.
// (C) Copyright Ion Gaztanaga 2006-2009. // (C) Copyright Ion Gaztanaga 2006-2012.
// //
// 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,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Olaf Krzikalla 2004-2006. // (C) Copyright Olaf Krzikalla 2004-2006.
// (C) Copyright Ion Gaztanaga 2006-2009. // (C) Copyright Ion Gaztanaga 2006-2012.
// //
// 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 2007. // (C) Copyright Ion Gaztanaga 2007-2012
// //
// 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,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Olaf Krzikalla 2004-2006. // (C) Copyright Olaf Krzikalla 2004-2006.
// (C) Copyright Ion Gaztanaga 2006-2009. // (C) Copyright Ion Gaztanaga 2006-2012.
// //
// 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
@ -106,7 +106,7 @@ void test_slist<ValueTraits, Linear, CacheLast>
> list_type; > list_type;
list_type testlist; list_type testlist;
BOOST_TEST (testlist.empty()); BOOST_TEST (testlist.empty());
testlist.push_front (values[0]); testlist.push_front (values[0]);
BOOST_TEST (testlist.size() == 1); BOOST_TEST (testlist.size() == 1);
BOOST_TEST (&testlist.front() == &values[0]); BOOST_TEST (&testlist.front() == &values[0]);
@ -114,11 +114,11 @@ void test_slist<ValueTraits, Linear, CacheLast>
testlist.push_front (values[1]); testlist.push_front (values[1]);
BOOST_TEST (testlist.size() == 2); BOOST_TEST (testlist.size() == 2);
BOOST_TEST (&testlist.front() == &values[1]); BOOST_TEST (&testlist.front() == &values[1]);
testlist.pop_front(); testlist.pop_front();
BOOST_TEST (testlist.size() == 1); BOOST_TEST (testlist.size() == 1);
BOOST_TEST (&testlist.front() == &values[0]); BOOST_TEST (&testlist.front() == &values[0]);
testlist.pop_front(); testlist.pop_front();
BOOST_TEST (testlist.empty()); BOOST_TEST (testlist.empty());
} }
@ -241,8 +241,8 @@ void test_slist<ValueTraits, Linear, CacheLast>
testlist.reverse(); testlist.reverse();
{ int init_values [] = { 5, 3, 1, 4, 2 }; { int init_values [] = { 5, 3, 1, 4, 2 };
TEST_INTRUSIVE_SEQUENCE( init_values, testlist.begin() ); } TEST_INTRUSIVE_SEQUENCE( init_values, testlist.begin() ); }
} }
//test: assign, insert_after, const_iterator, erase_after, s_iterator_to, previous: //test: assign, insert_after, const_iterator, erase_after, s_iterator_to, previous:
template<class ValueTraits, bool Linear, bool CacheLast> template<class ValueTraits, bool Linear, bool CacheLast>
void test_slist<ValueTraits, Linear, CacheLast> void test_slist<ValueTraits, Linear, CacheLast>
@ -374,7 +374,7 @@ void test_slist<ValueTraits, Linear, CacheLast>
testlist.clear(); testlist.clear();
} }
} }
} }
//test: insert_after (seq-version), swap, splice_after: //test: insert_after (seq-version), swap, splice_after:
template<class ValueTraits, bool Linear, bool CacheLast> template<class ValueTraits, bool Linear, bool CacheLast>
@ -476,7 +476,7 @@ void test_slist<ValueTraits, Linear, CacheLast>
{ int init_values [] = { 1 }; { int init_values [] = { 1 };
TEST_INTRUSIVE_SEQUENCE( init_values, testlist1.begin() ); } TEST_INTRUSIVE_SEQUENCE( init_values, testlist1.begin() ); }
} }
} }
template<class ValueTraits, bool Linear, bool CacheLast> template<class ValueTraits, bool Linear, bool CacheLast>
void test_slist<ValueTraits, Linear, CacheLast> void test_slist<ValueTraits, Linear, CacheLast>

View File

@ -113,18 +113,6 @@ class smart_ptr
: m_ptr(0) : m_ptr(0)
{} {}
/*
//!Constructor from raw pointer (allows "0" pointer conversion). Never throws.
explicit smart_ptr(pointer ptr = 0)
: m_ptr(ptr)
{}
//!Constructor from other pointer. Never throws.
template <class T>
smart_ptr(T *ptr)
: m_ptr(ptr)
{}
*/
//!Constructor from other smart_ptr //!Constructor from other smart_ptr
smart_ptr(const smart_ptr& ptr) smart_ptr(const smart_ptr& ptr)
: m_ptr(ptr.m_ptr) : m_ptr(ptr.m_ptr)
@ -139,52 +127,20 @@ class smart_ptr
smart_ptr(const smart_ptr<T2> &ptr) smart_ptr(const smart_ptr<T2> &ptr)
: m_ptr(ptr.m_ptr) : m_ptr(ptr.m_ptr)
{} {}
/*
//!Emulates static_cast operator. Never throws.
template<class Y>
smart_ptr(const smart_ptr<Y> & r, detail::static_cast_tag)
: m_ptr(static_cast<PointedType*>(r.m_ptr))
{}
//!Emulates const_cast operator. Never throws.
template<class Y>
smart_ptr(const smart_ptr<Y> & r, detail::const_cast_tag)
: m_ptr(const_cast<PointedType*>(r.m_ptr))
{}
//!Emulates dynamic_cast operator. Never throws.
template<class Y>
smart_ptr(const smart_ptr<Y> & r, detail::dynamic_cast_tag)
: m_ptr(dynamic_cast<PointedType*>(r.m_ptr))
{}
//!Emulates reinterpret_cast operator. Never throws.
template<class Y>
smart_ptr(const smart_ptr<Y> & r, detail::reinterpret_cast_tag)
: m_ptr(reinterpret_cast<PointedType*>(r.m_ptr))
{}
//!Obtains raw pointer from offset. Never throws.
pointer get() const
{ return m_ptr; }
*/
//!Pointer-like -> operator. It can return 0 pointer. Never throws. //!Pointer-like -> operator. It can return 0 pointer. Never throws.
pointer operator->() const pointer operator->() const
{ return m_ptr; } { return m_ptr; }
//!Dereferencing operator, if it is a null smart_ptr behavior //!Dereferencing operator, if it is a null smart_ptr behavior
//! is undefined. Never throws. //! is undefined. Never throws.
reference operator* () const reference operator* () const
{ return *m_ptr; } { return *m_ptr; }
//!Indexing operator. Never throws. //!Indexing operator. Never throws.
reference operator[](std::ptrdiff_t idx) const reference operator[](std::ptrdiff_t idx) const
{ return m_ptr[idx]; } { return m_ptr[idx]; }
/*
//!Assignment from pointer (saves extra conversion). Never throws.
smart_ptr& operator= (pointer from)
{ m_ptr = from; return *this; }
*/
//!Assignment from other smart_ptr. Never throws. //!Assignment from other smart_ptr. Never throws.
smart_ptr& operator= (const smart_ptr & pt) smart_ptr& operator= (const smart_ptr & pt)
{ m_ptr = pt.m_ptr; return *this; } { m_ptr = pt.m_ptr; return *this; }
@ -196,7 +152,7 @@ class smart_ptr
{ m_ptr = pt.m_ptr; return *this; } { m_ptr = pt.m_ptr; return *this; }
//!smart_ptr + std::ptrdiff_t. Never throws. //!smart_ptr + std::ptrdiff_t. Never throws.
smart_ptr operator+ (std::ptrdiff_t offset) const smart_ptr operator+ (std::ptrdiff_t offset) const
{ smart_ptr s; s.m_ptr = m_ptr + offset; return s; } { smart_ptr s; s.m_ptr = m_ptr + offset; return s; }
//!smart_ptr - std::ptrdiff_t. Never throws. //!smart_ptr - std::ptrdiff_t. Never throws.
@ -228,21 +184,13 @@ class smart_ptr
{ smart_ptr temp(*this); --*this; return temp; } { smart_ptr temp(*this); --*this; return temp; }
//!safe bool conversion operator. Never throws. //!safe bool conversion operator. Never throws.
operator unspecified_bool_type() const operator unspecified_bool_type() const
{ return m_ptr? &self_t::unspecified_bool_type_func : 0; } { return m_ptr? &self_t::unspecified_bool_type_func : 0; }
//!Not operator. Not needed in theory, but improves portability. //!Not operator. Not needed in theory, but improves portability.
//!Never throws. //!Never throws.
bool operator! () const bool operator! () const
{ return m_ptr == 0; } { return m_ptr == 0; }
/*
friend void swap (smart_ptr &pt, smart_ptr &pt2)
{
value_type *ptr = pt.get();
pt = pt2;
pt2 = ptr;
}
*/
}; };
//!smart_ptr<T1> == smart_ptr<T2>. Never throws. //!smart_ptr<T1> == smart_ptr<T2>. Never throws.
@ -293,12 +241,12 @@ inline std::basic_istream<E, T> & operator>>
(std::basic_istream<E, T> & os, smart_ptr<Y> & p) (std::basic_istream<E, T> & os, smart_ptr<Y> & p)
{ Y * tmp; return os >> tmp; p = tmp; } { Y * tmp; return os >> tmp; p = tmp; }
//!std::ptrdiff_t + smart_ptr //!std::ptrdiff_t + smart_ptr
template<class T> template<class T>
inline smart_ptr<T> operator+(std::ptrdiff_t diff, const smart_ptr<T>& right) inline smart_ptr<T> operator+(std::ptrdiff_t diff, const smart_ptr<T>& right)
{ return right + diff; } { return right + diff; }
//!smart_ptr - smart_ptr //!smart_ptr - smart_ptr
template<class T, class T2> template<class T, class T2>
inline std::ptrdiff_t operator- (const smart_ptr<T> &pt, const smart_ptr<T2> &pt2) inline std::ptrdiff_t operator- (const smart_ptr<T> &pt, const smart_ptr<T2> &pt2)
{ return pt.operator->()- pt2.operator->(); } { return pt.operator->()- pt2.operator->(); }
@ -307,7 +255,7 @@ inline std::ptrdiff_t operator- (const smart_ptr<T> &pt, const smart_ptr<T2> &pt
template<class T> template<class T>
inline void swap (smart_ptr<T> &pt, inline void swap (smart_ptr<T> &pt,
smart_ptr<T> &pt2) smart_ptr<T> &pt2)
{ {
typename smart_ptr<T>::value_type *ptr = pt.operator->(); typename smart_ptr<T>::value_type *ptr = pt.operator->();
pt = pt2; pt = pt2;
pt2 = ptr; pt2 = ptr;
@ -317,32 +265,32 @@ inline void swap (smart_ptr<T> &pt,
template<class T, class U> template<class T, class U>
inline smart_ptr<T> inline smart_ptr<T>
static_pointer_cast(const smart_ptr<U> & r) static_pointer_cast(const smart_ptr<U> & r)
{ {
return smart_ptr<T>(r, detail::static_cast_tag()); return smart_ptr<T>(r, detail::static_cast_tag());
} }
//!Simulation of const_cast between pointers. Never throws. //!Simulation of const_cast between pointers. Never throws.
template<class T, class U> template<class T, class U>
inline smart_ptr<T>const_pointer_cast(smart_ptr<U> const & r) inline smart_ptr<T>const_pointer_cast(smart_ptr<U> const & r)
{ {
return smart_ptr<T>(r, detail::const_cast_tag()); return smart_ptr<T>(r, detail::const_cast_tag());
} }
//!Simulation of dynamic_cast between pointers. Never throws. //!Simulation of dynamic_cast between pointers. Never throws.
template<class T, class U> template<class T, class U>
inline smart_ptr<T> inline smart_ptr<T>
dynamic_pointer_cast(smart_ptr<U> const & r) dynamic_pointer_cast(smart_ptr<U> const & r)
{ {
return smart_ptr<T> return smart_ptr<T>
(r, detail::dynamic_cast_tag()); (r, detail::dynamic_cast_tag());
} }
//!Simulation of reinterpret_cast between pointers. Never throws. //!Simulation of reinterpret_cast between pointers. Never throws.
template<class T, class U> template<class T, class U>
inline smart_ptr<T> inline smart_ptr<T>
reinterpret_pointer_cast(smart_ptr<U> const & r) reinterpret_pointer_cast(smart_ptr<U> const & r)
{ {
return smart_ptr<T>(r, detail::reinterpret_cast_tag()); return smart_ptr<T>(r, detail::reinterpret_cast_tag());
} }
} //namespace intrusive { } //namespace intrusive {

View File

@ -1,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Olaf Krzikalla 2004-2006. // (C) Copyright Olaf Krzikalla 2004-2006.
// (C) Copyright Ion Gaztanaga 2006-2009. // (C) Copyright Ion Gaztanaga 2006-2012.
// //
// 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 2007. // (C) Copyright Ion Gaztanaga 2007-2012
// //
// 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 2007-2009 // (C) Copyright Ion Gaztanaga 2007-2012
// //
// 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 2007-2011 // (C) Copyright Ion Gaztanaga 2007-2012
// //
// 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
@ -247,7 +247,7 @@ void test_common_unordered_and_associative_container(Container & c, Data & d)
{ {
BOOST_TEST( c.find(*di) != c.end() ); BOOST_TEST( c.find(*di) != c.end() );
} }
typename Data::const_iterator db = d.begin(); typename Data::const_iterator db = d.begin();
typename Data::const_iterator da = db++; typename Data::const_iterator da = db++;

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2006-2009 // (C) Copyright Ion Gaztanaga 2006-2012
// //
// 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,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Olaf Krzikalla 2004-2006. // (C) Copyright Olaf Krzikalla 2004-2006.
// (C) Copyright Ion Gaztanaga 2006-2009. // (C) Copyright Ion Gaztanaga 2006-2012.
// //
// 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 2006-2009. // (C) Copyright Ion Gaztanaga 2006-2012.
// //
// 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,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Olaf Krzikalla 2004-2006. // (C) Copyright Olaf Krzikalla 2004-2006.
// (C) Copyright Ion Gaztanaga 2006-2009. // (C) Copyright Ion Gaztanaga 2006-2012.
// //
// 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
@ -157,7 +157,7 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
testset.erase (testset.iterator_to (values[0])); testset.erase (testset.iterator_to (values[0]));
testset.erase (testset.iterator_to (values[1])); testset.erase (testset.iterator_to (values[1]));
testset.insert (values[1]); testset.insert (values[1]);
testset.erase (testset.iterator_to (values[2])); testset.erase (testset.iterator_to (values[2]));
testset.erase (testset.iterator_to (values[3])); testset.erase (testset.iterator_to (values[3]));
} }
@ -194,7 +194,7 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
} }
testset1.clear(); testset1.clear();
BOOST_TEST (testset1.empty()); BOOST_TEST (testset1.empty());
} }
//test: insert, const_iterator, const_reverse_iterator, erase, iterator_to: //test: insert, const_iterator, const_reverse_iterator, erase, iterator_to:
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental> template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
@ -231,7 +231,7 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
i = testset.insert (values[0]); i = testset.insert (values[0]);
BOOST_TEST (&*i == &values[0]); BOOST_TEST (&*i == &values[0]);
i = testset.iterator_to (values[2]); i = testset.iterator_to (values[2]);
BOOST_TEST (&*i == &values[2]); BOOST_TEST (&*i == &values[2]);
testset.erase(i); testset.erase(i);
@ -275,7 +275,7 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
i = testset.insert (values[0]); i = testset.insert (values[0]);
BOOST_TEST (&*i == &values[0]); BOOST_TEST (&*i == &values[0]);
i = testset.iterator_to (values[2]); i = testset.iterator_to (values[2]);
BOOST_TEST (&*i == &values[2]); BOOST_TEST (&*i == &values[2]);
testset.erase(i); testset.erase(i);
@ -442,7 +442,7 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>:
// BOOST_TEST (&testset1.front() == &values[3]); // BOOST_TEST (&testset1.front() == &values[3]);
BOOST_TEST (&*testset1.begin() == &values[3]); BOOST_TEST (&*testset1.begin() == &values[3]);
} }
} }
@ -651,7 +651,7 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>
BOOST_TEST (testset1.size() == values.size()); BOOST_TEST (testset1.size() == values.size());
{ int init_values [] = { 1, 2, 2, 3, 4, 5 }; { int init_values [] = { 1, 2, 2, 3, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); } TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
} }
//test: find, equal_range (lower_bound, upper_bound): //test: find, equal_range (lower_bound, upper_bound):
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental> template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
@ -682,7 +682,7 @@ void test_unordered_multiset<ValueTraits, CacheBegin, CompareHash, Incremental>:
BOOST_TEST (i->value_ == 2); BOOST_TEST (i->value_ == 2);
BOOST_TEST ((++i)->value_ == 2); BOOST_TEST ((++i)->value_ == 2);
std::pair<iterator,iterator> range = testset.equal_range (cmp_val); std::pair<iterator,iterator> range = testset.equal_range (cmp_val);
BOOST_TEST (range.first->value_ == 2); BOOST_TEST (range.first->value_ == 2);
BOOST_TEST (range.second->value_ == 3); BOOST_TEST (range.second->value_ == 3);
BOOST_TEST (std::distance (range.first, range.second) == 2); BOOST_TEST (std::distance (range.first, range.second) == 2);

View File

@ -1,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Olaf Krzikalla 2004-2006. // (C) Copyright Olaf Krzikalla 2004-2006.
// (C) Copyright Ion Gaztanaga 2006-2009. // (C) Copyright Ion Gaztanaga 2006-2012.
// //
// 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
@ -188,11 +188,11 @@ void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
{ int init_values [] = { 1, 2, 3, 4, 5 }; { int init_values [] = { 1, 2, 3, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); } TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
} }
testset1.clear(); testset1.clear();
BOOST_TEST (testset1.empty()); BOOST_TEST (testset1.empty());
} }
//test: insert, const_iterator, const_reverse_iterator, erase, iterator_to: //test: insert, const_iterator, const_reverse_iterator, erase, iterator_to:
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental> template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>:: void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
@ -251,7 +251,7 @@ void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
{ int init_values [] = { 1, 3, 5 }; { int init_values [] = { 1, 3, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); } TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); }
} }
} }
//test: insert (seq-version), swap, erase (seq-version), size: //test: insert (seq-version), swap, erase (seq-version), size:
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental> template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
@ -299,7 +299,7 @@ void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
BOOST_TEST (testset1.size() == 1); BOOST_TEST (testset1.size() == 1);
BOOST_TEST (&*testset1.begin() == &values[3]); BOOST_TEST (&*testset1.begin() == &values[3]);
} }
} }
//test: rehash: //test: rehash:
template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental> template<class ValueTraits, bool CacheBegin, bool CompareHash, bool Incremental>
@ -507,7 +507,7 @@ void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
BOOST_TEST (testset1.size() == values.size()-1); BOOST_TEST (testset1.size() == values.size()-1);
{ int init_values [] = { 1, 2, 3, 4, 5 }; { int init_values [] = { 1, 2, 3, 4, 5 };
TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); } TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); }
} }
//test: find, equal_range (lower_bound, upper_bound): //test: find, equal_range (lower_bound, upper_bound):
@ -538,7 +538,7 @@ void test_unordered_set<ValueTraits, CacheBegin, CompareHash, Incremental>::
BOOST_TEST (i->value_ == 2); BOOST_TEST (i->value_ == 2);
BOOST_TEST ((++i)->value_ != 2); BOOST_TEST ((++i)->value_ != 2);
std::pair<iterator,iterator> range = testset.equal_range (cmp_val); std::pair<iterator,iterator> range = testset.equal_range (cmp_val);
BOOST_TEST (range.first->value_ == 2); BOOST_TEST (range.first->value_ == 2);
BOOST_TEST (range.second->value_ == 3); BOOST_TEST (range.second->value_ == 3);
BOOST_TEST (std::distance (range.first, range.second) == 1); BOOST_TEST (std::distance (range.first, range.second) == 1);

View File

@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// (C) Copyright Ion Gaztanaga 2007-2009 // (C) Copyright Ion Gaztanaga 2007-2012
// //
// 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
@ -78,7 +78,7 @@ int main()
//Test the objects inserted in the base hook list //Test the objects inserted in the base hook list
for(; vect_it != vect_itend; ++vect_it, ++list_it) for(; vect_it != vect_itend; ++vect_it, ++list_it)
if(&*list_it != &*vect_it) if(&*list_it != &*vect_it)
return 1; return 1;
} }