merged from trunk to branch

[SVN r34022]
This commit is contained in:
Joaquín M. López Muñoz 2006-05-19 06:57:13 +00:00
parent 48764f7801
commit 5c5ca84a23
8 changed files with 49 additions and 34 deletions

View File

@ -135,7 +135,9 @@ Maxim Yegorushkin proposed a valuable
for ordered indices and provided figures of its impact on performance for ordered indices and provided figures of its impact on performance
for containers with large numbers of elements. for containers with large numbers of elements.
Caleb Epstein performed the tests under MSVC++ 8.0 described in the Caleb Epstein performed the tests under MSVC++ 8.0 described in the
performance section. performance section. The following people have reported bugs and problems with
previous versions and prereleases of the library: Alexei Alexandrov, Martin Eigel,
Guillaume Lazzara, Felipe Magno de Almeida, Julien Pervillé, Toby Smith.
</p> </p>
<p> <p>
@ -158,7 +160,7 @@ Index
<br> <br>
<p>Revised February 6th 2006</p> <p>Revised May 10th 2006</p>
<p>&copy; Copyright 2003-2006 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz. <p>&copy; Copyright 2003-2006 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
Distributed under the Boost Software Distributed under the Boost Software

View File

@ -397,9 +397,9 @@ which is functionally equivalent to <code>std::set&lt;int></code>.
<p align="center"> <p align="center">
<table cellspacing="0"> <table cellspacing="0">
<tr> <tr>
<th width="33%">GCC 3.1.1</th> <th width="33%">GCC 3.4.5</th>
<th width="33%">ICC 7.1</th> <th width="33%">ICC 7.1</th>
<th width="33%">MSVC 6.5</th> <th width="33%">MSVC 8.0</th>
</tr> </tr>
<tr> <tr>
<td align="center">80%</td> <td align="center">80%</td>
@ -457,9 +457,9 @@ which is functionally equivalent to <code>std::list&lt;int></code>.
<p align="center"> <p align="center">
<table cellspacing="0"> <table cellspacing="0">
<tr> <tr>
<th width="33%">GCC 3.1.1</th> <th width="33%">GCC 3.4.5</th>
<th width="33%">ICC 7.1</th> <th width="33%">ICC 7.1</th>
<th width="33%">MSVC 6.5</th> <th width="33%">MSVC 8.0</th>
</tr> </tr>
<tr> <tr>
<td align="center">100%</td> <td align="center">100%</td>
@ -512,9 +512,9 @@ The following instantiation of <code>multi_index_container</code> was tested:
<p align="center"> <p align="center">
<table cellspacing="0"> <table cellspacing="0">
<tr> <tr>
<th width="33%">GCC 3.1.1</th> <th width="33%">GCC 3.4.5</th>
<th width="33%">ICC 7.1</th> <th width="33%">ICC 7.1</th>
<th width="33%">MSVC 6.5</th> <th width="33%">MSVC 8.0</th>
</tr> </tr>
<tr> <tr>
<td align="center">70%</td> <td align="center">70%</td>
@ -568,9 +568,9 @@ The following instantiation of <code>multi_index_container</code> was tested:
<p align="center"> <p align="center">
<table cellspacing="0"> <table cellspacing="0">
<tr> <tr>
<th width="33%">GCC 3.1.1</th> <th width="33%">GCC 3.4.5</th>
<th width="33%">ICC 7.1</th> <th width="33%">ICC 7.1</th>
<th width="33%">MSVC 6.5</th> <th width="33%">MSVC 8.0</th>
</tr> </tr>
<tr> <tr>
<td align="center">75%</td> <td align="center">75%</td>
@ -631,9 +631,9 @@ The following instantiation of <code>multi_index_container</code> was tested:
<p align="center"> <p align="center">
<table cellspacing="0"> <table cellspacing="0">
<tr> <tr>
<th width="33%">GCC 3.1.1</th> <th width="33%">GCC 3.4.5</th>
<th width="33%">ICC 7.1</th> <th width="33%">ICC 7.1</th>
<th width="33%">MSVC 6.5</th> <th width="33%">MSVC 8.0</th>
</tr> </tr>
<tr> <tr>
<td align="center">66.7%</td> <td align="center">66.7%</td>
@ -685,9 +685,9 @@ The following instantiation of <code>multi_index_container</code> was tested:
<p align="center"> <p align="center">
<table cellspacing="0"> <table cellspacing="0">
<tr> <tr>
<th width="33%">GCC 3.1.1</th> <th width="33%">GCC 3.4.5</th>
<th width="33%">ICC 7.1</th> <th width="33%">ICC 7.1</th>
<th width="33%">MSVC 6.5</th> <th width="33%">MSVC 8.0</th>
</tr> </tr>
<tr> <tr>
<td align="center">69.2%</td> <td align="center">69.2%</td>
@ -749,7 +749,7 @@ Examples
<br> <br>
<p>Revised February 6th 2006</p> <p>Revised May 9th 2006</p>
<p>&copy; Copyright 2003-2006 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz. <p>&copy; Copyright 2003-2006 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
Distributed under the Boost Software Distributed under the Boost Software

