80 Commits

Author SHA1 Message Date
joaquintides
5c17744f34 fixed documentation error 2024-03-15 09:49:30 +01:00
joaquintides
2404754d42 fixed explanatory code as prompted by discussion in #63 2022-08-15 16:31:01 +02:00
joaquintides
7c591a13aa
improved performance of count in ranked indices (#56)
* count for ranked_index uses rank

Normally, count is calculated as the distance between iterators,
which takes linear time when count(x,comp) is comparable with n,
but for ranked indices we can subtract the values or rank,
reducing the complexity from log(n)+count(x,comp) to log(n).

* Added test for new count(x) and count(x,comp) in ranked_index

Both, the existing implementation of count from ordered_index and
the new implementation for ranked_index are compared with the
common sense. Positive results of this test show in particular that
the numbers produced by the new implementation are consistent with
those from the existing implementation and hence correct.

* Benchmark of count(): ordered_index vs ranked_index

A benchmark is added as count_benchmark.cpp in the 'example'
directory.

When the values of an index are unique, both implementations are
comparable (ranked_index is 10-15% faster).

However, for highly non-unique indices (like the age of people),
the new implementation in ranked_index outperforms ordered_index.
For 1 000 people of age in 0..99 ranked_index is ~2x faster,
for 10 000 people it is 12-13x faster, and
for 100 000 people it is 95-100x times faster.

For even more non-unique indices (like sex or the age of pupils)
or coarse comparison predicates (grouping people in age groups
like 0..9, 10..19 etc.) the gap in performance grows further.
For a comparison predicate comparing 'age/10' for age in 0..99,
similar gaps in performance occur already for 10x smaller
containers:
for 100 people count in ranked_index is 2x faster,
for 1 000 people it is ~9x faster,
for 10 000 people it is 95-100x faster,
for 100 000 people it is almost 1000x faster.

* Documentation updated with new complexity of count in ranked_index

* simplified Damian's contribution

* reorganized code

* covered ranked_index::count

* updated docs

Co-authored-by: DamianSawicki <86234282+DamianSawicki@users.noreply.github.com>
2022-02-05 12:59:43 +01:00
joaquintides
7c3cb66008 corrected statements on SCARYness 2021-08-30 20:55:10 +02:00
joaquintides
a52810fc3d
implemented merge operations (#49)
* initial draft

* modified appveyor.yml for this branch

* dropped BOOST_RV_REF
as it doesn't handle lvalue refs

* befriended index_base from all indices
so as to be grant access to final_extract_for_merge_ from an external container

* added rvalue ref merge
(test expected to fail in C++03)

* added explicit boost::move on rvalue ref
for the benefit of C++03 compilers

* fixed previous workaround

* refactored merge algorithm into multi_index_container

* added hashed_index::merge

* reimplemented sequenced_index::splice(position,x)

* added missing this->'s

* refactored SFINAEing code

* made sequenced_index::splice(position,x) exception robust

* reimplemented random_access_index::splice(position,x)

* micro-optimized legacy code in random_access_index::splice(position,x)

* added missing #include

* reimplemented sequenced_index::splice(position,x,i)

* reimplemented random_access_index::splice(position,x,i)

* reimplemented sequenced_index::splice(position,x,first,last)

* reimplemented random_access_index::splice(position,x,first,last)

* re-engineered sequenced_index::splice(position,x,i)
so that it works when source and destination belong to the same container

* stylistic

* re-engineered random_access_index::splice(position,x,i)
so that it works when source and destination belong to the same container

* re-engineered sequenced_index::splice(position,x,first,last)
so that it works when source and destination belong to the same container

* stylistic

* fixed bug in rvalue ref overload of sequenced_index::splice(position,x,first,last)

* fixed internal sequenced_index::splice(position,x,first,last) across different indices

* re-engineered random_access_index::splice(position,x,first,last)
the same way as done with sequenced_index

* replaced multi_index_container::merge_ with transfer_range_
so as to refactor some code in non-key-based indices

* fixed safe mode check for different-type containers

* hardened merge/splice tests

* s/BOOST_RV_REF/BOOST_FWD_REF

* called the right merge_different overload

* fixed problem with Boost.Move C++03 perfect fwd emulation

* updated (C) year

* allowed intra-container full splice

* required position==end() in intra-container full splice

* made pointwise splice return a pair<iterator,bool>

* added partial merge functionality to key-based indices
plus fixed a compile-time error with legacy splice code when applied to different-type indices

* suppressed unused variable

* fixed wrong signature in splice memfun

* made safe-mode iterators SCARY

* refactored any_container_view

* implemented safe iterator transfer in merge/splice

* reorganized internal deps

* stylistic

* automatically checked iterator invalidation upon merge/splice

* removed commented-out code

* checked allocator equality

* reimplemented random_access_index internal, cross-index splice in linear time

* updated docs

* reverted appveyor.yml
2021-08-19 10:41:03 +02:00
joaquintides
5623d2b9e2 added contains (#35) 2021-07-29 12:04:15 +02:00
joaquintides
e69466039d implemented node extraction/insertion (#27) 2020-05-09 20:25:41 +02:00
joaquintides
2374136ea8 clarified documentation on read/write key extractors (#32) 2020-04-19 21:10:57 +02:00
joaquintides
ffbdc49bf2 typos (#32) 2020-04-18 11:59:45 +02:00
joaquintides
a8d34a56f7 made multi_index_container AllocatorAware (#30) 2020-01-26 11:52:23 +01:00
joaquintides
c9a21d79d6 used proper HTLM entities (#31) 2020-01-09 14:56:30 +01:00
joaquintides
e49ae2b4c2 handled volatile/ref-qualified/noexcept memfun key extraction (#24) 2019-06-09 17:32:46 +02:00
joaquintides
18cea285e2 inherited size_type and difference_type from the allocator 2018-12-29 13:06:57 +01:00
joaquintides
fe746a187c documented BOOST_MULTI_INDEX_KEY_SUPPORTED 2018-08-22 11:23:32 +02:00
joaquintides
504574a265 s/·/&middot; 2018-08-18 13:25:00 +02:00
joaquintides
7cc508376c introduced C++17 terse key specification syntax 2018-08-17 13:07:53 +02:00
joaquintides
9623bf0a7d addressed https://svn.boost.org/trac10/ticket/13518 2018-04-13 18:06:55 +02:00
joaquintides
b9a4467f34 addressed https://svn.boost.org/trac/boost/ticket/12542 2017-08-24 23:41:35 +02:00
joaquintides
c055516320 clarified permissible usage of modify functions as per https://svn.boost.org/trac/boost/ticket/11801 2015-11-26 20:29:19 +01:00
joaquintides
62dbfff9c8 typos 2015-11-24 08:47:51 +01:00
joaquintides
096741d58b updated (C) year as per previous commit 2015-11-24 08:36:32 +01:00
zerotypos-found
1db23a5f1c Fix typo in comment and docs. 2015-11-24 12:08:02 +09:00
joaquintides
8ece62829b fixed grammar 2015-05-04 08:18:13 +02:00
joaquintides
cff87caa7c document the fact that deletion in ranked indices is log(n) in contrast with ordered indices where it is constant 2015-04-21 23:08:02 +02:00
joaquintides
d0a7194db7 added ranked indices, plus some doc stylistic updates 2015-04-19 21:10:31 +02:00
joaquintides
6d6bb75504 added interoperability of std::tuples with composite keys 2014-08-20 11:19:40 +02:00
joaquintides
86d7b3ef6e copied content from develop after wrongly made merge 2013-12-25 12:36:32 +01:00
Joaquín M López Muñoz
0bc802ad7d merged [85001], [85004], [85005], [85016], [85017], [85018], [85022], [85028], [85099] and [85100] from trunk
[SVN r85146]
2013-07-24 07:52:40 +00:00
Joaquín M López Muñoz
588e7657f3 merged [57541] and [58472] from trunk
[SVN r58473]
2009-12-21 10:23:36 +00:00
Joaquín M López Muñoz
ff51956131 merged [55055] and [55058] from trunk
[SVN r55081]
2009-07-22 15:16:28 +00:00
Joaquín M López Muñoz
b61b58abfa merged up to rev. 49674 from trunk
[SVN r50300]
2008-12-16 21:00:30 +00:00
Joaquín M López Muñoz
bd8ea1bc86 merged up to rev. 47041 from trunk
[SVN r47045]
2008-07-03 16:51:53 +00:00
Beman Dawes
0468378c0d Full merge from trunk at revision 41356 of entire boost-root tree.
[SVN r41370]
2007-11-25 18:38:02 +00:00
Joaquín M. López Muñoz
0c0acfaa3f merged from trunk to branch
[SVN r34527]
2006-07-13 07:57:18 +00:00
Joaquín M. López Muñoz
d7f2c3606b merged from trunk to branch
[SVN r33734]
2006-04-18 17:01:51 +00:00
Joaquín M. López Muñoz
3a663bd7c4 merged from trunk to branch
[SVN r33545]
2006-04-05 07:28:50 +00:00
Joaquín M. López Muñoz
f1dde3d84e added rearrange facilities; added navigational <link>s; typos
[SVN r32660]
2006-02-06 15:38:39 +00:00
Joaquín M. López Muñoz
f8eb1b16ce added navigational <link>s
[SVN r32659]
2006-02-06 15:36:55 +00:00
Joaquín M. López Muñoz
119d6d4a1c restricted acceptance of chained pointers so as to not mask convertibility to Value; overloaded composite_key_compare::operator() to treat non-tuples as tuples of length 1; added navigational <link>s
[SVN r32658]
2006-02-06 15:35:31 +00:00
Joaquín M. López Muñoz
8682a33fcb new section on index views; added navigational <link>s
[SVN r32657]
2006-02-06 15:33:56 +00:00
Joaquín M. López Muñoz
34da3c9fd5 added random access indices; added navigational <link>s
[SVN r32656]
2006-02-06 15:32:27 +00:00
Joaquín M. López Muñoz
aa5cfdfb3c added random access indices
[SVN r32631]
2006-02-06 14:56:21 +00:00
Joaquín M. López Muñoz
b92f05140b typos and formatting
[SVN r30811]
2005-09-05 08:39:00 +00:00
Joaquín M. López Muñoz
1e00c5139b erase(position) and erase(first,last) now return iterator to following element
[SVN r30722]
2005-08-29 11:51:56 +00:00
Joaquín M. López Muñoz
b3de839dee updated link to TR1 doc; erase(position) and erase(first,last) now return iterator to following element
[SVN r30721]
2005-08-29 11:51:18 +00:00
Joaquín M. López Muñoz
7343ddf980 added statement about iterator/reference stability
[SVN r30621]
2005-08-22 08:39:25 +00:00
Douglas Gregor
b28164d7f8 Merged from 1.33.0 release
[SVN r30540]
2005-08-12 13:02:37 +00:00
Joaquín M. López Muñoz
d4ff4dab15 typo
[SVN r29457]
2005-06-07 06:03:13 +00:00
Joaquín M. López Muñoz
5d4107a5fa "template class" -> "class template"
[SVN r29278]
2005-05-30 06:14:23 +00:00
Joaquín M. López Muñoz
f1176d462b minor reformatting
[SVN r29055]
2005-05-19 06:00:34 +00:00