diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index f0007e9..4b75a49 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -49,7 +49,7 @@ doxygen autodoc xml intrusive : intrusive.qbk : ../../../tools/auto_index/include - ; + ; boostbook standalone : @@ -62,21 +62,21 @@ boostbook standalone autodoc # Build requirements go here: - + # on (or off) one turns on (or off) indexing: on - + # Turns on (or off) auto-index-verbose for diagnostic info. # This is highly recommended until you have got all the many details correct! on - + # Choose the indexing method (separately for html and PDF) - see manual. # Choose indexing method for PDFs: pdf:off - + # Choose indexing method for html: html:on - + # Set the name of the script file to use (index.idx is popular): $(here)/index.idx # Commands in the script file should all use RELATIVE PATHS diff --git a/doc/intrusive.qbk b/doc/intrusive.qbk index 077d43f..a520047 100644 --- a/doc/intrusive.qbk +++ b/doc/intrusive.qbk @@ -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 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -8,7 +8,7 @@ [library Boost.Intrusive [quickbook 1.4] [authors [Krzikalla, Olaf], [Gaztanaga, Ion]] - [copyright 2005 Olaf Krzikalla, 2006-2011 Ion Gaztanaga] + [copyright 2005 Olaf Krzikalla, 2006-2012 Ion Gaztanaga] [id intrusive] [dirname intrusive] [purpose Intrusive containers] @@ -262,7 +262,7 @@ For [classref boost::intrusive::list list], you can publicly derive from class list_base_hook; The class can take several options. [*Boost.Intrusive] classes receive arguments in the -form `option_name`. You can specify the following options: +form `option_name`. You can specify the following options: * [*`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 @@ -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. By default, constant-time size is activated. -* [*`size_type`]: Specifies a type that can hold +* [*`size_type`]: Specifies an unsigned type that can hold 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` is requested. @@ -340,28 +340,33 @@ the base hook with the default tag: typedef list 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++] typedef list > FooList; -Remember that the user must specify the base hook if the base hook has no default tag -(e.g: if more than one base hook is used): +Remember that the user must specify the base hook in the container declaration +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++] #include using namespace boost::intrusive; - - struct my_tag; - typedef list_base_hook< tag > BaseHook; - class Foo : public BaseHook + struct my_tag1; + struct my_tag2; + + typedef list_base_hook< tag > BaseHook; + typedef list_base_hook< tag > BaseHook2; + class Foo : public BaseHook, public BaseHook2 { /**/ }; - typedef list< Foo, base_hook > FooList; + typedef list< Foo, base_hook > FooList; + typedef list< Foo, base_hook > FooList2; Once the list is defined, we can use it: @@ -400,7 +405,7 @@ Example: class Foo { 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, so you have to be careful to avoid resource leaks. - + * 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. @@ -508,11 +513,11 @@ chapters: [variablelist Brief Concepts Summary [[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 parameter that describes the node.]] [[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.]] [[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.]] @@ -543,7 +548,7 @@ chapters: Many operations have logarithmic time complexity. * [*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. The size overhead is moderate for user classes (usually the size of three pointers). 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: -* [*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 - container. When erasing an element from the container, the container puts the hook - in the safe state again. This allows a safer use mode and it can be used to detect - programming errors. It implies a slight performance overhead in some operations - and can convert some constant time operations to linear time operations. + container using that hook. When erasing an element from the container, the container + puts the `node` of the hook in the safe state again. This allows a safer use mode and it can + be used to detect programming errors. It implies a slight performance overhead in some + operations and can convert some constant time operations to linear time operations. * [*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 @@ -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: [c++] - + #include using boost::intrusive; @@ -2169,7 +2174,7 @@ Apart from the container to be cloned, `clone_from` takes two function objects a template void clone_from(const list &src, Cloner cloner, Disposer disposer); - + This function will make `*this` a clone of `src`. Let's explain the arguments: * 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 &)`. * 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. - + The cloning function works as follows: * 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]: - * 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] - 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 - resource management smart pointers (like `boost::shared_ptr`) can't be used. +* 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] + 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 + 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 `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 next node. [*Node Algorithms] just require a [*NodeTraits] 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: [c++] @@ -2484,18 +2489,18 @@ before explaining the customization options of [*Boost.Intrusive]. struct node { node *next_; - }; - + }; + typedef node * node_ptr; typedef const node * const_node_ptr; //A function to obtain a pointer to the next node 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 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 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, - and also the inverse operation. + and also the inverse operation. So we can define [*ValueTraits] as the glue between user classes and nodes required by [*Node Algorithms]. 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`. * [*['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 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 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 as `node_ptr`: If `node_ptr` is `node*`, `pointer` must be `value_type*`. If `node_ptr` is `smart_ptr`, `pointer` must be `smart_ptr`. 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] defined in ``. - + * [*['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 `node_ptr` is `smart_ptr`, `const_pointer` must be `smart_ptr`. - + * [*['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. These are the possible types: @@ -3188,13 +3193,13 @@ intrusive containers, so [*Boost.Intrusive] offers a templatized that does exactly what we want: [c++] - + #include //Now we can define legacy_value_traits just with a single line using namespace boost::intrusive; typedef trivial_value_traits legacy_value_traits; - + Now we can just define the containers that will store the legacy abi objects and write a little test: @@ -3373,7 +3378,7 @@ has a couple of downsides: //Implicitly specify constant-time size and size type typedef list List2; - + * 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 non-specified options. Object and debugging information files can grow and compilation times diff --git a/example/Jamfile.v2 b/example/Jamfile.v2 index 0b17488..fdead88 100644 --- a/example/Jamfile.v2 +++ b/example/Jamfile.v2 @@ -1,6 +1,6 @@ # 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 # Boost Software License, Version 1.0. (See accompanying file # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/example/doc_advanced_value_traits.cpp b/example/doc_advanced_value_traits.cpp index 7f3ec54..5efdeea 100644 --- a/example/doc_advanced_value_traits.cpp +++ b/example/doc_advanced_value_traits.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at @@ -26,7 +26,7 @@ struct simple_node class base_1{}; class base_2{}; -struct value_1 : public base_1, public simple_node +struct value_1 : public base_1, public simple_node { int id_; }; 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 node * node_ptr; typedef const node * const_node_ptr; - static node *get_next(const node *n) { return n->next_; } - static void set_next(node *n, node *next) { n->next_ = next; } - static node *get_previous(const node *n) { return n->prev_; } - static void set_previous(node *n, node *prev) { n->prev_ = prev; } + static node *get_next(const node *n) { return n->next_; } + static void set_next(node *n, node *next) { n->next_ = next; } + static node *get_previous(const node *n) { return n->prev_; } + static void set_previous(node *n, node *prev) { n->prev_ = prev; } }; //A templatized value traits for value_1 and value_2 diff --git a/example/doc_advanced_value_traits2.cpp b/example/doc_advanced_value_traits2.cpp index d75ef6a..f69d0ac 100644 --- a/example/doc_advanced_value_traits2.cpp +++ b/example/doc_advanced_value_traits2.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at @@ -26,17 +26,17 @@ struct simple_node_traits typedef simple_node node; typedef node * node_ptr; typedef const node * const_node_ptr; - static node *get_next(const node *n) { return n->next_; } - static void set_next(node *n, node *next) { n->next_ = next; } - static node *get_previous(const node *n) { return n->prev_; } - static void set_previous(node *n, node *prev) { n->prev_ = prev; } + static node *get_next(const node *n) { return n->next_; } + static void set_next(node *n, node *next) { n->next_ = next; } + static node *get_previous(const node *n) { return n->prev_; } + static void set_previous(node *n, node *prev) { n->prev_ = prev; } }; //[doc_advanced_value_traits2_value_traits class base_1{}; class base_2{}; -struct value_1 : public base_1, public simple_node +struct value_1 : public base_1, public simple_node { int id_; simple_node node_; diff --git a/example/doc_any_hook.cpp b/example/doc_any_hook.cpp index 11991aa..64c0956 100644 --- a/example/doc_any_hook.cpp +++ b/example/doc_any_hook.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2008 +// (C) Copyright Ion Gaztanaga 2008-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/example/doc_assoc_optimized_code.cpp b/example/doc_assoc_optimized_code.cpp index 418354c..931f3f4 100644 --- a/example/doc_assoc_optimized_code.cpp +++ b/example/doc_assoc_optimized_code.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at @@ -20,7 +20,7 @@ using namespace boost::intrusive; struct StrHasher { std::size_t operator()(const char *str) const - { + { std::size_t seed = 0; for(; *str; ++str) boost::hash_combine(seed, *str); return seed; @@ -31,7 +31,7 @@ class Expensive : public set_base_hook<>, public unordered_set_base_hook<> { std::string key_; // Other members... - + public: Expensive(const char *key) : key_(key) diff --git a/example/doc_auto_unlink.cpp b/example/doc_auto_unlink.cpp index 28a84ac..9947172 100644 --- a/example/doc_auto_unlink.cpp +++ b/example/doc_auto_unlink.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/example/doc_avl_set.cpp b/example/doc_avl_set.cpp index b311320..f3fab35 100644 --- a/example/doc_avl_set.cpp +++ b/example/doc_avl_set.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at @@ -55,7 +55,7 @@ int main() BaseSet baseset; MemberMultiset membermultiset; - + //Check that size optimization is activated in the base hook assert(sizeof(avl_set_base_hook >) == 3*sizeof(void*)); //Check that size optimization is deactivated in the member hook diff --git a/example/doc_avltree_algorithms.cpp b/example/doc_avltree_algorithms.cpp index 0f67c9f..d606b8a 100644 --- a/example/doc_avltree_algorithms.cpp +++ b/example/doc_avltree_algorithms.cpp @@ -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. // (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 int balance; - 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 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 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 balance get_balance(const_node_ptr n) { return n->balance_; } + 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 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 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 balance get_balance(const_node_ptr n) { return n->balance_; } static void set_balance(node_ptr n, balance b) { n->balance_ = b; } static balance negative() { return -1; } static balance zero() { return 0; } @@ -72,7 +72,7 @@ int main() //Now go to the next node n = algo::next_node(n); - assert(n == &three); + assert(n == &three); //Erase a node just using a pointer to it algo::unlink(&two); diff --git a/example/doc_bucket_traits.cpp b/example/doc_bucket_traits.cpp index 7fe1a89..83dded5 100644 --- a/example/doc_bucket_traits.cpp +++ b/example/doc_bucket_traits.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/example/doc_clone_from.cpp b/example/doc_clone_from.cpp index f8c5794..d21bb85 100644 --- a/example/doc_clone_from.cpp +++ b/example/doc_clone_from.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/example/doc_entity.cpp b/example/doc_entity.cpp index 2c08ebc..70f693d 100644 --- a/example/doc_entity.cpp +++ b/example/doc_entity.cpp @@ -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. // (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 while (!global_list.empty()) - delete &global_list.front(); + delete &global_list.front(); } int main() diff --git a/example/doc_erasing_and_disposing.cpp b/example/doc_erasing_and_disposing.cpp index f3bb51a..4952521 100644 --- a/example/doc_erasing_and_disposing.cpp +++ b/example/doc_erasing_and_disposing.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/example/doc_external_value_traits.cpp b/example/doc_external_value_traits.cpp index f271030..ea377ce 100644 --- a/example/doc_external_value_traits.cpp +++ b/example/doc_external_value_traits.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/example/doc_function_hooks.cpp b/example/doc_function_hooks.cpp index f7b6a87..640006c 100644 --- a/example/doc_function_hooks.cpp +++ b/example/doc_function_hooks.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/example/doc_how_to_use.cpp b/example/doc_how_to_use.cpp index b966fe0..7e1bbc2 100644 --- a/example/doc_how_to_use.cpp +++ b/example/doc_how_to_use.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/example/doc_iterator_from_value.cpp b/example/doc_iterator_from_value.cpp index 652e314..2ba1c6c 100644 --- a/example/doc_iterator_from_value.cpp +++ b/example/doc_iterator_from_value.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/example/doc_list.cpp b/example/doc_list.cpp index 108b83e..08a3f70 100644 --- a/example/doc_list.cpp +++ b/example/doc_list.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/example/doc_list_algorithms.cpp b/example/doc_list_algorithms.cpp index c96beab..7f94f77 100644 --- a/example/doc_list_algorithms.cpp +++ b/example/doc_list_algorithms.cpp @@ -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. // (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_ptr; typedef const my_node * const_node_ptr; - 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 node *get_previous(const_node_ptr n) { return n->prev_; } - static void set_previous(node_ptr n, node_ptr prev){ n->prev_ = prev; } + 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 node *get_previous(const_node_ptr n) { return n->prev_; } + static void set_previous(node_ptr n, node_ptr prev){ n->prev_ = prev; } }; int main() diff --git a/example/doc_offset_ptr.cpp b/example/doc_offset_ptr.cpp index 1ee4970..ca54844 100644 --- a/example/doc_offset_ptr.cpp +++ b/example/doc_offset_ptr.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/example/doc_positional_insertion.cpp b/example/doc_positional_insertion.cpp index 7609bc2..83ff279 100644 --- a/example/doc_positional_insertion.cpp +++ b/example/doc_positional_insertion.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/example/doc_rbtree_algorithms.cpp b/example/doc_rbtree_algorithms.cpp index 2ca88f2..62ec7ae 100644 --- a/example/doc_rbtree_algorithms.cpp +++ b/example/doc_rbtree_algorithms.cpp @@ -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. // (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 const my_node * const_node_ptr; typedef int color; - 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 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 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 color get_color(const_node_ptr n) { return n->color_; } + 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 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 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 color get_color(const_node_ptr n) { return n->color_; } static void set_color(node_ptr n, color c) { n->color_ = c; } static color black() { return color(0); } static color red() { return color(1); } @@ -70,7 +70,7 @@ int main() //Now go to the next node n = algo::next_node(n); - assert(n == &three); + assert(n == &three); //Erase a node just using a pointer to it algo::unlink(&two); diff --git a/example/doc_recursive.cpp b/example/doc_recursive.cpp index c161e14..fa8198e 100644 --- a/example/doc_recursive.cpp +++ b/example/doc_recursive.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/example/doc_recursive_member.cpp b/example/doc_recursive_member.cpp index 042acbe..ff1e3ea 100644 --- a/example/doc_recursive_member.cpp +++ b/example/doc_recursive_member.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/example/doc_set.cpp b/example/doc_set.cpp index ca1d00b..528ff84 100644 --- a/example/doc_set.cpp +++ b/example/doc_set.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at @@ -55,7 +55,7 @@ int main() BaseSet baseset; MemberMultiset membermultiset; - + //Check that size optimization is activated in the base hook assert(sizeof(set_base_hook >) == 3*sizeof(void*)); //Check that size optimization is deactivated in the member hook diff --git a/example/doc_sg_set.cpp b/example/doc_sg_set.cpp index a95f022..1c3bbaa 100644 --- a/example/doc_sg_set.cpp +++ b/example/doc_sg_set.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at @@ -56,7 +56,7 @@ int main() BaseSet baseset; MemberMultiset membermultiset; - + //Now insert them in the reverse order in the base hook sg_set for(VectIt it(values.begin()), itend(values.end()); it != itend; ++it){ baseset.insert(*it); diff --git a/example/doc_slist.cpp b/example/doc_slist.cpp index fb8bbeb..3ebc561 100644 --- a/example/doc_slist.cpp +++ b/example/doc_slist.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/example/doc_slist_algorithms.cpp b/example/doc_slist_algorithms.cpp index b53d8b3..94ddaaa 100644 --- a/example/doc_slist_algorithms.cpp +++ b/example/doc_slist_algorithms.cpp @@ -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. // (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_ptr; typedef const my_node * const_node_ptr; - 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 node_ptr get_next(const_node_ptr n) { return n->next_; } + static void set_next(node_ptr n, node_ptr next) { n->next_ = next; } }; int main() diff --git a/example/doc_splay_algorithms.cpp b/example/doc_splay_algorithms.cpp index c50cbab..1c00035 100644 --- a/example/doc_splay_algorithms.cpp +++ b/example/doc_splay_algorithms.cpp @@ -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. // (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 const my_node * const_node_ptr; - 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 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 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 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 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 node_ptr get_right(const_node_ptr n) { return n->right_; } + static void set_right(node_ptr n, node_ptr right) { n->right_ = right; } }; struct node_ptr_compare @@ -66,7 +66,7 @@ int main() //Now go to the next node n = algo::next_node(n); - assert(n == &three); + assert(n == &three); //Erase a node just using a pointer to it algo::unlink(&two); diff --git a/example/doc_splay_set.cpp b/example/doc_splay_set.cpp index 8a3b188..19c9d6c 100644 --- a/example/doc_splay_set.cpp +++ b/example/doc_splay_set.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at @@ -20,7 +20,7 @@ using namespace boost::intrusive; class MyClass : 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 - + { int int_; diff --git a/example/doc_splaytree_algorithms.cpp b/example/doc_splaytree_algorithms.cpp index e9723d4..9e2cb3d 100644 --- a/example/doc_splaytree_algorithms.cpp +++ b/example/doc_splaytree_algorithms.cpp @@ -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. // (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 const my_node * const_node_ptr; - 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 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 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 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 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 node_ptr get_right(const_node_ptr n) { return n->right_; } + static void set_right(node_ptr n, node_ptr right) { n->right_ = right; } }; struct node_ptr_compare @@ -65,7 +65,7 @@ int main() //Now go to the next node n = algo::next_node(n); - assert(n == &three); + assert(n == &three); //Erase a node just using a pointer to it algo::unlink(&two); diff --git a/example/doc_stateful_value_traits.cpp b/example/doc_stateful_value_traits.cpp index e409d17..376211a 100644 --- a/example/doc_stateful_value_traits.cpp +++ b/example/doc_stateful_value_traits.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/example/doc_treap_algorithms.cpp b/example/doc_treap_algorithms.cpp index 3739bbe..fa0b11e 100644 --- a/example/doc_treap_algorithms.cpp +++ b/example/doc_treap_algorithms.cpp @@ -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. // (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 const my_node * const_node_ptr; - 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 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 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 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 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 node_ptr get_right(const_node_ptr n) { return n->right_; } + static void set_right(node_ptr n, node_ptr right) { n->right_ = right; } }; struct node_ptr_compare @@ -66,7 +66,7 @@ int main() //Now go to the next node n = algo::next_node(n); - assert(n == &three); + assert(n == &three); //Erase a node just using a pointer to it algo::unlink(&two, node_ptr_priority()); diff --git a/example/doc_treap_set.cpp b/example/doc_treap_set.cpp index 7f5afb2..dc8b7a9 100644 --- a/example/doc_treap_set.cpp +++ b/example/doc_treap_set.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at @@ -70,7 +70,7 @@ int main() BaseSet baseset; MemberMultiset membermultiset; - + //Now insert them in the sets for(VectIt it(values.begin()), itend(values.end()); it != itend; ++it){ baseset.insert(*it); diff --git a/example/doc_unordered_set.cpp b/example/doc_unordered_set.cpp index fdd0938..70ff299 100644 --- a/example/doc_unordered_set.cpp +++ b/example/doc_unordered_set.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/example/doc_value_traits.cpp b/example/doc_value_traits.cpp index bd47689..be091cc 100644 --- a/example/doc_value_traits.cpp +++ b/example/doc_value_traits.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at @@ -39,10 +39,10 @@ struct legacy_node_traits typedef legacy_value * node_ptr; typedef const legacy_value * const_node_ptr; - static node *get_next(const node *n) { return n->next_; } - static void set_next(node *n, node *next) { n->next_ = next; } - static node *get_previous(const node *n) { return n->prev_; } - static void set_previous(node *n, node *prev) { n->prev_ = prev; } + static node *get_next(const node *n) { return n->next_; } + static void set_next(node *n, node *next) { n->next_ = next; } + static node *get_previous(const node *n) { return n->prev_; } + static void set_previous(node *n, node *prev) { n->prev_ = prev; } }; //This ValueTraits will configure list and slist. In this case, diff --git a/example/doc_window.cpp b/example/doc_window.cpp index 7fa57b0..67ff275 100644 --- a/example/doc_window.cpp +++ b/example/doc_window.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/perf/Jamfile.v2 b/perf/Jamfile.v2 index 03faed7..b36a81b 100644 --- a/perf/Jamfile.v2 +++ b/perf/Jamfile.v2 @@ -1,6 +1,6 @@ # 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 # Boost Software License, Version 1.0. (See accompanying file # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/perf/perf_list.cpp b/perf/perf_list.cpp index 4f5d86e..6a4769c 100644 --- a/perf/perf_list.cpp +++ b/perf/perf_list.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/proj/vc7ide/to-do.txt b/proj/vc7ide/to-do.txt index 7dce052..c57890b 100644 --- a/proj/vc7ide/to-do.txt +++ b/proj/vc7ide/to-do.txt @@ -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. // (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 -> 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 +-> 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. diff --git a/test/any_test.cpp b/test/any_test.cpp index 6fc6a4c..61dee2c 100644 --- a/test/any_test.cpp +++ b/test/any_test.cpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/avl_multiset_test.cpp b/test/avl_multiset_test.cpp index dfb60bb..149c2d0 100644 --- a/test/avl_multiset_test.cpp +++ b/test/avl_multiset_test.cpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/avl_set_test.cpp b/test/avl_set_test.cpp index 13db77e..78590a4 100644 --- a/test/avl_set_test.cpp +++ b/test/avl_set_test.cpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/common_functors.hpp b/test/common_functors.hpp index 4cbf03a..0cc9d96 100644 --- a/test/common_functors.hpp +++ b/test/common_functors.hpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/custom_bucket_traits_test.cpp b/test/custom_bucket_traits_test.cpp index c2e1d7c..6e710a5 100644 --- a/test/custom_bucket_traits_test.cpp +++ b/test/custom_bucket_traits_test.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/default_hook_test.cpp b/test/default_hook_test.cpp index c5baea9..728c7fb 100644 --- a/test/default_hook_test.cpp +++ b/test/default_hook_test.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/external_value_traits_test.cpp b/test/external_value_traits_test.cpp index a641fd5..b53b972 100644 --- a/test/external_value_traits_test.cpp +++ b/test/external_value_traits_test.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/function_hook_test.cpp b/test/function_hook_test.cpp index 5b9e570..bbb0774 100644 --- a/test/function_hook_test.cpp +++ b/test/function_hook_test.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/generic_assoc_test.hpp b/test/generic_assoc_test.hpp index 7db4faa..28a0201 100644 --- a/test/generic_assoc_test.hpp +++ b/test/generic_assoc_test.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (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. // (See accompanying file LICENSE_1_0.txt or copy at @@ -134,7 +134,7 @@ void test_generic_assoc::test_insert_erase_burst( typedef typename std::vector::const_iterator cvec_iterator; //Random erasure std::vector it_vector; - + for(cvec_iterator it(values.begin()), itend(values.end()) ; it != itend ; ++it){ @@ -396,7 +396,7 @@ void test_generic_assoc::test_insert_before { assoc_type testset; typedef typename std::vector::iterator vec_iterator; - + for(vec_iterator it(--values.end()); true; --it){ testset.push_front(*it); if(it == values.begin()){ diff --git a/test/generic_multiset_test.hpp b/test/generic_multiset_test.hpp index f58de84..51236cc 100644 --- a/test/generic_multiset_test.hpp +++ b/test/generic_multiset_test.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (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. // (See accompanying file LICENSE_1_0.txt or copy at @@ -92,7 +92,7 @@ void test_generic_multiset::test_impl() testset.erase (testset.iterator_to (values[0])); testset.erase (testset.iterator_to (values[1])); testset.insert (values[1]); - + testset.erase (testset.iterator_to (values[2])); testset.erase (testset.iterator_to (values[3])); } @@ -127,8 +127,8 @@ void test_generic_multiset::test_sort(std::vector BOOST_TEST (testset2.begin()->value_ == 2); BOOST_TEST (testset2.rbegin()->value_ == 5); -} - +} + //test: insert, const_iterator, const_reverse_iterator, erase, iterator_to: template class ContainerDefiner> void test_generic_multiset::test_insert(std::vector& values) @@ -165,7 +165,7 @@ void test_generic_multiset::test_insert(std::vect { int init_values [] = { 1, 3, 5 }; TEST_INTRUSIVE_SEQUENCE( init_values, testset.begin() ); } -} +} //test: insert (seq-version), swap, erase (seq-version), size: template class ContainerDefiner> @@ -191,7 +191,7 @@ void test_generic_multiset::test_swap(std::vector testset1.erase (testset1.iterator_to(values[5]), testset1.end()); BOOST_TEST (testset1.size() == 1); BOOST_TEST (&*testset1.begin() == &values[3]); -} +} //test: find, equal_range (lower_bound, upper_bound): template class ContainerDefiner> @@ -207,19 +207,21 @@ void test_generic_multiset::test_find(std::vector multiset_type testset (values.begin(), values.end()); typedef typename multiset_type::iterator iterator; - value_type cmp_val; - cmp_val.value_ = 2; - iterator i = testset.find (cmp_val); - BOOST_TEST (i->value_ == 2); - BOOST_TEST ((++i)->value_ == 2); - std::pair 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); + { + value_type cmp_val; + cmp_val.value_ = 2; + iterator i = testset.find (cmp_val); + BOOST_TEST (i->value_ == 2); + BOOST_TEST ((++i)->value_ == 2); + std::pair range = testset.equal_range (cmp_val); - cmp_val.value_ = 7; - BOOST_TEST (testset.find (cmp_val) == testset.end()); + 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 (testset.find (cmp_val) == testset.end()); + } } }}} //namespace boost::intrusive::test diff --git a/test/generic_set_test.hpp b/test/generic_set_test.hpp index 5ce0466..9340235 100644 --- a/test/generic_set_test.hpp +++ b/test/generic_set_test.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (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. // (See accompanying file LICENSE_1_0.txt or copy at @@ -103,7 +103,7 @@ void test_generic_set::test_impl() testset.erase (testset.iterator_to (values[0])); testset.erase (testset.iterator_to (values[1])); testset.insert (values[1]); - + testset.erase (testset.iterator_to (values[2])); testset.erase (testset.iterator_to (values[3])); } @@ -137,8 +137,8 @@ void test_generic_set::test_sort(std::vectorvalue_ == 2); BOOST_TEST (testset2.rbegin()->value_ == 5); -} - +} + //test: insert, const_iterator, const_reverse_iterator, erase, s_iterator_to: template class ContainerDefiner> void test_generic_set::test_insert(std::vector& values) @@ -263,7 +263,7 @@ void test_generic_set::test_swap(std::vector class ContainerDefiner> @@ -278,19 +278,21 @@ void test_generic_set::test_find(std::vectorvalue_ == 2); - BOOST_TEST ((++i)->value_ != 2); - std::pair 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); + { + value_type cmp_val; + cmp_val.value_ = 2; + iterator i = testset.find (cmp_val); + BOOST_TEST (i->value_ == 2); + BOOST_TEST ((++i)->value_ != 2); + std::pair range = testset.equal_range (cmp_val); - cmp_val.value_ = 7; - BOOST_TEST (testset.find (cmp_val) == testset.end()); + 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 (testset.find (cmp_val) == testset.end()); + } } }}} //namespace boost::intrusive::test diff --git a/test/has_member_function_callable_with.cpp b/test/has_member_function_callable_with.cpp index a0c3830..715df6d 100644 --- a/test/has_member_function_callable_with.cpp +++ b/test/has_member_function_callable_with.cpp @@ -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 // 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; }; -typedef char yes_type; +typedef char yes_type; struct no_type{ char dummy[2]; }; template no_type is_private_type(T const &); yes_type is_private_type(private_type const &); -}}}} +}}}} namespace boost{ @@ -123,7 +123,7 @@ class has_member_function_named_func template static has_member_function_callable_with::no_type Test(...); - + static const bool value = 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 intrusive{ @@ -216,7 +216,7 @@ class has_member_function_named_func ) ); }; - }}} + }}} namespace boost{ namespace intrusive{ @@ -308,7 +308,7 @@ class has_member_function_named_func template static has_member_function_callable_with::no_type Test(...); - + static const bool value = sizeof(Test< Fun >(0)) == sizeof(has_member_function_callable_with::yes_type); }; @@ -460,7 +460,7 @@ int main() (void)check5; (void)check6; (void)check7; - } + } return 0; diff --git a/test/itestvalue.hpp b/test/itestvalue.hpp index 1140430..0470e8a 100644 --- a/test/itestvalue.hpp +++ b/test/itestvalue.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (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. // (See accompanying file LICENSE_1_0.txt or copy at @@ -141,7 +141,7 @@ struct even_odd return v1.value_ < v2.value_; else return v2.value_ & 1; - } + } }; struct is_even @@ -149,7 +149,7 @@ struct is_even template bool operator() (const testvalue& v1) const - { return (v1.value_ & 1) == 0; } + { return (v1.value_ & 1) == 0; } }; /* struct int_testvalue_comp diff --git a/test/list_test.cpp b/test/list_test.cpp index cbc6b1c..4857a2f 100644 --- a/test/list_test.cpp +++ b/test/list_test.cpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (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. // (See accompanying file LICENSE_1_0.txt or copy at @@ -114,7 +114,7 @@ void test_list testlist.pop_front(); BOOST_TEST (testlist.empty()); -} +} //test: constructor, iterator, reverse_iterator, sort, reverse: @@ -196,7 +196,7 @@ void test_list int init_values [] = { 1, 3, 4, 5 }; TEST_INTRUSIVE_SEQUENCE( init_values, testlist1.begin() ); } - + //test: assign, insert, const_iterator, const_reverse_iterator, erase, s_iterator_to: template void test_list diff --git a/test/make_functions_test.cpp b/test/make_functions_test.cpp index 4cc4423..1b98f24 100644 --- a/test/make_functions_test.cpp +++ b/test/make_functions_test.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/multiset_test.cpp b/test/multiset_test.cpp index 0099bb4..74bb18e 100644 --- a/test/multiset_test.cpp +++ b/test/multiset_test.cpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/pointer_traits_test.cpp b/test/pointer_traits_test.cpp index c81f2f2..fef7aa1 100644 --- a/test/pointer_traits_test.cpp +++ b/test/pointer_traits_test.cpp @@ -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 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // diff --git a/test/recursive_test.cpp b/test/recursive_test.cpp index d47ccc6..619206a 100644 --- a/test/recursive_test.cpp +++ b/test/recursive_test.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at @@ -49,7 +49,7 @@ void instantiate() list< Foo, base_hook > list_; list_.clear(); slist< Foo, base_hook > slist_; slist_.clear(); set< Foo, base_hook > set_; set_.clear(); - + USet::bucket_type buckets[1]; USet unordered_set_(USet::bucket_traits(buckets, 1)); unordered_set_.clear(); } diff --git a/test/set_test.cpp b/test/set_test.cpp index bbe8204..1570dcd 100644 --- a/test/set_test.cpp +++ b/test/set_test.cpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/sg_multiset_test.cpp b/test/sg_multiset_test.cpp index 68d6b1d..0230a9d 100644 --- a/test/sg_multiset_test.cpp +++ b/test/sg_multiset_test.cpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/sg_set_test.cpp b/test/sg_set_test.cpp index 193eb25..f19d55e 100644 --- a/test/sg_set_test.cpp +++ b/test/sg_set_test.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007. +// (C) Copyright Ion Gaztanaga 2007-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/slist_test.cpp b/test/slist_test.cpp index d059a5a..32c1d12 100644 --- a/test/slist_test.cpp +++ b/test/slist_test.cpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (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. // (See accompanying file LICENSE_1_0.txt or copy at @@ -106,7 +106,7 @@ void test_slist > list_type; list_type testlist; BOOST_TEST (testlist.empty()); - + testlist.push_front (values[0]); BOOST_TEST (testlist.size() == 1); BOOST_TEST (&testlist.front() == &values[0]); @@ -114,11 +114,11 @@ void test_slist testlist.push_front (values[1]); BOOST_TEST (testlist.size() == 2); BOOST_TEST (&testlist.front() == &values[1]); - + testlist.pop_front(); BOOST_TEST (testlist.size() == 1); BOOST_TEST (&testlist.front() == &values[0]); - + testlist.pop_front(); BOOST_TEST (testlist.empty()); } @@ -241,8 +241,8 @@ void test_slist testlist.reverse(); { int init_values [] = { 5, 3, 1, 4, 2 }; TEST_INTRUSIVE_SEQUENCE( init_values, testlist.begin() ); } -} - +} + //test: assign, insert_after, const_iterator, erase_after, s_iterator_to, previous: template void test_slist @@ -374,7 +374,7 @@ void test_slist testlist.clear(); } } -} +} //test: insert_after (seq-version), swap, splice_after: template @@ -476,7 +476,7 @@ void test_slist { int init_values [] = { 1 }; TEST_INTRUSIVE_SEQUENCE( init_values, testlist1.begin() ); } } -} +} template void test_slist diff --git a/test/smart_ptr.hpp b/test/smart_ptr.hpp index 84587b0..cea8e90 100644 --- a/test/smart_ptr.hpp +++ b/test/smart_ptr.hpp @@ -113,18 +113,6 @@ class smart_ptr : 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 - smart_ptr(T *ptr) - : m_ptr(ptr) - {} -*/ //!Constructor from other smart_ptr smart_ptr(const smart_ptr& ptr) : m_ptr(ptr.m_ptr) @@ -139,52 +127,20 @@ class smart_ptr smart_ptr(const smart_ptr &ptr) : m_ptr(ptr.m_ptr) {} -/* - //!Emulates static_cast operator. Never throws. - template - smart_ptr(const smart_ptr & r, detail::static_cast_tag) - : m_ptr(static_cast(r.m_ptr)) - {} - //!Emulates const_cast operator. Never throws. - template - smart_ptr(const smart_ptr & r, detail::const_cast_tag) - : m_ptr(const_cast(r.m_ptr)) - {} - - //!Emulates dynamic_cast operator. Never throws. - template - smart_ptr(const smart_ptr & r, detail::dynamic_cast_tag) - : m_ptr(dynamic_cast(r.m_ptr)) - {} - - //!Emulates reinterpret_cast operator. Never throws. - template - smart_ptr(const smart_ptr & r, detail::reinterpret_cast_tag) - : m_ptr(reinterpret_cast(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 operator->() const + pointer operator->() const { return m_ptr; } //!Dereferencing operator, if it is a null smart_ptr behavior //! is undefined. Never throws. - reference operator* () const + reference operator* () const { return *m_ptr; } //!Indexing operator. Never throws. - reference operator[](std::ptrdiff_t idx) const + reference operator[](std::ptrdiff_t idx) const { 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. smart_ptr& operator= (const smart_ptr & pt) { m_ptr = pt.m_ptr; return *this; } @@ -196,7 +152,7 @@ class smart_ptr { m_ptr = pt.m_ptr; return *this; } //!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 - std::ptrdiff_t. Never throws. @@ -228,21 +184,13 @@ class smart_ptr { smart_ptr temp(*this); --*this; return temp; } //!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; } //!Not operator. Not needed in theory, but improves portability. //!Never throws. bool operator! () const { return m_ptr == 0; } -/* - friend void swap (smart_ptr &pt, smart_ptr &pt2) - { - value_type *ptr = pt.get(); - pt = pt2; - pt2 = ptr; - } -*/ }; //!smart_ptr == smart_ptr. Never throws. @@ -293,12 +241,12 @@ inline std::basic_istream & operator>> (std::basic_istream & os, smart_ptr & p) { Y * tmp; return os >> tmp; p = tmp; } -//!std::ptrdiff_t + smart_ptr +//!std::ptrdiff_t + smart_ptr template inline smart_ptr operator+(std::ptrdiff_t diff, const smart_ptr& right) { return right + diff; } -//!smart_ptr - smart_ptr +//!smart_ptr - smart_ptr template inline std::ptrdiff_t operator- (const smart_ptr &pt, const smart_ptr &pt2) { return pt.operator->()- pt2.operator->(); } @@ -307,7 +255,7 @@ inline std::ptrdiff_t operator- (const smart_ptr &pt, const smart_ptr &pt template inline void swap (smart_ptr &pt, smart_ptr &pt2) -{ +{ typename smart_ptr::value_type *ptr = pt.operator->(); pt = pt2; pt2 = ptr; @@ -317,32 +265,32 @@ inline void swap (smart_ptr &pt, template inline smart_ptr static_pointer_cast(const smart_ptr & r) -{ - return smart_ptr(r, detail::static_cast_tag()); +{ + return smart_ptr(r, detail::static_cast_tag()); } //!Simulation of const_cast between pointers. Never throws. template inline smart_ptrconst_pointer_cast(smart_ptr const & r) -{ - return smart_ptr(r, detail::const_cast_tag()); +{ + return smart_ptr(r, detail::const_cast_tag()); } //!Simulation of dynamic_cast between pointers. Never throws. template inline smart_ptr dynamic_pointer_cast(smart_ptr const & r) -{ +{ return smart_ptr - (r, detail::dynamic_cast_tag()); + (r, detail::dynamic_cast_tag()); } //!Simulation of reinterpret_cast between pointers. Never throws. template inline smart_ptr reinterpret_pointer_cast(smart_ptr const & r) -{ - return smart_ptr(r, detail::reinterpret_cast_tag()); +{ + return smart_ptr(r, detail::reinterpret_cast_tag()); } } //namespace intrusive { diff --git a/test/splay_multiset_test.cpp b/test/splay_multiset_test.cpp index be3efc5..83481f8 100644 --- a/test/splay_multiset_test.cpp +++ b/test/splay_multiset_test.cpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/splay_set_test.cpp b/test/splay_set_test.cpp index 82b59cc..c4ac86f 100644 --- a/test/splay_set_test.cpp +++ b/test/splay_set_test.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2007. +// (C) Copyright Ion Gaztanaga 2007-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/stateful_value_traits_test.cpp b/test/stateful_value_traits_test.cpp index 927cc61..3e76eca 100644 --- a/test/stateful_value_traits_test.cpp +++ b/test/stateful_value_traits_test.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/test_container.hpp b/test/test_container.hpp index 15470af..7737fa7 100644 --- a/test/test_container.hpp +++ b/test/test_container.hpp @@ -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. // (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() ); } - + typename Data::const_iterator db = d.begin(); typename Data::const_iterator da = db++; diff --git a/test/test_macros.hpp b/test/test_macros.hpp index f5a3b62..92b4ddc 100644 --- a/test/test_macros.hpp +++ b/test/test_macros.hpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/treap_multiset_test.cpp b/test/treap_multiset_test.cpp index 80023fb..7f555e4 100644 --- a/test/treap_multiset_test.cpp +++ b/test/treap_multiset_test.cpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/treap_set_test.cpp b/test/treap_set_test.cpp index fcad786..98a9a53 100644 --- a/test/treap_set_test.cpp +++ b/test/treap_set_test.cpp @@ -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. // (See accompanying file LICENSE_1_0.txt or copy at diff --git a/test/unordered_multiset_test.cpp b/test/unordered_multiset_test.cpp index d446bcd..ae52969 100644 --- a/test/unordered_multiset_test.cpp +++ b/test/unordered_multiset_test.cpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (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. // (See accompanying file LICENSE_1_0.txt or copy at @@ -157,7 +157,7 @@ void test_unordered_multiset testset.erase (testset.iterator_to (values[0])); testset.erase (testset.iterator_to (values[1])); testset.insert (values[1]); - + testset.erase (testset.iterator_to (values[2])); testset.erase (testset.iterator_to (values[3])); } @@ -194,7 +194,7 @@ void test_unordered_multiset } testset1.clear(); BOOST_TEST (testset1.empty()); -} +} //test: insert, const_iterator, const_reverse_iterator, erase, iterator_to: template @@ -231,7 +231,7 @@ void test_unordered_multiset i = testset.insert (values[0]); BOOST_TEST (&*i == &values[0]); - + i = testset.iterator_to (values[2]); BOOST_TEST (&*i == &values[2]); testset.erase(i); @@ -275,7 +275,7 @@ void test_unordered_multiset i = testset.insert (values[0]); BOOST_TEST (&*i == &values[0]); - + i = testset.iterator_to (values[2]); BOOST_TEST (&*i == &values[2]); testset.erase(i); @@ -442,7 +442,7 @@ void test_unordered_multiset: // BOOST_TEST (&testset1.front() == &values[3]); BOOST_TEST (&*testset1.begin() == &values[3]); } -} +} @@ -651,7 +651,7 @@ void test_unordered_multiset BOOST_TEST (testset1.size() == values.size()); { int init_values [] = { 1, 2, 2, 3, 4, 5 }; TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); } -} +} //test: find, equal_range (lower_bound, upper_bound): template @@ -682,7 +682,7 @@ void test_unordered_multiset: BOOST_TEST (i->value_ == 2); BOOST_TEST ((++i)->value_ == 2); std::pair 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); diff --git a/test/unordered_set_test.cpp b/test/unordered_set_test.cpp index 15bb230..5cba389 100644 --- a/test/unordered_set_test.cpp +++ b/test/unordered_set_test.cpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (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. // (See accompanying file LICENSE_1_0.txt or copy at @@ -188,11 +188,11 @@ void test_unordered_set:: { int init_values [] = { 1, 2, 3, 4, 5 }; TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); } } - + testset1.clear(); BOOST_TEST (testset1.empty()); -} - +} + //test: insert, const_iterator, const_reverse_iterator, erase, iterator_to: template void test_unordered_set:: @@ -251,7 +251,7 @@ void test_unordered_set:: { int init_values [] = { 1, 3, 5 }; TEST_INTRUSIVE_SEQUENCE( init_values, const_testset.begin() ); } } -} +} //test: insert (seq-version), swap, erase (seq-version), size: template @@ -299,7 +299,7 @@ void test_unordered_set:: BOOST_TEST (testset1.size() == 1); BOOST_TEST (&*testset1.begin() == &values[3]); } -} +} //test: rehash: template @@ -507,7 +507,7 @@ void test_unordered_set:: BOOST_TEST (testset1.size() == values.size()-1); { int init_values [] = { 1, 2, 3, 4, 5 }; TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); } -} +} //test: find, equal_range (lower_bound, upper_bound): @@ -538,7 +538,7 @@ void test_unordered_set:: BOOST_TEST (i->value_ == 2); BOOST_TEST ((++i)->value_ != 2); std::pair 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); diff --git a/test/virtual_base_test.cpp b/test/virtual_base_test.cpp index e146020..1b3c8fa 100644 --- a/test/virtual_base_test.cpp +++ b/test/virtual_base_test.cpp @@ -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. // (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 for(; vect_it != vect_itend; ++vect_it, ++list_it) - if(&*list_it != &*vect_it) + if(&*list_it != &*vect_it) return 1; }