View File

@ -1,6 +1,6 @@
/* Boost.MultiIndex example of member functions used as key extractors. /* Boost.MultiIndex example of member functions used as key extractors.
* *
* Copyright 2003-2005 Joaquín M López Muñoz. * Copyright 2003-2006 Joaquín M López Muñoz.
* 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
* http://www.boost.org/LICENSE_1_0.txt) * http://www.boost.org/LICENSE_1_0.txt)
@ -29,8 +29,8 @@ using namespace boost::multi_index;
struct name_record struct name_record
{ {
name_record(std::string given_name,std::string family_name): name_record(std::string given_name_,std::string family_name_):
given_name(given_name),family_name(family_name) given_name(given_name_),family_name(family_name_)
{} {}
std::string name()const std::string name()const

View File

@ -1,6 +1,6 @@
/* Boost.MultiIndex example of serialization of a MRU list. /* Boost.MultiIndex example of serialization of a MRU list.
* *
* Copyright 2003-2005 Joaquín M López Muñoz. * Copyright 2003-2006 Joaquín M López Muñoz.
* 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
* http://www.boost.org/LICENSE_1_0.txt) * http://www.boost.org/LICENSE_1_0.txt)
@ -50,7 +50,7 @@ public:
typedef Item item_type; typedef Item item_type;
typedef typename item_list::iterator iterator; typedef typename item_list::iterator iterator;
mru_list(std::size_t max_num_items):max_num_items(max_num_items){} mru_list(std::size_t max_num_items_):max_num_items(max_num_items_){}
void insert(const item_type& item) void insert(const item_type& item)
{ {

View File

@ -37,14 +37,14 @@ public:
typedef const typename Node::value_type& reference; typedef const typename Node::value_type& reference;
typedef std::forward_iterator_tag iterator_category; typedef std::forward_iterator_tag iterator_category;
duplicates_iterator(Node* node,Node* end,Predicate pred): duplicates_iterator(Node* node_,Node* end_,Predicate pred_):
node(node),begin_chunk(0),end(end),pred(pred) node(node_),begin_chunk(0),end(end_),pred(pred_)
{ {
advance(); advance();
} }
duplicates_iterator(Node* end,Predicate pred): duplicates_iterator(Node* end_,Predicate pred_):
node(end),begin_chunk(end),end(end),pred(pred) node(end_),begin_chunk(end_),end(end_),pred(pred_)
{ {
} }

View File

@ -95,7 +95,7 @@ struct ordered_index_node_compressed_base
{ {
struct color_ref struct color_ref
{ {
color_ref(uintptr_type* r):r(r){} color_ref(uintptr_type* r_):r(r_){}
operator ordered_index_color()const operator ordered_index_color()const
{ {
@ -120,7 +120,7 @@ struct ordered_index_node_compressed_base
struct parent_ref struct parent_ref
{ {
parent_ref(uintptr_type* r):r(r){} parent_ref(uintptr_type* r_):r(r_){}
operator ordered_index_node_impl*()const operator ordered_index_node_impl*()const
{ {

View File

@ -1051,17 +1051,18 @@ private:
void rearranger(node_type* position,node_type *x) void rearranger(node_type* position,node_type *x)
{ {
if(!position)position=lower_bound(key(x->value())).get_node(); if(!position||comp(key(position->value()),key(x->value()))){
position=lower_bound(key(x->value())).get_node();
}
else if(comp(key(x->value()),key(position->value()))){
/* inconsistent rearrangement */
throw_exception(
archive::archive_exception(
archive::archive_exception::other_exception));
}
else node_type::increment(position); else node_type::increment(position);
if(position!=x){ if(position!=x){
/* check the rearrangement is consistent */
if(!in_place(x->value(),position,Category())){
throw_exception(
archive::archive_exception(
archive::archive_exception::other_exception));
}
ordered_index_node_impl::rebalance_for_erase( ordered_index_node_impl::rebalance_for_erase(
x->impl(),header()->parent(),header()->left(),header()->right()); x->impl(),header()->parent(),header()->left(),header()->right());
ordered_index_node_impl::restore( ordered_index_node_impl::restore(

View File

@ -143,6 +143,18 @@ void test_serialization2()
m.insert(pair_of_ints(11,1)); m.insert(pair_of_ints(11,1));
m.insert(pair_of_ints(10,1)); m.insert(pair_of_ints(10,1));
test_serialization(m); test_serialization(m);
/* testcase for bug reported at
* http://lists.boost.org/boost-users/2006/05/19362.php
*/
m.clear();
m.insert(pair_of_ints(0,0));
m.insert(pair_of_ints(1,0));
m.insert(pair_of_ints(2,1));
m.insert(pair_of_ints(4,2));
m.insert(pair_of_ints(3,2));
test_serialization(m);
} }
test_hashed_index_serialization(); test_hashed_index_serialization();
} }