Compare commits

...

546 Commits

Author SHA1 Message Date
ead855f4f3 Rework as esp-idf component 2023-11-23 17:17:05 +01:00
d6e0a32f2e Merge pull request #131 from BenjaminRodenberg/patch-1
Fix typo
2022-01-23 09:01:28 -05:00
95095cf4bb Fix typo 2022-01-23 12:53:11 +01:00
88c6199aed Merge branch 'master' into develop 2021-05-29 01:02:17 +03:00
fd40a25fea Add CMakeLists.txt 2021-03-18 17:28:05 +02:00
da69f60d3e Merge pull request #120 from eldiener/develop
[skip ci] Add "cxxstd" json field
2021-01-21 09:13:11 +00:00
6fc6e92adc [skip ci] Add "cxxstd" json field. The "cxxstd" json field is being added to each Boost library's meta json information for libraries in order to specify the minumum C++ standard compilation level. The value of this field matches one of the values for 'cxxstd' in Boost.Build. The purpose of doing this is to provide information for the Boost website documentation for each library which will specify the minimum C++ standard compilation that an end-user must employ in order to use the particular library. This will aid end-users who want to know if they can successfully use a Boost library based on their C++ compiler's compilation level, without having to search the library's documentation to find this out. 2021-01-21 03:20:56 -05:00
e13030df17 Merge pull request #117 from Mike-Devel/patch-1
Replace include of outdated boost/cast.hpp header
2020-12-12 09:21:49 -05:00
6776ffa8e8 Replace incldue of outdated boost/cast.hpp header
- Instead include `boost/polymorphic_cast.hpp` directly.
- This replaces the direct dependency of Boost.Range on Boost.NumericConversion with a direct dependency on Boost.Conversion
2020-11-19 14:25:21 +01:00
000b4882aa Merge branch 'develop' 2020-11-03 07:32:17 -05:00
486c74fbeb No longer include the deprecated headers in metafunctions.hpp 2020-09-12 07:48:06 -04:00
f3ff60c3bc Merge branch 'develop' 2020-06-24 19:44:12 +01:00
72e2a4457a Merge pull request #69 from cwecht/unique_erase
Added boost::unique_erase
2020-05-11 19:05:31 +01:00
bb27d50b31 Merge pull request #84 from cekc/patch-1
add std::tuple_element and std::tuple_size specializations for index_value
2020-05-11 19:05:06 +01:00
5572b24a71 Merge pull request #101 from Kojoley/deprecated-headers-compile-time-warning
Add compile-time warning to deprecated headers
2020-05-11 19:04:30 +01:00
b42165a916 Merge pull request #102 from Kojoley/combine-remove-unused-includes-and-code
combine: remove unused includes and code
2020-05-11 19:04:10 +01:00
9a2960f01b Merge pull request #104 from eldiener/develop
Changes for Embarcadero C++ clang-based compilers, targeting Boost 1.74. Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost conf…
2020-05-11 13:00:07 -04:00
4ed7887128 Merge pull request #105 from Lastique/fix_deprecated_headers
Fix usage of deprecated headers
2020-05-11 12:59:37 -04:00
ee1ec1cf57 Fix deprecated usage of boost/bind.hpp.
boost/bind.hpp emits compiler warnings about deprecation of the header
and global _N placeholders. This commit converts usage of this header
to boost/bind/bind.hpp and using namespace boost::placeholders.

Where boost::bind is not actually used, the includes are removed.
2020-05-11 19:26:26 +03:00
3b04f1a65e Remove uses of deprecated header boost/detail/iterator.hpp.
This header was deprecated in favor of <iterator>. It generates compiler
warnings and will be removed in a future release.
2020-05-11 19:13:20 +03:00
45d3aae111 Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost config for the Embarcadero non-clang-based compilers. 2020-03-31 16:55:55 -04:00
0e8ad01bf9 combine: remove unused includes and code 2020-03-01 18:03:19 +03:00
c25b0e5069 Add compile-time warning to deprecated headers 2020-02-13 18:29:06 +03:00
994ff83292 Merge pull request #95 from mjendruk/fix-lower-upper-bound-taking-argument-by-value
Make lower_bound and upper_bound take argument by const reference
2020-02-13 09:38:29 +00:00
77e5b868a0 Merge pull request #97 from Kojoley/remove-broken-no_function_template_ordering-support
Remove broken BOOST_NO_FUNCTION_TEMPLATE_ORDERING workaround
2020-02-13 09:37:35 +00:00
474efda11a Merge pull request #94 from mjendruk/fix-any-range-non-reference-references
Fix any_range with non-reference references can cause UB
2020-02-13 09:36:50 +00:00
f1215fbda2 Remove broken BOOST_NO_FUNCTION_TEMPLATE_ORDERING workaround
The workaround seems to be broken for a while, no compilers with that bug are
tested/supported, and there is no complaint whatsoever, not even on trac.
2019-09-28 01:11:01 +03:00
5f04231144 Make lower_bound and upper_bound take argument by const reference 2019-05-31 16:06:46 +02:00
4e0b172a23 Merge branch 'fix-any-range-non-reference-references' of https://github.com/mjendruk/range into fix-any-range-non-reference-references
# Conflicts:
#	include/boost/range/detail/any_iterator_interface.hpp
2019-05-31 10:46:51 +02:00
21a06a93aa Replace decay with remove_reference / remove_const 2019-05-31 10:46:04 +02:00
6b3750f209 Remove unused include 2019-05-08 22:43:09 +02:00
1bf2db29c0 Replace is_copy_constructible and is_abstract with is_convertible 2019-05-08 17:21:45 +02:00
9f03cc44d8 Add is_copy_constructible for >= C++11 2019-05-08 09:58:37 +02:00
911d8a427d Add result_type typedef in tests 2019-05-07 17:17:50 +02:00
3496282d3b Remove usage of initializer_list in test 2019-05-07 17:01:02 +02:00
ce24356018 Replace is_copy_constructible with is_abstract (for pre C++11) 2019-05-07 15:03:56 +02:00
dbb6ef424f Fix any_range with non-reference references can cause UB 2019-05-07 12:06:05 +02:00
77a4dd5124 Merge pull request #91 from glenfe/develop
Implement min_element and max_element and sever algorithm dependency
2019-04-23 09:13:53 +10:00
4ec46acdf5 Implement min_element and max_element and sever algorithm dependency 2019-04-22 18:20:35 -04:00
cecebeea51 Merge pull request #77 from MBoldyrev/MBoldyrev-doc-fix-var-name
fixed variable name in docs
2019-04-02 08:40:20 -04:00
802fda6701 Merge pull request #85 from Eelis/patch-1
Fix function name in remove_if documentation
2019-04-02 08:39:11 -04:00
4ad147a220 Fix function name in remove_if documentation 2019-03-08 17:59:18 +01:00
221ae46c2b add std::tuple_element and std::tuple_size specializations for index_value
To make index_value work with structured bindings
https://wandbox.org/permlink/gsveiKdAamnEbOKM
2019-02-25 18:35:53 +03:00
eced0cfac8 fixed variable name in docs 2018-10-14 19:24:57 +03:00
9f94c8703b Merge branch 'develop' 2018-10-01 15:42:04 +03:00
023f45be01 Remove constexpr from begin/end on g++ 4.6 as it doesn't like it 2018-09-30 01:34:50 +03:00
364f755d99 Use boost::declval, as g++ 4.4 has decltype but no std::declval 2018-09-30 01:11:12 +03:00
af9f65e06e Add g++-4.4, g++-4.6 to Travis 2018-09-29 17:34:43 +03:00
b91cb90dca Make min/max engine members constexpr in random_shuffle.hpp 2018-09-24 02:26:50 +03:00
7efe3c68f6 Fix msvc-10.0, msvc-11.0 failures in ref_unwrapped tests 2018-09-24 02:21:55 +03:00
357bf3b980 Merge pull request #75 from morinmorin/add_adl_barrier_to_distance
Add ADL guard namespace for boost::distance(rng)
2018-09-23 20:08:55 +03:00
9192996a93 Add ADL guard namespace for boost::distance(rng). 2018-09-23 21:45:30 +09:00
4cfd4d8287 Merge branch 'develop' 2018-07-12 16:59:32 +03:00
70d1727ed3 Merge pull request #71 from boostorg/pr/concepts-msvc-permissive-2
Change RandomAccessIteratorConcept to BidirectionalIteratorConcept to…
2018-07-10 12:02:41 +01:00
406226eccd Change RandomAccessIteratorConcept to BidirectionalIteratorConcept to work around a MSVC bug 2018-07-10 13:12:55 +03:00
05532829bd Merge pull request #70 from boostorg/pr/concepts-msvc-permissive-
Remove ill-formed MSVC-specific code that doesn't compile with /permi…
2018-07-09 20:19:38 +01:00
c24661a636 Remove ill-formed MSVC-specific code that doesn't compile with /permissive- 2018-07-09 20:41:33 +03:00
11dd528eb0 added unique_erase 2018-04-24 16:29:31 +02:00
314b5d6b3c Merge branch 'develop' 2018-04-18 11:04:16 +01:00
4dd5ad0f64 Merge pull request #65 from VeroSoftware/develop
Fix Error C4596: 'difference_type': illegal qualified name in member declaration
2018-04-06 14:58:20 +01:00
f1906e914e use _MSC_VER to guard fix for C4596 when compiling with MSVC141 2018-02-28 13:43:34 +00:00
795046f8fc Fix Error C4596: 'difference_type': illegal qualified name in member declaration when compiling with VS 2017 Professional 15.5.6 2018-02-28 10:55:24 +00:00
2aaa802e6a Merge pull request #64 from boostorg/revert-54-push_back_move_support
Revert "push_back: added support for not-copyable but moveable value-types li…"
2018-01-03 14:39:46 +00:00
5b2500872d Revert "push_back: added support for not-copyable but moveable value-types li…" 2018-01-03 14:36:50 +00:00
b1d5d23514 Add quick test target (for CI) 2017-12-18 21:14:16 +02:00
aaebfa5b20 Include boost/next_prior.hpp where needed
A recent change to boost/utility.hpp removed the include of this header,
so now it's needed for boost::prior and boost::next.

b74f49f1e5
2017-12-18 21:14:06 +02:00
95a62a3b3a Split Travis jobs to avoid timeout 2017-12-03 15:16:45 +02:00
67929cd7df Add .travis.yml 2017-12-03 15:16:25 +02:00
5408f220dd Split Travis jobs to avoid timeout 2017-12-03 03:16:30 +02:00
937a411c3f Add .travis.yml 2017-12-02 19:17:02 +02:00
1dac6a796e Add quick test target (for CI) 2017-12-02 19:10:56 +02:00
1234c59a39 Merge pull request #61 from danieljames/develop
Include boost/next_prior.hpp where needed
2017-12-02 16:00:35 +02:00
e0d2e492a1 Include boost/next_prior.hpp where needed
A recent change to boost/utility.hpp removed the include of this header,
so now it's needed for boost::prior and boost::next.

b74f49f1e5
2017-12-02 10:40:16 +00:00
619c074146 Merge pull request #58 from boostorg/revert-45-develop
Revert "Update irange.hpp"
2017-11-15 23:22:00 +00:00
4614777aaf Revert "Update irange.hpp" 2017-11-15 23:21:32 +00:00
83a352fa58 Merge pull request #45 from mateuszlewko/develop
Update irange.hpp
2017-11-15 19:52:41 +00:00
0e0d77cfab Merge pull request #56 from tonyelewis/add_const_to_adj_filt_rng
Add missing const to adjacent_filtered_range
2017-11-15 19:51:18 +00:00
d1f36fba8d Merge pull request #54 from cwecht/push_back_move_support
push_back: added support for not-copyable but moveable value-types li…
2017-11-15 19:51:00 +00:00
4283443532 Merge pull request #57 from jeanphilippeD/fix_transformed_test
Fix transformed test compile error on GCC 5.4
2017-11-15 19:49:05 +00:00
3771624560 Merge pull request #43 from timblechmann/topic/unary-irange
irange: introduce one-parameter variant of irange
2017-11-15 19:48:19 +00:00
4a729678fd Fix transformed test compile error on GCC 5.4
The function object 'lambda' did not provide result_type like the other
function objects did.

The test now compile and pass using'b2'
2017-09-24 14:13:42 +01:00
dfa3697764 Add missing const to adjacent_filtered_range 2017-09-14 20:07:07 +01:00
efdd98332b Qualify boost::search in test/algorithm to avoid ambiguity with C++17's std::search 2017-09-10 03:03:16 +03:00
8b98b696ff Qualify boost::search in test/algorithm to avoid ambiguity with C++17's std::search 2017-09-10 03:01:13 +03:00
97951d2a8b Fix test compilation
boost::detail::iterator_traits was used without including the necessary header
file. It's deprecated anyway and only maps to std::iterator_traits. Also,
utility was missing for std::pair.
2017-09-10 02:21:53 +03:00
efa2dc71f9 Fix compilation
boost::detail::iterator_traits was used without including the necessary header file. It's deprecated anyway and only maps to std::iterator_traits.
2017-09-09 23:37:16 +03:00
d99628981d push_back: added support for not-copyable but moveable value-types like e.g. unique_ptr 2017-09-01 17:53:46 +02:00
e65434eb4f Merge pull request #53 from morinmorin/fix_c++03_breakage
Fix breakage in replaced adaptor for C++03
2017-07-12 14:18:05 +01:00
93513a3801 Make rng | replaced_if consistent with rng | replaced 2017-07-12 22:08:22 +09:00
93eb91e63e Fix breakage in replaced adaptor for C++03 2017-07-12 22:06:58 +09:00
f3a4246bd9 Merge pull request #48 from t-wynants/fix-ticket-12754-sfinae-friendly-overload
Ticket 12754 - sfinea friendly boost::range_details::replace_holder overloads
2017-06-30 12:45:34 +01:00
796080bbb8 Merge pull request #46 from jeanphilippeD/lambda_copy_transform_it
Allow iterator copy for lambda in transformed and filtered
2017-06-30 12:43:38 +01:00
370f1a4cd2 Merge pull request #51 from DanielaE/feature/replace-removed-c++98-stuff
Conditionally replace deprecated/removed C++98 function adapters and …
2017-06-30 12:42:59 +01:00
7d564572e2 Merge pull request #50 from orgads/patch-1
Fix broken link in overview
2017-06-30 12:42:41 +01:00
9afc3bcbe2 Merge pull request #52 from morinmorin/use_boost_distance_from_iterator_lib
Make boost::distance traversal-category-aware (and constexpr in C++14)
2017-06-30 12:40:18 +01:00
69409ed63a Make boost::distance traversal-category-aware (and constexpr in C++14) 2017-06-30 20:02:53 +09:00
23e5801e2a Conditionally replace deprecated/removed C++98 function adapters and std::random_shuffle by equivalents.
Signed-off-by: Daniela Engert <dani@ngrt.de>
2017-05-05 14:15:11 +02:00
e476e1900a Fix broken link in overview 2017-05-03 10:18:25 +03:00
452b1bb7e7 Merge pull request #44 from apolukhin/develop
Added BOOST_CONSTEXPR for begin()/end()
2017-04-17 14:39:19 +01:00
7b89c747d6 Ticket 12754 - operator| overload for boost::range_details::replace_holder is not SFINEA friendly
include\boost\range\adaptor\replaced.hpp

Make sure that the overload resolution doesn't choke on the value type factory when its considers the overload
2017-01-12 17:45:31 +01:00
deb3ae9800 Merge branch 'master' into develop 2016-11-26 22:45:08 -08:00
56d470635d Qualify call to boost::size to avoid ambiguity with std::size 2016-11-26 22:44:31 -08:00
5c70a54597 Merge branch 'master' into develop 2016-11-23 14:56:09 -08:00
f829c55c72 Merge pull request #47 from boostorg/fix-boost-size_type
Don't assume that because type `T` is a range that `const T` is also a range.
2016-11-23 14:54:26 -08:00
910fc7bf82 Qualify call to boost::size to avoid ambiguity with std::size 2016-11-23 14:47:42 -08:00
67c18ac1f1 Merge remote-tracking branch 'origin/master' into develop 2016-11-18 21:28:24 -08:00
5787c56994 Merge pull request #47 from boostorg/fix-boost-size_type
Don't assume that because type `T` is a range that `const T` is also a range.
2016-11-18 12:06:32 -08:00
9e5680b590 Don't assume that because type T is a range that const T is also a range.
size_type<const T> erroneously dispatches to detail::size_type_<T>. That breaks for types that have non-const begin/end but that don't have const begin/end. The range-v3 library has such types.
2016-11-18 11:50:32 -08:00
1b4f8100ef Allow iterator copy for lambda in transformed and filtered
Lambda has no default constructor nor a copy or move assignment.

range\test\adaptors.cpp is checking that produced ranges are copiable,
but it is not doing so the for lambda, or lambda like objects.

default_constructible_unary_fn uses an optional for default
construction.
I extended it to use its emplace facility to copy assign non copy
assignable types.
(see boost::optional 'Type Requierment':  'If T is not MoveAssignable,
it is still possible to reset the value of optional<T> using function
emplace():')
2016-10-23 23:27:31 +01:00
7567dce0c1 Add, and update, documentation build targets. 2016-10-10 11:39:52 -05:00
e48b9c38e7 Add, and update, documentation build targets. 2016-10-07 23:07:36 -05:00
283b8beddc Update irange.hpp
Added: irange(int last), irange(int first, int last)
2016-04-09 19:32:22 +02:00
4ce15f9b52 Added BOOST_CONSTEXPR for begin()/end() 2016-01-24 22:51:19 +03:00
bb43887430 irange: introduce one-parameter variant of irange
this simplifies the use of boost::irange, as boost::irange( 0, foo );
may compile or not depending on the platform-specific integer type of
foo, requiring an explicit cast of 0 to decltype(foo).
2016-01-17 11:40:55 +01:00
5a37aa4e98 Merge pull request #41 from robin-eckert/adaptor_ref_unwrapped
add a new range adaptor boost::adaptors::ref_unwrapped
2016-01-04 16:38:36 +00:00
0e931f4a80 Merge pull request #33 from tobias-loew/master
Ticket #10397 - compilation error with mfc-iteratior-support: ambiguous symbol
2016-01-04 16:37:18 +00:00
5196baa1b0 Merge pull request #42 from rydotyosh/patch-1
[range] fixed minor typo in docs
2016-01-04 16:36:58 +00:00
1947daf1b5 Merge pull request #39 from MarcelRaad/fix_iterator_pair_test
Fix test compilation
2016-01-04 16:36:42 +00:00
7ca999c662 [range] fixed minor typo in docs 2015-11-14 15:41:48 +09:00
e7ebe14707 Merge pull request #40 from treh/treh-patch-1
qualify boost::range_[const|mutable]_iterator
2015-11-05 11:42:43 +00:00
3225aaf82b add a new range adaptor boost::adaptors::ref_unwrapped
The new adaptor is like boost::adaptors::indirected, but for
std::reference_wrapper values (instead of pointer). It calls
.get() on every value and returns the result. It is useful for
range-based iteration of ranges of std::reference_wrapper (or
related) types.
2015-11-04 19:12:26 +01:00
262c0f96b3 qualify boost::range_[const|mutable]_iterator
otherwise boost::range_detail::range_[const|mutable]_iterator gets accidentily called
2015-11-04 09:58:15 +01:00
1a3aeeb336 Fix test compilation
boost::detail::iterator_traits was used without including the necessary header
file. It's deprecated anyway and only maps to std::iterator_traits. Also,
utility was missing for std::pair.
2015-09-22 00:51:41 +02:00
78a8f5bf3d Merge pull request #38 from MarcelRaad/patch-1
Fix compilation
2015-09-18 09:08:01 +01:00
9bf860fd30 Fix compilation
boost::detail::iterator_traits was used without including the necessary header file. It's deprecated anyway and only maps to std::iterator_traits.
2015-09-18 09:54:08 +02:00
64c83341ab Merge pull request #37 from mclow/develop
Remove use of deprecated macros
2015-09-13 21:52:09 +01:00
6241dc62aa Remove use of deprecated macros 2015-09-11 15:16:24 -07:00
f83381d938 Merge pull request #36 from morinmorin/fix/ticket11563
Fix ticket 11563 (boost::range behavior changed from 1.55 to 1.56)
2015-09-07 07:45:08 +01:00
926318105e Merge pull request #35 from morinmorin/fix/credit_in_trac5014
Fix credit in ticket 5014 testcase
2015-09-07 07:44:51 +01:00
140866b402 Merge pull request #34 from morinmorin/fix/ticket11528
Fix ticket 11528 (MSVS 2015 + boost::range: STL and Boost iterators)
2015-09-07 07:44:35 +01:00
490ba3fdcd Reapply r85400 (this time use Iterator1 instead of Iterator2 as per r85691) and enhance the testcase; fixes ticket 11563. 2015-08-21 21:40:25 +09:00
e4f456d438 Fix credit in ticket 5014 testcase 2015-08-20 20:36:19 +09:00
adcb071dc6 Replace std::min_element/max_element with boost::first_min_element/first_max_element to accept a range that models ForwardRange but its underlying iterator models only InputIterator; fixes ticket 11528. 2015-08-20 20:03:08 +09:00
4f66482414 Ticket #10397 - compilation error with mfc-iteratior-support: ambiguous symbol
fixed compilation error for mfc-iteration-support

changed
boost::range_detail::range_const_iterator
to
boost::range_detail::range_const_iterator_helper

to address compilation error when using mfc-iteration-support
2015-08-12 15:32:31 +02:00
7fad9837fb Merge pull request #32 from mclow/develop
Add char16_t and char32_t to the list of literal string types. Fixes …
2015-05-13 12:23:39 +01:00
11dbb1cb5a Add char16_t and char32_t to the list of literal string types. Fixes bug 11265 in Boost.StringAlgo's join. 2015-05-12 21:26:05 -06:00
e961e66909 Merge pull request #26 from Yasami/develop
fix missing return statement
2015-04-27 19:51:18 +01:00
8847fd63cb Merge pull request #30 from nekko1119/pr-fix-doc
Fix parameters in replaced adaptor document
2015-04-27 19:50:57 +01:00
62941f740d Merge pull request #31 from eldiener/develop
Use operator || rather than boost::mpl::or_ for constant boolean exprtession.
2015-04-27 19:49:28 +01:00
0c930a3697 Fix syntax error. 2015-04-27 14:06:59 -04:00
09084d6355 Use || operator instead of boost::mpl::or_ for constant boolean value since current Boost compilers all support operator use. 2015-04-27 13:18:48 -04:00
9ca1622dd0 Fix parameters in replaced adaptor document 2015-04-22 02:48:05 +09:00
7669f52547 Merge branch 'develop' 2015-04-21 08:22:15 +01:00
c6c4a8f3c1 Merge pull request #29 from ericniebler/develop
fix build break on msvc-8.0
2015-04-19 13:28:52 -07:00
3d5f3611ba fix build break on msvc-8.0 2015-04-18 11:42:38 -07:00
8c1180f7f2 Merge pull request #27 from eldiener/develop
Remove dependency on type traits ice_xxx.hpp headers, which are deprecat...
2015-04-14 09:27:05 +01:00
8ea11f9281 Merge pull request #28 from ericniebler/develop
make range_iterator, range_difference, and range_size SFINAE-friendly, r...
2015-04-14 09:26:35 +01:00
811b27141a make range_iterator, range_difference, and range_size SFINAE-friendly, refs #11187 2015-04-14 00:57:54 -07:00
a53bd134b2 Remove dependency on type traits ice_xxx.hpp headers, which are deprecated. 2015-04-02 01:54:45 -04:00
0b28fd043f Fix for MSVC subrange iterator conversions. 2015-02-09 01:21:16 +00:00
474c62ab16 fix missing return statement 2015-02-04 15:52:15 +09:00
de206a64db ticket10514 subrange unit test added. 2015-02-02 20:26:31 +00:00
435ca994bf Ticket 10989 - strided adapter category. 2015-02-02 20:17:04 +00:00
4a80ccd50d Ticket 10988 - Filtered adaptor should only require SinglePassRange. 2015-02-01 19:05:58 +00:00
6f11252633 Ticket 10336 - unit test added. 2015-01-31 14:50:58 +00:00
2356783e17 Merge branch 'develop'
Conflicts:
	include/boost/range/detail/any_iterator.hpp
	test/iterator_range.cpp
2015-01-31 13:38:08 +00:00
688d1bc418 Update inclusion of polymorphic_cast.hpp to cat.hpp 2015-01-31 13:31:33 +00:00
dcbe4f9365 Merge pull request #21 from Lastique/patch-1
Use public interface of Boost.Iterator
2015-01-25 19:15:31 +00:00
9b3a21b5e3 Merge pull request #25 from levinmk/master
fix ticket #10754
2015-01-25 19:15:05 +00:00
e362bb1855 Merge pull request #20 from danieljames/metadata
Create metadata file.
2015-01-25 20:30:52 +02:00
1965b797d8 fix ticket #10754
as described in https://svn.boost.org/trac/boost/ticket/10754, postfix_increment_proxy and writable_postfix_increment_proxy were moved to boost::iterators::detail namespace
2014-12-12 16:43:32 -06:00
4f3bdbe4d3 Merge pull request #24 from steveire/remove-algorithm-dep
Remove algorithm dep
2014-09-25 01:12:32 +01:00
8bb3a85f68 Use local sfinae typedefs for yes_type and no_type.
Remove dependency on Boost.Algorithm library.
2014-09-10 15:37:48 +02:00
0e9a9e613b Rely on the 'typename' keyword from the compiler.
Remove trailing whitespace from modified lines.

 git grep -l BOOST_STRING_TYPENAME | xargs sed -i 's|BOOST_STRING_TYPENAME *$|typename|'
 git grep -l BOOST_STRING_TYPENAME | xargs sed -i 's|BOOST_STRING_TYPENAME \(.*\) +$|typename \1|'
 git grep -l BOOST_STRING_TYPENAME | xargs sed -i 's|BOOST_STRING_TYPENAME|typename|'

Remove include of header from Boost.Algorithm library providing the define.
2014-09-10 15:37:45 +02:00
18e5bfd037 Merge pull request #22 from insideoutclub/develop
Update algorithms.qbk
2014-09-05 13:47:21 -04:00
51b8115fc1 Update algorithms.qbk
Fixed the spelling of "old-fashioned".
2014-09-05 10:34:21 -07:00
4617c43b5e Use public interface of Boost.Iterator 2014-08-30 16:04:46 +04:00
a58e59ec67 Add metadata file. 2014-08-18 15:09:55 +01:00
470a28ecb6 replace =default in test to fix iterator_range.cpp unit test regression with older compilers. 2014-08-15 12:26:30 +01:00
1e509e6749 Merge pull request #19 from ericniebler/develop
Possible fix for iterator_range SFINAE bug
2014-08-10 17:07:10 +01:00
7d13f63d5d avoid SFINAE problem in iterator_range constructor 2014-08-09 14:48:57 -07:00
d6bce30c4f Merge remote-tracking branch 'origin/develop' into develop 2014-08-09 12:30:26 -07:00
b0b08e0039 Add upgrade documentation about pop_front() and pop_back() being renamed. 2014-08-04 22:06:25 +01:00
c865de5aa6 Hotfix to add back advance_begin and advance_end. 2014-08-04 22:06:11 +01:00
dc0a6b6340 Add upgrade documentation about pop_front() and pop_back() being renamed. 2014-08-04 19:32:37 +01:00
7fb879a283 Hotfix to add back advance_begin and advance_end. 2014-08-04 17:53:14 +01:00
af2f17ccc5 Merge pull request #18 from ericniebler/master
attempted fix for iterator_range relational operators bug
2014-07-30 09:11:20 -07:00
4716c1efec Merge pull request #16 from ericniebler/develop
attempted fix for iterator_range relational operators bug
2014-07-30 07:53:31 -07:00
9d8034d541 Merge remote-tracking branch 'origin/develop' into develop 2014-07-29 19:35:26 -07:00
48dfb68045 Merge pull request #17 from ericniebler/iterators-namespace
accomodate new boost::iterators namespace.
2014-07-29 18:21:34 -07:00
1617a513d2 accomodate new boost::iterators namespace. See boostorg/iterator@dc96d371fa 2014-07-29 18:18:02 -07:00
c2a7ac4197 attempted fix for iterator_range relational operators bug 2014-07-29 17:53:27 -07:00
1e25d862bc Merge branch 'master' into develop 2014-07-22 09:37:16 -07:00
8a8b511109 remove executable bit on range.hpp 2014-07-22 09:36:52 -07:00
1fd0ded6b1 merge back from master 2014-07-22 09:36:01 -07:00
fbf91ce2da add missing inline keyword 2014-07-22 09:21:24 -07:00
edc7bb5fd9 add missing inline keyword 2014-07-22 09:19:52 -07:00
0ffe40272a Merge branch 'develop' - to incorporate the MSVC workaround for range_iterator by Eric Niebler. 2014-07-15 10:32:55 +01:00
7896e79373 Merge branch 'ericniebler-develop' into develop 2014-07-15 10:06:19 +01:00
d6dd1ad193 work-around for msvc limitation that causes has_iterator<> to fail for structs named iterator. Only applies to msvc-10.0 and earlier. 2014-07-14 00:03:45 -07:00
cf6fabe950 Merge branch 'develop' - contains emergency fix to traversal tags to fix the accumulator tests. 2014-06-19 10:33:51 +01:00
3b9aabb925 Merge pull request #13 from ericniebler/iterator-range-traversal
handle composite iterator traversals in iterator_range
2014-06-19 10:31:15 +01:00
1eecd2c2f6 handle composite iterator traversals in iterator_range 2014-06-19 00:43:52 -07:00
e33c501c05 Merge branch 'develop' - small fixes in addition to a more major fix for adaptors
producing iterators that did not have default constructors.
2014-06-16 22:51:08 +01:00
3ecf600434 Fixed range adaptors that were creating underlying iterators that were not default constructible. 2014-06-16 14:49:25 +01:00
31ace63a0c Merge pull request #12 from Flast/pr/file-mode
More remove execute attribute from files.
2014-06-16 14:17:48 +01:00
61e02039dd More remove execute attribute from files.
rel. to:
  e0e6fefb1e

Signed-off-by: Kohei Takahashi <flast@flast.jp>
2014-06-16 20:28:02 +09:00
fc172fc509 fixed and resolved missing coverage in the copy_backward unit test. 2014-06-16 11:45:41 +01:00
a0dad84a13 Merge pull request #10 from apolukhin/develop
Replaced deprecated cast.hpp with polymorphic_cast.hpp. Droped dependenc...
2014-06-16 10:40:18 +01:00
264017e2a9 more robust implementation for BOOST_RANGE_EXTRACT_OPTIONAL_TYPE 2014-06-16 00:00:09 -07:00
12d4af20dd Merge branch 'develop' - improved indexed adaptor 2014-06-09 12:06:20 +01:00
5ba77001dd Replaced deprecated cast.hpp with polymorphic_cast.hpp. Droped dependency to the Numeric library 2014-06-09 13:21:24 +04:00
5ce6dc7814 change the return type from the indexed adaptor so that the index is available from the range element. 2014-06-09 02:12:00 +01:00
749b1c5456 Merge branch 'develop' to incorporate trac 10098 2014-06-08 23:54:18 +01:00
344f578934 trac_10098 iterator_range sign warning. 2014-06-07 17:19:35 +01:00
6ee61a6578 Merge branch 'develop' - to include the range_fwd.hpp header file. 2014-06-07 17:07:15 +01:00
fe1a592e46 add a range_fwd.hpp header file for the main classes/structs and the extension points. 2014-06-05 19:10:19 +01:00
c555a1228f Merge branch 'develop' to incorporate the formatted adaptor 2014-06-05 14:30:52 +01:00
4c8164a9aa bring formatted_range into the boost::range namespace. 2014-06-05 01:04:21 +01:00
5918e7e63e changed the separated function to become the new formatted adaptor. 2014-06-05 01:00:13 +01:00
e0e6fefb1e remove crazy execute file attribute from header files. 2014-06-04 18:56:49 +01:00
36bb8a82fb Merge branch 'develop' to incorporate fixes from trac tickets. 2014-06-04 18:37:36 +01:00
e43796c42c allow clang to use Range Concepts despite reporting GCC 4.2. 2014-06-04 13:15:04 +01:00
60025220f5 add Enabler template argument to range_iterator, range_const_iterator and range_mutable_iterator extension points. 2014-06-04 12:23:40 +01:00
698a083e65 Merge pull request #9 from romanek-adam/patch-1
[doc] Fix typo in the name of forward traversal tag.
2014-05-07 11:42:43 -04:00
ac99249c89 Update any_range.qbk
Fix typo in the name of forward traversal tag.
2014-05-07 09:39:00 +02:00
4ec54072d3 change to fix MSVC 8 unit test failure due to uint32_t. 2014-05-07 01:46:38 +01:00
ec3c98bc25 any_iterator now compiles without RTTI. 2014-05-07 00:13:09 +01:00
5f2560f753 Ticket 9851 - adaptors should perform concept check assertions. 2014-05-06 23:37:21 +01:00
d7fde2736c Merge pull request #8 from Flast/pr/doc/metafun
Fix return type in metafunction documentation
2014-05-05 12:29:54 -04:00
4cdf15a0f6 Fix return type in metafunction document
Signed-off-by: Kohei Takahashi <flast@flast.jp>
2014-05-06 01:12:53 +09:00
3b3e590e73 Merge pull request #7 from Flast/pr/doc/fix/typo
Fix documentation typo
2014-05-02 11:29:42 -04:00
117bcd83d6 Fix document typo
Signed-off-by: Kohei Takahashi <flast@flast.jp>
2014-05-02 02:12:06 +09:00
3419a28a9f Merge pull request #6 from insideoutclub/develop
Make BinaryOperator version of transform() stop when end of either range is reached (refs #9812)
2014-04-28 12:51:07 -04:00
e3f605a02f Update transform.hpp 2014-04-28 08:06:04 -07:00
9e5144bab9 Merge pull request #4 from Flast/pr/config/macro
Fix using deprecated macro
2014-04-26 00:33:28 -04:00
35595211b6 Fix using deprecated macro
Signed-off-by: Kohei Takahashi <flast@flast.jp>
2014-04-21 01:14:09 +09:00
449e78e0b0 test find works as a contains function. 2014-04-08 16:45:34 +01:00
fa629a53bd Merge branch 'develop' 2014-03-12 03:43:36 +00:00
311225e0a1 remove rvalue reference changes to transformed adaptor. 2014-03-10 20:08:36 +00:00
edb81e828b fully quality boost::enable_if since msvc namespaces dont work. 2014-03-10 19:01:24 +00:00
083df800b5 Merge branch 'develop' 2014-03-10 11:10:25 +00:00
ed0febc902 ticket 6172 - added unit test to ensure transformed works with bind. 2014-03-09 21:51:07 +00:00
a6bd3e6e44 added the boost::range::separated function for range output streaming. 2014-03-09 21:09:00 +00:00
70256bd8b0 ticket 4572 - make_iterator_range_n 2014-03-09 19:27:28 +00:00
f1de74a6ac ticket 9438 for qualifying calls to ignore_unused_variable_warning 2014-03-09 17:59:35 +00:00
52933ebd40 Merge branch 'develop' 2014-03-09 17:48:23 +00:00
cbf385ac05 fix concepts on gccc4.8.2 and dodgy test iterators in iterator_range_drop.cpp test case. 2014-03-09 17:47:44 +00:00
2f71c4b69b Merge branch 'develop' 2014-03-09 07:33:34 +00:00
4ebbbba82b ticket 7885 rvalue support for metafunctions. 2014-03-09 00:28:43 +00:00
be85e295e8 updated docs for hash_value iterator_range support. 2014-03-08 22:38:25 +00:00
f86d487706 ticket 7294 iterator_range hash_value support. 2014-03-08 22:23:22 +00:00
90faa3941c ticket 7328 gccxml compatibility. 2014-03-08 22:00:27 +00:00
9d0d5199ba ticket 9072 iterator_range accept reference to function type. 2014-03-08 21:54:55 +00:00
343e74b8e3 added algorithm_ext insert algorithm for containers without a where iterator. 2014-03-08 21:42:42 +00:00
7cd8b9ec24 updated algorithms.qbk to explicitly mention range_return_value so that this can be searched for. 2014-03-08 21:28:52 +00:00
7147a00fd7 ticket 5817 any_range default template params. 2014-03-08 21:19:03 +00:00
3ed0626756 ticket 8028 - combine reimplemented and now documented. 2014-03-08 20:52:10 +00:00
6c6be971ed Merge branch 'develop'
Removed html from Boost.Range documentation since it is now in the build.
2014-03-05 23:35:55 +00:00
94c31a790b removed the html files from Boost.Range since the docs are now in the build. 2014-03-05 22:16:07 +00:00
74fa42ed13 Merge branch 'develop'
These changes are just to address some small issues on some compiler versions with newly introduced tests. It also includes a fix to a recent regression in the sub_range class so that it preserves constness propagation as before the SFINAE improvement changes.
2014-03-05 22:02:25 +00:00
4960d8dab2 fix lifetime issue with test case for ticket 6715. 2014-03-04 20:29:34 +00:00
e089e0748f fix for recently introduced regression to sub_range const propagation. 2014-03-04 20:22:57 +00:00
e26866d3fa Merge branch 'feature/drop_front_back' into develop 2014-03-04 16:22:13 +00:00
09cc98f60d drop_front and drop_back included in synopsis. 2014-03-04 16:19:51 +00:00
69759731bb implemented drop_front and drop_back with test. 2014-03-04 15:05:00 +00:00
59f39e5d7f merge branch develop 2014-03-04 13:51:43 +00:00
194f357eeb trac 6685 - MFC range map adaptor. 2014-03-04 13:33:59 +00:00
b84385cfce trac 8803 - size(const Rng&) returns size_type. It also no longer requires random access. 2014-03-04 12:54:07 +00:00
5d6867d35c Merge branch 'hotfix/type_erased_test_split' into develop 2014-03-04 12:34:19 +00:00
0d93777ece type_erased unit test reduce dependencies of the recently split type_erased tests. 2014-03-04 12:33:51 +00:00
6206535453 type_erased random_access adapter separated. 2014-03-04 12:02:28 +00:00
a4633c2c1e type_erased_bidrectional.cpp formatting. 2014-03-04 11:53:13 +00:00
bd1fd9610e type_erased test separated the forward traversal. 2014-03-04 11:52:02 +00:00
379fbc51e3 type_erased unit test separated bidirectional traversal. 2014-03-04 11:46:57 +00:00
438e735dcc type_erased split out single-pass. 2014-03-04 11:41:19 +00:00
c96897198a type_erased test separated the template parameter conversion test. 2014-03-04 11:34:36 +00:00
b5f60f0448 removed obsolete test code from type_erased.cpp. 2014-03-04 11:28:22 +00:00
8de7e29fc7 type_erased mix of values test separated. 2014-03-04 11:26:50 +00:00
43ab929257 type_erased abstract and brackets tests separated. 2014-03-04 11:18:46 +00:00
c9a04a1a9a trac 7842 - documentation inaccuracies on intro page for range adaptors. 2014-03-03 18:58:33 +00:00
ef388661b3 trac 8927 - added comment about std::partition requirements pre C++11. 2014-03-03 18:36:01 +00:00
b3180d3a5a trac 9514 - adjacent_filtered requires a ForwardRange. 2014-03-03 18:30:13 +00:00
c9b96f2c88 trac 7376 - join iterator reference type. 2014-03-03 15:43:05 +00:00
ea6ca22e3f trac 7188 c4127 warning in the equal function. 2014-03-03 15:00:42 +00:00
42a7f0c70c trac 6742 - unit test showing working phoenix combined with the transformed adaptor. 2014-03-03 14:21:35 +00:00
4cb056c80b ticket 5811 - attempt to fix link error on many automated regression test hosts. 2014-03-03 12:30:23 +00:00
17c0fa271c trac 9515 - fix for uniqued adaptor consistent with unique algorithm. 2014-03-03 01:24:56 +00:00
d87e1f3ade make intel happy with type_erased static_assert calls. 2014-03-03 00:30:11 +00:00
132828a8db make msvc happy with the ticket 6715 test case. 2014-03-03 00:26:22 +00:00
63acc5c633 trac 8676 sliced adaptor fixed. 2014-03-03 00:10:08 +00:00
8b60f2c768 iterator_range interop with variant. 2014-03-02 22:50:24 +00:00
79d2a66831 trac 5816 - fix any_range requiring copyable elements. 2014-03-02 15:35:50 +00:00
3afac93b7f Merge branch 'hotfix/trac_8617_counting_range' into develop 2014-02-27 17:43:05 +00:00
3af0142509 fixed counting_range from a range. 2014-02-27 17:42:32 +00:00
19f0726533 Merge branch 'hotfix/trac_9524_assertions_break_single_pass' into develop 2014-02-27 16:52:46 +00:00
502abb9884 eliminate unused local typedef and signed/unsigned comparison warnings. 2014-02-27 16:34:58 +00:00
9b477525de reformatted numeric.hpp 2014-02-27 15:59:03 +00:00
fd0f99c767 inner_product avoids pre-condition check with input_iterators due to single-pass limitation. 2014-02-27 13:51:06 +00:00
259e917eaf trac_8693 const cast warn 2014-02-26 22:02:27 +00:00
665477de19 Merge branch 'hotfix/trac_6732_join_iterator_unused_warn' into develop 2014-02-26 21:41:01 +00:00
2a065b2420 trac_6732 join_iterator.hpp unused variable warn. 2014-02-26 21:40:39 +00:00
b130e25804 Merge branch 'hotfix/trac_9403_equal_impl_order_n' into develop 2014-02-26 21:35:03 +00:00
49cfefdef5 equal algorithm corrected to be O(1) with random access and pred. 2014-02-26 21:34:34 +00:00
f064012939 Merge branch 'hotfix/trac_9519_reverse_strided' into develop 2014-02-26 21:18:14 +00:00
ceffd1cf79 strided adaptor rewritten to correct defects and optimise performance. 2014-02-26 21:17:29 +00:00
298de4cd85 Merge branch 'hotfix/integer_range_size' into develop 2014-02-26 00:56:46 +00:00
9e6bdc13ba hotfix to regression in integer_range due to recent SFINAE change to iterator_range. 2014-02-26 00:56:27 +00:00
654ae838ee refactored iterator_range to better handle SFINAE. 2014-02-24 18:26:03 +00:00
b07224c752 Merge branch 'hotfix/ticket_6715_iterator_range_equality' into develop 2014-02-24 14:46:12 +00:00
1d91272a55 trac 6715 - iterator_range operators work automatically in derived. 2014-02-22 22:31:48 +00:00
d70210e6f2 Merge branch 'hotfix/trac5811_indirected_optional' into develop 2014-02-22 16:16:19 +00:00
8e7eeeb6d9 ticket 5811 - unit test to confirm already fixed. 2014-02-22 16:14:55 +00:00
7cd6631cae strided.cpp unit test has the deque test removed. 2014-02-21 17:52:32 +00:00
96054b0b48 unit test type_erased.cpp corrected mix of value types under test. 2014-02-21 17:50:28 +00:00
b795de8310 extension_size.cpp include added to cstdint.hpp 2014-02-21 17:44:16 +00:00
e513fb7e01 Create first merge point for Git 2014-02-01 01:43:28 -05:00
9928939724 Remove remaining occurances of BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
These evaded scripting.

[SVN r86249]
2013-12-30 04:56:00 -05:00
87ecc0caee Remove BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
Process #ifdef...#else...#endif blocks.

[SVN r86246]
2013-12-30 04:55:56 -05:00
2d78bde327 Remove BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
Process #ifndef...#else...#endif blocks.

[SVN r86245]
2013-12-30 04:55:51 -05:00
946d451d03 Remove obsolete files.
[SVN r86242]
2013-12-30 04:55:43 -05:00
b60d4c7172 Range: Remove obsolete GCC version checks.
[SVN r86102]
2013-12-30 04:55:38 -05:00
d1aea63c2f Remove obsolete MSVC check from pragma guard
git grep -h -B1 "^#\s*pragma once" | grep -v pragma | sort | uniq

is now clean.

[SVN r85952]
2013-12-30 04:55:32 -05:00
ebbfe65595 Range: Remove obsolete MSVC version checks.
[SVN r85915]
2013-12-30 04:55:12 -05:00
738bd42696 Range: Remove ATL specific define for old MSVC.
[SVN r85912]
2013-12-30 04:53:54 -05:00
caeff56002 [boost][range] - fix a very odd compilation problem in range_size that only occurs on clang 4.2 on the Mac (clang 4.2 on linux is fine)
[SVN r85717]
2013-12-30 04:53:48 -05:00
d3b13dd490 Fixed compilation with gcc 4.7.
[SVN r85707]
2013-12-30 04:53:43 -05:00
01b4147e09 [boost][range] - removed warnings found building with clang 3.2.
[SVN r85698]
2013-12-30 04:53:39 -05:00
a8084dcb12 [boost][range] correct lifetime defect in the tokenized range adapter
[SVN r85697]
2013-12-30 04:53:34 -05:00
ec4783e655 [boost][range] - changed join_iterator reference type handling to address several user observations and failing clang builds.
[SVN r85692]
2013-12-30 04:53:29 -05:00
e7880d8963 [boost][range] - changed join_iterator reference type handling to address several user observations and failing clang builds.
[SVN r85691]
2013-12-30 04:53:24 -05:00
226dbab183 [boost][range] Ticket 8702 - size_type detection
[SVN r85690]
2013-12-30 04:53:17 -05:00
3d3dea1411 [boost][range] - fix for ticket 6888 - unique predicate overloads
[SVN r85686]
2013-12-30 04:53:12 -05:00
fbc0057432 [boost][range] - fix for ticket 8341 - has_range_iterator
[SVN r85682]
2013-12-30 04:53:06 -05:00
6f0ab4a8be range: silence some warnings
[SVN r85584]
2013-12-30 04:52:56 -05:00
4c28983459 [range] Fixed a bug in join_iterator where joining a const range and a non-const range led to a compiler error (refs #8483).
[SVN r85400]
2013-12-30 04:52:48 -05:00
58d1ee1444 Merge r86524 (Correct broken links to C++ standard papers); fixes #9212
[SVN r86673]
2013-11-13 03:22:55 +00:00
2735dcff18 Correct broken links to C++ standard papers. Refs #9212.
[SVN r86524]
2013-10-30 12:51:24 +00:00
e7185c2966 Remove remaining occurances of BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
These evaded scripting.

[SVN r86249]
2013-10-11 23:22:36 +00:00
5366172708 Remove BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
Process #ifdef...#else...#endif blocks.

[SVN r86246]
2013-10-11 23:19:17 +00:00
b02c60e468 Remove BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
Process #ifndef...#else...#endif blocks.

[SVN r86245]
2013-10-11 23:17:48 +00:00
c55650216f Remove obsolete files.
[SVN r86242]
2013-10-11 23:11:35 +00:00
1e6ba3c885 Range: Remove obsolete GCC version checks.
[SVN r86102]
2013-10-01 08:41:42 +00:00
4f34d95156 Remove obsolete MSVC check from pragma guard
git grep -h -B1 "^#\s*pragma once" | grep -v pragma | sort | uniq

is now clean.

[SVN r85952]
2013-09-26 13:02:51 +00:00
650b75d2d7 Range: Remove obsolete MSVC version checks.
[SVN r85915]
2013-09-25 21:13:39 +00:00
8af782611e Range: Remove ATL specific define for old MSVC.
[SVN r85912]
2013-09-25 21:12:40 +00:00
34cea300e5 [boost][range] - fix a very odd compilation problem in range_size that only occurs on clang 4.2 on the Mac (clang 4.2 on linux is fine)
[SVN r85717]
2013-09-16 23:23:38 +00:00
cca9739022 Fixed compilation with gcc 4.7.
[SVN r85707]
2013-09-16 17:13:20 +00:00
30e6df5a15 [boost][range] - removed warnings found building with clang 3.2.
[SVN r85698]
2013-09-16 11:21:36 +00:00
2285f909f6 [boost][range] correct lifetime defect in the tokenized range adapter
[SVN r85697]
2013-09-16 10:10:12 +00:00
0addcfadeb [boost][range] - changed join_iterator reference type handling to address several user observations and failing clang builds.
[SVN r85692]
2013-09-15 22:15:46 +00:00
426e0c39a8 [boost][range] - changed join_iterator reference type handling to address several user observations and failing clang builds.
[SVN r85691]
2013-09-15 22:15:12 +00:00
f662a07bcc [boost][range] Ticket 8702 - size_type detection
[SVN r85690]
2013-09-15 21:54:32 +00:00
90ce7f3703 [boost][range] - fix for ticket 6888 - unique predicate overloads
[SVN r85686]
2013-09-15 19:44:36 +00:00
a59819fc6e [boost][range] - fix for ticket 8341 - has_range_iterator
[SVN r85682]
2013-09-15 18:05:49 +00:00
2480b52f5b range: silence some warnings
[SVN r85584]
2013-09-06 08:51:00 +00:00
b4f00e3c18 [range] Fixed a bug in join_iterator where joining a const range and a non-const range led to a compiler error (refs #8483).
[SVN r85400]
2013-08-20 06:06:12 +00:00
43d2ca8549 [range] Merge Boost.Range bug fixes to release branch (fixes #6944; fixes #7407; fixes #7408; fixes #7731; fixes #7827; fixes #8338; fixes #8453).
[SVN r84823]
2013-06-18 02:22:07 +00:00
b0c1cf556f [range] Fixed a bug in istream_range() that prevented it from working with character types other than 'char' (refs #7407).
[SVN r84707]
2013-06-09 02:34:36 +00:00
8be23dd1aa [range] Fix off-by-one error in implementation of irange() (refs #7731).
[SVN r84701]
2013-06-08 20:41:43 +00:00
1eb5554da9 [range] Choose the appropriate implementation of BOOST_RANGE_EXTRACT_OPTIONAL_TYPE() based on BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS rather than BOOST_NO_PARTIAL_TEMPLATE_SPECIALIZATION (refs #8453).
[SVN r84663]
2013-06-06 23:06:55 +00:00
3d3631744f [range] Don't include <istream> unnecessarily in istream_range.hpp (refs #7408).
[SVN r84644]
2013-06-05 00:55:37 +00:00
991bd7f8be [range] Fixed a failing test on gcc 4.2 (refs #6944).
[SVN r84643]
2013-06-05 00:42:41 +00:00
c908e04144 [range] Make iterator of 'indexed' adaptor default-constructible (refs #7827).
[SVN r84617]
2013-06-03 09:00:46 +00:00
1c18f42e83 [range] Use correct iterator concepts when checking Boost.Range concepts (refs #6944).
[SVN r84566]
2013-05-30 23:16:51 +00:00
fe79a8efdd [range] allow iterator_range to be instantiated with a pointer to an array as the iterator type (refs #8338)
[SVN r83596]
2013-03-27 02:16:11 +00:00
58d57f9b7b [range] merge documentation fix from trunk (refs #7926)
[SVN r82622]
2013-01-26 04:03:46 +00:00
4971da58ee [range] fixed #7926 (missing prototypes for lower_bound and upper_bound in docs)
[SVN r82621]
2013-01-26 03:59:06 +00:00
4df157ac11 [range] merge fix for typos in comments to release branch (refs #7916)
[SVN r82620]
2013-01-26 03:13:39 +00:00
45a1acb980 [range] fix some minor typos in comments - fixes #7916
[SVN r82594]
2013-01-24 09:10:47 +00:00
537f2474c9 [range] Merge documentation fixes and minor refactoring of docs (refs #5160; refs #5314; refs #5440; refs #5775; refs #6212; refs #7585; refs #7843; refs #7866).
[SVN r82487]
2013-01-14 09:19:32 +00:00
f228ab608a [range] fixed #7866 (minor typo in docs)
[SVN r82486]
2013-01-14 09:04:57 +00:00
cbd915a988 [range] fixed #5314 (small mistakes in range adaptor examples)
[SVN r82346]
2013-01-04 01:18:36 +00:00
fc88bc06ad [range] fixed #7843 (missing example in docs for 'tokenized' range adaptor)
[SVN r82345]
2013-01-04 00:58:17 +00:00
4a44cc75c9 [range] refactor use of examples in documentation to avoid redundancy
[SVN r82344]
2013-01-03 23:44:30 +00:00
86b169dab3 [range] fixed #5440 (typo in documentation for 'inner_product' algorithm)
[SVN r82327]
2013-01-03 01:06:39 +00:00
36843ccdba [range] docs for writing adaptors: removed clarification added in r82315 (it was redundant); fixed typos that messed up numbering
[SVN r82326]
2013-01-03 01:01:55 +00:00
17e4f7024d [range] fixed #5160 (typo in replace_copy_if() example on intro page for range adaptors)
[SVN r82325]
2013-01-02 23:41:58 +00:00
3379affd4a [range] fixed #7585 (typo in documentation for 'indexed' adaptor)
[SVN r82316]
2013-01-02 08:09:46 +00:00
958b4fbf6e [range] small clarification in documentation for how to write a range adaptor
[SVN r82315]
2013-01-02 08:05:30 +00:00
61979ff421 [range] fixed #6212 (missing step in documentation for how to write a range adaptor)
[SVN r82314]
2013-01-02 07:51:21 +00:00
1d51c3afb2 [range] fixed #5775 (typo in the documentation of pop_heap())
[SVN r82313]
2013-01-02 05:27:02 +00:00
2726efa8c1 [range] merged bug fixes (r81890, refs #5603; r82071, refs #6103) from trunk
[SVN r82139]
2012-12-21 08:47:14 +00:00
a417560f09 [range] merge doc fixes (r81888, r81889) from trunk
[SVN r82138]
2012-12-21 08:44:32 +00:00
b7f443e583 [range] corrected undesirable namespace nesting in algorithm/search_n.hpp; fixes #6103
[SVN r82071]
2012-12-18 09:25:08 +00:00
f49e347772 [range] added missing includes to any_range.hpp and related files; fixes #5603
[SVN r81890]
2012-12-13 07:48:50 +00:00
bf4ca510ea [range] fixed some doc typos (patch by Michel Morin)
[SVN r81889]
2012-12-13 07:09:11 +00:00
665c4a3234 [range] fixed a typo in the docs, introduced in r77990, that messed up the sections
[SVN r81888]
2012-12-13 07:01:39 +00:00
bda0d613c1 [boost][range] merge from trunk to release
[SVN r80677]
2012-09-23 18:59:28 +00:00
dceccc9de9 [boost][range] - Added the missing include of boost/utility/enable_if.hpp to boost/range/algorithm/for_each.hpp
[SVN r79180]
2012-06-29 21:49:37 +00:00
dc46fc13ab [boost][range] - Merge trac resolutions from the trunk. The most notable change is the alteration of the size type to be unsigned. This is a potentially breaking change.
[SVN r78860]
2012-06-08 22:59:54 +00:00
a72eae6099 Replace all uses of boost/utility.hpp with more-granular includes. Solves modularization dependency nightmare.
[SVN r78502]
2012-05-18 04:44:04 +00:00
5a04c9e05b [boost][range] - Ticket 5993 - Accumulate Concept Check constness.
[SVN r77993]
2012-04-15 12:24:53 +00:00
e6279d4436 [boost][range] - Ticket 6149 - as_literal causing unnecessary copy (on very silly compilers)
[SVN r77992]
2012-04-15 12:18:02 +00:00
11238e4c19 [boost][range] - Trac 5971 - size() should return an unsigned type.
[SVN r77990]
2012-04-15 11:52:01 +00:00
1cb6a99c80 eliminated unit_test_framework
[SVN r74719]
2011-10-05 09:13:05 +00:00
2f3d82be9f [boost][range] - merge from trunk of miscellaneous defect fixes
[SVN r72427]
2011-06-05 21:47:57 +00:00
47e478d099 Merge to release.
[SVN r72228]
2011-05-27 19:51:13 +00:00
c4bd4bf4ce Remove tabs.
[SVN r72190]
2011-05-26 18:23:57 +00:00
41b76f8f5c [boost][range] - Ticket 5236 - Improved test coverage to ensure that the result for a random access strided range is consistent with that of a bidirectional strided range.
[SVN r72108]
2011-05-22 22:15:14 +00:00
846f11a96c [boost][range] - Ticket 5236 - Strided reversing past begin issue resolved.
[SVN r72107]
2011-05-22 22:06:30 +00:00
8810c4c4aa [boost][range] - Ticket 5547 - Boost.Range join() ambiguous with Boost.Algorithm join() function. Put the Boost.Range join function into the boost::range namespace and brought out with 'using'
[SVN r72106]
2011-05-22 21:19:53 +00:00
91428c2110 [boost][range] - Ticket 5530 - adaptor example fails to compile. This change adds tests for all of the .cpp example files for the range adaptors, and fixes a few small issues with the examples shown by the new tests.
[SVN r72104]
2011-05-22 21:03:01 +00:00
44c26a3356 [boost][range] - Ticket 5486 - Removal of unnecessary variables from adjacent_filtered_range. This removes the requirement for the predicate to be default constructible.
[SVN r72102]
2011-05-22 20:33:06 +00:00
b06fca8378 [boost][range] - Ticket 5556 - is_sorted namespace issue under GCC 4.5
[SVN r72101]
2011-05-22 20:20:20 +00:00
3b3889b70f [boost][range] - Ticket 5485 - doubly defined BOOST_DEFINE_RANGE_ADAPTOR_1 macro.
[SVN r72098]
2011-05-22 20:01:12 +00:00
5ed6116490 [boost][range] - ticket 5544 - fix for termination of irange - done properly for negative step sizes.
[SVN r72097]
2011-05-22 19:59:59 +00:00
df1a3a334f [boost][range] - ticket 5544 - fix for termination of irange.
[SVN r72070]
2011-05-22 11:16:53 +00:00
126e6861d7 [boost][range] - Resolved Trace 5162 - boost::iterator_range<T*> is unsafe.
[SVN r70852]
2011-04-02 13:05:26 +00:00
d490a84c8d [boost][range] - Improved the work-around for VC10 for_each implementation. Corrected a missing newline at the end of the file.
[SVN r70850]
2011-04-02 10:14:51 +00:00
10af4fc1e0 [boost][range] - Improve the forwarding of the functor, and provide a work-around for the breaking changes in VC10 for_each.
[SVN r70690]
2011-03-29 10:27:00 +00:00
f8bb8aafbf [range] - Improved default Reference type deduction for the join_iterator as implemented by aschoedl in Trac issue 5061.
[SVN r70041]
2011-03-16 23:55:25 +00:00
c6a6a46db4 [range] - Fix for the demotion of traversal tags supplied by aschoedl. This is mentioned in Trac issue 5061, but has also been reported independently by a few users.
[SVN r70040]
2011-03-16 23:47:02 +00:00
cc8a1413cb [range] - Qualify the lookup of the make_transform_iterator function to protect against ADL. This was reported as part of Trac issue 5061.
[SVN r70039]
2011-03-16 23:41:12 +00:00
1131136d4a [range] - Fix for Trac issue 5313 - Typos in boost/range/detail/detail_str.hpp
[SVN r70038]
2011-03-16 23:37:03 +00:00
3cd6a7277f [range] Added <=, ==, >, >=, != operators to iterator_range
[SVN r70037]
2011-03-16 23:33:57 +00:00
19a2090ef8 [range] - Fix for Trac issue 5295 - boost/range/sub_range.hpp cannot be included by itself
[SVN r70036]
2011-03-16 23:31:59 +00:00
67f457ade1 [range] Fix for Trac issue 5179 - Extra ";" in boost range file
[SVN r70035]
2011-03-16 23:29:29 +00:00
7315e2c14e [range] resolved trac issue 5295 - sub_range.hpp was missing an include of concepts.hpp
[SVN r70034]
2011-03-16 23:20:12 +00:00
cafea6aea5 [boost][range] - Merge a fix to undo an erroneous change to iterator_range.size() that allowed it to compile for ranges that did not model the Random Access Range Concept and thereby broken the complexity guarantees.
[SVN r68190]
2011-01-16 17:07:27 +00:00
96c78123f0 [boost][range] - Fixed erroneous change by 'Wash' the size() function is intended to be for Random Access Ranges only to be in keeping with the other Boost.Range size() functions.
[SVN r68177]
2011-01-16 00:05:12 +00:00
868858b844 Fixed ambiguity issues when compiling with C++0x support enabled.
[SVN r68155]
2011-01-14 17:37:59 +00:00
367582d0f4 Removed the use of __gnu_cxx::is_sorted from Boost.Graph as it's lolnonportable,
implemented a version of the algorithm as a replacement,



[SVN r68144]
2011-01-14 03:02:47 +00:00
6d46ce412f [range] - merge the tested changes from the trunk in preparation for the 1.46 release.
[SVN r67905]
2011-01-10 06:35:02 +00:00
2da424d940 [boost][range] - Improved the tests by implementing outside of the boost namespace to better simulate real world usage.
[SVN r67602]
2011-01-03 01:33:04 +00:00
a5d94bbe21 [boost][range] - Make the type_erased adaptor test compatible with more compilers and reduce the time of test compilation/execution to avoid timeouts on the Intel compilers.
[SVN r67601]
2011-01-03 00:38:52 +00:00
716cf7795e [boost][range] - Fixed defect where BOOST_TEST_MESSAGE was being undefined as a side-effect by the boost/range/detail/any_iterator_buffer.hpp header file
[SVN r67542]
2011-01-01 16:51:31 +00:00
55fd3ca5b2 [boost][range] - Updated begin/end to be protected against accidental ADL to improve compatibility with C++0x. Added any_range which adds type erasure support. Added a type_erased adaptor to utilise the any_range. Implemented the any_iterator using a small buffer optimization to avoid heap usage.
[SVN r67541]
2011-01-01 16:46:32 +00:00
c506d2537f [boost][range] - Trac item 4226 - Implemented a safe_bool utility class that is intended to be refactored into a core area. Integrated this into iterator_range.
[SVN r67463]
2010-12-26 23:14:08 +00:00
efb7b50a8a [boost][range] - Improved the implementation of strided range to eliminate requirements for boost::size(rng) to be a valid expression. Each traversal category of strided_iterator is now individually implemented.
[SVN r67461]
2010-12-26 20:33:33 +00:00
674be9dfa0 [boost][range] - merge from trunk which fixes a defect in the strided range adaptor, and contains improvements to the documentation
[SVN r67454]
2010-12-26 15:13:43 +00:00
fd63de33e9 [boost][range] - Correctly attribute the test case kindly contributed by Michel Morin.
[SVN r67453]
2010-12-26 14:15:23 +00:00
014fdb8ace [boost][range] - Corrected yesterdays erroneous modifications to the strided adaptor.
[SVN r67445]
2010-12-24 15:00:08 +00:00
9cf925c079 [boost][range] - Added has_range_iterator and has_range_const_iterator. Trac ticket 4296.
[SVN r67433]
2010-12-23 18:10:09 +00:00
4fc942f45e [boost][range] - Resolved Trac ticket 4355 - Concepts did not check that iterators must be dereferencable.
[SVN r67430]
2010-12-23 11:56:27 +00:00
48fc316156 [boost][range] - Added documentation for the join() function. This is to resolve Trac ticket 4740.
[SVN r67428]
2010-12-23 10:56:23 +00:00
c66fb8e807 [boost][range] - manually split the implementation calls to search_n _impl and search_n_pred_impl due to a function overload resolution issue with VC10.
[SVN r67426]
2010-12-23 09:59:53 +00:00
3adf4d2869 [boost][range] - Resolution of Trac item 4905 - Implementation of boost::range::map_keys should use boost::range_reference
[SVN r67423]
2010-12-23 00:56:04 +00:00
de24df7962 [boost][range] - Fixed the search_n predicate version and resolve Trac ticket 4776
[SVN r67421]
2010-12-23 00:12:28 +00:00
dfa0764d53 [boost][range] - Resolution of Trac ticket 4355. Made the naming of the returned types from range adaptors consistent and documented.
[SVN r67420]
2010-12-22 23:42:02 +00:00
d68174a51d [boost][range] - Update to relax preconditions for the strided adaptor, and numerous fixes to inspection report issues.
[SVN r67419]
2010-12-22 22:36:43 +00:00
612cec17bb [boost][range] - Update to relax preconditions for the strided adaptor, and numerous fixes to inspection report issues.
[SVN r67418]
2010-12-22 22:31:33 +00:00
1ff26bc99b boost/range/iterator_range_core.hpp: fixing bug introduced with rev. 67153 (major breakage)
[SVN r67169]
2010-12-11 14:30:49 +00:00
4b96ce34aa Fix order of includes for Spirit scheme example. Changed iterator_range.size()
to use std::distance instead of subtracting iterators, this allows it to work
with iterators other than random access. Added more utree docs to Spirit.



[SVN r67153]
2010-12-10 20:04:30 +00:00
65b22bfa38 Merge filesystem, range, doc from trunk.
* Inline deprecated methods in filesystem.
* Fix some links in range.
* Clean up test document a bit.


[SVN r64315]
2010-07-24 14:26:01 +00:00
9e48730a0e Fix some links in the range documentation.
[SVN r64279]
2010-07-22 23:28:41 +00:00
fb8994f51c Merge documentation changes.
[SVN r64186]
2010-07-19 23:29:09 +00:00
ce9d9b4726 Remove old range documentation files.
[SVN r64167]
2010-07-19 20:14:35 +00:00
26c095d022 Boost.Range merge of bug fixes and documentation
[SVN r64120]
2010-07-18 11:36:34 +00:00
22c4ab4a06 Boost.Range fixes for Tickets: 4131, 4136, 4398, 4388. Plus updated history in the documentation.
[SVN r64111]
2010-07-17 19:44:31 +00:00
a06f11589f Removed invalid comparison of invalidated iterators in the Boost.Range partition test case.
[SVN r64088]
2010-07-17 12:25:57 +00:00
109bf20484 [range] - corrected defected test for the partition algorithm.
[SVN r64001]
2010-07-13 22:28:37 +00:00
183e449a31 [range] disambiguate const / non-const overloads for Intel compilers and older GCC.
[SVN r63998]
2010-07-13 20:31:40 +00:00
7c3b66d520 [range] experimental commit using disable_if in an attempt to resolve the ambiguity warnings on some compilers.
[SVN r63938]
2010-07-12 22:45:30 +00:00
334bc28136 avoid name clash with Boost.Algorithm by renaming replace_range to replaced_range
[SVN r63936]
2010-07-12 22:02:46 +00:00
40714ccc7e [range] - fix erroneous change to uniqued test case.
[SVN r63935]
2010-07-12 21:52:28 +00:00
5bb66037d3 [boost][range] - Improved handling of temporary ranges in range algorithms.
[SVN r63904]
2010-07-12 00:14:07 +00:00
74a01a4487 [boost][range] - Improved handling of temporary ranges in range algorithms.
[SVN r63903]
2010-07-12 00:12:49 +00:00
ef000176d8 [boost][range] - Improved handling of temporary ranges in range algorithms.
[SVN r63902]
2010-07-12 00:08:41 +00:00
ca2328ed87 Merge documentation fixes.
* Use `doc/src/*.css` instead of `doc/html/*.css`.
* Remove wiki and people directories.
* Some documentation fixes.
* Left out `minimal.css` changes and boostbook changes because of clashes.


[SVN r63347]
2010-06-26 12:30:09 +00:00
db345d4e8e Update various libraries' documentation build.
Mostly to use the images and css files under doc/src instead of
doc/html, usually be deleting the settings in order to use the defaults.
Also add 'boost.root' to some builds in order to fix links which rely on
it.

[SVN r63146]
2010-06-20 18:00:48 +00:00
aebb16feef Boost.Range sliced adaptor is now compatible with VC10 even with using namespace boost::adaptors.
[SVN r61923]
2010-05-12 01:34:50 +00:00
794fd3e226 Move Boost.Range's join_iterator intrusive_ptr_add_ref and intrusive_ptr_release where ADL will actually find them
[SVN r61867]
2010-05-09 01:32:55 +00:00
88001ada37 Merge standards-conformance fixes for Boost.Range
[SVN r61864]
2010-05-09 01:23:32 +00:00
5b1d0544e2 Const-qualified objects of class type require the class to have a
user-declared default constructor.


[SVN r61758]
2010-05-04 15:26:09 +00:00
c9802507ab Boost.Range - modified join and irange to return public range types.
[SVN r61690]
2010-04-29 22:03:58 +00:00
91d62c2c1a Boost.Range documentation merge from the trunk. Corrects inconsitency with return types, Range Return Categories etc.
[SVN r61685]
2010-04-29 21:18:58 +00:00
3ef3363c2d Boost.Range documentation iteration.
[SVN r61662]
2010-04-28 19:27:44 +00:00
7e065ca313 Boost.Range corrected dodgy link in the Uniqued adaptor documentation.
[SVN r61661]
2010-04-28 19:16:28 +00:00
1d5fb47238 Boost.Range documentation iteration.
[SVN r61660]
2010-04-28 19:07:47 +00:00
83c89f3038 Boost.Range documentation: corrected the Returned Range Category for the uniqued adaptor
[SVN r61654]
2010-04-28 18:09:41 +00:00
e3e1fc43d3 Boost.Range documentation iteration. Primarily this is the inclusion of Range Return Categories for every Range Adaptor page.
[SVN r61653]
2010-04-28 18:03:26 +00:00
5364ea2cad Boost.Range commit fix for the mismatch documentation - thanks to vincente botet for spotting this.
[SVN r61651]
2010-04-28 16:52:24 +00:00
ec58d739eb Boost.Range documentation iteration.
[SVN r61650]
2010-04-28 16:29:11 +00:00
925b3ad355 Boost.Range updated unit tests.
[SVN r61648]
2010-04-28 16:11:40 +00:00
abc18532e4 Boost.Range documentation update iteration.
[SVN r61647]
2010-04-28 16:09:03 +00:00
f9eeb5d447 Boost.Range correct missing items from merge by merging these changes manually.
This changeset is what should have happened with the prior svn merge operation.

[SVN r61519]
2010-04-23 23:18:59 +00:00
a47f15a98f Boost.Range merge from trunk to release.
This is motivated by the need to correct the istream_range, to correct the adaptors.hpp header file, and correct the return types of various range algorithms.

[SVN r61517]
2010-04-23 22:50:56 +00:00
adc4b5db3b Boost.Range brought back some of the const overloads that were over-zealously removed.
[SVN r61495]
2010-04-22 22:43:57 +00:00
1dea353fa3 Boost.Range revert accidental check-in of lambda test. It kinda breaks most compilers - doh.
[SVN r61452]
2010-04-21 07:37:25 +00:00
3e2d5cb786 Boost.MultiArray disambiguated calls to equal functions in the unit tests. These became ambiguous due to changes in Boost.Range.
[SVN r61441]
2010-04-20 21:56:33 +00:00
f6c15771e2 Fixed tab and no-newline-at-end-of-file issues from inspection report
[SVN r61435]
2010-04-20 17:54:16 +00:00
4641e2e69d Boost.Range - removed unnecessary code from the sliced adaptor.
Added a unit test to test the use of a non-member function as a transform functor and composition of strided, sliced and transformed range adaptors.

[SVN r61404]
2010-04-19 11:45:27 +00:00
a1cb3d9795 Boost.Range added the strided adaptor to the boost/range/adaptors.hpp
[SVN r61378]
2010-04-18 19:55:46 +00:00
4830359a93 Boost.Range corrected istream_range implementation. Added the missing istream_range unit test. Removed the untested and undocumented unbounded_range for this release.
[SVN r61345]
2010-04-17 21:02:28 +00:00
cf63ba0dc9 Boost.Range removed redundant overloads, increased compiler support, and made return types consistent.
[SVN r61281]
2010-04-14 22:16:11 +00:00
dfc30e334d Boost.Range merged defect fix for iterator_range.
[SVN r61280]
2010-04-14 21:15:41 +00:00
22fcae4fcb Boost.Range reverted attempted fix for iterator_range::operator[] since this was not a good fix.
[SVN r61269]
2010-04-14 07:41:38 +00:00
47b40f66e1 Boost.Range defect fix for the operator[] of iterator_range. This now reverts to a simpler implementation when the iterator is a pointer.
[SVN r61258]
2010-04-13 20:41:11 +00:00
350a1f8bfc Boost.Range updated the return types of various algorithms to improve consistency. This is to address a specific request made during the formal review of Boost.RangeEx.
[SVN r61211]
2010-04-11 22:05:02 +00:00
13b748a228 Boost.Range removed deprecated html documentation.
[SVN r61181]
2010-04-10 15:25:56 +00:00
cab01e8ba3 Boost.Range remove deprecated html documentation.
[SVN r61148]
2010-04-08 20:56:00 +00:00
eea32403ef Boost.Range merge of fixes from the trunk.
[SVN r61146]
2010-04-08 19:34:17 +00:00
067b63da8e Boost.Range improved push_front algorithm unit test. Updated documentation.
[SVN r61145]
2010-04-08 19:09:34 +00:00
52c04e94f9 Boost.Range fix for the range_size metafunction. This showed as a compilation failure on VACPP.
[SVN r61144]
2010-04-08 10:40:14 +00:00
b573b6c9bf Boost.Range modification in an attempt to improve the compatibility of the adjacent_filtered and uniqued adaptors.
[SVN r61142]
2010-04-07 23:40:53 +00:00
a24a69f38e Boost.Range - avoid accidental ADL of begin/end functions.
[SVN r61098]
2010-04-06 10:12:11 +00:00
6e2e1d592b Boost.Range - fixed documentation Jamfile defect and added the algorithm extension iota to the documentation.
[SVN r61072]
2010-04-05 17:36:10 +00:00
704ce0186a Boost.Range fix to the combine function that did not show as a defect on most compilers.
This iteration also makes the code compatible with more compilers.

[SVN r61071]
2010-04-05 14:12:24 +00:00
3a6c6c6bcd Boost.Range fix to the skip_iterator constructor used by adjacent_filter. On the templatised constructor the m_range variable was uninitialized. This may explain some of the failures for adjacent_filtered and uniqued on Intel compilers.
[SVN r61066]
2010-04-05 09:54:34 +00:00
c6c4634aca Revert accidental commit to range.
[SVN r61064]
2010-04-05 08:51:43 +00:00
a420ef96bc Rebuild the integer documentation.
[SVN r61058]
2010-04-05 07:27:25 +00:00
29b2053f5c Merged the new Boost.Range into the release branch.
[SVN r61052]
2010-04-04 20:00:13 +00:00
cee9ffc1a8 Boost.Range added unit tests for extended algorithms.
Put the extended algorithms into boost::range in a similar manner to the standard algorithms.
Added iota as an extended algorithm.
Fixed defects in the extended algorithms brought to light by the new unit tests.

[SVN r61042]
2010-04-04 14:14:12 +00:00
6cc4cbf1a1 Boost.Range a recent fix to a trac ticket causes a compilation error on Sun compilers. This commit causes the old code to be used for the operator[] of iterator_range on Sun compilers.
[SVN r61038]
2010-04-04 11:38:14 +00:00
debce93f63 Boost.Range is modified to conditionally compile concept assertions. This has been configured to disable concept assertions in Boost.Range for known broken compilers.
[SVN r61035]
2010-04-04 10:47:21 +00:00
71c2ca614c Boost.Range Fix for trac issue #3110 - Multi_array and iterator_range interaction.
This has been fixed by reusing the well proven iterator_facade operator[] mechanism.

[SVN r61029]
2010-04-03 22:09:29 +00:00
d0544400af Boost.Range fixes for compilers that were having problems picking between const and mutable range overloads of range algorithms.
[SVN r61028]
2010-04-03 21:00:56 +00:00
f8f29ae7d3 Boost.Range improvements for compiler compatibility, especially C++0x compilers.
[SVN r61026]
2010-04-03 20:10:16 +00:00
39d77206e1 Boost.Range fixed C++0x problem due to accidental argument dependent lookup in the const_ranges unit test.
[SVN r61025]
2010-04-03 19:31:43 +00:00
690ebf406e Boost.Range correct the adjacent_filtered adaptor to be resilient accident argument dependent lookup of boost::next
[SVN r61024]
2010-04-03 19:28:03 +00:00
22c72c53eb Boost.Range algorithms are now in the boost::range namespace and brought into boost by the appropriate using statement. This allows better interoperation with Boost.Algorithm since errors only occur when the use calls similarly named ambiguous functions. In this event the user can disambiguate by using algorithm::xxx() or range::xxx(). This iteration also updates the concept assert code in the range algorithms.
[SVN r61023]
2010-04-03 19:14:13 +00:00
b4ae711d4e Boost.Range minor documentation corrections and code comment fixes.
[SVN r61014]
2010-04-03 09:02:21 +00:00
629ab6adbf Correct Boost.Range irange unit test failure on 64-bit GCC
[SVN r60905]
2010-03-28 20:03:49 +00:00
40d20d65ca Fix compilation of Boost.Range adaptors on GCC 64-bit
[SVN r60904]
2010-03-28 19:44:33 +00:00
bed353556f Corrected namespace of the pipe operator for the copied adaptor.
[SVN r60901]
2010-03-28 18:37:28 +00:00
b0d1db7c2e Boost.RangeEx merged into Boost.Range
[SVN r60897]
2010-03-28 16:08:35 +00:00
1461479a17 rm cmake from trunk. I'm not entirely sure this is necessary to satisfy the inspect script, but I'm not taking any chances, and it is easy to put back
[SVN r56942]
2009-10-17 02:07:38 +00:00
29fa877949 rm cmake from the release branch before it goes out broken. Policy dictates that you never commit to release, you commit to trunk and merge to release.
[SVN r56941]
2009-10-17 01:10:45 +00:00
7663f559f2 Copyrights on CMakeLists.txt to keep them from clogging up the inspect
reports.  This is essentially the same commit as r55095 on the release
branch.



[SVN r55159]
2009-07-26 00:49:56 +00:00
a39946c55d Add basic copyright/license to keep cmake out of the inspection report
[SVN r55095]
2009-07-22 21:51:01 +00:00
90f4eca5cd Merge in inspect checks for links in CSS files and external content. And fix a few of these issues.
Merged revisions 52663-52664,52666-52668,52712 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r52663 | danieljames | 2009-04-29 22:12:08 +0100 (Wed, 29 Apr 2009) | 1 line
  
  Check for invalid css links in html files as well as css files.
........
  r52664 | danieljames | 2009-04-29 22:12:32 +0100 (Wed, 29 Apr 2009) | 1 line
  
  Check for external links.
........
  r52666 | danieljames | 2009-04-29 22:19:12 +0100 (Wed, 29 Apr 2009) | 1 line
  
  Use local copies of the boost logo.
........
  r52667 | danieljames | 2009-04-29 22:19:40 +0100 (Wed, 29 Apr 2009) | 1 line
  
  Remove unused copy of boostbook.css
........
  r52668 | danieljames | 2009-04-29 22:19:56 +0100 (Wed, 29 Apr 2009) | 3 lines
  
  Fix a link to a header on trac.
  
  IMO it would be better to link to the local copy.
........
  r52712 | danieljames | 2009-05-01 21:51:10 +0100 (Fri, 01 May 2009) | 1 line
  
  Better inspect error for external content.
........


[SVN r53044]
2009-05-16 13:45:21 +00:00
52b9581e4f Use local copies of the boost logo.
[SVN r52666]
2009-04-29 21:19:12 +00:00
c8c808b04e fix for bug Ticket #2903
[SVN r52204]
2009-04-05 20:49:47 +00:00
bcc0ea30cf Ticket #2903
[SVN r52202]
2009-04-05 20:46:02 +00:00
deefb61ec6 Merge PDF build changes from Trunk.
[SVN r51417]
2009-02-23 18:39:32 +00:00
837bf05867 Add PDF generation options to fix external links to point to the web site.
Added a few more Boostbook based libs that were missed first time around.
Fixed PDF naming issues.

[SVN r51284]
2009-02-17 10:05:58 +00:00
12d904a5e4 merge of cmake build files from trunk per beman
[SVN r50756]
2009-01-24 18:57:20 +00:00
5e7948667e Updating CMake files to latest trunk. Added dependency information for regression tests and a few new macros for internal use.
[SVN r49627]
2008-11-07 17:02:56 +00:00
a65512ed5c Continuing merge of CMake build system files into trunk with the encouragement of Doug Gregor
[SVN r49510]
2008-11-01 13:15:41 +00:00
26b096f65d update in response to inspection report
[SVN r47681]
2008-07-22 09:29:56 +00:00
2dab8cfbc9 update in response to inspection report
[SVN r47678]
2008-07-22 09:15:00 +00:00
a85afbe470 doc update
[SVN r47495]
2008-07-16 21:05:16 +00:00
8724a83c49 doc updates
[SVN r47482]
2008-07-16 19:59:34 +00:00
e7902d439b more changes from trunk
[SVN r46652]
2008-06-24 15:42:48 +00:00
b4f99d66b5 bug-fixes from trunk
[SVN r46649]
2008-06-24 15:38:50 +00:00
d1c2c5ce3f bug-fixes from trunk
[SVN r46647]
2008-06-24 15:37:59 +00:00
062e820882 cleanup to pass inspection tool
[SVN r43139]
2008-02-07 08:38:07 +00:00
4d381e8564 fixed #if -> #ifdef
[SVN r42716]
2008-01-13 11:38:13 +00:00
fd00cc129f doc fixes
[SVN r42692]
2008-01-12 12:38:46 +00:00
8291ce67fc minor changes from trunk
[SVN r41751]
2007-12-05 17:30:23 +00:00
dbfa1df088 missing include (Ticket #1463)
[SVN r41637]
2007-12-03 09:01:03 +00:00
5afec2b74f merge from truck (boost::size()->boost::distance())
[SVN r41635]
2007-12-03 08:51:22 +00:00
a33d5c22c5 Full merge from trunk at revision 41356 of entire boost-root tree.
[SVN r41370]
2007-11-25 18:38:02 +00:00
901266b76a Full merge from trunk at revision 41356 of entire boost-root tree.
[SVN r41369]
2007-11-25 18:07:19 +00:00
25e932149c Starting point for releases
[SVN r39706]
2007-10-05 14:25:06 +00:00
c54e15d374 This commit was manufactured by cvs2svn to create tag
'Version_1_34_1'.

[SVN r38286]
2007-07-24 19:28:14 +00:00
fd448ffa31 removed invalid test
[SVN r37117]
2007-02-28 22:27:50 +00:00
21b558fe5e license info
[SVN r36156]
2006-11-22 22:33:09 +00:00
33c8f3e3ec *** empty log message ***
[SVN r36155]
2006-11-22 22:27:28 +00:00
523f8a5926 Merge from HEAD.
Allow building of shared versions of some Boost.Test libraries.
Adjust tests to use always use static linking to Boost.Test, since
linking to the shared version requires test changes.

Patch from Juergen Hunold.


[SVN r35990]
2006-11-10 19:59:52 +00:00
3bd0d886c4 Remove obsolete Boost.Build v1 files.
[SVN r35880]
2006-11-06 17:10:46 +00:00
e46eae8144 *** empty log message ***
[SVN r35717]
2006-10-24 10:37:46 +00:00
12cf02586c Remove tabs
[SVN r34957]
2006-08-26 14:28:38 +00:00
ee024f588b applied borland patch
[SVN r33670]
2006-04-11 20:12:31 +00:00
8e715b3810 This commit was manufactured by cvs2svn to create branch 'RC_1_34_0'.
[SVN r33417]
2006-03-21 02:26:31 +00:00
508 changed files with 43244 additions and 7643 deletions

151
.travis.yml Normal file
View File

@ -0,0 +1,151 @@
# Copyright 2016, 2017 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
language: cpp
sudo: false
python: "2.7"
branches:
only:
- master
- develop
- /feature\/.*/
env:
matrix:
- BOGUS_JOB=true
matrix:
exclude:
- env: BOGUS_JOB=true
include:
- os: linux
compiler: g++
env: TOOLSET=gcc CXXSTD=03,11
- os: linux
compiler: g++-4.4
env: TOOLSET=gcc-4.4 CXXSTD=98,0x
addons:
apt:
packages:
- g++-4.4
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-4.6
env: TOOLSET=gcc-4.6 CXXSTD=03,0x
addons:
apt:
packages:
- g++-4.6
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-5
env: TOOLSET=gcc-5 CXXSTD=03,11
addons:
apt:
packages:
- g++-5
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-5
env: TOOLSET=gcc-5 CXXSTD=14,1z
addons:
apt:
packages:
- g++-5
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-6
env: TOOLSET=gcc-6 CXXSTD=03,11
addons:
apt:
packages:
- g++-6
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-6
env: TOOLSET=gcc-6 CXXSTD=14,1z
addons:
apt:
packages:
- g++-6
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-7
env: TOOLSET=gcc-7 CXXSTD=03,11
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-7
env: TOOLSET=gcc-7 CXXSTD=14,17
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: clang++
env: TOOLSET=clang CXXSTD=03,11
- os: linux
compiler: clang++
env: TOOLSET=clang CXXSTD=14,1z
addons:
apt:
packages:
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
- os: osx
compiler: clang++
env: TOOLSET=clang CXXSTD=03,11
- os: osx
compiler: clang++
env: TOOLSET=clang CXXSTD=14,1z
install:
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
- cd ..
- git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule update --init tools/build
- git submodule update --init libs/config
- git submodule update --init tools/boostdep
- cp -r $TRAVIS_BUILD_DIR/* libs/range
- python tools/boostdep/depinst/depinst.py range
- ./bootstrap.sh
- ./b2 headers
script:
- ./b2 -j 3 libs/range/test toolset=$TOOLSET cxxstd=$CXXSTD
notifications:
email:
on_success: always

73
CMakeLists.txt Normal file
View File

@ -0,0 +1,73 @@
# Generated by `boostdep --cmake range`
# Copyright 2020 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
if(NOT DEFINED IDF_TARGET)
cmake_minimum_required(VERSION 3.5...3.16)
project(boost_range VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
add_library(boost_range INTERFACE)
add_library(Boost::range ALIAS boost_range)
target_include_directories(boost_range INTERFACE include)
target_link_libraries(boost_range
INTERFACE
Boost::array
Boost::assert
Boost::concept_check
Boost::config
Boost::container_hash
Boost::conversion
Boost::core
Boost::detail
Boost::iterator
Boost::mpl
Boost::optional
Boost::preprocessor
Boost::regex
Boost::static_assert
Boost::tuple
Boost::type_traits
Boost::utility
)
if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
add_subdirectory(test)
endif()
else()
FILE(GLOB_RECURSE headers include/*.h include/*.hpp)
idf_component_register(
SRCS
${headers}
INCLUDE_DIRS
include
REQUIRES
boost_array
boost_assert
boost_concept_check
boost_config
boost_container_hash
boost_conversion
boost_core
boost_detail
boost_iterator
boost_mpl
boost_optional
boost_preprocessor
boost_regex
boost_static_assert
boost_tuple
boost_type_traits
boost_utility
)
endif()

1
doc/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.html

View File

@ -8,25 +8,28 @@
#// For more information, see http://www.boost.org/libs/range/
#//
project boost/libs/range/doc ;
using boostbook ;
using quickbook ;
use-project boost : $(BOOST_ROOT) ;
path-constant images_location : html ;
import boostbook : boostbook ;
import quickbook ;
xml boost_range : boost_range.qbk ;
boostbook standalone
boostbook quickbook
:
boost_range
boost_range.qbk
:
<xsl:param>toc.max.depth=2
<xsl:param>toc.section.depth=4
<xsl:param>chunk.section.depth=2
# <xsl:param>generate.section.toc.level=4
# <xsl:param>chunk.first.sections=7
# <xsl:param>toc.section.depth=10
<xsl:param>boost.root=../../../..
<xsl:param>chunk.section.depth=4
<xsl:param>chunk.first.sections=1
<xsl:param>toc.section.depth=3
<xsl:param>toc.max.depth=3
<xsl:param>generate.section.toc.level=4
<format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html
<format>pdf:<xsl:param>img.src.path=$(images_location)/
;
###############################################################################
alias boostdoc ;
explicit boostdoc ;
alias boostrelease : quickbook ;
explicit boostrelease ;

View File

@ -1,769 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Boost.Range Reference </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<table>
<tr>
<td><img src="../../../boost.png" width="100%" border="0"></td>
<td><h1><br>
Boost.Range
</h1>
</td>
</tr>
</table>
<h2>Synopsis and Reference
</h2>
<ul>
<li>
<a href="#overview">Overview</a>
<li>
<a href="#Synopsis">Synopsis</a>
<li>
<a href="#Semantics">Semantics</a>
<li>
<a href="#minimal_interface">Extending the library</a></li>
</ul>
<hr size="1">
<a name="overview"></a>
<h3>Overview</h3>
<p>
Three types of objects are currently supported by the library:
<ul>
<li>
standard-like containers
<li>
<code>std::pair&lt;iterator,iterator&gt;</code>
<li>
built-in arrays
</li>
</ul>
Even though the behavior of the primary templates are exactly such that
standard containers will be supported by default, the requirements are much
lower than the standard container requirements. For example, the utility class <a href="utility_class.html#iter_range">
<code>iterator_range</code></a> implements the <a href="#minimal_interface">minimal
interface</a> required to make the class a <a href="range.html#forward_range">Forward
Range</a>
.
<P></P>
<p>
Please also see <a href="range.html">Range concepts</a> for more details.
</p>
<a name="Synopsis"></a>
<h3>Synopsis</h3>
<p>
<pre>
<span class=keyword>namespace </span><span class=identifier>boost</span>
<span class=special>{
</span><span class=comment>//
// Single Pass Range metafunctions
//
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword>struct </span><a href="#range_iterator"><span
class=identifier>range_iterator</span></a><span class=special>;
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword>struct </span><a href="#range_value"><span
class=identifier>range_value</span></a><span class=special>;
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword>struct </span><a href="#range_reference"><span
class=identifier>range_reference</span></a><span class=special>;
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword>struct </span><a href="#range_pointer"><span
class=identifier>range_pointer</span></a><span class=special>;
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword>struct </span><a href="#range_category"><span
class=identifier>range_category</span></a><span class=special>;
</span><span class=comment>//
// Forward Range metafunctions
//
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword>struct </span><a href="#range_difference"><span
class=identifier>range_difference</span></a><span class=special>;
</span><span class=comment>//
// Bidirectional Range metafunctions
//
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword>struct </span><a
href="#range_reverse_iterator"><span
class=identifier>range_reverse_iterator</span></a><span class=special>;
</span><span class=comment>//
// Single Pass Range functions
//
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#begin"><span class=identifier>begin</span></a><span class=special>( </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#begin"><span class=identifier>begin</span></a><span class=special>( </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#end"><span class=identifier>end</span></a><span class=special>( </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#end"><span class=identifier>end</span></a><span class=special>( </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>bool
</span><a href="#empty"><span class=identifier>empty</span></a><span class=special>( </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span><span class=comment>//
// Forward Range functions
//
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_difference</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#size"><span class=identifier>distance</span></a><span class=special>( </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span><span class=comment>//
// Bidirectional Range functions
//
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_reverse_iterator</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#rbegin"><span class=identifier>rbegin</span></a><span class=special>( </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_reverse_iterator</span><span class=special>&lt;</span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#rbegin"><span class=identifier>rbegin</span></a><span class=special>( </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_reverse_iterator</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#rend"><span class=identifier>rend</span></a><span class=special>( </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_reverse_iterator</span><span class=special>&lt;</span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#rend"><span class=identifier>rend</span></a><span class=special>( </span><span class=keyword>const </span><span
class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span>
<span class=comment>//
// Random Access Range functions
//
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword></span><span class=keyword>typename </span><span class=identifier>range_difference</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type
</span><a href="#size"><span class=identifier>size</span></a><span class=special>( </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);</span>
<span class=comment>//
// Special const Range functions
//
</span>
<span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;</span>
<span class=keyword>typename </span><span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type </span>
<a href="#const_begin"><span class=identifier>const_begin</span></a><span class=special>(</span><span class=keyword> const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span>
<span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;</span>
<span class=keyword>typename </span><span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type </span>
<a href="#const_end"><span class=identifier>const_end</span></a><span class=special>(</span><span class=keyword> const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span>
<span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;</span>
<span class=keyword>typename </span><span class=identifier>range_reverse_iterator</span><span class=special>&lt;</span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type </span>
<a href="#const_rbegin"><span class=identifier>const_rbegin</span></a><span class=special>(</span><span class=keyword> const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);
</span>
<span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;</span>
<span class=keyword>typename </span><span class=identifier>range_reverse_iterator</span><span class=special>&lt;</span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type </span>
<a href="#const_rend"><span class=identifier>const_rend</span></a><span class=special>( </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>);</span>
<span class=comment>//
// String utilities
//</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=identifier>iterator_range</span><span class=special>&lt;...</span><span class=identifier>see</span> <span class=identifier>below</span><span class=special>...&gt;</span>
<span class=identifier><a href="#as_literal">as_literal</a></span><span class=special>(</span> <span class=identifier>T</span><span class=special>&amp;</span> <span class=identifier>r</span> <span class=special>);</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=identifier>iterator_range</span><span class=special>&lt;...</span><span class=identifier>see</span> <span class=identifier>below</span><span class=special>...&gt;</span>
<span class=identifier><a href="#as_array">as_literal</a></span><span class=special>(</span> <span class=keyword>const</span> <span class=identifier>T</span><span class=special>&amp;</span> <span class=identifier>r</span> <span class=special>);</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=identifier>iterator_range</span><span class=special>&lt;</span> <span class=keyword>typename</span> <span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type</span> <span class=special>&gt;</span>
<span class=identifier><a href="#as_array">as_array</a></span><span class=special>(</span> <span class=identifier>T</span><span class=special>&amp;</span> <span class=identifier>r</span> <span class=special>);</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=identifier>iterator_range</span><span class=special>&lt;</span> <span class=keyword>typename</span> <span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=keyword>const</span> <span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type</span> <span class=special>&gt;</span>
<span class=identifier><a href="#as_literal">as_array</a></span><span class=special>(</span> <span class=keyword>const</span> <span class=identifier>T</span><span class=special>&amp;</span> <span class=identifier>r</span> <span class=special>);</span>
<span class=special>} </span><span class=comment>// namespace 'boost'
</span>
</pre>
<P></P>
<a name="Semantics"></a>
<h3>Semantics</h3>
<h4>notation</h4>
<p>
<table cellpadding="5" border="1">
<tr>
<th>
Type
<th>
Object
<th>
Describes
</tr>
<tr>
<td><code>X</code>
<td><code>x</code>
<td>any type</td>
<tr>
<td><code>T</code>
</td>
<td><code>t</code>
<td>denotes behavior of the primary templates</td>
</tr>
<tr>
<td><code>P</code>
<td><code>p</code>
<td>denotes <code>std::pair&lt;iterator,iterator&gt;</code></td>
<tr>
<td><code>A[sz]</code>
<td><code>a</code>
<td>denotes an array of type <code>A</code> of size <code>sz</code>
</tr>
<tr>
<td><code>Char*</code>
<td><code>s</code>
<td>denotes either <code>char*</code> or <code>wchar_t*</code></td>
</tr>
</table>
</p>
<p>
Please notice in tables below that when four lines appear in a cell, the first
line will describe the primary template, the second line pairs of iterators,
the third line arrays and the last line null-terminated strings.
</p>
<h4>Metafunctions</h4>
<p>
<table border="1" cellpadding="5">
<tr>
<th>
Expression</th>
<th>
Return type</th>
<th>
Complexity</th>
</tr>
<tr >
<td><a name="range_iterator"></a><code>range_iterator&lt;X&gt;::type</code></td>
<td><code>T::iterator</code><br>
<code>P::first_type</code><br>
<code>A*</code><br>
<td>compile time</td>
</tr>
<tr>
<td><a name="range_const_iterator"></a><code>range_iterator&lt;const X&gt;::type</code></td>
<td><code>T::const_iterator</code><br>
<code>P::first_type</code><br>
<code>const A*</code><br>
<td>compile time</td>
</tr>
<tr>
<td><a name="range_value"></a><code>range_value&lt;X&gt;::type</code></td>
<td><code>boost::iterator_value&lt;range_iterator&lt;X&gt;::type&gt;::type</code>
</td>
<td>compile time</td>
</tr>
<tr>
<td><a name="range_reference"></a><code>range_reference&lt;X&gt;::type</code></td>
<td><code>boost::iterator_reference&lt;range_iterator&lt;X&gt;::type&gt;::type</code>
</td>
<td>compile time</td>
</tr>
<tr>
<td><a name="range_pointer"></a><code>range_pointer&lt;X&gt;::type</code></td>
<td><code>boost::iterator_pointer&lt;range_iterator&lt;X&gt;::type&gt;::type</code>
</td>
<td>compile time</td>
</tr>
<tr>
<td><a name="range_category"></a><code>range_category&lt;X&gt;::type</code></td>
<td><code>boost::iterator_category&lt;range_iterator&lt;X&gt;::type&gt;::type</code>
</td>
<td>compile time</td>
</tr>
<tr>
<td><a name="range_difference"></a><code>range_difference&lt;X&gt;::type</code></td>
<td>
<code>boost::iterator_difference&lt;range_iterator&lt;X&gt;::type&gt;::type</code></td>
<td>compile time</td>
</tr>
<tr>
<td><a name="range_reverse_iterator"></a><code>range_reverse_iterator&lt;X&gt;::type</code></td>
<td><code>boost::reverse_iterator&lt;range_iterator&lt;X&gt;::type&gt;</code><br>
<td>compile time</td>
</tr>
<tr>
<td><a name="range_const_reverse_iterator"></a><code>range_reverse_iterator&lt;const X&gt;::type</code></td>
<td><code>boost::reverse_iterator&lt;range_iterator&lt;const X&gt;::type&gt;</code>
<br>
<td>compile time</td>
</tr>
</table>
</p>
<h4>Functions</h4>
<p>
<table border="1" cellpadding="5">
<tr>
<th>
Expression</th>
<th>
Return type</th>
<th>
Returns</th>
<th>
Complexity</th>
</tr>
<tr>
<td><a name="begin"></a><code>begin(x)</code></td>
<td><code>range_iterator&lt;X&gt;::type</code></td>
<td>
<code>p.first</code> if <code>p</code> is of type <code>std::pair&lt;T&gt;<code><br>
<code>a</code> if <code>a</code> is an array <br>
<code>range_begin(x)</code> if that expression would invoke a function found by ADL <br>
<code>t.begin()</code> otherwise
<td>constant time</td>
</tr>
<tr>
<td><a name="end"></a><code>end(x)</code></td>
<td><code>range_iterator&lt;X&gt;::type</code></td>
<td>
<code>p.second</code> if <code>p</code> is of type <code>std::pair&lt;T&gt;<code><br>
<code>a + sz</code> if <code>a</code> is an array of size <code>sz</code>
<br>
<code>range_end(x)</code> if that expression would invoke a function found by ADL <br>
<code>t.end()</code> otherwise
<td>
constant time </td>
</tr>
<tr>
<td><a name="empty"></a><code>empty(x)</code></td>
<td><code>bool</code></td>
<td><code>boost::begin(x) == boost::end(x)</code><br>
<td> constant time <br>
</td>
</tr>
<tr>
<td><a name="distance"></a><code>distance(x)</code></td>
<td><code>range_difference&lt;X&gt;::type</code></td>
<td>
<code>
std::distance(boost::begin(x),boost::end(x))
</code>
</td>
<td>-</td>
</tr>
<tr>
<td><a name="size"></a><code>size(x)</code></td>
<td><code>range_difference&lt;X&gt;::type</code></td>
<td><code> boost::end(x) - boost::begin(x)</code>
<td> constant time </td>
</tr>
<tr>
<td><a name="rbegin"></a><code>rbegin(x)</code></td>
<td><code>range_reverse_iterator&lt;X&gt;::type</code></td>
<td><code>range_reverse_iterator&lt;X&gt;::type( boost::end(x) )</code>
<br>
<td>constant time
</td>
</tr>
<tr>
<td> <a name="rend"></a><code>rend(x)</code></td>
<td><code>range_reverse_iterator&lt;X&gt;::type</code></td>
<td><code>range_reverse_iterator&lt;X&gt;::type( boost::begin(x) )</code>
<td>constant time</td>
</tr>
<tr>
<td><a name="const_begin"></a><code>const_begin(x)</code></td>
<td><code>range_iterator&lt;const X&gt;::type</code></td>
<td><code>range_iterator&lt;const X&gt;::type( boost::begin(x) )</code>
<br>
<td>constant time
</td>
</tr>
<tr>
<td><a name="const_end"></a><code>const_end(x)</code></td>
<td><code>range_iterator&lt;const X&gt;::type</code></td>
<td><code>range_iterator&lt;const X&gt;::type( boost::end(x) )</code>
<td>constant time</td>
</tr>
<tr>
<td><a name="const_rbegin"></a><code>const_rbegin(x)</code></td>
<td><code>range_reverse_iterator&lt;const X&gt;::type</code></td>
<td><code>range_reverse_iterator&lt;const X&gt;::type( boost::rbegin(x) )</code>
<br>
<td>constant time
</td>
</tr>
<tr>
<td><a name="const_rend"></a><code>const_rend(x)</code></td>
<td><code>range_reverse_iterator&lt;const X&gt;::type</code></td>
<td><code>range_reverse_iterator&lt;const X&gt;::type( boost::rend(x) )</code>
<td>constant time</td>
</tr>
<tr>
<td><a name="as_literal"></a><code>as_literal(x)</code></td>
<td><code>iterator_range&lt;U></code> where <code>U</code> is
<code>Char*</code> if <code>x</code> is a pointer to a
string and <code>U</code> is
<code>range_iterator&lt;X>::type</code> otherwise
</td>
<td>
<!-- <code>[a,a+sz-1)</code> if <code>a</code> is an array
of size <code>sz</code><br>-->
<code>[s,s + std::char_traits&lt;X&gt;::length(s))</code> if <code>s</code> is a <code>Char*</code> or an array of <code>Char</code>
<br>
<code>[boost::begin(x),boost::end(x))</code> otherwise
</td>
<td>linear time for pointers to a string or arrays of
<code>Char</code>, constant time otherwise</td>
</tr>
<tr>
<td><a name="as_array"></a><code>as_array(x)</code></td>
<td><code>iterator_range&lt;X></code> </td>
<td>
<code>[boost::begin(x),boost::end(x))</code>
</td>
<td>constant time otherwise</td>
</tr>
</table>
</p>
<p>
The special <code>const_</code>-named functions are useful when you
want to document clearly that your code is read-only.
</p>
<p>
<code>as_literal()</code> can be used <i>internally</i> in string
algorithm librararies such that arrays of characters are
handled correctly.
</p>
<p>
<code>as_array()</code> can be used with string algorithm libraries to make it clear that arrays of characters are handled like an array and not like a string.
</p>
<p>Notice that the above functions should always be called with
qualification (<code>boost::</code>) to prevent <i>unintended</i>
Argument Dependent Lookup (ADL).
</p>
<hr>
<a name="minimal_interface"></a>
<h3>Extending the library</h3>
<ul>
<li><a href="#method1">Method 1: provide member functions and nested types</a></li>
<li><a href="#method2">Method 2: provide free-standing functions and specialize metafunctions</a></li>
</ul>
<!--<b>Warning:</b><i> If possible, then prefer method 1 if you want to be absolutely sure your code is forward compatible.
</i>-->
<a name="method1"></a>
<h4>Method 1: provide member functions and nested types</h4>
<p>
This procedure assumes that you have control over the types that should be made
conformant to a Range concept. If not, see <a href="#method2">method 2</a>.
</p>
<p>
The primary templates in this library are implemented such that standard
containers will work automatically and so will <code>boost::<a href="../../array/index.html">array</a></code>.
Below is given an overview of which member functions and member types a class
must specify to be useable as a certain Range concept.
</p>
<p>
<table cellpadding="5" border="1">
<tr>
<th>
Member function</th>
<th>
Related concept</th>
<tr>
<td><code>begin()</code></td>
<td><a href="range.html#single_pass_range">Single Pass Range</a></td>
</tr>
<tr>
<td><code>end()</code>
</td>
<td><a href="range.html#single_pass_range">Single Pass Range</a></td>
</tr>
</table>
</p>
<p>
Notice that <code>rbegin()</code> and <code>rend()</code> member functions are
not needed even though the container can support bidirectional iteration.
</p>
<p>
The required member types are:
</p>
<p>
<table cellpadding="5" border="1">
<tr>
<th>
Member type</th>
<th>
Related concept</th>
</tr>
<tr>
<td><code>iterator</code></td>
<td><a href="range.html#single_pass_range">Single Pass Range</a></td>
</tr>
<tr>
<td><code>const_iterator</code></td>
<td><a href="range.html#single_pass_range">Single Pass Range</a></td>
</tr>
</table>
</p>
<p>
Again one should notice that member types <code>reverse_iterator</code> and <code>const_reverse_iterator</code>
are not needed.
</p>
<a name="method2"></a>
<h4>Method 2: provide free-standing functions and specialize metafunctions</h4>
<p>
This procedure assumes that you cannot (or do not wish to) change the types that should be made
conformant to a Range concept. If this is not true, see <a href="#method1">method 1</a>.
</p>
<p>
The primary templates in this library are implemented such that
certain functions are found via argument-dependent-lookup (ADL).
Below is given an overview of which free-standing functions a class
must specify to be useable as a certain Range concept.
Let <code>x</code> be a variable (<code>const</code> or mutable)
of the class in question.
</p>
<p>
<table cellpadding="5" border="1" ID="Table1">
<tr>
<th>
Function</th>
<th>
Related concept</th>
<tr>
<td><code>range_begin(x)</code></td>
<td><a href="range.html#single_pass_range">Single Pass Range</a></td>
</tr>
<tr>
<td><code>range_end(x)</code>
</td>
<td><a href="range.html#single_pass_range">Single Pass Range</a></td>
</tr>
</table>
</p>
<p><code>range_begin()</code> and <code>range_end()</code> must be
overloaded for both <code>const</code> and mutable reference arguments.
</p>
<p>
You must also specialize two metafunctions for your type <code>X</code>:
</p>
<p>
<table cellpadding="5" border="1" ID="Table2">
<tr>
<th>
Metafunction</th>
<th>
Related concept</th>
<tr>
<td><code>boost::range_mutable_iterator</code></td>
<td><a href="range.html#single_pass_range">Single Pass Range</a></td>
</tr>
<tr>
<td><code>boost::range_const_iterator</code></td>
<td><a href="range.html#single_pass_range">Single Pass Range</a></td>
</tr>
</table>
</p>
<p>
A complete example is given here:
</p>
<blockquote>
<pre>
<span class=preprocessor>#include</span> <span class=special>&lt;</span><span class=identifier>boost</span><span class=special>/</span><span class=identifier>range</span><span class=special>.</span><span class=identifier>hpp</span><span class=special>&gt;</span>
<span class=preprocessor>#include</span> <span class=special>&lt;</span><span class=identifier>iterator</span><span class=special>&gt;</span> <span class=comment>// for std::iterator_traits, std::distance()</span>
<span class=keyword>namespace</span> <span class=identifier>Foo</span>
<span class=special>{</span>
<span class=comment>//
// Our sample UDT. A 'Pair'
// will work as a range when the stored
// elements are iterators.
//</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=keyword>struct</span> <span class=identifier>Pair</span>
<span class=special>{</span>
<span class=identifier>T</span> <span class=identifier>first</span><span class=special>,</span> <span class=identifier>last</span><span class=special>;</span>
<span class=special>};</span>
<span class=special>}</span> <span class=comment>// namespace 'Foo'</span>
<span class=keyword>namespace</span> <span class=identifier>boost</span>
<span class=special>{</span>
<span class=comment>//
// Specialize metafunctions. We must include the range.hpp header.
// We must open the 'boost' namespace.
//</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=keyword>struct</span> <span class=identifier>range_mutable_iterator</span><span class=special>&lt;</span> <span class=identifier>Foo</span><span class=special>::</span><span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;</span> <span class=special>&gt;</span>
<span class=special>{</span>
<span class=keyword>typedef</span> <span class=identifier>T</span> <span class=identifier>type</span><span class=special>;</span>
<span class=special>};</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=keyword>struct</span> <span class=identifier>range_const_iterator</span><span class=special>&lt;</span> <span class=identifier>Foo</span><span class=special>::</span><span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;</span> <span class=special>&gt;</span>
<span class=special>{</span>
<span class=comment>//
// Remark: this is defined similar to 'range_mutable_iterator'
// because the 'Pair' type does not distinguish
// between an iterator and a const_iterator.
//</span>
<span class=keyword>typedef</span> <span class=identifier>T</span> <span class=identifier>type</span><span class=special>;</span>
<span class=special>};</span>
<span class=special>}</span> <span class=comment>// namespace 'boost'</span>
<span class=keyword>namespace</span> <span class=identifier>Foo</span>
<span class=special>{</span>
<span class=comment>//
// The required functions. These should be defined in
// the same namespace as 'Pair', in this case
// in namespace 'Foo'.
//</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=keyword>inline</span> <span class=identifier>T</span> <span class=identifier>range_begin</span><span class=special>(</span> <span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;&amp;</span> <span class=identifier>x</span> <span class=special>)</span>
<span class=special>{</span>
<span class=keyword>return</span> <span class=identifier>x</span><span class=special>.</span><span class=identifier>first</span><span class=special>;</span>
<span class=special>}</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=keyword>inline</span> <span class=identifier>T</span> <span class=identifier>range_begin</span><span class=special>(</span> <span class=keyword>const</span> <span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;&amp;</span> <span class=identifier>x</span> <span class=special>)</span>
<span class=special>{</span>
<span class=keyword>return</span> <span class=identifier>x</span><span class=special>.</span><span class=identifier>first</span><span class=special>;</span>
<span class=special>}</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=keyword>inline</span> <span class=identifier>T</span> <span class=identifier>range_end</span><span class=special>(</span> <span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;&amp;</span> <span class=identifier>x</span> <span class=special>)</span>
<span class=special>{</span>
<span class=keyword>return</span> <span class=identifier>x</span><span class=special>.</span><span class=identifier>last</span><span class=special>;</span>
<span class=special>}</span>
<span class=keyword>template</span><span class=special>&lt;</span> <span class=keyword>class</span> <span class=identifier>T</span> <span class=special>&gt;</span>
<span class=keyword>inline</span> <span class=identifier>T</span> <span class=identifier>range_end</span><span class=special>(</span> <span class=keyword>const</span> <span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;&amp;</span> <span class=identifier>x</span> <span class=special>)</span>
<span class=special>{</span>
<span class=keyword>return</span> <span class=identifier>x</span><span class=special>.</span><span class=identifier>last</span><span class=special>;</span>
<span class=special>}</span>
<span class=special>}</span> <span class=comment>// namespace 'Foo'</span>
<span class=preprocessor>#include</span> <span class=special>&lt;</span><span class=identifier>vector</span><span class=special>&gt;</span>
<span class=keyword>int</span> <span class=identifier>main</span><span class=special>()</span>
<span class=special>{</span>
<span class=keyword>typedef</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>vector</span><span class=special>&lt;</span><span class=keyword>int</span><span class=special>&gt;::</span><span class=identifier>iterator</span> <span class=identifier>iter</span><span class=special>;</span>
<span class=identifier>std</span><span class=special>::</span><span class=identifier>vector</span><span class=special>&lt;</span><span class=keyword>int</span><span class=special>&gt;</span> <span class=identifier>vec</span><span class=special>;</span>
<span class=identifier>Foo</span><span class=special>::</span><span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>iter</span><span class=special>&gt;</span> <span class=identifier>pair</span> <span class=special>=</span> <span class=special>{</span> <span class=identifier>vec</span><span class=special>.</span><span class=identifier>begin</span><span class=special>(),</span> <span class=identifier>vec</span><span class=special>.</span><span class=identifier>end</span><span class=special>()</span> <span class=special>};</span>
<span class=keyword>const</span> <span class=identifier>Foo</span><span class=special>::</span><span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>iter</span><span class=special>&gt;&amp;</span> <span class=identifier>cpair</span> <span class=special>=</span> <span class=identifier>pair</span><span class=special>;</span>
<span class=comment>//
// Notice that we call 'begin' etc with qualification.
//</span>
<span class=identifier>iter</span> <span class=identifier>i</span> <span class=special>=</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>begin</span><span class=special>(</span> <span class=identifier>pair</span> <span class=special>);</span>
<span class=identifier>iter</span> <span class=identifier>e</span> <span class=special>=</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>end</span><span class=special>(</span> <span class=identifier>pair</span> <span class=special>);</span>
<span class=identifier>i</span> <span class=special>=</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>begin</span><span class=special>(</span> <span class=identifier>cpair</span> <span class=special>);</span>
<span class=identifier>e</span> <span class=special>=</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>end</span><span class=special>(</span> <span class=identifier>cpair</span> <span class=special>);</span>
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>range_difference</span><span class=special>&lt;</span> <span class=identifier>Foo</span><span class=special>::</span><span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>iter</span><span class=special>&gt;</span> <span class=special>&gt;::</span><span class=identifier>type</span> <span class=identifier>s</span> <span class=special>=</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>size</span><span class=special>(</span> <span class=identifier>pair</span> <span class=special>);</span>
<span class=identifier>s</span> <span class=special>=</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>size</span><span class=special>(</span> <span class=identifier>cpair</span> <span class=special>);</span>
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>range_reverse_iterator</span><span class=special>&lt;</span> <span class=identifier>const Foo</span><span class=special>::</span><span class=identifier>Pair</span><span class=special>&lt;</span><span class=identifier>iter</span><span class=special>&gt;</span> <span class=special>&gt;::</span><span class=identifier>type</span>
<span class=identifier>ri</span> <span class=special>=</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>rbegin</span><span class=special>(</span> <span class=identifier>cpair</span> <span class=special>),</span>
<span class=identifier>re</span> <span class=special>=</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>rend</span><span class=special>(</span> <span class=identifier>cpair</span> <span class=special>);</span>
<span class=special>}</span>
</pre>
</blockquote>
<hr>
<p>
&copy; <a name="Copyright" id="Copyright">Copyright</a> Thorsten Ottosen 2008.
</p>
<p>
Distributed under the Boost Software License, Version 1.0. (See
accompanying file LICENSE_1_0.txt or copy at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)
</p>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>

File diff suppressed because it is too large Load Diff

255
doc/concepts.qbk Normal file
View File

@ -0,0 +1,255 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:concepts Range Concepts]
[section Overview]
A Range is a [*/concept/] similar to the STL [@http://www.sgi.com/tech/stl/Container.html Container] concept. A Range provides iterators for accessing a half-open range `[first,one_past_last)` of elements and provides information about the number of elements in the Range. However, a Range has fewer requirements than a Container.
The motivation for the Range concept is that there are many useful Container-like types that do not meet the full requirements of Container, and many algorithms that can be written with this reduced set of requirements. In particular, a Range does not necessarily
* own the elements that can be accessed through it,
* have copy semantics,
Because of the second requirement, a Range object must be passed by (const or non-const) reference in generic code.
The operations that can be performed on a Range is dependent on the [@boost:/libs/iterator/doc/new-iter-concepts.html#iterator-traversal-concepts-lib-iterator-traversal traversal category] of the underlying iterator type. Therefore the range concepts are named to reflect which traversal category its iterators support. See also terminology and style guidelines. for more information about naming of ranges.
The concepts described below specifies associated types as [@boost:/libs/mpl/doc/refmanual/metafunction.html metafunctions] and all functions as free-standing functions to allow for a layer of indirection.
[endsect]
[section Single Pass Range]
[heading Notation]
[table
[]
[[`X`] [A type that is a model of __single_pass_range__.]]
[[`a`] [Object of type X.]]
]
[heading Description]
A range `X` where `boost::range_iterator<X>::type` is a model of __single_pass_iterator__.
[heading Associated types]
[table
[]
[[Iterator type ] [`boost::range_iterator<X>::type` ] [The type of iterator used to iterate through a Range's elements. The iterator's value type is expected to be the Range's value type. A conversion from the iterator type to the `const` iterator type must exist.]]
[[Const iterator type] [`boost::range_iterator<const X>::type`] [A type of iterator that may be used to examine, but not to modify, a Range's elements.]]
]
[heading Valid expressions]
The following expressions must be valid.
[table
[[Name ] [Expression ] [Return type ]]
[[Beginning of range] [`boost::begin(a)`] [`boost::range_iterator<X>::type` if `a` is mutable, `boost::range_iterator<const X>::type` otherwise]]
[[End of range ] [`boost::end(a)` ] [`boost::range_iterator<X>::type` if `a` is mutable, `boost::range_iterator<const X>::type` otherwise]]
]
[heading Expression semantics]
[table
[[Expression ] [Semantics ] [Postcondition]]
[[`boost::begin(a)`] [Returns an iterator pointing to the first element in the Range. ] [`boost::begin(a)` is either dereferenceable or past-the-end. It is past-the-end if and only if `boost::distance(a) == 0`.]]
[[`boost::end(a)` ] [Returns an iterator pointing one past the last element in the Range. ] [`boost::end(a)` is past-the-end.]]
]
[heading Complexity guarantees]
`boost::end(a)` is at most amortized linear time, `boost::begin(a)` is amortized constant time. For most practical purposes, one can expect both to be amortized constant time.
[heading Invariants]
[table
[]
[[Valid range ] [For any Range `a`, `[boost::begin(a),boost::end(a))` is a valid range, that is, `boost::end(a)` is reachable from `boost::begin(a)` in a finite number of increments.]]
[[Completeness] [An algorithm that iterates through the range `[boost::begin(a),boost::end(a))` will pass through every element of `a`.]]
]
[heading See also]
__extending_for_udts__
__implementation_of_metafunctions__
__implementation_of_functions__
__container__
[endsect]
[section Forward Range]
[heading Notation]
[table
[]
[[`X`] [A type that is a model of __forward_range__.]]
[[`a`] [Object of type X.]]
]
[heading Description]
A range `X` where `boost::range_iterator<X>::type` is a model of __forward_traversal_iterator__.
[heading Refinement of]
__single_pass_range__
[heading Associated types]
[table
[]
[[Distance type] [`boost::range_difference<X>::type`] [A signed integral type used to represent the distance between two of the Range's iterators. This type must be the same as the iterator's distance type.]]
[[Size type ] [`boost::range_size<X>::type` ] [An unsigned integral type that can represent any nonnegative value of the Range's distance type.]]
]
[heading See also]
__implementation_of_metafunctions__
__implementation_of_functions__
[endsect]
[section Bidirectional Range]
[heading Notation]
[table
[]
[[`X`] [A type that is a model of __bidirectional_range__.]]
[[`a`] [Object of type X.]]
]
[heading Description]
This concept provides access to iterators that traverse in both directions (forward and reverse). The `boost::range_iterator<X>::type` iterator must meet all of the requirements of __bidirectional_traversal_iterator__.
[heading Refinement of]
__forward_range__
[heading Associated types]
[table
[]
[[Reverse Iterator type ] [`boost::range_reverse_iterator<X>::type` ] [The type of iterator used to iterate through a Range's elements in reverse order. The iterator's value type is expected to be the Range's value type. A conversion from the reverse iterator type to the const reverse iterator type must exist.]]
[[Const reverse iterator type] [`boost::range_reverse_iterator<const X>::type`] [A type of reverse iterator that may be used to examine, but not to modify, a Range's elements.]]
]
[heading Valid expressions]
[table
[[Name ] [Expression ] [Return type] [Semantics]]
[[Beginning of range] [`boost::rbegin(a)`] [`boost::range_reverse_iterator<X>::type` if `a` is mutable `boost::range_reverse_iterator<const X>::type` otherwise.] [Equivalent to `boost::range_reverse_iterator<X>::type(boost::end(a))`.]]
[[End of range ] [`boost::rend(a)` ] [`boost::range_reverse_iterator<X>::type` if `a` is mutable, `boost::range_reverse_iterator<const X>::type` otherwise.] [Equivalent to `boost::range_reverse_iterator<X>::type(boost::begin(a))`.]]
]
[heading Complexity guarantees]
`boost::rbegin(a)` has the same complexity as `boost::end(a)` and `boost::rend(a)` has the same complexity as `boost::begin(a)` from __forward_range__.
[heading Invariants]
[table
[]
[[Valid reverse range] [For any Bidirectional Range a, `[boost::rbegin(a),boost::rend(a))` is a valid range, that is, `boost::rend(a)` is reachable from `boost::rbegin(a)` in a finite number of increments.]]
[[Completeness ] [An algorithm that iterates through the range `[boost::rbegin(a),boost::rend(a))` will pass through every element of `a`.]]
]
[heading See also]
__implementation_of_metafunctions__
__implementation_of_functions__
[endsect]
[section Random Access Range]
[heading Description]
A range `X` where `boost::range_iterator<X>::type` is a model of __random_access_traversal_iterator__.
[heading Refinement of]
__bidirectional_range__
[heading Valid expressions]
[table
[[Name ] [Expression ] [Return type ]]
[[Size of range] [`boost::size(a)`] [`boost::range_size<X>::type`]]
]
[heading Expression semantics]
[table
[[Expression ] [Semantics] [Postcondition]]
[[`boost::size(a)`] [Returns the size of the Range, that is, its number of elements. Note `boost::size(a) == 0u` is equivalent to `boost::empty(a)`.] [`boost::size(a) >= 0`]]
]
[heading Complexity guarantees]
`boost::size(a)` completes in amortized constant time.
[heading Invariants]
[table
[]
[[Range size] [`boost::size(a)` is equal to the `boost::end(a)` - `boost::begin(a)`.]]
]
[endsect]
[section Concept Checking]
Each of the range concepts has a corresponding concept checking class in the file [@boost:/boost/range/concepts.hpp `<boost/range/concepts.hpp>`]. These classes may be used in conjunction with the __concept_check__ to ensure that the type of a template parameter is compatible with a range concept. If not, a meaningful compile time error is generated. Checks are provided for the range concepts related to iterator traversal categories. For example, the following line checks that the type `T` models the __forward_range__ concept.
``
BOOST_CONCEPT_ASSERT(( ForwardRangeConcept<T> ));
``
An additional concept check is required for the value access property of the range based on the range's iterator type. For example to check for a ForwardReadableRange, the following code is required.
``
BOOST_CONCEPT_ASSERT(( ForwardRangeConcept<T> ));
BOOST_CONCEPT_ASSERT(( ReadableIteratorConcept<typename range_iterator<T>::type> ));
``
The following range concept checking classes are provided.
* Class SinglePassRangeConcept checks for __single_pass_range__
* Class ForwardRangeConcept checks for __forward_range__
* Class BidirectionalRangeConcept checks for __bidirectional_range__
* Class RandomAccessRangeConcept checks for __random_access_range__
[heading See also]
[link range.style_guide Range Terminology and style guidelines]
__iterator_concepts__
__concept_check__
[endsect]
[endsect]

View File

@ -1,72 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Boost.Range Examples </title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<table border="0" >
<tr>
<td ><img src="../../../boost.png" border="0" ></td>
<td ><h1 align="center">Boost.Range </h1></td>
</tr>
</table>
<h2 >Examples</h2><a name="Examples" ></a>
<p >
Some examples are given in the accompanying test files:
</p>
<ul >
<li >
<a href="../test/string.cpp" target="_self" ><code >string.cpp</code></a>
shows how to implement a container version of <code >std::find()</code> that
works with <code >char[],wchar_t[],char*,wchar_t*.</code>
</li>
<li >
<a href="../test/algorithm_example.cpp" target="_self" ><code >algorithm_example.cpp</code></a>
shows the replace example from the introduction.
</li>
<li> <a href="../test/iterator_range.cpp">iterator_range.cpp</a>
<li> <a href="../test/sub_range.cpp">sub_range.cpp</a>
<li> <a href="../test/iterator_pair.cpp">iterator_pair.cpp</a>
<li> <a href="../test/reversible_range.cpp">reversible_range.cpp</a>
<li> <a href="../test/std_container.cpp">std_container.cpp</a>
<li> <a href="../test/array.cpp">array.cpp</a>
</ul>
<hr>
<p>
&copy; <a name="Copyright" id="Copyright">Copyright</a> Thorsten Ottosen 2008.
</p>
<p>
Distributed under the Boost Software License, Version 1.0. (See
accompanying file LICENSE_1_0.txt or copy at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)
</p>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>

28
doc/examples.qbk Normal file
View File

@ -0,0 +1,28 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:examples Examples]
Some examples are given in the accompanying test files:
* [@http://www.boost.org/libs/range/test/string.cpp string.cpp] shows how to implement a container version of `std::find()` that works with `char[]`,`wchar_t[]`,`char*`,`wchar_t*`.
* [@http://www.boost.org/libs/range/test/algorithm_example.cpp algorithm_example.cpp] shows the replace example from the introduction.
* [@http://www.boost.org/libs/range/test/iterator_range.cpp iterator_range.cpp]
* [@http://www.boost.org/libs/range/test/sub_range.cpp sub_range.cpp]
* [@http://www.boost.org/libs/range/test/iterator_pair.cpp iterator_pair.cpp]
* [@http://www.boost.org/libs/range/test/reversible_range.cpp reversible_range.cpp]
* [@http://www.boost.org/libs/range/test/std_container.cpp std_container.cpp]
* [@http://www.boost.org/libs/range/test/array.cpp array.cpp]
[endsect]

View File

@ -1,145 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Boost.Range FAQ </title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<table border="0" >
<tr>
<td ><img src="../../../boost.png" border="0" ></td>
<td ><h1 align="center">Boost.Range</h1></td>
</tr>
</table>
<p>
<h2 >FAQ</h2> <a name="FAQ" ></a>
<ol >
<li >
<i>Why is there no difference between <code >range_iterator&lt;C&gt;::type</code>
and <code >range_const_iterator&lt;C&gt;::type</code> for <code>std::pair&lt;iterator, iterator&gt;</code></i>.
<p >
In general it is not possible nor desirable to find a corresponding <code >const_iterator</code>.
When it is possible to come up with one, the client might choose to construct a <code >std::pair&lt;const_iterator,const_iterator&gt;</code>
object.
</p>
<p>
Note that an <a href="utility_class.html#iter_range">iterator_range</a>
is somewhat more convenient than a <code>pair</code> and that a <a
href="utility_class.html#sub_range"><code>sub_range</code></a> does
propagate const-ness. </p>
</li>
<li >
<i>Why is there not supplied more types or more functions?</i>
<p >
The library has been kept small because its current interface will
serve most
purposes. If and when a genuine need arises for more functionality, it can be
implemented.
</p>
</li>
<li >
<i>How should I implement generic algorithms for ranges?</i>
<p >
One should always start with a generic algorithm that takes two iterators (or
more) as input. Then use Boost.Range to build handier versions on top of the
iterator based algorithm. Please notice that once the range version of the
algorithm is done, it makes sense <i>not</i> to expose the iterator version in
the public interface.
</p>
</li>
<li>
<i>Why is there no Incrementable Range concept?</i>
<p>
Even though we speak of incrementable iterators, it would not make
much sense for ranges; for example, we cannot determine the size and
emptiness of a range since we cannot even compare
its iterators.
</p>
<p>
Note also that incrementable iterators are derived from output
iterators and so there exist no output range.
</p>
</li>
<!--
<li>
<i>Should I use qualified syntax, for example
<blockquote><pre>
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>begin</span><span class=special>( </span><span class=identifier>r </span><span class=special>); </span>
</pre></blockquote>
instead of
<blockquote>
<pre><span class=keyword>using </span><span class=keyword>namespace </span><span class=identifier>boost</span><span class=special>;</span>
<span class=identifier>begin</span><span class=special>( </span><span class=identifier>r </span><span class=special>)</span></pre></blockquote>
when calling functions in this library? If so, can I still rely on argument
dependent lookup (ADL) to kick in?</i>
<p>
The answer to the first question is that "it's up to you". The
answer to the second question is Yes. Normally qualified syntax
disables ADL, but the functions are implemented in a special
manner that preserves ADL properties. The trick was explained by
Daniel Frey on comp.lang.std.c++ in the thread "Whence Swap" and
it is best explained by some code: <blockquote>
<pre>
<span class=keyword>namespace </span><span class=identifier>boost</span>
<span class=special>{
</span><span class=keyword>namespace </span><span class=identifier>range_detail
</span><span class=special>{
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword>typename </span><span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;:</span><span class=identifier>type </span><span class=identifier>begin</span><span class=special>( </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>)
</span><span class=special>{ </span><span class=comment>/* normal implementation */ </span><span class=special>}
</span><span class=special>}
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword>typename </span><span class=identifier>range_iterator</span><span class=special>&lt;</span><span class=identifier>T</span><span class=special>&gt;::</span><span class=identifier>type </span><span class=identifier>begin</span><span class=special>( </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>r </span><span class=special>)
</span><span class=special>{
</span><span class=comment>//
// Create ADL hook
//
</span><span class=keyword>using </span><span class=identifier>range_detail</span><span class=special>::</span><span class=identifier>begin</span><span class=special>;
</span><span class=keyword>return </span><span class=identifier>begin</span><span class=special>( </span><span class=identifier>r </span><span class=special>);
</span><span class=special>}</span>
<span class=special>} </span>
</pre>
</blockquote>
Cool indeed!
</p>
-->
</ol>
<hr>
<p>
&copy; <a name="Copyright" id="Copyright">Copyright</a> Thorsten Ottosen 2008.
</p>
<p>
Distributed under the Boost Software License, Version 1.0. (See
accompanying file LICENSE_1_0.txt or copy
at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)
</p>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>

30
doc/faq.qbk Normal file
View File

@ -0,0 +1,30 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:faq FAQ]
1. ['[*Why is there no difference between `range_iterator<C>::type` and `range_const_iterator<C>::type` for `std::pair<iterator, iterator>`?]]
[:In general it is not possible nor desirable to find a corresponding `const_iterator`. When it is possible to come up with one, the client might choose to construct a `std::pair<const_iterator,const_iterator>` object.]
[:Note that an __iterator_range__ is somewhat more convenient than a `pair` and that a __sub_range__ does propagate const-ness.]
2. ['[*Why is there not supplied more types or more functions?]]
[:The library has been kept small because its current interface will serve most purposes. If and when a genuine need arises for more functionality, it can be implemented.]
3. ['[*How should I implement generic algorithms for ranges?]]
[:One should always start with a generic algorithm that takes two iterators (or more) as input. Then use Boost.Range to build handier versions on top of the iterator based algorithm. Please notice that once the range version of the algorithm is done, it makes sense not to expose the iterator version in the public interface.]
4. ['[*Why is there no Incrementable Range concept?]]
[:Even though we speak of incrementable iterators, it would not make much sense for ranges; for example, we cannot determine the size and emptiness of a range since we cannot even compare its iterators.]
[:Note also that incrementable iterators are derived from output iterators and so there exist no output range.]
[endsect]

View File

@ -1,202 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Boost.Range Headers </title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<table border="0" >
<tr>
<td ><img src="../../../boost.png" border="0" ></td>
<td ><h1 align="center">Boost.Range</h1></td>
</tr>
</table>
<p>
<h2 >Library headers</h2><a name="Library headers" ></a>
<table cellpadding="5" border="1" >
<tr >
<th >Header</th>
<th >Includes</th>
<th>Related concept </th>
</tr>
<tr >
<td ><code >&lt;boost/range.hpp&gt;</code></td>
<td >everything</td>
<td>- </td>
</tr>
<tr >
<td ><code >&lt;boost/range/metafunctions.hpp&gt;</code></td>
<td >every metafunction</td>
<td>- </td>
</tr>
<tr >
<td ><code >&lt;boost/range/functions.hpp&gt;</code></td>
<td >every function</td>
<td>- </td>
</tr>
<tr >
<td ><code >&lt;boost/range/value_type.hpp&gt;</code></td>
<td ><a href="boost_range.html#range_value" >range_value</a></td>
<td><a href="range.html#single_pass_range">Single Pass Range</a></td>
</tr>
<tr >
<td ><code >&lt;boost/range/iterator.hpp&gt;</code></td>
<td ><a href="boost_range.html#range_iterator"
>range_iterator</a></td>
<td><a href="range.html#single_pass_range">Single Pass Range</a> </td>
</tr>
<tr >
<td ><code >&lt;boost/range/mutable_iterator.hpp&gt;</code></td>
<td ><a href="boost_range.html#range_mutable_iterator"
>range_mutable_iterator</a></td>
<td><a href="range.html#single_pass_range">Single Pass Range</a> </td>
</tr>
<tr >
<td ><code >&lt;boost/range/const_iterator.hpp&gt;</code></td>
<td ><a href="boost_range.html#range_const_iterator"
>range_const_iterator</a></td>
<td><a href="range.html#single_pass_range">Single Pass Range</a> </td>
</tr>
<tr >
<td ><code >&lt;boost/range/difference_type.hpp&gt;</code></td>
<td ><a href="boost_range.html#range_difference"
>range_difference</a></td>
<td><a href="range.html#forward_range">Forward Range</a> </td>
</tr>
<tr >
<td ><code >&lt;boost/range/pointer.hpp&gt;</code></td>
<td ><a href="boost_range.html#range_pointer"
>range_pointer</a></td>
<td>- </td>
</tr>
<tr >
<td ><code >&lt;boost/range/category.hpp&gt;</code></td>
<td ><a href="boost_range.html#range_category"
>range_category</a></td>
<td>- </td>
</tr>
<tr >
<td ><code >&lt;boost/range/reverse_iterator.hpp&gt;</code></td>
<td ><a href="boost_range.html#range_reverse_iterator" >range_reverse_iterator</a></td>
<td><a href="range.html#bidirectional_range">Bidirectional Range</a> </td>
</tr>
<tr >
<td ><code >&lt;boost/range/begin.hpp&gt;</code></td>
<td >
<a href="boost_range.html#begin" >begin</a> and
<a href="boost_range.html#const_begin" >const_begin</a>
</td>
<td><a href="range.html#single_pass_range">Single Pass Range</a> </td>
</tr>
<tr >
<td ><code >&lt;boost/range/end.hpp&gt;</code></td>
<td >
<a href="boost_range.html#end" >end</a> and
<a href="boost_range.html#const_end" >const_end</a>
</td>
<td><a href="range.html#single_pass_range">Single Pass Range</a> </td>
</tr>
<tr >
<td ><code >&lt;boost/range/empty.hpp&gt;</code></td>
<td ><a href="boost_range.html#empty" >empty</a></td>
<td><a href="range.html#single_pass_range">Single Pass Range</a> </td>
</tr>
<tr >
<td ><code >&lt;boost/range/distance.hpp&gt;</code></td>
<td ><a href="boost_range.html#distance" >distance</a></td>
<td><a href="range.html#forward_range">Forward Range</a> </td>
</tr>
<tr >
<td ><code >&lt;boost/range/size.hpp&gt;</code></td>
<td ><a href="boost_range.html#size" >size</a></td>
<td><a href="range.html#random_access_range">Random Access Range</a>
</td>
</tr>
<tr >
<td ><code >&lt;boost/range/rbegin.hpp&gt;</code></td>
<td >
<a href="boost_range.html#rbegin" >rbegin</a> and
<a href="boost_range.html#const_rbegin" >const_rbegin</a>
</td>
<td><a href="range.html#bidirectional_range">Bidirectional Range</a> </td>
</tr>
<tr >
<td ><code >&lt;boost/range/rend.hpp&gt;</code></td>
<td >
<a href="boost_range.html#rend" >rend</a> and
<a href="boost_range.html#const_rend" >const_rend</a>
</td>
<td><a href="range.html#bidirectional_range">Bidirectional Range</a> </td>
</tr>
<tr >
<td ><code >&lt;boost/range/as_array.hpp&gt;</code></td>
<td >
<a href="boost_range.html#as_array" >as_array</a>
</td>
<td>-</td>
</tr>
<tr >
<td ><code >&lt;boost/range/as_literal.hpp&gt;</code></td>
<td >
<a href="boost_range.html#as_literal" >as_literal</a>
</td>
<td>-</td>
</tr>
<tr >
<td ><code >&lt;boost/range/iterator_range.hpp&gt;</code></td>
<td ><a href="utility_class.html#iter_range"
>iterator_range</a></td>
<td>- </td>
</tr>
<tr >
<td ><code >&lt;boost/range/sub_range.hpp&gt;</code></td>
<td ><a href="utility_class.html#sub_range" >sub_range</a></td>
<td>- </td>
</tr>
<tr >
<td ><code >&lt;boost/range/concepts.hpp&gt;</code></td>
<td ><a href="range.html#concept_checking" >concept checks</a></td>
<td>- </td>
</tr>
</table>
<br>
</p>
<hr>
<p>
&copy; <a name="Copyright" id="Copyright">Copyright</a> Thorsten Ottosen 2008.
</p>
<p>
Distributed under the Boost Software License, Version 1.0. (See
accompanying file LICENSE_1_0.txt or copy
at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)
</p>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>

143
doc/headers.qbk Normal file
View File

@ -0,0 +1,143 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:headers Library Headers]
[section:general General]
[table
[[Header ] [Includes ] [Related Concept ]]
[[`<boost/range.hpp>` ] [everything from Boost.Range version 1 (Boost versions 1.42 and below). Includes the core range functions and metafunctions, but excludes Range Adaptors and Range Algorithms. ] [- ]]
[[`<boost/range/metafunctions.hpp>` ] [every metafunction ] [- ]]
[[`<boost/range/functions.hpp>` ] [every function ] [- ]]
[[`<boost/range/value_type.hpp>` ] [__range_value__ ] [__single_pass_range__ ]]
[[`<boost/range/iterator.hpp>` ] [__range_iterator__ ] [__single_pass_range__ ]]
[[`<boost/range/difference_type.hpp>` ] [__range_difference__ ] [__forward_range__ ]]
[[`<boost/range/pointer.hpp>` ] [__range_pointer__ ] [-]]
[[`<boost/range/category.hpp>` ] [__range_category__ ] [-]]
[[`<boost/range/reverse_iterator.hpp>`] [__range_reverse_iterator__ ] [__bidirectional_range__ ]]
[[`<boost/range/begin.hpp>` ] [__begin__ and __const_begin__ ] [__single_pass_range__ ]]
[[`<boost/range/end.hpp>` ] [__end__ and __const_end__ ] [__single_pass_range__ ]]
[[`<boost/range/empty.hpp>` ] [__empty__ ] [__single_pass_range__ ]]
[[`<boost/range/distance.hpp>` ] [__distance__ ] [__forward_range__ ]]
[[`<boost/range/size.hpp>` ] [__size__ ] [__random_access_range__ ]]
[[`<boost/range/rbegin.hpp>` ] [__rbegin__ and __const_rbegin__] [__bidirectional_range__ ]]
[[`<boost/range/rend.hpp>` ] [__rend__ and __const_rend__ ] [__bidirectional_range__ ]]
[[`<boost/range/as_array.hpp>` ] [__as_array__ ] [- ]]
[[`<boost/range/as_literal.hpp>` ] [__as_literal__ ] [- ]]
[[`<boost/range/iterator_range.hpp>` ] [__iterator_range__ ] [- ]]
[[`<boost/range/sub_range.hpp>` ] [__sub_range__ ] [- ]]
[[`<boost/range/concepts.hpp>` ] [__range_concepts__ ] [- ]]
[[`<boost/range/adaptors.hpp>` ] [every range adaptor ] [- ]]
[[`<boost/range/algorithm.hpp>` ] [every range equivalent of an STL algorithm ] [- ]]
[[`<boost/range/algorithm_ext.hpp>` ] [every range algorithm that is an extension of the STL algorithms ] [- ]]
[[`<boost/range/counting_range.hpp>` ] [ __counting_range__ ] [-]]
[[`<boost/range/istream_range.hpp>` ] [ __istream_range__ ] [-]]
[[`<boost/range/irange.hpp>` ] [ __irange__ ] [-]]
[[`<boost/range/join.hpp>` ] [ __join__ ] [-]]
]
[endsect]
[section:adaptors Adaptors]
[table
[[Header ][Includes ]]
[[`<boost/range/adaptor/adjacent_filtered.hpp>`] [__range_adaptors_adjacent_filtered__ ]]
[[`<boost/range/adaptor/copied.hpp>`] [__range_adaptors_copied__]]
[[`<boost/range/adaptor/filtered.hpp>`] [__range_adaptors_filtered__]]
[[`<boost/range/adaptor/indexed.hpp>`] [__range_adaptors_indexed__]]
[[`<boost/range/adaptor/indirected.hpp>`] [__range_adaptors_indirected__]]
[[`<boost/range/adaptor/map.hpp>`] [__range_adaptors_map_keys__ __range_adaptors_map_values__]]
[[`<boost/range/adaptor/replaced.hpp>`] [__range_adaptors_replaced__]]
[[`<boost/range/adaptor/replaced_if.hpp>`] [__range_adaptors_replaced_if__]]
[[`<boost/range/adaptor/reversed.hpp>`] [__range_adaptors_reversed__]]
[[`<boost/range/adaptor/sliced.hpp>`] [__range_adaptors_sliced__]]
[[`<boost/range/adaptor/strided.hpp>`] [__range_adaptors_strided__]]
[[`<boost/range/adaptor/tokenized.hpp>`] [__range_adaptors_tokenized__]]
[[`<boost/range/adaptor/transformed.hpp>`] [__range_adaptors_transformed__]]
[[`<boost/range/adaptor/uniqued.hpp>`] [__range_adaptors_uniqued__]]
]
[endsect]
[section:algorithm Algorithm]
[table
[[Header ][Includes ]]
[[`<boost/range/algorithm/adjacent_find.hpp>`] [__range_algorithms_adjacent_find__]]
[[`<boost/range/algorithm/binary_search.hpp>`] [__range_algorithms_binary_search__]]
[[`<boost/range/algorithm/copy.hpp>`] [__range_algorithms_copy__]]
[[`<boost/range/algorithm/copy_backward.hpp>`] [__range_algorithms_copy_backward__]]
[[`<boost/range/algorithm/count.hpp>`] [__range_algorithms_count__]]
[[`<boost/range/algorithm/count_if.hpp>`] [__range_algorithms_count_if__]]
[[`<boost/range/algorithm/equal.hpp>`] [__range_algorithms_equal__]]
[[`<boost/range/algorithm/equal_range.hpp>`] [__range_algorithms_equal_range__]]
[[`<boost/range/algorithm/fill.hpp>`] [__range_algorithms_fill__]]
[[`<boost/range/algorithm/fill_n.hpp>`] [__range_algorithms_fill_n__]]
[[`<boost/range/algorithm/find.hpp>`] [__range_algorithms_find__]]
[[`<boost/range/algorithm/find_end.hpp>`] [__range_algorithms_find_end__]]
[[`<boost/range/algorithm/find_first_of.hpp>`] [__range_algorithms_find_first_of__]]
[[`<boost/range/algorithm/find_if.hpp>`] [__range_algorithms_find_if__]]
[[`<boost/range/algorithm/for_each.hpp>`] [__range_algorithms_for_each__]]
[[`<boost/range/algorithm/generate.hpp>`] [__range_algorithms_generate__]]
[[`<boost/range/algorithm/heap_algorithm.hpp>`] [__range_algorithms_push_heap__
__range_algorithms_pop_heap__
__range_algorithms_make_heap__
__range_algorithms_sort_heap__]]
[[`<boost/range/algorithm/inplace_merge.hpp>`] [__range_algorithms_inplace_merge__]]
[[`<boost/range/algorithm/lexicographical_compare.hpp>`] [__range_algorithms_lexicographical_compare__]]
[[`<boost/range/algorithm/lower_bound.hpp>`] [__range_algorithms_lower_bound__]]
[[`<boost/range/algorithm/max_element.hpp>`] [__range_algorithms_max_element__]]
[[`<boost/range/algorithm/merge.hpp>`] [__range_algorithms_merge__]]
[[`<boost/range/algorithm/min_element.hpp>`] [__range_algorithms_min_element__]]
[[`<boost/range/algorithm/mismatch.hpp>`] [__range_algorithms_mismatch__]]
[[`<boost/range/algorithm/nth_element.hpp>`] [__range_algorithms_nth_element__]]
[[`<boost/range/algorithm/partial_sort.hpp>`] [__range_algorithms_partial_sort__]]
[[`<boost/range/algorithm/partition.hpp>`] [__range_algorithms_partition__]]
[[`<boost/range/algorithm/permutation.hpp>`] [__range_algorithms_next_permutation__
__range_algorithms_prev_permutation__]]
[[`<boost/range/algorithm/random_shuffle.hpp>`] [__range_algorithms_random_shuffle__]]
[[`<boost/range/algorithm/remove.hpp>`] [__range_algorithms_remove__]]
[[`<boost/range/algorithm/remove_copy.hpp>`] [__range_algorithms_remove_copy__]]
[[`<boost/range/algorithm/remove_copy_if.hpp>`] [__range_algorithms_remove_copy_if__]]
[[`<boost/range/algorithm/remove_if.hpp>`] [__range_algorithms_remove_if__]]
[[`<boost/range/algorithm/replace.hpp>`] [__range_algorithms_replace__]]
[[`<boost/range/algorithm/replace_copy.hpp>`] [__range_algorithms_replace_copy__]]
[[`<boost/range/algorithm/replace_copy_if.hpp>`] [__range_algorithms_replace_copy_if__]]
[[`<boost/range/algorithm/replace_if.hpp>`] [__range_algorithms_replace_if__]]
[[`<boost/range/algorithm/reverse.hpp>`] [__range_algorithms_reverse__]]
[[`<boost/range/algorithm/reverse_copy.hpp>`] [__range_algorithms_reverse_copy__]]
[[`<boost/range/algorithm/rotate.hpp>`] [__range_algorithms_rotate__]]
[[`<boost/range/algorithm/rotate_copy.hpp>`] [__range_algorithms_rotate_copy__]]
[[`<boost/range/algorithm/search.hpp>`] [__range_algorithms_search__]]
[[`<boost/range/algorithm/search_n.hpp>`] [__range_algorithms_search_n__]]
[[`<boost/range/algorithm/set_algorithm.hpp>`] [__range_algorithms_includes__
__range_algorithms_set_union__
__range_algorithms_set_intersection__
__range_algorithms_set_difference__
__range_algorithms_set_symmetric_difference__]]
[[`<boost/range/algorithm/sort.hpp>`] [__range_algorithms_sort__]]
[[`<boost/range/algorithm/stable_partition.hpp>`] [__range_algorithms_stable_partition__]]
[[`<boost/range/algorithm/swap_ranges.hpp>`] [__range_algorithms_swap_ranges__]]
[[`<boost/range/algorithm/transform.hpp>`] [__range_algorithms_transform__]]
[[`<boost/range/algorithm/unique.hpp>`] [__range_algorithms_unique__]]
[[`<boost/range/algorithm/unique_copy.hpp>`] [__range_algorithms_unique_copy__]]
[[`<boost/range/algorithm/upper_bound.hpp>`] [__range_algorithms_upper_bound__]]
]
[endsect]
[section:algorithm_ext Algorithm Extensions]
[table
[[Header ][Includes ]]
[[`<boost/range/algorithm_ext/copy_n.hpp>`] [__range_algorithm_ext_copy_n__]]
[[`<boost/range/algorithm_ext/erase.hpp>`] [__range_algorithm_ext_erase__]]
[[`<boost/range/algorithm_ext/for_each.hpp>`] [__range_algorithm_ext_for_each__]]
[[`<boost/range/algorithm_ext/insert.hpp>`] [__range_algorithm_ext_insert__]]
[[`<boost/range/algorithm_ext/iota.hpp>`] [__range_algorithm_ext_iota__]]
[[`<boost/range/algorithm_ext/is_sorted.hpp>`] [__range_algorithm_ext_is_sorted__]]
[[`<boost/range/algorithm_ext/overwrite.hpp>`] [__range_algorithm_ext_overwrite__]]
[[`<boost/range/algorithm_ext/push_back.hpp>`] [__range_algorithm_ext_push_back__]]
[[`<boost/range/algorithm_ext/push_front.hpp>`] [__range_algorithm_ext_push_front__]]
]
[endsect]
[endsect]

View File

@ -1,90 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Boost.Range History and Acknowledgement </title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<table border="0" >
<tr>
<td><img src="../../../boost.png" border="0" ></td>
<td><h1 align="center">Boost.Range </h1></td>
</tr>
</table>
<h2 >History and Acknowledgement</h2><a name="History" ></a>
<p >
The library was under way for a long time. Dietmar K<>hl originally intended
to submit an <code >array_traits</code> class template which had most of
the functionality present now, but only for arrays and standard containers.
I believe this was back in 2001 or 2002.
</p>
<p>
Meanwhile work on algorithms for containers in various contexts showed the
need for handling pairs of iterators, and string libraries needed special
treatment of character arrays. In the end it made sense to formalize the
minimal requirements of these similar concepts. And the results are the
Range concepts found in this library. </p>
<p>
The term Range was adopted because of paragraph <code>24.1/7</code> from the
C++ standard: <blockquote>
Most of the library's algorithmic templates that operate on data
structures have interfaces that use ranges. A <i>range</i> is a pair of
iterators that designate the beginning and end of the computation. A
range [i, i) is an empty range; in general, a range [i, j) refers to
the elements in the data structure starting with the one pointed to
by i and up to but not including the one pointed to by j. Range [i,
j) is valid if and only if j is reachable from i. The result of the
application of functions in the library to invalid ranges is
undefined.
</blockquote>
<p>
Special thanks goes to
<ul>
<li> Pavol Droba for help with documentation and implementation
<li> Pavel Vozenilek for help with porting the library
<li> Jonathan Turkanis and John Torjo for help with documentation
<li> Hartmut Kaiser for being review manager
<li> Jonathan Turkanis for porting the lib (as far sa possible) to
vc6 and vc7.
</ul>
</p>
<p>
The concept checks and their documentation was provided by Daniel Walker.
<hr>
<p>
&copy; <a name="Copyright" id="Copyright">Copyright</a> Thorsten Ottosen 2008.
</p>
<p>
Distributed under the Boost Software License, Version 1.0. (See
accompanying file LICENSE_1_0.txt or copy
at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)
</p>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>

58
doc/history_ack.qbk Normal file
View File

@ -0,0 +1,58 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:history_ack History and Acknowledgement]
[heading Version 1 - before Boost 1.43]
The library have been under way for a long time. Dietmar Kühl originally intended to submit an `array_traits` class template which had most of the functionality present now, but only for arrays and standard containers.
Meanwhile work on algorithms for containers in various contexts showed the need for handling pairs of iterators, and string libraries needed special treatment of character arrays. In the end it made sense to formalize the minimal requirements of these similar concepts. And the results are the Range concepts found in this library.
The term Range was adopted because of paragraph 24.1/7 from the C++ standard:
Most of the library's algorithmic templates that operate on data structures have interfaces that use ranges. A range is a pair of iterators that designate the beginning and end of the computation. A range [i, i) is an empty range; in general, a range [i, j) refers to the elements in the data structure starting with the one pointed to by i and up to but not including the one pointed to by j. Range [i, j) is valid if and only if j is reachable from i. The result of the application of functions in the library to invalid ranges is undefined.
Special thanks goes to
* Pavol Droba for help with documentation and implementation
* Pavel Vozenilek for help with porting the library
* Jonathan Turkanis and John Torjo for help with documentation
* Hartmut Kaiser for being review manager
* Jonathan Turkanis for porting the lib (as far as possible) to vc6 and vc7.
The concept checks and their documentation was provided by Daniel Walker.
[heading Version 2 - Boost 1.43 and beyond]
This version introduced Range Adaptors and Range Algorithms. This version 2 is
the result of a merge of all of the RangeEx features into Boost.Range.
There were an enormous number of very significant contributors through all
stages of this library.
Prior to Boost.RangeEx there had been a number of Range library implementations,
these include library implementations by Eric Niebler, Adobe,
Shunsuke Sogame etc. Eric Niebler contributed the Range Adaptor idea which is
arguably the single biggest innovation in this library. Inevitably a great deal
of commonality evolved in each of these libraries, but a considerable amount
of effort was expended to learn from all of the divergent techniques.
The people in the following list all made contributions in the form of reviews,
user feedback, design suggestions, or defect detection:
* Thorsten Ottosen: review management, design advice, documentation feedback
* Eric Niebler: early implementation, and review feedback
* Joel de Guzman: review
* Mathias Gaunard: review
* David Abrahams: implementation advice
* Robert Jones: defect reports, usage feedback
* Sean Parent: contributed experience from the Adobe range library
* Arno Schoedl: implementations, and review
* Rogier van Dalen: review
* Vincente Botet: review, documentation feedback
Regardless of how I write this section it will never truly fairly capture the
gratitude that I feel to all who have contributed. Thank you everyone.
[endsect]

View File

@ -1,164 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Boost.Range Introduction </title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<table border="0" >
<tr>
<td ><img src="../../../boost.png" border="0" ></td>
<td ><h1 align="center">Boost.Range</h1></td>
</tr>
</table>
<h2>Introduction</h2>
<p>
Generic algorithms have so far been specified in terms of two or more
iterators. Two iterators would together form a range of values that the
algorithm could work on. This leads to a very general interface, but also
to a somewhat clumsy use of the algorithms with redundant specification
of container names. Therefore we would like to raise the abstraction level
for algorithms so they specify their interface in terms of <a
href="range.html">Ranges</a> as much as possible.
</p>
<p>
The most common form of ranges we are used to work with is standard library
containers. However, one
often finds it desirable to extend that code to work with other types that
offer
enough functionality to satisfy the needs of the generic code
<i>if a suitable layer of indirection is applied </i>. For
example, raw arrays are often suitable for use with generic code that
works with containers, provided a suitable adapter is used.
</p>
<p>
This library therefore provides the means to adapt standard-like
containers, <code>std::pairs</code> of iterators, and raw arrays (and
more), such that
the same generic code can work with them all.
The basic idea is to add another layer of indirection using <a
href="../../mpl/doc/refmanual/metafunction.html">metafunctions</a> and
free-standing functions so syntactic and/or semantic differences can be removed.
</p>
<p >
The main advantages are
<ul >
<li >
simpler implementation and specification of generic range algorithms
</li>
<li >
more flexible, compact and maintainable client code
</li>
<li >
safe use of built-in arrays
</li>
</ul>
</p>
<p > Below is given a small example (the complete example can be found <a
href="../test/algorithm_example.cpp" target="_self" >here</a>): <blockquote>
<pre >
<span class=comment>
//
// example: extracting bounds in a generic algorithm
//
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>ForwardReadableRange</span><span class=special>, </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword>inline </span><span class=keyword>typename </span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>range_iterator</span><span class=special>&lt; </span><span class=identifier>ForwardReadableRange </span><span class=special>&gt;::</span><span class=identifier>type
</span><span class=identifier>find</span><span class=special>( </span><span class=identifier>ForwardReadableRange</span><span class=special>&amp; </span><span class=identifier>c</span><span class=special>, </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>value </span><span class=special>)
</span><span class=special>{
</span><span class=keyword>return </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>find</span><span class=special>( </span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>begin</span><span class=special>( </span><span class=identifier>c </span><span class=special>), </span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>end</span><span class=special>( </span><span class=identifier>c </span><span class=special>), </span><span class=identifier>value </span><span class=special>);
</span><span class=special>}
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>ForwardReadableRange</span><span class=special>, </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword>inline </span><span class=keyword>typename </span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>range_iterator</span><span class=special>&lt; </span><span class=keyword>const </span><span
class=identifier>ForwardReadableRange </span><span class=special>&gt;::</span><span class=identifier>type
</span><span class=identifier>find</span><span class=special>( </span><span class=keyword>const </span><span class=identifier>ForwardReadableRange</span><span class=special>&amp; </span><span class=identifier>c</span><span class=special>, </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>value </span><span class=special>)
</span><span class=special>{
</span><span class=keyword>return </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>find</span><span class=special>( </span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>begin</span><span class=special>( </span><span class=identifier>c </span><span class=special>), </span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>end</span><span class=special>( </span><span class=identifier>c </span><span class=special>), </span><span class=identifier>value </span><span class=special>);
</span><span class=special>}
</span><span class=comment>//
// replace first value and return its index
//
</span><span class=keyword>template</span><span class=special>&lt; </span><span class=keyword>class </span><span class=identifier>ForwardReadableWriteableRange</span><span class=special>, </span><span class=keyword>class </span><span class=identifier>T </span><span class=special>&gt;
</span><span class=keyword>inline </span><span class=keyword>typename </span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>range_difference</span><span class=special>&lt; </span><span class=identifier>ForwardReadableWriteableRange </span><span class=special>&gt;::</span><span class=identifier>type
</span><span class=identifier>my_generic_replace</span><span class=special>( </span><span class=identifier>ForwardReadableWriteableRange</span><span class=special>&amp; </span><span class=identifier>c</span><span class=special>, </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>value</span><span class=special>, </span><span class=keyword>const </span><span class=identifier>T</span><span class=special>&amp; </span><span class=identifier>replacement </span><span class=special>)
</span><span class=special>{
</span><span class=keyword>typename </span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>range_iterator</span><span class=special>&lt; </span><span class=identifier>ForwardReadableWriteableRange </span><span class=special>&gt;::</span><span class=identifier>type </span><span class=identifier>found </span><span class=special>= </span><span class=identifier>find</span><span class=special>( </span><span class=identifier>c</span><span class=special>, </span><span class=identifier>value </span><span class=special>);
</span><span class=keyword>if</span><span class=special>( </span><span class=identifier>found </span><span class=special>!= </span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>end</span><span class=special>( </span><span class=identifier>c </span><span class=special>) </span><span class=special>)
</span><span class=special>*</span><span class=identifier>found </span><span class=special>= </span><span class=identifier>replacement</span><span class=special>;
</span><span class=keyword>return </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>distance</span><span class=special>( </span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>begin</span><span class=special>( </span><span class=identifier>c </span><span class=special>), </span><span class=identifier>found </span><span class=special>);
</span><span class=special>}
</span><span class=comment>//
// usage
//
</span><span class=keyword>const </span><span class=keyword>int </span><span class=identifier>N </span><span class=special>= </span><span class=number>5</span><span class=special>;
</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>vector</span><span class=special>&lt;</span><span class=keyword>int</span><span class=special>&gt; </span><span class=identifier>my_vector</span><span class=special>;
</span><span class=keyword>int </span><span class=identifier>values</span><span class=special>[] </span><span class=special>= </span><span class=special>{ </span><span class=number>1</span><span class=special>,</span><span class=number>2</span><span class=special>,</span><span class=number>3</span><span class=special>,</span><span class=number>4</span><span class=special>,</span><span class=number>5</span><span class=special>,</span><span class=number>6</span><span class=special>,</span><span class=number>7</span><span class=special>,</span><span class=number>8</span><span class=special>,</span><span class=number>9 </span><span class=special>};
</span>
<span class=identifier>my_vector</span><span class=special>.</span><span
class=identifier>assign</span><span class=special>( </span><span class=identifier>values</span><span class=special>, </span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>end</span><span class=special>( </span><span class=identifier>values </span><span class=special>) </span><span class=special>);</span>
<span class=keyword>typedef </span><span class=identifier>std</span><span class=special>::</span><span class=identifier>vector</span><span class=special>&lt;</span><span class=keyword>int</span><span class=special>&gt;::</span><span class=identifier>iterator </span><span class=identifier>iterator</span><span class=special>;
</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>pair</span><span class=special>&lt;</span><span class=identifier>iterator</span><span class=special>,</span><span class=identifier>iterator</span><span class=special>&gt; </span><span class=identifier>my_view</span><span class=special>( </span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>begin</span><span class=special>( </span><span class=identifier>my_vector </span><span class=special>),
</span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>begin</span><span class=special>( </span><span class=identifier>my_vector </span><span class=special>) </span><span class=special>+ </span><span class=identifier>N </span><span class=special>);
</span><span class=keyword>char </span><span class=identifier>str_val</span><span class=special>[] </span><span class=special>= </span><span class=string>&quot;a string&quot;</span><span class=special>;
</span><span class=keyword>char</span><span class=special>* </span><span class=identifier>str </span><span class=special>= </span><span class=identifier>str_val</span><span class=special>;
</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>cout </span><span class=special>&lt;&lt; </span><span class=identifier>my_generic_replace</span><span class=special>( </span><span class=identifier>my_vector</span><span class=special>, </span><span class=number>4</span><span class=special>, </span><span class=number>2 </span><span class=special>);
</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>cout </span><span class=special>&lt;&lt; </span><span class=identifier>my_generic_replace</span><span class=special>( </span><span class=identifier>my_view</span><span class=special>, </span><span class=number>4</span><span class=special>, </span><span class=number>2 </span><span class=special>);
</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>cout </span><span class=special>&lt;&lt; </span><span class=identifier>my_generic_replace</span><span class=special>( </span><span class=identifier>str</span><span class=special>, </span><span class=literal>'a'</span><span class=special>, </span><span class=literal>'b' </span><span class=special>);
</span>
<span class=comment>// prints '3', '5' and '0' </span>
</pre>
</blockquote>
By using the free-standing functions and <a
href="../../mpl/doc/refmanual/metafunction.html">metafunctions</a>, the code automatically
works for all the types supported by this library; now and in the future.
Notice that we have to
provide two version of <code >find()</code> since we cannot forward a non-const
rvalue with reference arguments (see this article about <a href="http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2002/n1385.htm" target="_self" >The
Forwarding Problem</a> ).
</p>
<hr>
<p>
&copy; <a name="Copyright" id="Copyright">Copyright</a> Thorsten Ottosen 2008.
</p>
<p>
Distributed under the Boost Software License, Version 1.0. (See
accompanying file LICENSE_1_0.txt or copy
at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)
</p>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>

43
doc/introduction.qbk Normal file
View File

@ -0,0 +1,43 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:introduction Introduction]
Generic algorithms have so far been specified in terms of two or more iterators. Two iterators would together form a range of values that the algorithm could work on. This leads to a very general interface, but also to a somewhat clumsy use of the algorithms with redundant specification of container names. Therefore we would like to raise the abstraction level for algorithms so they specify their interface in terms of __ranges__ as much as possible.
The most common form of ranges used throughout the C++ community are standard library containers. When writing algorithms however, one often finds it desirable for the algorithm to accept other types that offer enough functionality to satisfy the needs of the generic code [*/if a suitable layer of indirection is applied/] . For example, raw arrays are often suitable for use with generic code that works with containers, provided a suitable adapter is used. Likewise, null terminated strings can be treated as containers of characters, if suitably adapted.
This library therefore provides the means to adapt standard-like containers, null terminated strings, `std::pairs` of iterators, and raw arrays (and more), such that the same generic code can work with them all. The basic idea is to add another layer of indirection using __metafunctions__ and free-standing functions so syntactic and/or semantic differences can be removed.
The main advantages are
* simpler implementation and specification of generic range algorithms
* more flexible, compact and maintainable client code
* safe use of built-in arrays (for legacy code; why else would you use built-in arrays?)
[heading Example - Iterate over the values in a map]
``
using namespace boost;
using namespace boost::adaptors;
for_each( my_map | map_values, fn );
``
[heading Example - Iterate over the keys in a map]
``
using namespace boost;
using namespace boost::adaptors;
for_each( my_map | map_keys, fn );
``
[heading Example - Push the even values from a map in reverse order into the container `target`]
``
using namespace boost;
using namespace boost::adaptors;
// Assume that is_even is a predicate that has been implemented elsewhere...
push_back(target, my_map | map_values | filtered(is_even()) | reversed);
``
[endsect]

View File

@ -1,581 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.3.10: http://docutils.sourceforge.net/" />
<title>Boost Range MFC/ATL Extension</title>
<meta name="author" content="Shunsuke Sogame" />
<meta name="date" content="26th of May 2006" />
<meta name="copyright" content="Shunsuke Sogame 2005-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see LICENSE_1_0.txt)." />
<style type="text/css">
/*
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:Date: $Date: 2005-09-25 17:49:54 +0200 (Sun, 25 Sep 2005) $
:Revision: $Revision: 3901 $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* "! important" is used here to override other ``margin-top`` and
``margin-bottom`` styles that are later in the stylesheet or
more specific. See http://www.w3.org/TR/CSS1#the-cascade */
.first {
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin-left: 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left {
clear: left }
img.align-right {
clear: right }
img.borderless {
border: 0 }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font-family: serif ;
font-size: 100% }
pre.line-block {
font-family: serif ;
font-size: 100% }
pre.literal-block, pre.doctest-block {
margin-left: 2em ;
margin-right: 2em ;
background-color: #eeeeee }
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid thin gray }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid thin black }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
tt.docutils {
background-color: #eeeeee }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="boost-range-mfc-atl-extension">
<h1 class="title"><img alt="Boost" src="http://www.boost.org/libs/ptr_container/doc/boost.png" /> Range MFC/ATL Extension</h1>
<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" />
<col class="docinfo-content" />
<tbody valign="top">
<tr><th class="docinfo-name">Author:</th>
<td>Shunsuke Sogame</td></tr>
<tr><th class="docinfo-name">Contact:</th>
<td><a class="first last reference" href="mailto:mb2act&#64;yahoo.co.jp">mb2act&#64;yahoo.co.jp</a></td></tr>
<tr><th class="docinfo-name">Date:</th>
<td>26th of May 2006</td></tr>
<tr><th class="docinfo-name">Copyright:</th>
<td>Shunsuke Sogame 2005-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see <a class="reference" href="http://www.boost.org/LICENSE_1_0.txt">LICENSE_1_0.txt</a>).</td></tr>
</tbody>
</table>
<div class="section">
<h1><a id="overview" name="overview">Overview</a></h1>
<p>Boost.Range MFC/ATL Extension provides <a class="reference" href="../index.html">Boost.Range</a> support for MFC/ATL collection and string types.</p>
<pre class="literal-block">
CTypedPtrArray&lt;CPtrArray, CList&lt;CString&gt; *&gt; myArray;
...
BOOST_FOREACH (CList&lt;CString&gt; *theList, myArray)
{
BOOST_FOREACH (CString&amp; str, *theList)
{
boost::to_upper(str);
std::sort(boost::begin(str), boost::end(str));
...
}
}
</pre>
<ul class="simple">
<li><a class="reference" href="#requirements">Requirements</a></li>
<li><a class="reference" href="#mfc-ranges">MFC Ranges</a></li>
<li><a class="reference" href="#atl-ranges">ATL Ranges</a></li>
<li><a class="reference" href="#const-ranges">const Ranges</a></li>
<li><a class="reference" href="#references">References</a></li>
</ul>
</div>
<div class="section">
<h1><a id="requirements" name="requirements">Requirements</a></h1>
<ul class="simple">
<li><a class="reference" href="http://www.boost.org/">Boost C++ Libraries Version 1.34.0</a> or later (no compilation required)</li>
<li>Visual C++ 7.1 or Visual C++ 8.0</li>
</ul>
</div>
<div class="section">
<h1><a id="mfc-ranges" name="mfc-ranges">MFC Ranges</a></h1>
<p>If the <tt class="docutils literal"><span class="pre">&lt;boost/range/mfc.hpp&gt;</span></tt> is included before or after <a class="reference" href="../index.html">Boost.Range</a> headers,
the MFC collections and strings become models of Range.
The table below lists the Traversal Category and <tt class="docutils literal"><span class="pre">range_reference</span></tt> of MFC ranges.</p>
<table border="1" class="docutils">
<colgroup>
<col width="34%" />
<col width="21%" />
<col width="45%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head"><tt class="docutils literal"><span class="pre">Range</span></tt></th>
<th class="head">Traversal Category</th>
<th class="head"><tt class="docutils literal"><span class="pre">range_reference&lt;Range&gt;::type</span></tt></th>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="docutils literal"><span class="pre">CArray&lt;T,A&gt;</span></tt></td>
<td>Random Access</td>
<td><tt class="docutils literal"><span class="pre">T&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CList&lt;T,A&gt;</span></tt></td>
<td>Bidirectional</td>
<td><tt class="docutils literal"><span class="pre">T&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CMap&lt;K,AK,M,AM&gt;</span></tt></td>
<td>Forward</td>
<td><tt class="docutils literal"><span class="pre">Range::CPair&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CTypedPtrArray&lt;B,T*&gt;</span></tt></td>
<td>Random Access</td>
<td><tt class="docutils literal"><span class="pre">T*</span> <span class="pre">const</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CTypedPtrList&lt;B,T*&gt;</span></tt></td>
<td>Bidirectional</td>
<td><tt class="docutils literal"><span class="pre">T*</span> <span class="pre">const</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CTypedPtrMap&lt;B,T*,V*&gt;</span></tt></td>
<td>Forward</td>
<td><tt class="docutils literal"><span class="pre">std::pair&lt;T*,V*&gt;</span> <span class="pre">const</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CByteArray</span></tt></td>
<td>Random Access</td>
<td><tt class="docutils literal"><span class="pre">BYTE&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CDWordArray</span></tt></td>
<td>Random Access</td>
<td><tt class="docutils literal"><span class="pre">DWORD&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CObArray</span></tt></td>
<td>Random Access</td>
<td><tt class="docutils literal"><span class="pre">CObject*</span> <span class="pre">&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CPtrArray</span></tt></td>
<td>Random Access</td>
<td><tt class="docutils literal"><span class="pre">void*</span> <span class="pre">&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CStringArray</span></tt></td>
<td>Random Access</td>
<td><tt class="docutils literal"><span class="pre">CString&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CUIntArray</span></tt></td>
<td>Random Access</td>
<td><tt class="docutils literal"><span class="pre">UINT&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CWordArray</span></tt></td>
<td>Random Access</td>
<td><tt class="docutils literal"><span class="pre">WORD&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CObList</span></tt></td>
<td>Bidirectional</td>
<td><tt class="docutils literal"><span class="pre">CObject*</span> <span class="pre">&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CPtrList</span></tt></td>
<td>Bidirectional</td>
<td><tt class="docutils literal"><span class="pre">void*</span> <span class="pre">&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CStringList</span></tt></td>
<td>Bidirectional</td>
<td><tt class="docutils literal"><span class="pre">CString&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CMapPtrToWord</span></tt></td>
<td>Forward</td>
<td><tt class="docutils literal"><span class="pre">std::pair&lt;void*,WORD&gt;</span> <span class="pre">const</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CMapPtrToPtr</span></tt></td>
<td>Forward</td>
<td><tt class="docutils literal"><span class="pre">std::pair&lt;void*,void*&gt;</span> <span class="pre">const</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CMapStringToOb</span></tt></td>
<td>Forward</td>
<td><tt class="docutils literal"><span class="pre">std::pair&lt;String,CObject*&gt;</span> <span class="pre">const</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CMapStringToString</span></tt></td>
<td>Forward</td>
<td><tt class="docutils literal"><span class="pre">Range::CPair&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CMapWordToOb</span></tt></td>
<td>Forward</td>
<td><tt class="docutils literal"><span class="pre">std::pair&lt;WORD,CObject*&gt;</span> <span class="pre">const</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CMapWordToPtr</span></tt></td>
<td>Forward</td>
<td><tt class="docutils literal"><span class="pre">std::pair&lt;WORD,void*&gt;</span> <span class="pre">const</span></tt></td>
</tr>
</tbody>
</table>
<p>Other <a class="reference" href="../index.html">Boost.Range</a> metafunctions are defined by the following.
Let <tt class="docutils literal"><span class="pre">Range</span></tt> be any type listed above and <tt class="docutils literal"><span class="pre">ReF</span></tt> be the same as <tt class="docutils literal"><span class="pre">range_reference&lt;Range&gt;::type</span></tt>.
<tt class="docutils literal"><span class="pre">range_value&lt;Range&gt;::type</span></tt> is the same as <tt class="docutils literal"><span class="pre">remove_reference&lt;remove_const&lt;Ref&gt;::type&gt;::type</span></tt>,
<tt class="docutils literal"><span class="pre">range_difference&lt;Range&gt;::type</span></tt> is the same as <tt class="docutils literal"><span class="pre">std::ptrdiff_t</span></tt>, and
<tt class="docutils literal"><span class="pre">range_pointer&lt;Range&gt;::type</span></tt> is the same as <tt class="docutils literal"><span class="pre">add_pointer&lt;remove_reference&lt;Ref&gt;::type&gt;::type</span></tt>.
As for <tt class="docutils literal"><span class="pre">const</span> <span class="pre">Range</span></tt>, see <a class="reference" href="#const-ranges">const Ranges</a>.</p>
</div>
<div class="section">
<h1><a id="atl-ranges" name="atl-ranges">ATL Ranges</a></h1>
<p>If the <tt class="docutils literal"><span class="pre">&lt;boost/range/atl.hpp&gt;</span></tt> is included before or after <a class="reference" href="../index.html">Boost.Range</a> headers,
the ATL collections and strings become models of Range.
The table below lists the Traversal Category and <tt class="docutils literal"><span class="pre">range_reference</span></tt> of ATL ranges.</p>
<table border="1" class="docutils">
<colgroup>
<col width="34%" />
<col width="21%" />
<col width="45%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head"><tt class="docutils literal"><span class="pre">Range</span></tt></th>
<th class="head">Traversal Category</th>
<th class="head"><tt class="docutils literal"><span class="pre">range_reference&lt;Range&gt;::type</span></tt></th>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="docutils literal"><span class="pre">CAtlArray&lt;E,ET&gt;</span></tt></td>
<td>Random Access</td>
<td><tt class="docutils literal"><span class="pre">E&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CAutoPtrArray&lt;E&gt;</span></tt></td>
<td>Random Access</td>
<td><tt class="docutils literal"><span class="pre">E&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CInterfaceArray&lt;I,pi&gt;</span></tt></td>
<td>Random Access</td>
<td><tt class="docutils literal"><span class="pre">CComQIPtr&lt;I,pi&gt;&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CAtlList&lt;E,ET&gt;</span></tt></td>
<td>Bidirectional</td>
<td><tt class="docutils literal"><span class="pre">E&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CAutoPtrList&lt;E&gt;</span></tt></td>
<td>Bidirectional</td>
<td><tt class="docutils literal"><span class="pre">E&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CHeapPtrList&lt;E,A&gt;</span></tt></td>
<td>Bidirectional</td>
<td><tt class="docutils literal"><span class="pre">E&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CInterfaceList&lt;I,pi&gt;</span></tt></td>
<td>Bidirectional</td>
<td><tt class="docutils literal"><span class="pre">CComQIPtr&lt;I,pi&gt;&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CAtlMap&lt;K,V,KT,VT&gt;</span></tt></td>
<td>Forward</td>
<td><tt class="docutils literal"><span class="pre">Range::CPair&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CRBTree&lt;K,V,KT,VT&gt;</span></tt></td>
<td>Bidirectional</td>
<td><tt class="docutils literal"><span class="pre">Range::CPair&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CRBMap&lt;K,V,KT,VT&gt;</span></tt></td>
<td>Bidirectional</td>
<td><tt class="docutils literal"><span class="pre">Range::CPair&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CRBMultiMap&lt;K,V,KT,VT&gt;</span></tt></td>
<td>Bidirectional</td>
<td><tt class="docutils literal"><span class="pre">Range::CPair&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CSimpleStringT&lt;B,b&gt;</span></tt></td>
<td>Random Access</td>
<td><tt class="docutils literal"><span class="pre">B&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CStringT&lt;B,ST&gt;</span></tt></td>
<td>Random Access</td>
<td><tt class="docutils literal"><span class="pre">B&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CFixedStringT&lt;S,n&gt;</span></tt></td>
<td>Random Access</td>
<td><tt class="docutils literal"><span class="pre">range_reference&lt;S&gt;::type</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CStringT&lt;B,ST&gt;</span></tt></td>
<td>Random Access</td>
<td><tt class="docutils literal"><span class="pre">B&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CComBSTR</span></tt></td>
<td>Random Access</td>
<td><tt class="docutils literal"><span class="pre">OLECHAR&amp;</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">CSimpleArray&lt;T,TE&gt;</span></tt></td>
<td>Random Access</td>
<td><tt class="docutils literal"><span class="pre">T&amp;</span></tt></td>
</tr>
</tbody>
</table>
<p>Other <a class="reference" href="../index.html">Boost.Range</a> metafunctions are defined by the following.
Let <tt class="docutils literal"><span class="pre">Range</span></tt> be any type listed above and <tt class="docutils literal"><span class="pre">ReF</span></tt> be the same as <tt class="docutils literal"><span class="pre">range_reference&lt;Range&gt;::type</span></tt>.
<tt class="docutils literal"><span class="pre">range_value&lt;Range&gt;::type</span></tt> is the same as <tt class="docutils literal"><span class="pre">remove_reference&lt;Ref&gt;::type</span></tt>,
<tt class="docutils literal"><span class="pre">range_difference&lt;Range&gt;::type</span></tt> is the same as <tt class="docutils literal"><span class="pre">std::ptrdiff_t</span></tt>, and
<tt class="docutils literal"><span class="pre">range_pointer&lt;Range&gt;::type</span></tt> is the same as <tt class="docutils literal"><span class="pre">add_pointer&lt;remove_reference&lt;Ref&gt;::type&gt;::type</span></tt>.
As for <tt class="docutils literal"><span class="pre">const</span> <span class="pre">Range</span></tt>, see <a class="reference" href="#const-ranges">const Ranges</a>.</p>
</div>
<div class="section">
<h1><a id="const-ranges" name="const-ranges">const Ranges</a></h1>
<p><tt class="docutils literal"><span class="pre">range_reference&lt;const</span> <span class="pre">Range&gt;::type</span></tt> is defined by the following algorithm.
Let <tt class="docutils literal"><span class="pre">Range</span></tt> be any type listed above and <tt class="docutils literal"><span class="pre">ReF</span></tt> be the same as <tt class="docutils literal"><span class="pre">range_reference&lt;Range&gt;::type</span></tt>.</p>
<pre class="literal-block">
if (Range is CObArray || Range is CObList)
return CObject const * &amp;
else if (Range is CPtrArray || Range is CPtrList)
return void const * &amp;
else if (there is a type X such that X&amp; is the same as ReF)
return X const &amp;
else if (there is a type X such that X* const is the same as ReF)
return X const * const
else
return ReF
</pre>
<p>Other <a class="reference" href="../index.html">Boost.Range</a> metafunctions are defined by the following.
<tt class="docutils literal"><span class="pre">range_value&lt;const</span> <span class="pre">Range&gt;::type</span></tt> is the same as <tt class="docutils literal"><span class="pre">range_value&lt;Range&gt;::type</span></tt>,
<tt class="docutils literal"><span class="pre">range_difference&lt;const</span> <span class="pre">Range&gt;::type</span></tt> is the same as <tt class="docutils literal"><span class="pre">std::ptrdiff_t</span></tt>, and
<tt class="docutils literal"><span class="pre">range_pointer&lt;const</span> <span class="pre">Range&gt;::type</span></tt> is the same as <tt class="docutils literal"><span class="pre">add_pointer&lt;remove_reference&lt;range_reference&lt;const</span> <span class="pre">Range&gt;::type&gt;::type&gt;::type</span></tt>.</p>
</div>
<div class="section">
<h1><a id="references" name="references">References</a></h1>
<ul class="simple">
<li><a class="reference" href="../index.html">Boost.Range</a></li>
<li><a class="reference" href="http://msdn2.microsoft.com/en-us/library/942860sh.aspx">MFC Collections</a></li>
<li><a class="reference" href="http://msdn2.microsoft.com/en-US/library/15e672bd.aspx">ATL Collection Classes</a></li>
</ul>
</div>
</div>
</body>
</html>

148
doc/mfc_atl.qbk Normal file
View File

@ -0,0 +1,148 @@
[/
Copyright 2010 Neil Groves
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)
/]
[def __mfc_collections__ [@http://msdn.microsoft.com/en-us/library/942860sh.aspx MFC Collection Classes]]
[def __atl_collections__ [@http://msdn.microsoft.com/en-us/library/15e672bd.aspx ATL Collection Classes]]
[section:mfc_atl MFC/ATL (courtesy of Shunsuke Sogame)]
[h4 Introduction]
This implementation was kindly donated by Shunsuke Sogame. This header adapts MFC and ATL containers to the appropriate Range concepts.
[table
[]
[[[*Author:]] [Shunsuke Sogame]]
[[[*Contact:]] [mb2act@yahoo.co.jp]]
[[[*Date:]] [26th of May 2006]]
[[[*Copyright:]] [Shunsuke Sogame 2005-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0]]
]
[h4 Overview]
Boost.Range MFC/ATL Extension provides Boost.Range support for MFC/ATL collection and string types.
``
CTypedPtrArray<CPtrArray, CList<CString> *> myArray;
...
BOOST_FOREACH (CList<CString> *theList, myArray)
{
BOOST_FOREACH (CString& str, *theList)
{
boost::to_upper(str);
std::sort(boost::begin(str), boost::end(str));
...
}
}
``
[section:requirements Requirements]
* Boost C++ Libraries Version 1.34.0 or later (no compilation required)
* Visual C++ 7.1 or later (for MFC and ATL)
[endsect]
[section:mfc_ranges MFC Ranges]
If the `<boost/range/mfc.hpp>` is included before or after Boost.Range headers, the MFC collections and strings become models of Range. The table below lists the Traversal Category and `range_reference` of MFC ranges.
[table
[[Range] [Traversal Category] [`range_reference<Range>::type`]]
[[`CArray<T,A>`] [__random_access_range__] [`T&`]]
[[`CList<T,A>`] [__bidirectional_range__] [`T&`]]
[[`CMap<K,AK,M,AM>`] [__forward_range__] [`Range::CPair&`]]
[[`CTypedPtrArray<B,T*>`] [__random_access_range__] [`T* const`]]
[[`CTypedPtrList<B,T*>`] [__bidirectional_range__] [`T* const`]]
[[`CTypedPtrMap<B,T*,V*>`] [__forward_range__] [`std::pair<T*,V*> const`]]
[[`CByteArray`] [__random_access_range__] [`BYTE&`]]
[[`CDWordArray`] [__random_access_range__] [`DWORD&`]]
[[`CObArray`] [__random_access_range__] [`CObject*&`]]
[[`CPtrArray`] [__random_access_range__] [`void*&`]]
[[`CStringArray`] [__random_access_range__] [`CString&`]]
[[`CUIntArray`] [__random_access_range__] [`UINT&`]]
[[`CWordArray`] [__random_access_range__] [`WORD&`]]
[[`CObList`] [__bidirectional_range__] [`CObject*&`]]
[[`CPtrList`] [__bidirectional_range__] [`void*&`]]
[[`CStringList`] [__bidirectional_range__] [`CString&`]]
[[`CMapPtrToWord`] [__forward_range__] [`std::pair<void*,WORD> const`]]
[[`CMapPtrToPtr`] [__forward_range__] [`std::pair<void*,void*> const`]]
[[`CMapStringToOb`] [__forward_range__] [`std::pair<String,CObject*> const`]]
[[`CMapStringToString`] [__forward_range__] [`Range::CPair&`]]
[[`CMapWordToOb`] [__forward_range__] [`std::pair<WORD,CObject*> const`]]
[[`CMapWordToPtr`] [__forward_range__] [`std::pair<WORD,void*> const`]]
]
Other Boost.Range metafunctions are defined by the following. Let `Range` be any type listed above and `Ref` be the same as `range_reference<Range>::type`. `range_value<Range>::type` is the same as `remove_reference<remove_const<Ref>::type>::type`, `range_difference<Range>::type` is the same as `std::ptrdiff_t`, and `range_pointer<Range>::type` is the same as `add_pointer<remove_reference<Ref>::type>::type`. As for `const Range`, see below.
Adam Walling has provided the header `<boost/range/mfc_map.hpp>` to add support
for the map adaptor with MFC map types.
[endsect]
[section:atl_ranges ATL Ranges]
If the `<boost/range/atl.hpp>` is included before or after Boost.Range headers, the ATL collections and strings become models of Range. The table below lists the Traversal Category and `range_reference` of ATL ranges.
[table
[[Range] [Traversal Category] [`range_reference<Range>::type`]]
[[`CAtlArray<E,ET>`] [__random_access_range__] [`E&`]]
[[`CAutoPtrArray<E>`] [__random_access_range__] [`E&`]]
[[`CInterfaceArray<I,pi>`] [__random_access_range__] [`CComQIPtr<I,pi>&`]]
[[`CAtlList<E,ET>`] [__bidirectional_range__] [`E&`]]
[[`CAutoPtrList<E>`] [__bidirectional_range__] [`E&`]]
[[`CHeapPtrList<E,A>`] [__bidirectional_range__] [`E&`]]
[[`CInterfaceList<I,pi>`] [__bidirectional_range__] [`CComQIPtr<I,pi>&`]]
[[`CAtlMap<K,V,KT,VT>`] [__forward_range__] [`Range::CPair&`]]
[[`CRBTree<K,V,KT,VT>`] [__bidirectional_range__] [`Range::CPair&`]]
[[`CRBMap<K,V,KT,VT>`] [__bidirectional_range__] [`Range::CPair&`]]
[[`CRBMultiMap<K,V,KT,VT>`] [__bidirectional_range__] [`Range::CPair&`]]
[[`CSimpleStringT<B,b>`] [__random_access_range__] [`B&`]]
[[`CStringT<B,ST>`] [__random_access_range__] [`B&`]]
[[`CFixedStringT<S,n>`] [__random_access_range__] [`range_reference<S>::type`]]
[[`CComBSTR`] [__random_access_range__] [`OLECHAR&`]]
[[`CSimpleArray<T,TE>`] [__random_access_range__] [`T&`]]
]
Other __boost_range_home__ metafunctions are defined by the following. Let `Range` be any type listed above and `Ref` be the same as `range_reference<Range>::type`. `range_value<Range>::type` is the same as `remove_reference<Ref>::type`, `range_difference<Range>::type` is the same as `std::ptrdiff_t`, and `range_pointer<Range>::type` is the same as `add_pointer<remove_reference<Ref>::type>::type`. As for `const Range`, see below.
[endsect]
[section:const_ranges const Ranges]
`range_reference<const Range>::type` is defined by the following algorithm. Let `Range` be any type listed above and `Ref` be the same as `range_reference<Range>::type`.
``
if (Range is CObArray || Range is CObList)
return CObject const * &
else if (Range is CPtrArray || Range is CPtrList)
return void const * &
else if (there is a type X such that X& is the same as Ref)
return X const &
else if (there is a type X such that X* const is the same as Ref)
return X const * const
else
return Ref
``
Other Boost.Range metafunctions are defined by the following.
[table
[[Range metafunction] [Result]]
[[`range_value<const Range>::type`] [`range_value<Range>::type`]]
[[`range_difference<const Range>::type`] [`std::ptrdiff_t`]]
[[`range_pointer<const Range>::type`] [`add_pointer<remove_reference<range_reference<const Range>::type>::type>::type`]]
]
[endsect]
[section:references References]
# __boost_range_home__
# __mfc_collections__
# __atl_collections__
[endsect]
[endsect]

View File

@ -1,103 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Boost.Range Portability </title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<table border="0" >
<tr>
<td ><img src="../../../boost.png" border="0" ></td>
<td ><h1 align="center">Boost.Range</h1></td>
</tr>
</table>
<h2>Portability</h2><a name="Portability" ></a>
<p>
A huge effort has been made to port the library to as many compilers as possible.
<!-- The results of the test-suites can be found <a
href="http://boost.sourceforge.net/regression-logs/developer/range.html">here</a
>.--> </p>
<p>
Full support for built-in arrays require that the compiler supports class
template partial specialization. For non-conforming compilers there might be a
chance that it works anyway thanks to workarounds in the type traits library.
</p>
<p> Visual C++ 6/7.0 has a limited support for arrays: as long as the arrays
are of built-in type it should work.
</p>
<p >
Notice also that some compilers cannot do function template ordering properly.
In that case one must rely on <a
href="boost_range.html#range_iterator"><code >range_iterator</code></a>
and a single function definition instead of overloaded versions for const and
non-const arguments.
So if one cares about old compilers, one should not pass rvalues to the
functions.
</p>
<p>
For maximum portability you should follow these guidelines:
<ol>
<li>
do not use built-in arrays,
<li>
do not pass rvalues to <a
href="boost_range.html#begin"><code>begin()</code></a>, <a
href="boost_range.html#end"><code>end()</code></a> and <a href="utility_class.html#iter_range">
<code>iterator_range</code></a> Range constructors and assignment operators,
<li>
use <a href="boost_range.html#const_begin"><code>const_begin()</code></a>
and <a href="boost_range.html#const_begin"><code>const_end()</code></a>
whenever your code by intention is read-only; this will also solve
most rvalue problems,
<li>
do not rely on ADL:
<ul>
<li>
if you overload functions, include that header <i>before</i> the headers in this
library,
<li>
put all overloads in namespace <code>boost</code>.
</ul>
</ol>
</p>
<hr>
<p>
&copy; <a name="Copyright" id="Copyright">Copyright</a> Thorsten Ottosen 2008.
</p>
<p>
Distributed under the Boost Software License, Version 1.0. (See
accompanying file LICENSE_1_0.txt or copy
at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)
</p>>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>

27
doc/portability.qbk Normal file
View File

@ -0,0 +1,27 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:portability Portability]
A huge effort has been made to port the library to as many compilers as possible.
Full support for built-in arrays require that the compiler supports class template partial specialization. For non-conforming compilers there might be a chance that it works anyway thanks to workarounds in the type traits library.
Visual C++ 6/7.0 has a limited support for arrays: as long as the arrays are of built-in type it should work.
Notice also that some compilers cannot do function template ordering properly. In that case one must rely of __range_iterator__ and a single function definition instead of overloaded versions for const and non-const arguments. So if one cares about old compilers, one should not pass rvalues to the functions.
For maximum portability you should follow these guidelines:
# do not use built-in arrays,
# do not pass rvalues to __begin__`()`, __end__`()` and __iterator_range__ Range constructors and assignment operators,
# use __const_begin__`()` and __const_end__`()` whenever your code by intention is read-only; this will also solve most rvalue problems,
# do not rely on ADL:
* if you overload functions, include that header before the headers in this library,
* put all overloads in namespace boost.
[endsect]

View File

@ -1,379 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<!--
-- Copyright (c) Jeremy Siek 2000
--
-- Permission to use, copy, modify, distribute and sell this software
-- and its documentation for any purpose is hereby granted without fee,
-- provided that the above copyright notice appears in all copies and
-- that both that copyright notice and this permission notice appear
-- in supporting documentation. Silicon Graphics makes no
-- representations about the suitability of this software for any
-- purpose. It is provided "as is" without express or implied warranty.
-->
<Head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<Title>Range Concepts</Title>
<link rel="stylesheet" href="style.css" type="text/css">
</HEAD>
<table border="0" >
<tr>
<td ><img src="../../../boost.png" border="0" ></td>
<td ><h1 align="center">Boost.Range </h1></td>
</tr>
</table>
<h2>Range concepts </h2>
<ul>
<li>
<a href="#overview">Overview</a>
<li>
<a href="#single_pass_range">Single Pass Range</a>
<li>
<a href="#forward_range">Forward Range</a>
<li>
<a href="#bidirectional_range">Bidirectional Range</a>
<li>
<a href="#random_access_range">Random Access Range</a>
<li>
<a href="#concept_checking">Concept Checking</a>
</ul>
<a name="overview"></a>
<hr>
<h3>Overview</h3>
<p>
A Range is a <i>concept</i> similar to the STL <a
href="http://www.sgi.com/Technology/STL/Container.html">Container</a> concept. A
Range provides iterators for accessing a half-open range
<code>[first,one_past_last)</code> of elements and provides
information about the number of elements in the Range. However, a Range has
<i>much</i> fewer requirements than a Container.
</p>
<p>
The motivation for the Range concept is
that there are many useful Container-like types that do not meet the full
requirements of Container, and many algorithms that can be written with this
reduced set of requirements. In particular, a Range does not necessarily
<ul>
<li>
own the elements that can be accessed through it,
<li>
have copy semantics,
<!--
<li>
require that the associated reference type is a real C++ reference.
-->
</ul>
Because of the second requirement, a Range object must be passed by
(const or non-const) reference in generic code.
</p>
<p>
The operations that can be performed on a Range is dependent on the
<a href="../../iterator/doc/new-iter-concepts.html#iterator-traversal-concepts-lib-iterator-traversal">traversal
category</a> of the underlying iterator type. Therefore
the range concepts are named to reflect which traversal category their
iterators support. See also <a href="style.html">terminology and style
guidelines.</a> for more information about naming of ranges.</p>
<p> The concepts described below specifies associated types as
<a href="../../mpl/doc/refmanual/metafunction.html">metafunctions</a> and all
functions as free-standing functions to allow for a layer of indirection. </p>
<!--<p><i>Notice that these metafunctions must be defined in namespace </i>
<code>boost</code></p>-->
<hr>
<a name="single_pass_range"></a>
<H2>Single Pass Range</H2>
<h3>Notation</h3>
<Table>
<TR>
<TD VAlign="top"><code>X</code></TD>
<TD VAlign="top">A type that is a model of Single Pass Range.</TD>
</TR>
<TR>
<TD VAlign="top"><code>a</code></TD>
<TD VAlign="top">Object of type <code>X</code>.</TD>
</TR>
</table>
<h3>Description</h3>
<p>
A range X where <code>boost::range_iterator&lt;X>::type</code> is a model of <a
href="../../iterator/doc/new-iter-concepts.html#single-pass-iterators-lib-single-pass-iterators">
Single Pass Iterator</a>
</p>
<h3>Associated types</h3>
<table border="1" cellpadding="5">
<TR>
<TD VAlign="top">Iterator type</TD>
<TD VAlign="top"><code>boost::range_iterator&lt;X>::type</code></TD>
<TD VAlign="top">The type of iterator used to iterate through a Range's elements.
The iterator's value type is expected to be the Range's value type. A
conversion from the iterator type to the const iterator type must exist.
</TR>
<TR>
<TD VAlign="top">Const iterator type</TD>
<TD VAlign="top"><code>boost::range_iterator&lt;const X>::type</code></TD>
<TD VAlign="top">A type of iterator that may be used to examine, but not to
modify, a Range's elements.</TD>
</TR>
<!--
<TR>
<TD VAlign="top">Reference type</TD>
<TD VAlign="top"><code>reference_of&lt;X>::type</code></TD>
<TD VAlign="top">A type that behaves like a reference to the Range's value type. <a href="#1">[1]</a></TD>
</TR>
-->
</table>
<h3>Valid expressions</h3>
The following expressions must be valid.
<p>
<Table border="1" cellpadding="5">
<TR>
<TH>Name</TH>
<TH>Expression</TH>
<TH>Return type</TH>
</TR>
<TR>
<TD VAlign="top">Beginning of range</TD>
<TD VAlign="top"><code>boost::begin(a)</code></TD>
<TD VAlign="top"><code>boost::range_iterator&lt;X>::type</code> if
<code>a</code> is mutable, <code>boost::range_iterator&lt;const X>::type</code>
otherwise</TD> </TR>
<TR>
<TD VAlign="top">End of range</TD>
<TD VAlign="top"><code>boost::end(a)</code></TD>
<TD VAlign="top"><code>boost::range_iterator&lt;X>::type</code> if
<code>a</code> is mutable, <code>boost::range_iterator&lt;const X>::type</code>
otherwise</TD>
</TR>
</table>
<h3>Expression semantics</h3>
<Table border>
<TR>
<TH>Expression</TH>
<TH>Semantics</TH>
<TH>Postcondition</TH>
</TR>
<TR>
<TD VAlign="top"><code>boost::begin(a)</code></TD>
<TD VAlign="top">Returns an iterator pointing to the first element in the Range.</TD>
<TD VAlign="top"><code>boost::begin(a)</code> is either dereferenceable or past-the-end.
It is past-the-end if and only if <code>boost::distance(a) == 0</code>.</TD>
</TR>
<TR>
<TD VAlign="top"><code>boost::end(a)</code></TD>
<TD VAlign="top">Returns an iterator pointing one past the last element in the
Range.</TD>
<TD VAlign="top"><code>boost::end(a)</code> is past-the-end.</TD>
</TR>
</table>
<h3>Complexity guarantees</h3>
<code>boost::end(a)</code> is at most amortized linear time, <code>boost::begin(a)</code> is
amortized constant time. For most practical
purposes, one can expect both to be amortized constant time.
<h3>Invariants</h3>
<Table border>
<TR>
<TD VAlign="top">Valid range</TD>
<TD VAlign="top">For any Range <code>a</code>, <code>[boost::begin(a),boost::end(a))</code> is
a valid range, that is, <code>boost::end(a)</code> is reachable from <code>boost::begin(a)</code>
in a finite number of increments.</TD>
</TR>
<TR>
<TD VAlign="top">Completeness</TD>
<TD VAlign="top">An algorithm that iterates through the range <code>[boost::begin(a),boost::end(a))</code>
will pass through every element of <code>a</code>.</TD>
</tr>
</table>
<h3>See also</h3>
<p><a
href="boost_range.html#minimal_interface">Extending the library for UDTs </a></p>
<p> <a href="boost_range.html#boost::rang_difference">Implementation of
metafunctions </a></p>
<p> <a href="boost_range.html#begin">Implementation of
functions </a></p>
<p>
<A href="http://www.sgi.com/Technology/STL/Container.html">Container</A>
</p>
<hr>
<a name=forward_range></a><h2>Forward Range</h2>
<h3>Notation</h3>
<Table>
<TR>
<TD VAlign="top"><code>X</code></TD>
<TD VAlign="top">A type that is a model of Forward Range.</TD>
</TR>
<TR>
<TD VAlign="top"><code>a</code></TD>
<TD VAlign="top">Object of type <code>X</code>.</TD>
</TR>
</table>
<h3>Description</h3>
<p>
A range <code>X</code> where <code>boost::range_iterator&lt;X>::type</code> is a model
of <a
href="../../iterator/doc/new-iter-concepts.html#forward-traversal-iterators-lib-forward-traversal-iterators">Forward Traversal Iterator</a>
</p>
<h3>Refinement of</h3> <a href="#single_pass_range">Single Pass
Range</a>
</p>
<hr>
<a name="bidirectional_range"></a><h2>Bidirectional Range</h2>
<h3>Notation</h3>
<Table>
<TR>
<TD VAlign="top"><code>X</code></TD>
<TD VAlign="top">A type that is a model of Bidirectional Range.</TD>
</TR>
<TR>
<TD VAlign="top"><code>a</code></TD>
<TD VAlign="top">Object of type <code>X</code>.</TD>
</TR>
</table>
<h3>Description</h3> This concept provides access to iterators that traverse in
both directions (forward and reverse). The
<code>boost::range_iterator&lt;X>::type</code> iterator must meet all of the requirements
of <a
href="../../iterator/doc/new-iter-concepts.html#bidirectional-traversal-iterator
s-lib-bidirectional-traversal-iterators">Bidirectional Traversal Iterator.</a>
<h3>Refinement of</h3> <a href="#forward_range">Forward Range</a>
</p>
<hr>
<a name=random_access_range></a><h2>Random Access Range</h2>
<h3>Description</h3>
<p>
A range <code>X</code> where <code>boost::range_iterator&lt;X>::type</code> is a model
of <a
href="../../iterator/doc/new-iter-concepts.html#random-access-traversal-iterators
-lib-random-access-traversal-iterators">Random Access Traversal Iterator</a>
</p>
<h3>Refinement of</h3>
<p>
<a href="#bidirectional_range">Bidirectional Range</a>
</p>
<hr>
<a name=concept_checking></a><h2>Concept Checking</h2>
Each of the range concepts has a corresponding concept checking
class in the file <code>&lt;boost/range/concepts.hpp&gt;</code>. These classes may be
used in conjunction with the <a
href="../../concept_check/concept_check.htm">Boost Concept
Check</a> library to insure that the type of a template parameter
is compatible with a range concept. If not, a meaningful compile
time error is generated. Checks are provided for the range
concepts related to iterator traversal categories. For example,
the following line checks that the type <code>T</code> models the
<a href="#forward_range">ForwardRange</a> concept.
<pre>
function_requires&lt;ForwardRangeConcept&lt;T&gt; &gt;();
</pre>
An additional concept check is required for the value access
property of the range based on the range's iterator type. For
example to check for a ForwardReadableRange, the following code is
required.
<pre>
function_requires&lt;ForwardRangeConcept&lt;T&gt; &gt;();
function_requires&lt;
ReadableIteratorConcept&lt;
typename range_iterator&lt;T&gt;::type
&gt;
&gt;();
</pre>
The following range concept checking classes are provided.
<ul>
<li>
Class <code>SinglePassRangeConcept</code> checks for <a
href="#single_pass_range">Single Pass Range</a>
<li>
Class <code>ForwardRangeConcept</code> checks for <a
href="#forward_range">Forward Range</a>
<li>
Class <code>BidirectionalRangeConcept</code> checks for <a
href="#bidirectional_range">Bidirectional Range</a>
<li>
Class <code>RandomAccessRangeConcept</code> checks for <a
href="#random_access_range">Random Access Range</a>
</ul>
<h3>See also</h3>
<p> <a href="style.html">Range Terminology and style guidelines</a></p>
<p> <a href="../../iterator/doc/iterator_concepts.html">Iterator Concepts</a></p>
<p> <a href="../../concept_check/concept_check.htm">Boost Concept Check library</a></p>
<hr>
<p>
&copy; <a name="Copyright" id="Copyright">Copyright</a> Thorsten Ottosen 2008.
</p>
<p>
Distributed under the Boost Software License, Version 1.0. (See
accompanying file LICENSE_1_0.txt or copy
at <a href=
"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)
</p>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</BODY>
</HTML>

21
doc/reference.qbk Normal file
View File

@ -0,0 +1,21 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:reference Reference]
[include reference/overview.qbk]
[section:concept_implementation Range concept implementation]
[include reference/synopsis.qbk]
[include reference/semantics.qbk]
[endsect]
[include reference/adaptors.qbk]
[include reference/algorithms.qbk]
[include reference/ranges.qbk]
[include reference/utilities.qbk]
[include reference/extending.qbk]
[endsect]

188
doc/reference/adaptors.qbk Normal file
View File

@ -0,0 +1,188 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:adaptors Range Adaptors]
[section:introduction Introduction and motivation]
A [*Range Adaptor] is a class that wraps an existing Range to provide a new Range with different behaviour. Since the behaviour of Ranges is determined by their associated iterators, a Range Adaptor simply wraps the underlying iterators with new special iterators. In this example
``
#include <boost/range/adaptors.hpp>
#include <boost/range/algorithm.hpp>
#include <iostream>
#include <vector>
std::vector<int> vec;
boost::copy( vec | boost::adaptors::reversed,
std::ostream_iterator<int>(std::cout) );
``
the iterators from `vec` are wrapped `reverse_iterator`s. The type of the underlying Range Adapter is not documented because you do not need to know it. All that is relevant is that the expression
``
vec | boost::adaptors::reversed
``
returns a Range Adaptor where the iterator type is now the iterator type of the range `vec` wrapped in `reverse_iterator`. The expression `boost::adaptors::reversed` is called an *Adaptor Generator*.
There are two ways of constructing a range adaptor. The first is by using `operator|()`. This is my preferred technique, however while discussing range adaptors with others it became clear that some users of the library strongly prefer a more familiar function syntax, so equivalent functions of the present tense form have been added as an alternative syntax. The equivalent to `rng | reversed` is `adaptors::reverse(rng)` for example.
Why do I prefer the `operator|` syntax? The answer is readability:
``
std::vector<int> vec;
boost::copy( boost::adaptors::reverse(vec),
std::ostream_iterator<int>(std::cout) );
``
This might not look so bad, but when we apply several adaptors, it becomes much worse. Just compare
``
std::vector<int> vec;
boost::copy( boost::adaptors::unique( boost::adaptors::reverse( vec ) ),
std::ostream_iterator<int>(std::cout) );
``
to
``
std::vector<int> vec;
boost::copy( vec | boost::adaptors::reversed
| boost::adaptors::uniqued,
std::ostream_iterator<int>(std::cout) );
``
Furthermore, some of the adaptor generators take arguments themselves and these arguments are expressed with function call notation too. In those situations, you will really appreciate the succinctness of `operator|()`.
[heading Composition of Adaptors]
Range Adaptors are a powerful complement to Range algorithms. The reason is that adaptors are ['*orthogonal*] to algorithms. For example, consider these Range algorithms:
* `boost::copy( rng, out )`
* `boost::count( rng, pred )`
What should we do if we only want to copy an element `a` if it satisfies some predicate, say `pred(a)`? And what if we only want to count the elements that satisfy the same predicate? The naive answer would be to use these algorithms:
* `boost::copy_if( rng, pred, out )`
* `boost::count_if( rng, pred )`
These algorithms are only defined to maintain a one to one relationship with the standard library algorithms. This approach of adding algorithm suffers a combinatorial explosion. Inevitably many algorithms are missing `_if` variants and there is redundant development overhead for each new algorithm. The Adaptor Generator is the design solution to this problem. It is conceivable that some algorithms are capable of optimization by tightly coupling the filter with the algorithm. The adaptors provide a more general solution with superior separation of orthogonal concerns.
[heading Range Adaptor alternative to copy_if algorithm]
``
boost::copy_if( rng, pred, out );
``
can be expressed as
``
boost::copy( rng | boost::adaptors::filtered(pred), out );
``
[heading Range Adaptor alternative to count_if algorithm]
``
boost::count_if( rng, pred );
``
can be expressed as
``
boost::size( rng | boost::adaptors::filtered(pred) );
``
What this means is that many algorithms no longer require nor benefit from an optimized implementation with an `_if` suffix. Furthermore, it turns out that algorithms with the `_copy` suffix are often not needed either. Consider `replace_copy_if()` which may be used as
``
std::vector<int> vec;
boost::replace_copy_if( rng, std::back_inserter(vec), pred, new_value );
``
With adaptors and algorithms we can express this as
``
std::vector<int> vec;
boost::push_back(vec, rng | boost::adaptors::replaced_if(pred, new_value));
``
The latter code has several benefits:
1. it is more ['*efficient*] because we avoid extra allocations as might happen with `std::back_inserter`
2. it is ['*flexible*] as we can subsequently apply even more adaptors, for example: ``
boost::push_back(vec, rng | boost::adaptors::replaced_if(pred, new_value)
| boost::adaptors::reversed);
``
3. it is ['*safer*] because there is no use of an unbounded output iterator.
In this manner, the ['*composition*] of Range Adaptors has the following consequences:
1. we no longer need many of the `_if`, `_copy`, `_copy_if` and `_n` variants of algorithms.
2. we can generate a multitude of new algorithms on the fly, for example, above we generated `reverse_replace_copy_if()`
In other words:
[*Range Adaptors are to algorithms what algorithms are to containers]
[endsect]
[section:general_requirements General Requirements]
In the description of generator expressions, the following notation is used:
* `fwdRng` is an expression of a type `R` that models `ForwardRange`
* `biRng` is an expression of a type `R` that models `BidirectionalRange`
* `rndRng` is an expression of a type `R` that models `RandomAccessRange`
* `pred` is an expression of a type that models `UnaryPredicate`
* `bi_pred` is an expression of a type that models `BinaryPredicate`
* `fun` is an expression of a type that models `UnaryFunction`
* `value`, `new_value` and `old_value` are objects convertible to `boost::range_value<R>::type`
* `n,m` are integer expressions convertible to `range_difference<R>::type`
Also note that `boost::range_value<R>::type` must be implicitly convertible to the type arguments to `pred`, `bi_pred` and `fun`.
Range Category in the following adaptor descriptions refers to the minimum range concept required by the range passed to the adaptor. The resultant range is a model of the same range concept as the input range unless specified otherwise.
Returned Range Category is the concept of the returned range. In some cases the returned range is of a lesser category than the range passed to the adaptor. For example, the `filtered` adaptor returns only a `ForwardRange` regardless of the input.
Furthermore, the following rules apply to any expression of the form
``
rng | boost::adaptors::adaptor_generator
``
1. Applying `operator|()` to a range `R` (always left argument) and a range adapter `RA` (always right argument) yields a new range type which may not conform to the same range concept as `R`.
2. The return-type of `operator|()` is otherwise unspecified.
3. `operator|()` is found by Argument Dependent Lookup (ADL) because a range adaptor is implemented in namespace `boost::adaptors`.
4. `operator|()` is used to add new behaviour ['*lazily*] and never modifies its left argument.
5. All iterators extracted from the left argument are extracted using qualified calls to `boost::begin()` and `boost::end()`.
6. In addition to the `throw`-clauses below, `operator|()` may throw exceptions as a result of copying iterators. If such copying cannot throw an exception, then neither can the whole expression.
[endsect]
[section:reference Reference]
[include adaptors/adjacent_filtered.qbk]
[include adaptors/copied.qbk]
[include adaptors/filtered.qbk]
[include adaptors/indexed.qbk]
[include adaptors/indirected.qbk]
[include adaptors/map_keys.qbk]
[include adaptors/map_values.qbk]
[include adaptors/ref_unwrapped.qbk]
[include adaptors/replaced.qbk]
[include adaptors/replaced_if.qbk]
[include adaptors/reversed.qbk]
[include adaptors/sliced.qbk]
[include adaptors/strided.qbk]
[include adaptors/type_erased.qbk]
[include adaptors/tokenized.qbk]
[include adaptors/transformed.qbk]
[include adaptors/uniqued.qbk]
[endsect]
[endsect]

View File

@ -0,0 +1,32 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:adjacent_filtered adjacent_filtered]
[table
[[Syntax] [Code]]
[[Pipe] [`rng | boost::adaptors::adjacent_filtered(bi_pred)`]]
[[Function] [`boost::adaptors::adjacent_filter(rng, bi_pred)`]]
]
* [*Precondition:] The `value_type` of the range is convertible to both argument types of `bi_pred`.
* [*Postcondition:] For all adjacent elements `[x,y]` in the returned range, `bi_pred(x,y)` is `true`.
* [*Throws:] Whatever the copy constructor of `bi_pred` might throw.
* [*Range Category:] __forward_range__
* [*Return Type:] `boost::adjacent_filtered_range<decltype(rng), decltype(bi_pred)>`
* [*Returned Range Category:] The minimum of the range category of `rng` and __forward_range__
[section:adjacent_filtered_example adjacent_filtered example]
[import ../../../test/adaptor_test/adjacent_filtered_example.cpp]
[adjacent_filtered_example]
[endsect]
This would produce the output:
``
1,2,3,4,5,6,
``
[endsect]

View File

@ -0,0 +1,30 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:copied copied]
[table
[[Syntax] [Code]]
[[Pipe] [`rng | boost::adaptors::copied(n, m)`]]
[[Function] [`boost::adaptors::copy(rng, n, m)`]]
]
* [*Precondition:] `0 <= n && n <= m && m < distance(rng)`
* [*Returns:] A new `iterator_range` that holds the sliced range `[n,m)` of the original range.
* [*Range Category:] __random_access_range__
* [*Returned Range Category:] __random_access_range__
[section:copied_example copied example]
[import ../../../test/adaptor_test/copied_example.cpp]
[copied_example]
[endsect]
This would produce the output:
``
2,3,4,5,
``
[endsect]

View File

@ -0,0 +1,32 @@
// Boost.Range library
//
// Copyright Thorsten Ottosen 2003-2004. Use, modification and
// distribution is 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)
//
// For more information, see http://www.boost.org/libs/range/
//
#include <boost/range/adaptor/indirected.hpp>
#include <boost/range/algorithm/copy.hpp>
#include <boost/shared_ptr.hpp>
#include <algorithm>
#include <iostream>
#include <vector>
int main(int argc, const char* argv[])
{
using namespace boost::adaptors;
std::vector<boost::shared_ptr<int> > input;
for (int i = 0; i < 10; ++i)
input.push_back(boost::shared_ptr<int>(new int(i)));
boost::copy(
input | indirected,
std::ostream_iterator<int>(std::cout, ","));
return 0;
}

View File

@ -0,0 +1,32 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:filtered filtered]
[table
[[Syntax] [Code]]
[[Pipe] [`rng | boost::adaptors::filtered(pred)`]]
[[Function] [`boost::adaptors::filter(rng, pred)`]]
]
* [*Precondition:] The `value_type` of the range is convertible to the argument type of `pred`.
* [*Postcondition:] For all elements `[x]` in the returned range, `pred(x)` is `true`.
* [*Throws:] Whatever the copy constructor of `pred` might throw.
* [*Range Category:] __singlepass_range__
* [*Range Return Type:] `boost::filtered_range<decltype(rng)>`
* [*Returned Range Category:] The minimum of the range category of `rng` and __bidirectional_range__
[section:filtered_example filtered example]
[import ../../../test/adaptor_test/filtered_example.cpp]
[filtered_example]
[endsect]
This would produce the output:
``
2,4,6,8,
``
[endsect]

View File

@ -0,0 +1,51 @@
[/
Copyright 2014 Neil Groves
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)
/]
[section:formatted formatted]
[table
[[Syntax] [Code]]
[[Pipe] [`rng | boost::adaptors::formatted()`]]
[[Pipe] [`rng | boost::adaptors::formatted(sep)`]]
[[Pipe] [`rng | boost::adaptors::formatted(sep, prefix)`]]
[[Pipe] [`rng | boost::adaptors::formatted(sep, prefix, postfix)`]]
[[Function] [`boost::adaptors::format(rng)`]]
[[Function] [`boost::adaptors::format(rng, sep)`]]
[[Function] [`boost::adaptors::format(rng, sep, prefix)`]]
[[Function] [`boost::adaptors::format(rng, sep, prefix, postfix)`]]
]
This adaptor produces a range that can be output streamed to a
`std::basic_ostream` to produce the output string formatted output. With the
default paramters given numbers 1 to 5 inclusively in a range the output when
streamed would be "{0,1,2,3,4,5}". The prefix, separator and postfix may be
passed as parameters.
The general format of the output is thus:
<prefix><element_1><sep><element_2><sep>...<element_n><postfix>
* [*Precondition:]
* `0 <= n`.
* `sep` has a type that is CopyConstructible and able to be streamed to `std::basic_ostream<Char,Traits>`
* `prefix` has a type that is CopyConstructible and able to be streamed to `std::basic_ostream<Char,Traits>`
* `postfix` has a type that is CopyConstructible and able to be streamed to `std::basic_ostream<Char,Traits>`
* [*Returns:] `boost::range::formatted_range<Iter, Sep, Prefix, Postfix>` where
`Iter` is `typename boost::range_iterator<Rng>::type`, `Sep` is the separator
type, `Prefix` is the prefix type and `Postfix` is the postfix type.
* [*Range Category:] __single_pass_range__
* [*Returned Range Category:] The range category of `rng`.
[section:formatted_example formatted example]
[import ../../../test/adaptor_test/formatted_example.cpp]
[separated_example]
[endsect]
This would produce the output:
``
{1,2,3,4,5}
``
[endsect]

View File

@ -0,0 +1,84 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:indexed indexed]
[table
[[Syntax] [Code]]
[[Pipe] [`rng | boost::adaptors::indexed()`]]
[[Pipe] [`rng | boost::adaptors::indexed(start_index)`]]
[[Function] [`boost::adaptors::index(rng)`]]
[[Function] [`boost::adaptors::index(rng, start_index)`]]
]
[heading Description]
The index within each returned `boost::range::index_value` is equal to
`start_index` + the offset of the element from the beginning of the range. In
the versions of the functions that omit `start_index` the starting index is
taken to be `0`.
* [*Purpose:] Adapt `rng` to return elements that have the corresponding value
from `rng` and a numeric index.
* [*Returns:] A range adapted to return both the element and the associated
index. The returned range has elements of type:
``
boost::range::index_value<
typename boost::range_reference<decltype(rng)>::type,
typename boost::range_difference<decltype(rng)>::type
>
``
The synopsis of index_value is as follows:
``
template<class T, class Indexable=std::ptrdiff_t>
class index_value : public boost::tuple<Indexable, T>
{
public:
typedef ...unspecified... index_type;
typedef ...unspecified... const_index_type;
typedef ...unspecified... value_type;
typedef ...unspecified... const_value_type;
// ...unspecified... constructors
index_type index();
const_index_type index() const;
value_type value();
const_value_type value() const;
};
``
* [*Range Category:] __single_pass_range__
* [*Range Return Type:] `boost::indexed_range<decltype(rng)>`
* [*Returned Range Category:] The range category of `rng` if and only if `rng`
is not a __bidirectional_range__. If `rng` is a __bidirectional_range__ then the
returned range category is __forward_range__. The rationale for the demotion of
__bidirectional_range__ inputs to __forward_range__ is to avoid slow calculation
of indices for `boost::end(rng)`.
[section:indexed_example indexed example]
[import ../../../test/adaptor_test/indexed_example.cpp]
[indexed_example]
[endsect]
This would produce the output:
``
Element = 10 Index = 0
Element = 20 Index = 1
Element = 30 Index = 2
Element = 40 Index = 3
Element = 50 Index = 4
Element = 60 Index = 5
Element = 70 Index = 6
Element = 80 Index = 7
Element = 90 Index = 8
``
[endsect]

View File

@ -0,0 +1,31 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:indirected indirected]
[table
[[Syntax] [Code]]
[[Pipe] [`rng | boost::adaptors::indirected`]]
[[Function] [`boost::adaptors::indirect(rng)`]]
]
* [*Precondition:] The `value_type` of the range defines unary `operator*()`
* [*Postcondition:] For all elements `x` in the returned range, `x` is the result of `*y` where `y` is the corresponding element in the original range.
* [*Range Category:] __single_pass_range__
* [*Range Return Type:] `boost::indirected_range<decltype(rng)>`
* [*Returned Range Category:] The range category of `rng`
[section:indirected_example indirected example]
[import ../../../test/adaptor_test/indirected_example.cpp]
[indirected_example]
[endsect]
This would produce the output:
``
0,1,2,3,4,5,6,7,8,9,
``
[endsect]

View File

@ -0,0 +1,31 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:map_keys map_keys]
[table
[[Syntax] [Code]]
[[Pipe] [`rng | boost::adaptors::map_keys`]]
[[Function] [`boost::adaptors::keys(rng)`]]
]
* [*Precondition:] The `value_type` of the range is an instantiation of `std::pair`.
* [*Postcondition:] For all elements `x` in the returned range, `x` is the result of `y.first` where `y` is the corresponding element in the original range.
* [*Range Category:] __single_pass_range__
* [*Range Return Type:] `boost::select_first_range<decltype(rng)>`
* [*Returned Range Category:] The range category of `rng`.
[section:map_keys_example map_keys example]
[import ../../../test/adaptor_test/map_keys_example.cpp]
[map_keys_example]
[endsect]
This would produce the output:
``
0,1,2,3,4,5,6,7,8,9,
``
[endsect]

View File

@ -0,0 +1,31 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:map_values map_values]
[table
[[Syntax] [Code]]
[[Pipe] [`rng | boost::adaptors::map_values`]]
[[Function] [`boost::adaptors::values(rng)`]]
]
* [*Precondition:] The `value_type` of the range is an instantiation of `std::pair`.
* [*Postcondition:] For all elements `x` in the returned range, `x` is the result of `y.second` where `y` is the corresponding element in the original range.
* [*Range Category:] __single_pass_range__
* [*Range Return Type:] for constant ranges, `boost::select_second_const<decltype(rng)>` otherwise `boost::select_second_mutable<decltype(rng)>`
* [*Returned Range Category:] The range category of `rng`.
[section:map_values_example map_values example]
[import ../../../test/adaptor_test/map_values_example.cpp]
[map_values_example]
[endsect]
This would produce the output:
``
0,10,20,30,40,50,60,70,80,90,
``
[endsect]

View File

@ -0,0 +1,32 @@
[/
Copyright 2015 Robin Eckert
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)
/]
[section:ref_unwrapped ref_unwrapped]
[table
[[Syntax] [Code]]
[[Pipe] [`rng | boost::adaptors::ref_unwrapped`]]
[[Function] [`boost::adaptors::ref_unwrap(rng)`]]
]
This adaptor produces a range than applies `.get()` on all values in
the range. It is useful for iterating ranges of
`std::reference_wrapper` values or values using similar semantics.
The adaptor is C++11 (and above) only.
* [*Precondition:] The `value_type` of the range has a `.get() const`.
* [*Postcondition:] For all elements `x` in the returned range, `x` is the result of `y.get()` where `y` is the corresponding element in the original range.
* [*Range Category:] __single_pass_range__
* [*Range Return Type:] `boost::unwrap_ref_range<decltype(rng)>`
* [*Returned Range Category:] The range category of `rng`.
[section:ref_unwrapped_example ref_unwrapped example]
[import ../../../test/adaptor_test/ref_unwrapped_example.cpp]
[ref_unwrapped_example]
[endsect]
This would produce the output `123`.
[endsect]

View File

@ -0,0 +1,33 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:replaced replaced]
[table
[[Syntax] [Code]]
[[Pipe] [`rng | boost::adaptors::replaced(old_value, new_value)`]]
[[Function] [`boost::adaptors::replace(rng, old_value, new_value)`]]
]
* [*Precondition:]
* `new_value` is convertible to the `value_type` of the range.
* `old_value` is convertible to the `value_type` of the range.
* [*Postcondition:] For all elements `x` in the returned range, the value `x` is equal to the value of `(y == old_value) ? new_value : y` where `y` is the corresponding element in the original range.
* [*Range Category:] __single_pass_range__
* [*Range Return Type:] `boost::replaced_range<decltype(rng)>`
* [*Returned Range Category:] The range category of `rng`.
[section:replaced_example replaced example]
[import ../../../test/adaptor_test/replaced_example.cpp]
[replaced_example]
[endsect]
This would produce the output:
``
1,10,3,10,5,10,7,10,9,
``
[endsect]

View File

@ -0,0 +1,33 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:replaced_if replaced_if]
[table
[[Syntax] [Code]]
[[Pipe] [`rng | boost::adaptors::replaced_if(pred, new_value)`]]
[[Function] [`boost::adaptors::replace_if(rng, pred, new_value)`]]
]
* [*Precondition:]
* The range `value_type` is convertible to the argument type of `pred`.
* `new_value` is convertible to the `value_type` of the range.
* [*Postconditions:] For all elements `x` in the returned range, the value `x` is equal to the value of `pred(y) ? new_value : y` where `y` is the corresponding element in the original range.
* [*Range Category:] __single_pass_range__
* [*Range Return Type:] `boost::replaced_if_range<decltype(rng)>`
* [*Returned Range Category:] The range category of `rng`.
[section:replaced_if_example replaced_if example]
[import ../../../test/adaptor_test/replaced_if_example.cpp]
[replaced_if_example]
[endsect]
This would produce the output:
``
1,10,3,10,5,10,7,10,9,
``
[endsect]

View File

@ -0,0 +1,30 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:reversed reversed]
[table
[[Syntax] [Code]]
[[Pipe] [`rng | boost::adaptors::reversed`]]
[[Function] [`boost::adaptors::reverse(rng)`]]
]
* [*Returns:] A range whose iterators behave as if they were the original iterators wrapped in `reverse_iterator`.
* [*Range Category:] __bidirectional_range__
* [*Range Return Type:] `boost::reversed_range<decltype(rng)>`
* [*Returned Range Category:] The range category of `rng`.
[section:reversed_example reversed example]
[import ../../../test/adaptor_test/reversed_example.cpp]
[reversed_example]
[endsect]
This would produce the output:
``
9,8,7,6,5,4,3,2,1,
``
[endsect]

View File

@ -0,0 +1,31 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:sliced sliced]
[table
[[Syntax] [Code]]
[[Pipe] [`rng | boost::adaptors::sliced(n, m)`]]
[[Function] [`boost::adaptors::slice(rng, n, m)`]]
]
* [*Precondition:] `0 <= n && n <= m && m < distance(rng)`
* [*Returns:] `make_range(rng, n, m)`
* [*Range Category:] __random_access_range__
* [*Range Return Type:] `boost::sliced_range<decltype(rng)>`
* [*Returned Range Category:] __random_access_range__
[section:sliced_example sliced example]
[import ../../../test/adaptor_test/sliced_example.cpp]
[sliced_example]
[endsect]
This would produce the output:
``
3,4,5,
``
[endsect]

View File

@ -0,0 +1,30 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:strided strided]
[table
[[Syntax] [Code]]
[[Pipe] [`rng | boost::adaptors::strided(n)`]]
[[Function] [`boost::adaptors::stride(rng, n)`]]
]
* [*Precondition:] `0 <= n`.
* [*Returns:] A new range based on `rng` where traversal is performed in steps of `n`.
* [*Range Category:] __single_pass_range__
* [*Returned Range Category:] The range category of `rng`.
[section:strided_example strided example]
[import ../../../test/adaptor_test/strided_example.cpp]
[strided_example]
[endsect]
This would produce the output:
``
1,3,5,7,9,
``
[endsect]

View File

@ -0,0 +1,67 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:tokenized tokenized]
[table
[[Syntax] [Code]]
[
[Pipe]
[
``
rng | boost::adaptors::tokenized(regex)
rng | boost::adaptors::tokenized(regex, i)
rng | boost::adaptors::tokenized(regex, rndRng)
rng | boost::adaptors::tokenized(regex, i, flags)
rng | boost::adaptors::tokenized(regex, rndRng, flags)
``
]
]
[
[Function]
[
``
boost::adaptors::tokenize(rng, regex)
boost::adaptors::tokenize(rng, regex, i)
boost::adaptors::tokenize(rng, regex, rndRng)
boost::adaptors::tokenize(rng, regex, i, flags)
boost::adaptors::tokenize(rng, regex, rndRng, flags)
``
]
]
]
* [*Precondition:]
* Let `T` denote `typename range_value<decltype(rng)>::type`, then `regex` has the type `basic_regex<T>` or is implicitly convertible to one of these types.
* `i` has the type `int`.
* the `value_type` of `rndRng` is `int`.
* `flags` has the type `regex_constants::syntax_option_type`.
* [*Returns:] A range whose iterators behave as if they were the original iterators wrapped in `regex_token_iterator`. The first iterator in the range would be constructed by forwarding all the arguments of `tokenized()` to the `regex_token_iterator` constructor.
* [*Throws:] Whatever constructing and copying equivalent `regex_token_iterator`s might throw.
* [*Range Category:] __random_access_range__
* [*Range Return Type:] `boost::tokenized_range<decltype(rng)>`
* [*Returned Range Category:] __random_access_range__
[section:tokenized_example tokenized_example]
[import ../../../test/adaptor_test/tokenized_example.cpp]
[tokenized_example]
[endsect]
This would produce the output:
``
a
b
c
d
e
f
g
hijklmnopqrstuvwxyz
``
[endsect]

View File

@ -0,0 +1,32 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:transformed transformed]
[table
[[Syntax] [Code]]
[[Pipe] [`rng | boost::adaptors::transformed(fun)`]]
[[Function] [`boost::adaptors::transform(rng, fun)`]]
]
* [*Precondition:] The `value_type` of the range is convertible to the argument type of `fun`.
* [*Postcondition:] For all elements `x` in the returned range, `x` is the result of `fun(y)` where `y` is the corresponding element in the original range.
* [*Throws:] Whatever the copy-constructor of `fun` might throw.
* [*Range Category:] __single_pass_range__
* [*Range Return Type:] `boost::transformed_range<decltype(rng)>`
* [*Returned Range Category:] The range category of `rng`.
[section:transformed_example transformed example]
[import ../../../test/adaptor_test/transformed_example.cpp]
[transformed_example]
[endsect]
This would produce the output:
``
2,4,6,8,10,12,14,16,18,20,
``
[endsect]

View File

@ -0,0 +1,65 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:type_erased type_erased]
[table
[[Syntax] [Code]]
[[Pipe] [`rng | boost::adaptors::type_erased<Value, Traversal, Reference, Difference, Buffer>()`]]
[[Function] [`boost::adaptors::type_erase(rng, boost::adaptors::type_erased<Value, Traversal, Reference, Difference, Buffer>)`]]
]
Please note that it is frequently unnecessary to use the `type_erased` adaptor. It is often better to use the implicit conversion to `any_range`.
Let `Rng` be the type of `rng`.
* [*Template parameters:]
* `Value` is the `value_type` for the `any_range`. If this is set to boost::use_default, `Value` will be calculated from the
range type when the adaptor is applied.
* `Traversal` is the tag used to identify the traversal of the resultant range. Frequently it is desirable to set a traversal category lower than the source container or range to maximize the number of ranges that can convert to the `any_range`. If this is left as boost::use_default then `Traversal` will be `typename boost::iterator_traversal<boost::range_iterator<Rng>::type>::type`
* `Reference` is the `reference` for the `any_range`. `boost::use_default` will equate to `typename range_reference<Rng>::type`.
* `Difference` is the `difference_type` for the any_range. `boost::use_default` will equate to `typename boost::range_difference<Rng>::type`
* `Buffer` is the storage used to allocate the underlying iterator wrappers. This can typically be ignored, but is available as a template parameter for customization. Buffer must be a model of the `AnyIteratorBufferConcept`.
* [*Precondition:] `Traversal` is one of `{ boost::use_default, boost::single_pass_traversal_tag, boost::forward_traversal_tag, boost::bidirectional_traversal_tag, boost::random_access_traversal_tag }`
* [*Returns:] The returned value is the same as `typename any_range_type_generator< Rng, Value, Traversal, Reference, Difference, Buffer >` that represents `rng` in a type-erased manner.
* [*Range Category:] __single_pass_range__
* [*Returned Range Category:] if `Traversal` was specified as `boost::use_default` then `typename boost::iterator_traversal<boost::range_iterator<Rng>::type>::type`, otherwise `Traversal`.
[heading AnyIteratorBufferConcept]
``
class AnyIteratorBufferConcept
{
public:
AnyIteratorBufferConcept();
~AnyIteratorBufferConcept();
// bytes is the requested size to allocate. This function
// must return a pointer to an adequate area of memory.
// throws: bad_alloc
//
// The buffer will only ever have zero or one
// outstanding memory allocations.
void* allocate(std::size_t bytes);
// deallocate this buffer
void deallocate();
};
``
[section:type_erased_example type-erased example]
[import ../../../test/adaptor_test/type_erased_example.cpp]
[type_erased_example]
[endsect]
This would produce the output:
``
1,2,3,4,5,
6,7,8,9,10,
11,12,13,14,15,
11,12,13,14,15,
``
[endsect]

View File

@ -0,0 +1,31 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:uniqued uniqued]
[table
[[Syntax] [Code]]
[[Pipe] [`rng | boost::adaptors::uniqued`]]
[[Function] [`boost::adaptors::unique(rng)`]]
]
* [*Precondition:] The `value_type` of the range is comparable with `operator==()`.
* [*Postcondition:] For all adjacent elements `[x,y]` in the returned range, `x==y` is false.
* [*Range Category:] __forward_range__
* [*Range Return Type:] `boost::uniqued_range<decltype(rng)>`
* [*Returned Range Category:] The minimum of the range concept of `rng` and __forward_range__.
[section:uniqued_example uniqued example]
[import ../../../test/adaptor_test/uniqued_example.cpp]
[uniqued_example]
[endsect]
This would produce the output:
``
1,2,3,4,5,6,
``
[endsect]

View File

@ -0,0 +1,85 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:adjacent_find adjacent_find]
[heading Prototype]
``
template<class ForwardRange>
typename range_iterator<ForwardRange>::type
adjacent_find(ForwardRange& rng);
template<class ForwardRange>
typename range_iterator<const ForwardRange>::type
adjacent_find(const ForwardRange& rng);
template<class ForwardRange, class BinaryPredicate>
typename range_iterator<ForwardRange>::type
adjacent_find(ForwardRange& rng, BinaryPred pred);
template<class ForwardRange, class BinaryPredicate>
typename range_iterator<const ForwardRange>::type
adjacent_find(const ForwardRange& rng, BinaryPred pred);
template<range_return_value_re, class ForwardRange>
typename range_return<ForwardRange, re>::type
adjacent_find(ForwardRange& rng);
template<range_return_value_re, class ForwardRange>
typename range_return<const ForwardRange, re>::type
adjacent_find(const ForwardRange& rng);
template<
range_return_value re,
class ForwardRange,
class BinaryPredicate
>
typename range_return<ForwardRange, re>::type
adjacent_find(ForwardRange& rng, BinaryPredicate pred);
template<
range_return_value re,
class ForwardRange,
class BinaryPredicate
>
typename range_return<const ForwardRange, re>::type
adjacent_find(const ForwardRange& rng, BinaryPredicate pred);
``
[heading Description]
[*Non-predicate versions:]
`adjacent_find` finds the first adjacent elements `[x,y]` in `rng` where `x == y`
[*Predicate versions:]
`adjacent_find` finds the first adjacent elements `[x,y]` in `rng` where `pred(x,y)` is `true`.
[heading Definition]
Defined in the header file `boost/range/algorithm/adjacent_find.hpp`
[heading Requirements]
[*For the non-predicate versions of adjacent_find:]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange`'s value type is a model of the `EqualityComparableConcept`.
[*For the predicate versions of adjacent_find:]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `BinaryPredicate` is a model of the `BinaryPredicateConcept`.
* `ForwardRange`'s value type is convertible to `BinaryPredicate`'s first argument type and to `BinaryPredicate`'s second argument type.
[heading Complexity]
Linear. If `empty(rng)` then no comparisons are performed; otherwise, at most `distance(rng) - 1` comparisons.
[endsect]

View File

@ -0,0 +1,60 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:binary_search binary_search]
[heading Prototype]
``
template<class ForwardRange, class Value>
bool binary_search(const ForwardRange& rng, const Value& val);
template<class ForwardRange, class Value, class BinaryPredicate>
bool binary_search(const ForwardRange& rng, const Value& val, BinaryPredicate pred);
``
[heading Description]
`binary_search` returns `true` if and only if the value `val` exists in the range `rng`.
[heading Definition]
Defined in the header file `boost/range/algorithm/binary_search.hpp`
[heading Requirements]
[*For the non-predicate versions of binary_search:]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `Value` is a model of the `LessThanComparableConcept`.
* The ordering of objects of type `Value` is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
* `ForwardRange`'s value type is the same type as `Value`.
[*For the predicate versions of binary_search:]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `BinaryPredicate` is a model of the `StrictWeakOrderingConcept`.
* `ForwardRange`'s value type is the same type as `Value`.
* `ForwardRange`'s value type is convertible to `BinaryPredicate`'s argument type.
[heading Precondition:]
[*For the non-predicate version:]
`rng` is ordered in ascending order according to `operator<`.
[*For the predicate version:]
`rng` is ordered in ascending order according to the function object `pred`.
[heading Complexity]
For non-random-access ranges, the complexity is `O(N)` where `N` is `distance(rng)`.
For random-access ranges, the complexity is `O(log N)` where `N` is `distance(rng)`.
[endsect]

View File

@ -0,0 +1,41 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:copy copy]
[heading Prototype]
``
template<class SinglePassRange, class OutputIterator>
OutputIterator copy(const SinglePassRange& source_rng, OutputIterator out_it);
``
[heading Description]
`copy` copies all elements from `source_rng` to the range `[out_it, out_it + distance(source_rng))`.
The return value is `out_it + distance(source_rng)`
[heading Definition]
Defined in the header file `boost/range/algorithm/copy.hpp`
[heading Requirements]
* `SinglePassRange` is a model of the __single_pass_range__ Concept.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
* The `value_type` of __single_pass_range__ Concept is convertible to a type in `OutputIterator`'s set of value types.
[heading Precondition:]
* `out_it` is not an iterator within the `source_rng`.
* `[out_it, out_it + distance(source_rng))` is a valid range.
[heading Complexity]
Linear. Exactly `distance(source_rng)` assignments are performed.
[endsect]

View File

@ -0,0 +1,46 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:copy_backward copy_backward]
[heading Prototype]
``
template<class BidirectionalRange, class BidirectionalOutputIterator>
BidirectionalOutputIterator
copy_backward(const BidirectionalRange& source_rng,
BidirectionalOutputIterator out_it);
``
[heading Description]
`copy_backward` copies all elements from `source_rng` to the range `[out_it - distance(source_rng), out_it)`.
The values are copied in reverse order. The return value is `out_it - distance(source_rng)`.
Note well that unlike all other standard algorithms `out_it` denotes the *end* of the output sequence.
[heading Definition]
Defined in the header file `boost/range/algorithm/copy_backward.hpp`
[heading Requirements]
* `BidirectionalRange` is a model of __bidirectional_range__ Concept.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
* The `value_type` of __bidirectional_range__ Concept is convertible to a type in `OutputIterator`'s set of value types.
[heading Precondition:]
* `out_it` is not an iterator within the `source_rng`.
* `[out_it, out_it + distance(source_rng))` is a valid range.
[heading Complexity]
Linear. Exactly `distance(source_rng)` assignments are performed.
[endsect]

View File

@ -0,0 +1,41 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:count count]
[heading Prototype]
``
template<class SinglePassRange, class Value>
typename range_difference<SinglePassRange>::type
count(SinglePassRange& rng, const Value& val);
template<class SinglePassRange, class Value>
typename range_difference<const SinglePassRange>::type
count(const SinglePassRange& rng, const Value& val);
``
[heading Description]
`count` returns the number of elements `x` in `rng` where `x == val` is `true`.
[heading Definition]
Defined in the header file `boost/range/algorithm/count.hpp`
[heading Requirements]
* `SinglePassRange` is a model of the __single_pass_range__ Concept.
* `Value` is a model of the `EqualityComparableConcept`.
* `SinglePassRange`'s value type is a model of the `EqualityComparableConcept`.
* An object of `SinglePassRange`'s value type can be compared for equality with an object of type `Value`.
[heading Complexity]
Linear. Exactly `distance(rng)` comparisons.
[endsect]

View File

@ -0,0 +1,37 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:count_if count_if]
[heading Prototype]
``
template<class SinglePassRange, class UnaryPredicate>
typename range_difference<const SinglePassRange>::type
count_if(const SinglePassRange& rng, UnaryPredicate pred);
``
[heading Description]
`count_if` returns the number of elements `x` in `rng` where `pred(x)` is `true`.
[heading Definition]
Defined in the header file `boost/range/algorithm/count_if.hpp`
[heading Requirements]
* `SinglePassRange` is a model of the __single_pass_range__ Concept.
* `UnaryPredicate` is a model of the `UnaryPredicateConcept`.
* `SinglePassRange`'s value type is a model of the `EqualityComparableConcept`.
* The value type of `SinglePassRange` is convertible to the argument type of `UnaryPredicate`.
[heading Complexity]
Linear. Exactly `distance(rng)` invocations of `pred`.
[endsect]

View File

@ -0,0 +1,64 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:equal equal]
[heading Prototype]
``
template<
class SinglePassRange1,
class SinglePassRange2
>
bool equal(const SinglePassRange1& rng1,
const SinglePassRange2& rng2);
template<
class SinglePassRange1,
class SinglePassRange2,
class BinaryPredicate
>
bool equal(const SinglePassRange1& rng1,
const SinglePassRange2& rng2,
BinaryPredicate pred);
``
[heading Description]
`equal` returns `true` if `distance(rng1)` is equal to the `distance(rng2)` and for each element `x` in `rng1`, the corresponding element `y` in `rng2` is equal. Otherwise `false` is returned.
In this range version of `equal` it is perfectly acceptable to pass in two ranges of unequal lengths.
Elements are considered equal in the non-predicate version if `operator==` returns `true`. Elements are considered equal in the predicate version if `pred(x,y)` is `true`.
[heading Definition]
Defined in the header file `boost/range/algorithm/equal.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
* `SinglePassRange1`'s value type is a model of the `EqualityComparableConcept`.
* `SinglePassRange2`'s value type is a model of the `EqualityComparableConcept`.
* `SinglePassRange1`'s value type can be compared for equality with `SinglePassRange2`'s value type.
[*For the predicate versions:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
* `BinaryPredicate` is a model of the `BinaryPredicateConcept`.
* `SinglePassRange1`'s value type is convertible to `BinaryPredicate`'s first argument type.
* `SinglePassRange2`'s value type is convertible to `BinaryPredicate`'s second argument type.
[heading Complexity]
Linear. At most `min(distance(rng1), distance(rng2))` comparisons.
[endsect]

View File

@ -0,0 +1,83 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:equal_range equal_range]
[heading Prototype]
``
template<
class ForwardRange,
class Value
>
std::pair<typename range_iterator<ForwardRange>::type,
typename range_iterator<ForwardRange>::type>
equal_range(ForwardRange& rng, const Value& val);
template<
class ForwardRange,
class Value
>
std::pair<typename range_iterator<const ForwardRange>::type,
typename range_iterator<const ForwardRange>::type>
equal_range(const ForwardRange& rng, const Value& val);
template<
class ForwardRange,
class Value,
class SortPredicate
>
std::pair<typename range_iterator<ForwardRange>::type,
typename range_iterator<ForwardRange>::type>
equal_range(ForwardRange& rng, const Value& val, SortPredicate pred);
template<
class ForwardRange,
class Value,
class SortPredicate
>
std::pair<typename range_iterator<const ForwardRange>::type,
typename range_iterator<const ForwardRange>::type>
equal_range(const ForwardRange& rng, const Value& val, SortPredicate pred);
``
[heading Description]
`equal_range` returns a range in the form of a pair of iterators where all of the elements are equal to `val`. If no values are found that are equal to `val`, then an empty range is returned, hence `result.first == result.second`. For the non-predicate versions of `equal_range` the equality of elements is determined by `operator<`.
For the predicate versions of `equal_range` the equality of elements is determined by `pred`.
[heading Definition]
Defined in the header file `boost/range/algorithm/equal_range.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `Value` is a model of the `LessThanComparableConcept`.
* The ordering of objects of type `Value` is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
* `ForwardRange`'s value type is the same type as `Value`.
[*For the predicate versions:]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `SortPredicate` is a model of the `StrictWeakOrderingConcept`.
* `ForwardRange`'s value type is the same as `Value`.
* `ForwardRange`'s value type is convertible to both of `SortPredicate`'s argument types.
[heading Precondition:]
For the non-predicate versions: `rng` is ordered in ascending order according to `operator<`.
For the predicate versions: `rng` is ordered in ascending order according to `pred`.
[heading Complexity]
For random-access ranges, the complexity is `O(log N)`, otherwise the complexity is `O(N)`.
[endsect]

View File

@ -0,0 +1,36 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:fill fill]
[heading Prototype]
``
template<class ForwardRange, class Value>
ForwardRange& fill( ForwardRange& rng, const Value& val );
``
[heading Description]
`fill` assigns the value `val` to every element in the range `rng`.
[heading Definition]
Defined in the header file `boost/range/algorithm/fill.hpp`
[heading Requirements]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange` is mutable.
* `Value` is a model of the `AssignableConcept`.
* `Value` is convertible to `ForwardRange`'s value type.
[heading Complexity]
Linear. Exactly `distance(rng)` assignments are performed.
[endsect]

View File

@ -0,0 +1,36 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:fill_n fill_n]
[heading Prototype]
``
template<class ForwardRange, class Size, class Value>
ForwardRange& fill( ForwardRange& rng, Size n, const Value& val );
``
[heading Description]
`fill_n` assigns the value `val` to `n` elements in the range `rng` beginning with `boost::begin(rng)`.
[heading Definition]
Defined in the header file `boost/range/algorithm/fill_n.hpp`
[heading Requirements]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange` is mutable.
* `Value` is a model of the `AssignableConcept`.
* `Value` is convertible to `ForwardRange`'s value type.
[heading Complexity]
Linear. Exactly `n` assignments are performed.
[endsect]

View File

@ -0,0 +1,45 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:find find]
[heading Prototype]
``
template<class SinglePassRange, class Value>
typename range_iterator<SinglePassRange>::type
find(SinglePassRange& rng, Value val);
template<
range_return_value re,
class SinglePassRange,
class Value
>
typename range_return<SinglePassRange, re>::type
find(SinglePassRange& rng, Value val);
``
[heading Description]
The versions of `find` that return an iterator, returns the first iterator in the range `rng` such that `*i == value`. `end(rng)` is returned if no such iterator exists.
The versions of find that return a `range_return`, defines `found` in the same manner as the returned iterator described above.
[heading Definition]
Defined in the header file `boost/range/algorithm/find.hpp`
[heading Requirements]
* `SinglePassRange` is a model of the __single_pass_range__ Concept.
* `Value` is a model of the `EqualityComparableConcept`.
* The `operator==` is defined for type `Value` to be compared with the `SinglePassRange`'s value type.
[heading Complexity]
Linear. At most `distance(rng)` comparisons for equality.
[endsect]

View File

@ -0,0 +1,74 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:find_end find_end]
[heading Prototype]
``
template<class ForwardRange1, class ForwardRange2>
typename range_iterator<ForwardRange1>::type
find_end(ForwardRange1& rng1, const ForwardRange2& rng2);
template<
class ForwardRange1,
class ForwardRange2,
class BinaryPredicate
>
typename range_iterator<ForwardRange1>::type
find_end(ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred);
template<
range_return_value re,
class ForwardRange1,
class ForwardRange2
>
typename range_return<ForwardRange1, re>::type
find_end(ForwardRange1& rng1, const ForwardRange2& rng2);
template<
range_return_value re,
class ForwardRange1,
class ForwardRange2,
class BinaryPredicate
>
typename range_return<ForwardRange1, re>::type
find_end(ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred);
``
[heading Description]
The versions of `find_end` that return an iterator, return an iterator to the beginning of the last sub-sequence equal to `rng2` within `rng1`.
Equality is determined by `operator==` for non-predicate versions of `find_end`, and by satisfying `pred` in the predicate versions. The versions of `find_end` that return a `range_return`, defines `found` in the same manner as the returned iterator described above.
[heading Definition]
Defined in the header file `boost/range/algorithm/find_end.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `ForwardRange1` is a model of the __forward_range__ Concept.
* `ForwardRange2` is a model of the __forward_range__ Concept.
* `ForwardRange1`'s value type is a model of the `EqualityComparableConcept`.
* `ForwardRange2`'s value type is a model of the `EqualityComparableConcept`.
* Objects of `ForwardRange1`'s value type can be compared for equality with objects of `ForwardRange2`'s value type.
[*For the predicate versions:]
* `ForwardRange1` is a model of the __forward_range__ Concept.
* `ForwardRange2` is a model of the __forward_range__ Concept.
* `BinaryPredicate` is a model of the `BinaryPredicateConcept`.
* `ForwardRange1`'s value type is convertible to `BinaryPredicate`'s first argument type.
* `ForwardRange2`'s value type is convertible to `BinaryPredicate`'s second argument type.
[heading Complexity]
The number of comparisons is proportional to `distance(rng1) * distance(rng2)`. If both `ForwardRange1` and `ForwardRange2` are models of `BidirectionalRangeConcept` then the average complexity is linear and the worst case is `distance(rng1) * distance(rng2)`.
[endsect]

View File

@ -0,0 +1,74 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:find_first_of find_first_of]
[heading Prototype]
``
template<class SinglePassRange1, class ForwardRange2>
typename range_iterator<SinglePassRange1>::type
find_first_of(SinglePassRange1& rng1, const ForwardRange2& rng2);
template<
class SinglePassRange1,
class ForwardRange2,
class BinaryPredicate
>
typename range_iterator<SinglePassRange1>::type
find_first_of(SinglePassRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred);
template<
range_return_value re,
class SinglePassRange1,
class ForwardRange2
>
typename range_return<SinglePassRange1, re>::type
find_first_of(SinglePassRange1& rng1, const ForwardRange2& rng2);
template<
range_return_value re,
class SinglePassRange1,
class ForwardRange2,
class BinaryPredicate
>
typename range_return<SinglePassRange1, re>::type
find_first_of(SinglePassRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred);
``
[heading Description]
The versions of `find_first_of` that return an iterator, return an iterator to the first occurrence in `rng1` of any of the elements in `rng2`.
Equality is determined by `operator==` for non-predicate versions of `find_first_of`, and by satisfying `pred` in the predicate versions.
The versions of `find_first_of` that return a `range_return`, defines `found` in the same manner as the returned iterator described above.
[heading Definition]
Defined in the header file `boost/range/algorithm/find_first_of.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `ForwardRange2` is a model of the __forward_range__ Concept.
* `SinglePassRange1`'s value type is a model of the `EqualityComparableConcept`, and can be compared for equality with `ForwardRange2`'s value type.
[*For the predicate versions:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `ForwardRange2` is a model of the __forward_range__ Concept.
* `BinaryPredicate` is a model of the `BinaryPredicateConcept`.
* `SinglePassRange1`'s value type is convertible to `BinaryPredicate`'s first argument type.
* `ForwardRange2`'s value type is convertible to `BinaryPredicate`'s second argument type.
[heading Complexity]
At most `distance(rng1) * distance(rng2)` comparisons.
[endsect]

View File

@ -0,0 +1,50 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:find_if find_if]
[heading Prototype]
``
template<class SinglePassRange, class UnaryPredicate>
typename range_iterator<SinglePassRange>::type
find_if(SinglePassRange& rng, UnaryPredicate pred);
template<
range_return_value re,
class SinglePassRange,
class UnaryPredicate
>
typename range_return<SinglePassRange, re>::type
find_if(SinglePassRange& rng, UnaryPredicate pred);
``
[heading Description]
The versions of `find_if` that return an iterator, returns the first iterator in the range `rng` such that `pred(*i)` is `true`. `end(rng)` is returned if no such iterator exists.
The versions of `find_if` that return a `range_return`, defines found in the same manner as the returned iterator described above.
[heading Definition]
Defined in the header file `boost/range/algorithm/find_if.hpp`
[heading Requirements]
* `SinglePassRange` is a model of the __single_pass_range__ Concept.
* `UnaryPredicate` is a model of the `PredicateConcept`.
* The value type of `SinglePassRange` is convertible to the argument type of `UnaryPredicate`.
[heading Precondition:]
For each iterator `i` in `rng`, `*i` is in the domain of `UnaryPredicate`.
[heading Complexity]
Linear. At most `distance(rng)` invocations of `pred`.
[endsect]

View File

@ -0,0 +1,45 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:for_each for_each]
[heading Prototype]
``
template<
class SinglePassRange,
class UnaryFunction
>
UnaryFunction for_each(SinglePassRange& rng, UnaryFunction fun);
template<
class SinglePassRange,
class UnaryFunction
>
UnaryFunction for_each(const SinglePassRange& rng, UnaryFunction fun);
``
[heading Description]
`for_each` traverses forward through `rng` and for each element `x` it invokes `fun(x)`.
[heading Definition]
Defined in the header file `boost/range/algorithm/for_each.hpp`
[heading Requirements]
* `SinglePassRange` is a model of the __single_pass_range__ Concept.
* `UnaryFunction` is a model of the `UnaryFunctionConcept`.
* `UnaryFunction` does not apply any non-constant operation through its argument.
* `SinglePassRange`'s value type is convertible to `UnaryFunction`'s argument type.
[heading Complexity]
Linear. Exactly `distance(rng)` applications of `UnaryFunction`.
[endsect]

View File

@ -0,0 +1,44 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:generate generate]
[heading Prototype]
``
template<class ForwardRange, class Generator>
ForwardRange& generate( ForwardRange& rng, Generator gen );
template<class ForwardRange, class Generator>
const ForwardRange& generate( const ForwardRange& rng, Generator gen );
``
[heading Description]
`generate` assigns the result of `gen()` to each element in range `rng`. Returns the resultant range.
[heading Definition]
Defined in the header file `boost/range/algorithm/generate.hpp`
[heading Requirements]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange` is mutable.
* `Generator` is a model of the `GeneratorConcept`.
* The `value_type` of `SinglePassRange` is convertible to a type in `OutputIterator`'s set of value types.
[heading Precondition:]
* `out_it` is not an iterator within `rng`.
* `[out_it, out_it + distance(rng))` is a valid range.
[heading Complexity]
Linear. Exactly `distance(rng)` assignments are performed.
[endsect]

View File

@ -0,0 +1,69 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:includes includes]
[heading Prototype]
``
template<class SinglePassRange1, class SinglePassRange2>
bool includes(const SinglePassRange1& rng1, const SinglePassRange2& rng2);
template<
class SinglePassRange1,
class SinglePassRange2,
class BinaryPredicate
>
bool includes(const SinglePassRange1& rng1, const SinglePassRange2& rng2,
BinaryPredicate pred);
``
[heading Description]
`includes` returns `true` if and only if, for every element in `rng2`, an equivalent element is also present in `rng1`.
The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions.
[heading Definition]
Defined in the header file `boost/range/algorithm/set_algorithm.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
* `SinglePassRange1` and `SinglePassRange2` have the same value type.
* `SinglePassRange1`'s value type is a model of the `LessThanComparableConcept`.
* `SinglePassRange2`'s value type is a model of the `LessThanComparableConcept`.
* The ordering of objects of type `SinglePassRange1`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
* The ordering of objects of type `SinglePassRange2`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
[*For the predicate versions:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
* `SinglePassRange1` and `SinglePassRange2` have the same value type.
* `BinaryPredicate` is a model of the `StrictWeakOrderingConcept`.
* `SinglePassRange1`'s value type is convertible to `BinaryPredicate`'s first argument type.
* `SinglePassRange2`'s value type is convertible to `BinaryPredicate`'s second argument types.
[heading Precondition:]
[*For the non-predicate versions:]
`rng1` and `rng2` are sorted in ascending order according to `operator<`.
[*For the predicate versions:]
`rng1` and `rng2` are sorted in ascending order according to `pred`.
[heading Complexity]
Linear. `O(N)`, where `N` is `distance(rng1) + distance(rng2)`.
[endsect]

View File

@ -0,0 +1,77 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:inplace_merge inplace_merge]
[heading Prototype]
``
template<class BidirectionalRange>
BidirectionalRange&
inplace_merge( BidirectionalRange& rng,
typename range_iterator<BidirectionalRange>::type middle );
template<class BidirectionalRange>
const BidirectionalRange&
inplace_merge( const BidirectionalRange& rng,
typename range_iterator<const BidirectionalRange>::type middle );
template<class BidirectionalRange, class BinaryPredicate>
BidirectionalRange&
inplace_merge( BidirectionalRange& rng,
typename range_iterator<BidirectionalRange>::type middle,
BinaryPredicate pred );
template<class BidirectionalRange, class BinaryPredicate>
const BidirectionalRange&
inplace_merge( const BidirectionalRange& rng,
typename range_iterator<const BidirectionalRange>::type middle,
BinaryPredicate pred );
``
[heading Description]
`inplace_merge` combines two consecutive sorted ranges `[begin(rng), middle)` and `[middle, end(rng))` into a single sorted range `[begin(rng), end(rng))`. That is, it starts with a range `[begin(rng), end(rng))` that consists of two pieces each of which is in ascending order, and rearranges it so that the entire range is in ascending order. `inplace_merge` is stable, meaning both that the relative order of elements within each input range is preserved.
[heading Definition]
Defined in the header file `boost/range/algorithm/inplace_merge.hpp`
[heading Requirements]
[*For the non-predicate version:]
* `BidirectionalRange` is a model of the __bidirectional_range__ Concept.
* `BidirectionalRange` is mutable.
* `range_value<BidirectionalRange>::type` is a model of `LessThanComparableConcept`
* The ordering on objects of `range_type<BidirectionalRange>::type` is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
[*For the predicate version:]
* `BidirectionalRange` is a model of the __bidirectional_range__ Concept.
* `BidirectionalRange` is mutable.
* `BinaryPredicate` is a model of the `StrictWeakOrderingConcept`.
* `BidirectionalRange`'s value type is convertible to both `BinaryPredicate`'s argument types.
[heading Precondition:]
[heading For the non-predicate version:]
* `middle` is in the range `rng`.
* `[begin(rng), middle)` is in ascending order. That is for each pair of adjacent elements `[x,y]`, `y < x` is `false`.
* `[middle, end(rng))` is in ascending order. That is for each pair of adjacent elements `[x,y]`, `y < x` is `false`.
[heading For the predicate version:]
* `middle` is in the range `rng`.
* `[begin(rng), middle)` is in ascending order. That is for each pair of adjacent elements `[x,y]`, `pred(y,x) == false`.
* `[middle, end(rng))` is in ascending order. That is for each pair of adjacent elements `[x,y]`, `pred(y,x) == false`.
[heading Complexity]
Worst case: `O(N log(N))`
[endsect]

View File

@ -0,0 +1,60 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:lexicographical_compare lexicographical_compare]
[heading Prototype]
``
template<
class SinglePassRange1,
class SinglePassRange2
>
bool lexicographical_compare(const SinglePassRange1& rng1,
const SinglePassRange2& rng2);
template<
class SinglePassRange1,
class SinglePassRange2,
class BinaryPredicate
>
bool lexicographical_compare(const SinglePassRange1& rng1,
const SinglePassRange2& rng2,
BinaryPredicate pred);
``
[heading Description]
`lexicographical_compare` compares element by element `rng1` against `rng2`. If the element from `rng1` is less than the element from `rng2` then `true` is returned. If the end of `rng1` without reaching the end of `rng2` this also causes the return value to be `true`. The return value is `false` in all other circumstances. The elements are compared using `operator<` in the non-predicate versions of `lexicographical_compare` and using `pred` in the predicate versions.
[heading Definition]
Defined in the header file `boost/range/algorithm/lexicographical_compare.hpp`
[heading Requirements]
[*For the non-predicate versions of lexicographical_compare:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
* `SinglePassRange1`'s value type is a model of the `LessThanComparableConcept`.
* `SinglePassRange2`'s value type is a model of the `LessThanComparableConcept`.
* Let `x` be an object of `SinglePassRange1`'s value type. Let `y` be an object of `SinglePassRange2`'s value type. `x < y` must be valid. `y < x` must be valid.
[*For the predicate versions of lexicographical_compare:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
* `BinaryPredicate` is a model of the `BinaryPredicateConcept`.
* `SinglePassRange1`'s value type is convertible to `BinaryPredicate`'s first argument type.
* `SinglePassRange2`'s value type is convertible to `BinaryPredicate`'s second argument type.
[heading Complexity]
Linear. At most `2 * min(distance(rng1), distance(rng2))` comparisons.
[endsect]

View File

@ -0,0 +1,93 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:lower_bound lower_bound]
[heading Prototype]
``
template<
class ForwardRange,
class Value
>
typename range_iterator<ForwardRange>::type
lower_bound(ForwardRange& rng, Value val);
template<
range_return_value re,
class ForwardRange,
class Value
>
typename range_return<ForwardRange, re>::type
lower_bound(ForwardRange& rng, Value val);
template<
class ForwardRange,
class Value,
class SortPredicate
>
typename range_iterator<ForwardRange>::type
lower_bound(ForwardRange& rng, Value val, SortPredicate pred);
template<
range_return_value re,
class ForwardRange,
class Value,
class SortPredicate
>
typename range_return<ForwardRange,re>::type
lower_bound(ForwardRange& rng, Value val, SortPredicate pred);
``
[heading Description]
The versions of `lower_bound` that return an iterator, returns the first iterator in the range `rng` such that:
without predicate - `*i < value` is `false`,
with predicate - `pred(*i, value)` is `false`.
`end(rng)` is returned if no such iterator exists.
The versions of `lower_bound` that return a `range_return`, defines `found` in the same manner as the returned iterator described above.
[heading Definition]
Defined in the header file `boost/range/algorithm/lower_bound.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `Value` is a model of the `LessThanComparableConcept`.
* The ordering of objects of type `Value` is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
* `ForwardRange`'s value type is the same type as `Value`.
[*For the predicate versions:]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `BinaryPredicate` is a model of the `StrictWeakOrderingConcept`.
* `ForwardRange`'s value type is the same type as `Value`.
* `ForwardRange`'s value type is convertible to both of `BinaryPredicate`'s argument types.
[heading Precondition:]
[*For the non-predicate versions:]
`rng` is sorted in ascending order according to `operator<`.
[*For the predicate versions:]
`rng` is sorted in ascending order according to `pred`.
[heading Complexity]
For ranges that model the __random_access_range__ concept the complexity is `O(log N)`, where `N` is `distance(rng)`.
For all other range types the complexity is `O(N)`.
[endsect]

View File

@ -0,0 +1,56 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:make_heap make_heap]
[heading Prototype]
``
template<class RandomAccessRange>
RandomAccessRange& make_heap(RandomAccessRange& rng);
template<class RandomAccessRange>
const RandomAccessRange& make_heap(const RandomAccessRange& rng);
template<class RandomAccessRange, class Compare>
RandomAccessRange& make_heap(RandomAccessRange& rng, Compare pred);
template<class RandomAccessRange, class Compare>
const RandomAccessRange& make_heap(const RandomAccessRange& rng, Compare pred);
``
[heading Description]
`make_heap` turns `rng` into a heap.
The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions.
[heading Definition]
Defined in the header file `boost/range/algorithm/heap_algorithm.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `RandomAccessRange` is a model of the __random_access_range__ Concept.
* `RandomAccessRange` is mutable.
* `RandomAccessRange`'s value type is a model of the `LessThanComparableConcept`.
* The ordering of objects of type `RandomAccessRange`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
[*For the predicate versions:]
* `RandomAccessRange` is a model of the __random_access_range__ Concept.
* `RandomAccessRange` is mutable.
* `Compare` is a model of the `StrictWeakOrderingConcept`.
* `RandomAccessRange`'s value type is convertible to both of `Compare`'s argument types.
[heading Complexity]
Linear. At most `3 * distance(rng)` comparisons.
[endsect]

View File

@ -0,0 +1,86 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:max_element max_element]
[heading Prototype]
``
template<class ForwardRange>
typename range_iterator<ForwardRange>::type
max_element(ForwardRange& rng);
template<class ForwardRange>
typename range_iterator<const ForwardRange>::type
max_element(const ForwardRange& rng);
template<class ForwardRange, class BinaryPredicate>
typename range_iterator<ForwardRange>::type
max_element(ForwardRange& rng, BinaryPredicate pred);
template<class ForwardRange, class BinaryPredicate>
typename range_iterator<const ForwardRange>::type
max_element(const ForwardRange& rng, BinaryPredicate pred);
template<
range_return_value re,
class ForwardRange
>
typename range_return<ForwardRange, re>::type
max_element(ForwardRange& rng);
template<
range_return_value_re,
class ForwardRange
>
typename range_return<const ForwardRange, re>::type
max_element(const ForwardRange& rng);
template<
range_return_value re,
class ForwardRange,
class BinaryPredicate
>
typename range_return<ForwardRange, re>::type
max_element(ForwardRange& rng, BinaryPredicate pred);
template<
range_return_value re,
class ForwardRange,
class BinaryPredicate
>
typename range_return<const ForwardRange, re>::type
max_element(const ForwardRange& rng, BinaryPredicate pred);
``
[heading Description]
The versions of `max_element` that return an iterator, return the iterator to the maximum value as determined by using `operator<` if a predicate is not supplied. Otherwise the predicate `pred` is used to determine the maximum value. The versions of `max_element` that return a `range_return`, defines `found` in the same manner as the returned iterator described above.
[heading Definition]
Defined in the header file `boost/range/algorithm/max_element.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange`'s value type is a model of the `LessThanComparableConcept`.
[*For the predicate versions:]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `BinaryPredicate` is a model of the `BinaryPredicateConcept`.
* `ForwardRange`'s value type is convertible to both of `BinaryPredicate`'s argument types.
[heading Complexity]
Linear. Zero comparisons if `empty(rng)`, otherwise `distance(rng) - 1` comparisons.
[endsect]

View File

@ -0,0 +1,88 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:merge merge]
[heading Prototype]
``
template<
class SinglePassRange1,
class SinglePassRange2,
class OutputIterator
>
OutputIterator merge(const SinglePassRange1& rng1,
const SinglePassRange2& rng2,
OutputIterator out);
template<
class SinglePassRange1,
class SinglePassRange2,
class OutputIterator,
class BinaryPredicate
>
OutputIterator merge(const SinglePassRange1& rng1,
const SinglePassRange2& rng2,
OutputIterator out,
BinaryPredicate pred);
``
[heading Description]
`merge` combines two sorted ranges `rng1` and `rng2` into a single sorted range by copying elements. `merge` is stable. The return value is `out + distance(rng1) + distance(rng2)`.
The two versions of `merge` differ by how they compare the elements.
The non-predicate version uses the `operator<()` for the range value type. The predicate version uses the predicate instead of `operator<()`.
[heading Definition]
Defined in the header file `boost/range/algorithm/merge.hpp`
[heading Requirements]
[*For the non-predicate version:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
* `range_value<SinglePassRange1>::type` is the same as `range_value<SinglePassRange2>::type`.
* `range_value<SinglePassRange1>::type` is a model of the `LessThanComparableConcept`.
* The ordering on objects of `range_value<SinglePassRange1>::type` is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
* `range_value<SinglePassRange1>::type` is convertible to a type in `OutputIterator`'s set of value types.
[*For the predicate version:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
* `range_value<SinglePassRange1>::type` is the same as `range_value<SinglePassRange2>::type`.
* `BinaryPredicate` is a model of the `StrictWeakOrderingConcept`.
* `SinglePassRange1`'s value type is convertible to both `BinaryPredicate`'s argument types.
* `range_value<SinglePassRange1>::type` is convertible to a type in `OutputIterator`'s set of value types.
[heading Precondition:]
[heading For the non-predicate version:]
* The elements of `rng1` are in ascending order. That is, for each adjacent element pair `[x,y]` of `rng1`, `y < x == false`.
* The elements of `rng2` are in ascending order. That is, for each adjacent element pair `[x,y]` of `rng2`, `y < x == false`.
* The ranges `rng1` and `[out, out + distance(rng1) + distance(rng2))` do not overlap.
* The ranges `rng2` and `[out, out + distance(rng1) + distance(rng2))` do not overlap.
* `[out, out + distance(rng1) + distance(rng2))` is a valid range.
[heading For the predicate version:]
* The elements of `rng1` are in ascending order. That is, for each adjacent element pair `[x,y]`, of `rng1`, `pred(y, x) == false`.
* The elements of `rng2` are in ascending order. That is, for each adjacent element pair `[x,y]`, of `rng2`, `pred(y, x) == false`.
* The ranges `rng1` and `[out, out + distance(rng1) + distance(rng2))` do not overlap.
* The ranges `rng2` and `[out, out + distance(rng1) + distance(rng2))` do not overlap.
* `[out, out + distance(rng1) + distance(rng2))` is a valid range.
[heading Complexity]
Linear. There are no comparisons if both `rng1` and `rng2` are empty, otherwise at most `distance(rng1) + distance(rng2) - 1` comparisons.
[endsect]

View File

@ -0,0 +1,86 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:min_element min_element]
[heading Prototype]
``
template<class ForwardRange>
typename range_iterator<ForwardRange>::type
min_element(ForwardRange& rng);
template<class ForwardRange>
typename range_iterator<const ForwardRange>::type
min_element(const ForwardRange& rng);
template<class ForwardRange, class BinaryPredicate>
typename range_iterator<ForwardRange>::type
min_element(ForwardRange& rng, BinaryPredicate pred);
template<class ForwardRange, class BinaryPredicate>
typename range_iterator<const ForwardRange>::type
min_element(const ForwardRange& rng, BinaryPredicate pred);
template<
range_return_value re,
class ForwardRange
>
typename range_return<ForwardRange, re>::type
min_element(ForwardRange& rng);
template<
range_return_value_re,
class ForwardRange
>
typename range_return<const ForwardRange, re>::type
min_element(const ForwardRange& rng);
template<
range_return_value re,
class ForwardRange,
class BinaryPredicate
>
typename range_return<ForwardRange, re>::type
min_element(ForwardRange& rng, BinaryPredicate pred);
template<
range_return_value re,
class ForwardRange,
class BinaryPredicate
>
typename range_return<const ForwardRange, re>::type
min_element(const ForwardRange& rng, BinaryPredicate pred);
``
[heading Description]
The versions of `min_element` that return an iterator, return the iterator to the minimum value as determined by using `operator<` if a predicate is not supplied. Otherwise the predicate `pred` is used to determine the minimum value. The versions of `min_element` that return a `range_return`, defines `found` in the same manner as the returned iterator described above.
[heading Definition]
Defined in the header file `boost/range/algorithm/min_element.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange`'s value type is a model of the `LessThanComparableConcept`.
[*For the predicate versions:]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `BinaryPredicate` is a model of the `BinaryPredicateConcept`.
* `ForwardRange`'s value type is convertible to both of `BinaryPredicate`'s argument types.
[heading Complexity]
Linear. Zero comparisons if `empty(rng)`, otherwise `distance(rng) - 1` comparisons.
[endsect]

View File

@ -0,0 +1,119 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:mismatch mismatch]
[heading Prototype]
``
template<class SinglePassRange1, class SinglePassRange2>
std::pair<
typename range_iterator<SinglePassRange1>::type,
typename range_iterator<const SinglePassRange2>::type >
mismatch(SinglePassRange1& rng1, const SinglePassRange2& rng2);
template<class SinglePassRange1, class SinglePassRange2>
std::pair<
typename range_iterator<const SinglePassRange1>::type,
typename range_iterator<const SinglePassRange2>::type >
mismatch(const SinglePassRange1& rng1, const SinglePassRange2& rng2);
template<class SinglePassRange1, class SinglePassRange2>
std::pair<
typename range_iterator<SinglePassRange1>::type,
typename range_iterator<SinglePassRange2>::type >
mismatch(SinglePassRange1& rng1, SinglePassRange2& rng2);
template<class SinglePassRange1, class SinglePassRange2>
std::pair<
typename range_iterator<const SinglePassRange1>::type,
typename range_iterator<SinglePassRange2>::type >
mismatch(const SinglePassRange1& rng1, SinglePassRange2& rng2);
template<
class SinglePassRange1,
class SinglePassRange2,
class BinaryPredicate
>
std::pair<
typename range_iterator<SinglePassRange1>::type,
typename range_iterator<const SinglePassRange2>::type >
mismatch(SinglePassRange1& rng1, const SinglePassRange2& rng2,
BinaryPredicate pred);
template<
class SinglePassRange1,
class SinglePassRange2,
class BinaryPredicate
>
std::pair<
typename range_iterator<const SinglePassRange1>::type,
typename range_iterator<const SinglePassRange2>::type >
mismatch(const SinglePassRange1& rng1, const SinglePassRange2& rng2,
BinaryPredicate pred);
template<
class SinglePassRange1,
class SinglePassRange2,
class BinaryPredicate
>
std::pair<
typename range_iterator<SinglePassRange1>::type,
typename range_iterator<SinglePassRange2>::type >
mismatch(SinglePassRange1& rng1, SinglePassRange2& rng2,
BinaryPredicate pred);
template<
class SinglePassRange1,
class SinglePassRange2,
class BinaryPredicate
>
std::pair<
typename range_iterator<const SinglePassRange1>::type,
typename range_iterator<SinglePassRange2>::type >
mismatch(const SinglePassRange1& rng1, SinglePassRange2& rng2,
BinaryPredicate pred);
``
[heading Description]
`mismatch` finds the first position where the corresponding elements from the two ranges `rng1` and `rng2` are not equal.
Equality is determined by `operator==` for non-predicate versions of `mismatch`, and by satisfying `pred` in the predicate versions.
[heading Definition]
Defined in the header file `boost/range/algorithm/mismatch.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
* `SinglePassRange1`'s value type is a model of the `EqualityComparableConcept`.
* `SinglePassRange2`'s value type is a model of the `EqualityComparableConcept`.
* `SinglePassRange1`s value type can be compared for equality with `SinglePassRange2`'s value type.
[*For the predicate versions:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
* `BinaryPredicate` is a model of the `BinaryPredicateConcept`.
* `SinglePassRange1`'s value type is convertible to `BinaryPredicate`'s first argument type.
* `SinglePassRange2`'s value type is convertible to `BinaryPredicate`'s second argument type.
[heading Precondition:]
`distance(rng2) >= distance(rng1)`
[heading Complexity]
Linear. At most `distance(rng1)` comparisons.
[endsect]

View File

@ -0,0 +1,56 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:next_permutation next_permutation]
[heading Prototype]
``
template<class BidirectionalRange>
bool next_permutation(BidirectionalRange& rng);
template<class BidirectionalRange>
bool next_permutation(const BidirectionalRange& rng);
template<class BidirectionalRange, class Compare>
bool next_permutation(BidirectionalRange& rng, Compare pred);
template<class BidirectionalRange, class Compare>
bool next_permutation(const BidirectionalRange& rng, Compare pred);
``
[heading Description]
`next_permutation` transforms the range of elements `rng` into the lexicographically next greater permutation of the elements if such a permutation exists. If one does not exist then the range is transformed into the lexicographically smallest permutation and `false` is returned. `true` is returned when the next greater permutation is successfully generated.
The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions.
[heading Definition]
Defined in the header file `boost/range/algorithm/permutation.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `BidirectionalRange` is a model of the __bidirectional_range__ Concept.
* `BidirectionalRange` is mutable.
* `BidirectionalRange`'s value type is a model of the `LessThanComparableConcept`.
* The ordering of objects of type `BidirectionalRange`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
[*For the predicate versions:]
* `BidirectionalRange` is a model of the __bidirectional_range__ Concept.
* `BidirectionalRange` is mutable.
* `Compare` is a model of the `StrictWeakOrderingConcept`.
* `BidirectionalRange`'s value type is convertible to both of `Compare`'s argument types.
[heading Complexity]
Linear. At most `distance(rng) / 2` swaps.
[endsect]

View File

@ -0,0 +1,67 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:nth_element nth_element]
[heading Prototype]
``
template<class RandomAccessRange>
RandomAccessRange& nth_element(
RandomAccessRange& rng,
typename range_iterator<RandomAccessRange>::type nth);
template<class RandomAccessRange>
const RandomAccessRange& nth_element(
const RandomAccessRange& rng,
typename range_iterator<const RandomAccessRange>::type nth);
template<class RandomAccessRange>
RandomAccessRange& nth_element(
RandomAccessRange& rng,
typename range_iterator<RandomAccessRange>::type nth,
BinaryPredicate sort_pred);
template<class RandomAccessRange>
const RandomAccessRange& nth_element(
const RandomAccessRange& rng,
typename range_iterator<const RandomAccessRange>::type nth,
BinaryPredicate sort_pred);
``
[heading Description]
`nth_element` partially orders a range of elements. `nth_element` arranges the range `rng` such that the element corresponding with the iterator `nth` is the same as the element that would be in that position if `rng` has been sorted.
[heading Definition]
Defined in the header file `boost/range/algorithm/nth_element.hpp`
[heading Requirements]
[*For the non-predicate version:]
* `RandomAccessRange` is a model of the __random_access_range__ Concept.
* `RandomAccessRange` is mutable.
* `RandomAccessRange`'s value type is a model of the `LessThanComparableConcept`.
* The ordering relation on `RandomAccessRange`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
[*For the predicate version:]
* `RandomAccessRange` is a model of the __random_access_range__ Concept.
* `RandomAccessRange` is mutable.
* `BinaryPredicate` is a model of the `StrictWeakOrderingConcept`.
* `RandomAccessRange`'s value type is convertible to both of `BinaryPredicate`'s argument types.
[heading Complexity]
On average, linear in `distance(rng)`.
[endsect]

View File

@ -0,0 +1,69 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:partial_sort partial_sort]
[heading Prototype]
``
template<class RandomAccessRange>
RandomAccessRange& partial_sort(
RandomAccessRange& rng,
typename range_iterator<RandomAccessRange>::type middle);
template<class RandomAccessRange>
const RandomAccessRange& partial_sort(
const RandomAccessRange& rng,
typename range_iterator<const RandomAccessRange>::type middle);
template<class RandomAccessRange>
RandomAccessRange& partial_sort(
RandomAccessRange& rng,
typename range_iterator<RandomAccessRange>::type middle,
BinaryPredicate sort_pred);
template<class RandomAccessRange>
const RandomAccessRange& partial_sort(
const RandomAccessRange& rng,
typename range_iterator<const RandomAccessRange>::type middle,
BinaryPredicate sort_pred);
``
[heading Description]
`partial_sort` rearranges the elements in `rng`. It places the smallest `distance(begin(rng), middle)` elements, sorted in ascending order, into the range `[begin(rng), middle)`. The remaining elements are placed in an unspecified order into `[middle, last)`.
The non-predicative versions of this function specify that one element is less than another by using `operator<()`. The predicate versions use the predicate instead.
[heading Definition]
Defined in the header file `boost/range/algorithm/partial_sort.hpp`
[heading Requirements]
[*For the non-predicate version:]
* `RandomAccessRange` is a model of the __random_access_range__ Concept.
* `RandomAccessRange` is mutable.
* `RandomAccessRange`'s value type is a model of the `LessThanComparableConcept`.
* The ordering relation on `RandomAccessRange`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
[*For the predicate version:]
* `RandomAccessRange` is a model of the __random_access_range__ Concept.
* `RandomAccessRange` is mutable.
* `BinaryPredicate` is a model of the `StrictWeakOrderingConcept`.
* `RandomAccessRange`'s value type is convertible to both of `BinaryPredicate`'s argument types.
[heading Complexity]
Approximately `distance(rng) * log(distance(begin(rng), middle))` comparisons.
[endsect]

View File

@ -0,0 +1,63 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:partition partition]
[heading Prototype]
``
template<
class ForwardRange,
class UnaryPredicate
>
typename range_iterator<ForwardRange>::type
partition(ForwardRange& rng, UnaryPredicate pred);
template<
class ForwardRange,
class UnaryPredicate
>
typename range_iterator<const ForwardRange>::type
partition(const ForwardRange& rng, UnaryPredicate pred);
template<
range_return_value re,
class ForwardRange,
class UnaryPredicate
>
typename range_return<ForwardRange, re>::type
partition(ForwardRange& rng, UnaryPredicate pred);
template<
range_return_value re,
class ForwardRange,
class UnaryPredicate
>
typename range_return<const ForwardRange, re>::type
partition(const ForwardRange& rng, UnaryPredicate pred);
``
[heading Description]
`partition` orders the elements in `rng` based on `pred`, such that the elements that satisfy `pred` precede the elements that do not. In the versions that return a single iterator, the return value is the middle iterator. In the versions that have a configurable range_return, `found` corresponds to the middle iterator.
[heading Definition]
Defined in the header file `boost/range/algorithm/partition.hpp`
[heading Requirements]
* `ForwardRange` is a model of the __forward_range__ Concept. For C++ versions prior to C++11 the underlying std::partition requires Bidirectional Iterators, hence the requirement for older library versions is for a __bidirectional_range__.
* `UnaryPredicate` is a model of the `PredicateConcept`.
* `ForwardRange`'s value type is convertible to `UnaryPredicate`'s argument type.
[heading Complexity]
Linear. Exactly `distance(rng)` applications of `pred`, and at most `distance(rng) / 2` swaps.
[endsect]

View File

@ -0,0 +1,61 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:pop_heap pop_heap]
[heading Prototype]
``
template<class RandomAccessRange>
RandomAccessRange& pop_heap(RandomAccessRange& rng);
template<class RandomAccessRange>
const RandomAccessRange& pop_heap(const RandomAccessRange& rng);
template<class RandomAccessRange, class Compare>
RandomAccessRange& pop_heap(RandomAccessRange& rng, Compare pred);
template<class RandomAccessRange, class Compare>
const RandomAccessRange& pop_heap(const RandomAccessRange& rng, Compare pred);
``
[heading Description]
`pop_heap` removes the largest element from the heap. It is assumed that `begin(rng), prior(end(rng))` is already a heap (and therefore the largest element is `*begin(rng)`).
The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions.
[heading Definition]
Defined in the header file `boost/range/algorithm/heap_algorithm.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `RandomAccessRange` is a model of the __random_access_range__ Concept.
* `RandomAccessRange` is mutable.
* `RandomAccessRange`'s value type is a model of the `LessThanComparableConcept`.
* The ordering of objects of type `RandomAccessRange`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
[*For the predicate versions:]
* `RandomAccessRange` is a model of the __random_access_range__ Concept.
* `RandomAccessRange` is mutable.
* `Compare` is a model of the `StrictWeakOrderingConcept`.
* `RandomAccessRange`'s value type is convertible to both of `Compare`'s argument types.
[heading Precondition:]
* `!empty(rng)`
* `rng` is a heap.
[heading Complexity]
Logarithmic. At most `2 * log(distance(rng))` comparisons.
[endsect]

View File

@ -0,0 +1,56 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:prev_permutation prev_permutation]
[heading Prototype]
``
template<class BidirectionalRange>
bool prev_permutation(BidirectionalRange& rng);
template<class BidirectionalRange>
bool prev_permutation(const BidirectionalRange& rng);
template<class BidirectionalRange, class Compare>
bool prev_permutation(BidirectionalRange& rng, Compare pred);
template<class BidirectionalRange, class Compare>
bool prev_permutation(const BidirectionalRange& rng, Compare pred);
``
[heading Description]
`prev_permutation` transforms the range of elements `rng` into the lexicographically next smaller permutation of the elements if such a permutation exists. If one does not exist then the range is transformed into the lexicographically largest permutation and `false` is returned. `true` is returned when the next smaller permutation is successfully generated.
The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions.
[heading Definition]
Defined in the header file `boost/range/algorithm/permutation.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `BidirectionalRange` is a model of the __bidirectional_range__ Concept.
* `BidirectionalRange` is mutable.
* `BidirectionalRange`'s value type is a model of the `LessThanComparableConcept`.
* The ordering of objects of type `BidirectionalRange`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
[*For the predicate versions:]
* `BidirectionalRange` is a model of the __bidirectional_range__ Concept.
* `BidirectionalRange` is mutable.
* `Compare` is a model of the `StrictWeakOrderingConcept`.
* `BidirectionalRange`'s value type is convertible to both of `Compare`'s argument types.
[heading Complexity]
Linear. At most `distance(rng) / 2` swaps.
[endsect]

View File

@ -0,0 +1,61 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:push_heap push_heap]
[heading Prototype]
``
template<class RandomAccessRange>
RandomAccessRange& push_heap(RandomAccessRange& rng);
template<class RandomAccessRange>
const RandomAccessRange& push_heap(const RandomAccessRange& rng);
template<class RandomAccessRange, class Compare>
RandomAccessRange& push_heap(RandomAccessRange& rng, Compare pred);
template<class RandomAccessRange, class Compare>
const RandomAccessRange& push_heap(const RandomAccessRange& rng, Compare pred);
``
[heading Description]
`push_heap` adds an element to a heap. It is assumed that `begin(rng)`, `prior(end(rng))` is already a heap and that the element to be added is `*prior(end(rng))`.
The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions.
[heading Definition]
Defined in the header file `boost/range/algorithm/heap_algorithm.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `RandomAccessRange` is a model of the __random_access_range__ Concept.
* `RandomAccessRange` is mutable.
* `RandomAccessRange`'s value type is a model of the `LessThanComparableConcept`.
* The ordering of objects of type `RandomAccessRange`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
[*For the predicate versions:]
* `RandomAccessRange` is a model of the __random_access_range__ Concept.
* `RandomAccessRange` is mutable.
* `Compare` is a model of the `StrictWeakOrderingConcept`.
* `RandomAccessRange`'s value type is convertible to both of `Compare`'s argument types.
[heading Precondition:]
* `!empty(rng)`
* `[begin(rng), prior(end(rng)))` is a heap.
[heading Complexity]
Logarithmic. At most `log(distance(rng))` comparisons.
[endsect]

View File

@ -0,0 +1,55 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:random_shuffle random_shuffle]
[heading Prototype]
``
template<class RandomAccessRange>
RandomAccessRange& random_shuffle(RandomAccessRange& rng);
template<class RandomAccessRange>
const RandomAccessRange& random_shuffle(const RandomAccessRange& rng);
template<class RandomAccessRange, class Generator>
RandomAccessRange& random_shuffle(RandomAccessRange& rng, Generator& gen);
template<class RandomAccessRange, class Generator>
const RandomAccessRange& random_shuffle(const RandomAccessRange& rng, Generator& gen);
``
[heading Description]
`random_shuffle` randomly rearranges the elements in `rng`. The versions of `random_shuffle` that do not specify a `Generator` use an internal random number generator. The versions of `random_shuffle` that do specify a `Generator` use this instead. Returns the shuffles range.
[heading Definition]
Defined in the header file `boost/range/algorithm/random_shuffle.hpp`
[heading Requirements]
[*For the version without a Generator:]
* `RandomAccessRange` is a model of the __random_access_range__ Concept.
[*For the version with a Generator:]
* `RandomAccessRange` is a model of the __random_access_range__ Concept.
* `Generator` is a model of the `RandomNumberGeneratorConcept`.
* `RandomAccessRange`'s distance type is convertible to `Generator`'s argument type.
[heading Precondition:]
* `distance(rng)` is less than `gen`'s maximum value.
[heading Complexity]
Linear. If `!empty(rng)`, exactly `distance(rng) - 1` swaps are performed.
[endsect]

View File

@ -0,0 +1,60 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:remove remove]
[heading Prototype]
``
template<
class ForwardRange,
class Value
>
typename range_iterator<ForwardRange>::type
remove(ForwardRange& rng, const Value& val);
template<
class ForwardRange,
class Value
>
typename range_iterator<const ForwardRange>::type
remove(const ForwardRange& rng, const Value& val);
template<
range_return_value re,
class ForwardRange,
class Value
>
typename range_return<ForwardRange,re>::type
remove(ForwardRange& rng, const Value& val);
template<
range_return_value re,
class ForwardRange,
class Value
>
typename range_return<const ForwardRange,re>::type
remove(const ForwardRange& rng, const Value& val);
``
[heading Description]
`remove` removes from `rng` all of the elements `x` for which `x == val` is `true`. The versions of `remove` that return an iterator, return an iterator `new_last` such that the range `[begin(rng), new_last)` contains no elements equal to `val`. The `range_return` versions of `remove` defines `found` as the new last element. The iterators in the range `[new_last, end(rng))` are dereferenceable, but the elements are unspecified.
[heading Definition]
Defined in the header file `boost/range/algorithm/remove.hpp`
[heading Requirements]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange` is mutable.
* `Value` is a model of the `EqualityComparableConcept`.
* Objects of type `Value` can be compared for equality with objects of `ForwardRange`'s value type.
[heading Complexity]
Linear. `remove` performs exactly `distance(rng)` comparisons for equality.
[endsect]

View File

@ -0,0 +1,39 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:remove_copy remove_copy]
[heading Prototype]
``
template<class ForwardRange, class Outputiterator, class Value>
OutputIterator
remove_copy(ForwardRange& rng, OutputIterator out, const Value& val);
template<class ForwardRange, class OutputIterator, class Value>
OutputIterator
remove_copy(const ForwardRange& rng, OutputIterator out, const Value& val);
``
[heading Description]
`remove_copy` copied all of the elements `x` from `rng` for which `x == val` is `false`.
[heading Definition]
Defined in the header file `boost/range/algorithm/remove_copy.hpp`
[heading Requirements]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange` is mutable.
* `Value` is a model of the `EqualityComparableConcept`.
* Objects of type `Value` can be compared for equality with objects of `ForwardRange`'s value type.
[heading Complexity]
Linear. `remove_copy` performs exactly `distance(rng)` comparisons for equality.
[endsect]

View File

@ -0,0 +1,38 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:remove_copy_if remove_copy_if]
[heading Prototype]
``
template<class ForwardRange, class Outputiterator, class UnaryPred>
OutputIterator
remove_copy_if(ForwardRange& rng, OutputIterator out, UnaryPred pred);
template<class ForwardRange, class OutputIterator, class UnaryPred>
OutputIterator
remove_copy_if(const ForwardRange& rng, OutputIterator out, UnaryPred pred);
``
[heading Description]
`remove_copy_if` copied all of the elements `x` from `rng` for which `pred(x)` is `false`.
[heading Definition]
Defined in the header file `boost/range/algorithm/remove_copy_if.hpp`
[heading Requirements]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange` is mutable.
* `UnaryPred` is a model of the `UnaryPredicateConcept`.
[heading Complexity]
Linear. `remove_copy_if` performs exactly `distance(rng)` comparisons with UnaryPred.
[endsect]

View File

@ -0,0 +1,63 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:remove_if remove_if]
[heading Prototype]
``
template<
class ForwardRange,
class UnaryPredicate
>
typename range_iterator<ForwardRange>::type
remove_if(ForwardRange& rng, UnaryPredicate pred);
template<
class ForwardRange,
class UnaryPredicate
>
typename range_iterator<const ForwardRange>::type
remove_if(const ForwardRange& rng, UnaryPredicate pred);
template<
range_return_value re,
class ForwardRange,
class UnaryPredicate
>
typename range_return<ForwardRange,re>::type
remove_if(ForwardRange& rng, UnaryPredicate pred);
template<
range_return_value re,
class ForwardRange,
class UnaryPredicate
>
typename range_return<const ForwardRange,re>::type
remove_if(const ForwardRange& rng, UnaryPredicate pred);
``
[heading Description]
`remove_if` removes from `rng` all of the elements `x` for which `pred(x)` is `true`. The versions of `remove_if` that return an iterator, return an iterator `new_last` such that the range `[begin(rng), new_last)` contains no elements where `pred(x)` is `true`. The iterators in the range `[new_last, end(rng))` are dereferenceable, but the elements are unspecified.
[heading Definition]
Defined in the header file `boost/range/algorithm/remove_if.hpp`
[heading Requirements]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange` is mutable.
* `UnaryPredicate` is a model of the `PredicateConcept`.
* `ForwardRange`'s value type is convertible to `UnaryPredicate`'s argument type.
[heading Complexity]
Linear. `remove_if` performs exactly `distance(rng)` applications of `pred`.
[endsect]

View File

@ -0,0 +1,46 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:replace replace]
[heading Prototype]
``
template<
class ForwardRange,
class Value
>
ForwardRange& replace(ForwardRange& rng, const Value& what, const Value& with_what);
template<
class ForwardRange,
class UnaryPredicate
>
const ForwardRange& replace(const ForwardRange& rng, const Value& what, const Value& with_what);
``
[heading Description]
`replace` every element in `rng` equal to `what` with `with_what`. Return a reference to `rng`.
[heading Definition]
Defined in the header file `boost/range/algorithm/replace.hpp`
[heading Requirements]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange` is mutable.
* `Value` is convertible to `ForwardRange`'s value type.
* `Value` is a model of the `AssignableConcept`.
* `Value` is a model of the `EqualityComparableConcept`, and may be compared for equality with objects of `ForwardRange`'s value type.
[heading Complexity]
Linear. `replace` performs exactly `distance(rng)` comparisons for equality and at most `distance(rng)` assignments.
[endsect]

View File

@ -0,0 +1,38 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:replace_copy replace_copy]
[heading Prototype]
``
template<class ForwardRange, class OutputIterator, class Value>
OutputIterator replace_copy(const ForwardRange& rng, OutputIterator out,
const Value& what, const Value& with_what);
``
[heading Description]
`replace_copy` copy every element `x` in `rng` such that the corresponding element in the output range `y` is `x == what ? with_what : x`.
[heading Definition]
Defined in the header file `boost/range/algorithm/replace_copy.hpp`
[heading Requirements]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange` is mutable.
* `Value` is convertible to `ForwardRange`'s value type.
* `Value` is a model of the `AssignableConcept`.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
[heading Complexity]
Linear. `replace_copy` performs exactly `distance(rng)`.
[endsect]

View File

@ -0,0 +1,39 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:replace_copy_if replace_copy_if]
[heading Prototype]
``
template<class ForwardRange, class OutputIterator, class UnaryPredicate, class Value>
OutputIterator replace_copy_if(const ForwardRange& rng, OutputIterator out,
UnaryPredicate pred, const Value& with_what);
``
[heading Description]
`replace_copy_if` copy every element `x` in `rng` such that the corresponding element in the output range `y` is `pred(x) ? with_what : x`.
[heading Definition]
Defined in the header file `boost/range/algorithm/replace_copy_if.hpp`
[heading Requirements]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange` is mutable.
* `Value` is convertible to `ForwardRange`'s value type.
* `Value` is a model of the `AssignableConcept`.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
* `UnaryPredicate` is a model of the `UnaryPredicateConcept`.
[heading Complexity]
Linear. `replace_copy_if` performs exactly `distance(rng)` evaluations of `pred`.
[endsect]

View File

@ -0,0 +1,41 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:replace_if replace_if]
[heading Prototype]
``
template<class ForwardRange, class UnaryPredicate, class Value>
ForwardRange& replace_if(ForwardRange& rng, UnaryPredicate pred, const Value& with_what);
template<class ForwardRange, class UnaryPredicate, class Value>
const ForwardRange& replace_if(const ForwardRange& rng, UnaryPredicate pred, const Value& with_what);
``
[heading Description]
`replace_if` replaces every element `x` in `rng` for which `pred(x) == true` with `with_what`. Returns a reference to `rng`.
[heading Definition]
Defined in the header file `boost/range/algorithm/replace_if.hpp`
[heading Requirements]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange` is mutable.
* `UnaryPredicate` is a model of the `PredicateConcept`
* `ForwardRange`'s value type is convertible to `UnaryPredicate`'s argument type.
* `Value` is convertible to `ForwardRange`'s value type.
* `Value` is a model of the `AssignableConcept`.
[heading Complexity]
Linear. `replace_if` performs exactly `distance(rng)` applications of `pred`, and at most `distance(rng)` assignments.
[endsect]

View File

@ -0,0 +1,37 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:reverse reverse]
[heading Prototype]
``
template<class BidirectionalRange>
BidirectionalRange& reverse(BidirectionalRange& rng);
template<class BidirectionalRange>
const BidirectionalRange& reverse(const BidirectionalRange& rng);
``
[heading Description]
`reverse` reverses a range. Returns a reference to the reversed range.
[heading Definition]
Defined in the header file `boost/range/algorithm/reverse.hpp`
[heading Requirements]
* `BidirectionalRange` is a model of the __bidirectional_range__ Concept.
* `BidirectionalRange` is mutable.
[heading Complexity]
Linear. `reverse` makes `distance(rng)/2` calls to `iter_swap`.
[endsect]

View File

@ -0,0 +1,36 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:reverse_copy reverse_copy]
[heading Prototype]
``
template<class BidirectionalRange, class OutputIterator>
OutputIterator reverse_copy(const BidirectionalRange& rng, OutputIterator out);
``
[heading Description]
`reverse_copy` copies the elements from `rng` in reverse order to `out`.
Returns the output iterator one passed the last copied element.
[heading Definition]
Defined in the header file `boost/range/algorithm/reverse_copy.hpp`
[heading Requirements]
* `BidirectionalRange` is a model of the __bidirectional_range__ Concept.
* `BidirectionalRange` is mutable.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
[heading Complexity]
Linear. `reverse_copy` makes `distance(rng)` copies.
[endsect]

View File

@ -0,0 +1,44 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:rotate rotate]
[heading Prototype]
``
template<class ForwardRange>
ForwardRange& rotate(ForwardRange& rng,
typename range_iterator<ForwardRange>::type middle);
template<class ForwardRange>
const ForwardRange& rotate(const ForwardRange& rng,
typename range_iterator<const ForwardRange>::type middle);
``
[heading Description]
`rotate` rotates the elements in a range. It exchanges the two ranges `[begin(rng), middle)` and `[middle, end(rng))`. Returns a reference to `rng`.
[heading Definition]
Defined in the header file `boost/range/algorithm/rotate.hpp`
[heading Requirements]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange` is mutable.
[heading Precondition:]
* `[begin(rng), middle)` is a valid range.
* `[middle, end(rng))` is a valid range.
[heading Complexity]
Linear. At most `distance(rng)` swaps are performed.
[endsect]

View File

@ -0,0 +1,43 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:rotate_copy rotate_copy]
[heading Prototype]
``
template<class ForwardRange, class OutputIterator>
OutputIterator rotate_copy(
const ForwardRange& rng,
typename range_iterator<ForwardRange>::type middle,
OutputIterator out);
``
[heading Description]
`rotate_copy` rotates the elements in a range. It copies the two ranges `[begin(rng), middle)` and `[middle, end(rng))` to `out`.
[heading Definition]
Defined in the header file `boost/range/algorithm/rotate_copy.hpp`
[heading Requirements]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange` is mutable.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
[heading Precondition:]
* `[begin(rng), middle)` is a valid range.
* `[middle, end(rng))` is a valid range.
[heading Complexity]
Linear. Exactly `distance(rng)` elements are copied.
[endsect]

View File

@ -0,0 +1,106 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:search search]
[heading Prototype]
``
template<class ForwardRange1, class ForwardRange2>
typename range_iterator<ForwardRange1>::type
search(ForwardRange1& rng1, const ForwardRange2& rng2);
template<class ForwardRange1, class ForwardRange2>
typename range_iterator<const ForwardRange1>::type
search(const ForwardRange1& rng1, const ForwardRange2& rng2);
template<
class ForwardRange1,
class ForwardRange2,
class BinaryPredicate
>
typename range_iterator<ForwardRange1>::type,
search(ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred);
template<
class ForwardRange1,
class ForwardRange2,
class BinaryPredicate
>
typename range_iterator<const ForwardRange1>::type
search(const ForwardRange1& rng1, ForwardRange2& rng2, BinaryPredicate pred);
template<
range_return_value re,
class ForwardRange1,
class ForwardRange2
>
typename range_return<ForwardRange1, re>::type
search(ForwardRange1& rng1, const ForwardRange2& rng2);
template<
range_return_value re,
class ForwardRange1,
class ForwardRange2
>
typename range_return<const ForwardRange1, re>::type
search(const ForwardRange1& rng1, const ForwardRange2& rng2);
template<
range_return_value re,
class ForwardRange1,
class ForwardRange2,
class BinaryPredicate
>
typename range_return<ForwardRange1, re>::type,
search(ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred);
template<
range_return_value re,
class ForwardRange1,
class ForwardRange2,
class BinaryPredicate
>
typename range_return<const ForwardRange1, re>::type
search(const ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred);
``
[heading Description]
The versions of `search` that return an iterator, return an iterator to the start of the first subsequence in `rng1` that is equal to the subsequence `rng2`. The `end(rng1)` is returned if no such subsequence exists in `rng1`.
Equality is determined by `operator==` for non-predicate versions of `search`, and by satisfying `pred` in the predicate versions.
The versions of `search` that return a `range_return`, defines `found` in the same manner as the returned iterator described above.
[heading Definition]
Defined in the header file `boost/range/algorithm/search.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `ForwardRange1` is a model of the __forward_range__ Concept.
* `ForwardRange2` is a model of the __forward_range__ Concept.
* `ForwardRange1`'s value type is a model of the `EqualityComparableConcept`.
* `ForwardRange2`'s value type is a model of the `EqualityComparableConcept`.
* `ForwardRange1`s value type can be compared for equality with `ForwardRange2`'s value type.
[*For the predicate versions:]
* `ForwardRange1` is a model of the __forward_range__ Concept.
* `ForwardRange2` is a model of the __forward_range__ Concept.
* `BinaryPredicate` is a model of the `BinaryPredicateConcept`.
* `ForwardRange1`'s value type is convertible to `BinaryPredicate`'s first argument type.
* `ForwardRange2`'s value type is convertible to `BinaryPredicate`'s second argument type.
[heading Complexity]
Average complexity is Linear. Worst-case complexity is quadratic.
[endsect]

View File

@ -0,0 +1,63 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:search_n search_n]
[heading Prototype]
``
template<class ForwardRange, class Integer, class Value>
typename range_iterator<ForwardRange>::type
search_n(ForwardRange& rng, Integer n, const Value& value);
template<class ForwardRange, class Integer, class Value>
typename range_iterator<const ForwardRange>::type
search_n(const ForwardRange& rng, Integer n, const Value& value);
template<class ForwardRange, class Integer, class Value, class BinaryPredicate>
typename range_iterator<ForwardRange>::type
search_n(ForwardRange& rng, Integer n, const Value& value,
BinaryPredicate binary_pred);
template<class ForwardRange, class Integer, class Value, class BinaryPredicate>
typename range_iterator<const ForwardRange>::type
search_n(const ForwardRange& rng, Integer n, const Value& value,
BinaryPredicate binary_pred);
``
[heading Description]
`search_n` searches `rng` for a sequence of length `n` equal to `value` where
equality is determined by operator== in the non-predicate case, and by a
predicate when one is supplied.
[heading Definition]
Defined in the header file `boost/range/algorithm/search_n.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange`'s value type is a model of the `EqualityComparableConcept`.
* `ForwardRange`s value type can be compared for equality with `Value`.
* `Integer` is a model of the `IntegerConcept`.
[*For the predicate versions:]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `BinaryPredicate` is a model of the `BinaryPredicateConcept`.
* `ForwardRange`'s value type is convertible to `BinaryPredicate`'s first argument type.
* `Value` is convertible to `BinaryPredicate`'s second argument type.
* `Integer` is a model of the `IntegerConcept`.
[heading Complexity]
Average complexity is Linear. Worst-case complexity is quadratic.
[endsect]

View File

@ -0,0 +1,81 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:set_difference set_difference]
[heading Prototype]
``
template<
class SinglePassRange1,
class SinglePassRange2,
class OutputIterator
>
OutputIterator set_difference(const SinglePassRange1& rng1,
const SinglePassRange2& rng2,
OutputIterator out);
template<
class SinglePassRange1,
class SinglePassRange2,
class OutputIterator,
class BinaryPredicate
>
OutputIterator set_difference(const SinglePassRange1& rng1,
const SinglePassRange2& rng2,
OutputIterator out,
BinaryPredicate pred);
``
[heading Description]
`set_difference` constructs a sorted range that is the set difference of the sorted ranges `rng1` and `rng2`. The return value is the end of the output range.
The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions.
[heading Definition]
Defined in the header file `boost/range/algorithm/set_algorithm.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
* `SinglePassRange1` and `SinglePassRange2` have the same value type.
* `SinglePassRange1`'s value type is a model of the `LessThanComparableConcept`.
* `SinglePassRange2`'s value type is a model of the `LessThanComparableConcept`.
* The ordering of objects of type `SinglePassRange1`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
* The ordering of objects of type `SinglePassRange2`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
[*For the predicate versions:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
* `SinglePassRange1` and `SinglePassRange2` have the same value type.
* `BinaryPredicate` is a model of the `StrictWeakOrderingConcept`.
* `SinglePassRange1`'s value type is convertible to `BinaryPredicate`'s first argument type.
* `SinglePassRange2`'s value type is convertible to `BinaryPredicate`'s second argument types.
[heading Precondition:]
[*For the non-predicate versions:]
`rng1` and `rng2` are sorted in ascending order according to `operator<`.
[*For the predicate versions:]
`rng1` and `rng2` are sorted in ascending order according to `pred`.
[heading Complexity]
Linear. `O(N)`, where `N` is `distance(rng1) + distance(rng2)`.
[endsect]

View File

@ -0,0 +1,81 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:set_intersection set_intersection]
[heading Prototype]
``
template<
class SinglePassRange1,
class SinglePassRange2,
class OutputIterator
>
OutputIterator set_intersection(const SinglePassRange1& rng1,
const SinglePassRange2& rng2,
OutputIterator out);
template<
class SinglePassRange1,
class SinglePassRange2,
class OutputIterator,
class BinaryPredicate
>
OutputIterator set_intersection(const SinglePassRange1& rng1,
const SinglePassRange2& rng2,
OutputIterator out,
BinaryPredicate pred);
``
[heading Description]
`set_intersection` constructs a sorted range that is the intersection of the sorted ranges `rng1` and `rng2`. The return value is the end of the output range.
The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions.
[heading Definition]
Defined in the header file `boost/range/algorithm/set_algorithm.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
* `SinglePassRange1` and `SinglePassRange2` have the same value type.
* `SinglePassRange1`'s value type is a model of the `LessThanComparableConcept`.
* `SinglePassRange2`'s value type is a model of the `LessThanComparableConcept`.
* The ordering of objects of type `SinglePassRange1`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
* The ordering of objects of type `SinglePassRange2`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
[*For the predicate versions:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
* `SinglePassRange1` and `SinglePassRange2` have the same value type.
* `BinaryPredicate` is a model of the `StrictWeakOrderingConcept`.
* `SinglePassRange1`'s value type is convertible to `BinaryPredicate`'s first argument type.
* `SinglePassRange2`'s value type is convertible to `BinaryPredicate`'s second argument types.
[heading Precondition:]
[*For the non-predicate versions:]
`rng1` and `rng2` are sorted in ascending order according to `operator<`.
[*For the predicate versions:]
`rng1` and `rng2` are sorted in ascending order according to `pred`.
[heading Complexity]
Linear. `O(N)`, where `N` is `distance(rng1) + distance(rng2)`.
[endsect]

View File

@ -0,0 +1,83 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:set_symmetric_difference set_symmetric_difference]
[heading Prototype]
``
template<
class SinglePassRange1,
class SinglePassRange2,
class OutputIterator
>
OutputIterator
set_symmetric_difference(const SinglePassRange1& rng1,
const SinglePassRange2& rng2,
OutputIterator out);
template<
class SinglePassRange1,
class SinglePassRange2,
class OutputIterator,
class BinaryPredicate
>
OutputIterator
set_symmetric_difference(const SinglePassRange1& rng1,
const SinglePassRange2& rng2,
OutputIterator out,
BinaryPredicate pred);
``
[heading Description]
`set_symmetric_difference` constructs a sorted range that is the set symmetric difference of the sorted ranges `rng1` and `rng2`. The return value is the end of the output range.
The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions.
[heading Definition]
Defined in the header file `boost/range/algorithm/set_algorithm.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
* `SinglePassRange1` and `SinglePassRange2` have the same value type.
* `SinglePassRange1`'s value type is a model of the `LessThanComparableConcept`.
* `SinglePassRange2`'s value type is a model of the `LessThanComparableConcept`.
* The ordering of objects of type `SinglePassRange1`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
* The ordering of objects of type `SinglePassRange2`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
[*For the predicate versions:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
* `SinglePassRange1` and `SinglePassRange2` have the same value type.
* `BinaryPredicate` is a model of the `StrictWeakOrderingConcept`.
* `SinglePassRange1`'s value type is convertible to `BinaryPredicate`'s first argument type.
* `SinglePassRange2`'s value type is convertible to `BinaryPredicate`'s second argument types.
[heading Precondition:]
[*For the non-predicate versions:]
`rng1` and `rng2` are sorted in ascending order according to `operator<`.
[*For the predicate versions:]
`rng1` and `rng2` are sorted in ascending order according to `pred`.
[heading Complexity]
Linear. `O(N)`, where `N` is `distance(rng1) + distance(rng2)`.
[endsect]

View File

@ -0,0 +1,80 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:set_union set_union]
[heading Prototype]
``
template<
class SinglePassRange1,
class SinglePassRange2,
class OutputIterator
>
OutputIterator set_union(const SinglePassRange1& rng1,
const SinglePassRange2& rng2,
OutputIterator out);
template<
class SinglePassRange1,
class SinglePassRange2,
class OutputIterator,
class BinaryPredicate
>
OutputIterator set_union(const SinglePassRange1& rng1,
const SinglePassRange2& rng2,
OutputIterator out,
BinaryPredicate pred);
``
[heading Description]
`set_union` constructs a sorted range that is the union of the sorted ranges `rng1` and `rng2`. The return value is the end of the output range.
The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions.
[heading Definition]
Defined in the header file `boost/range/algorithm/set_algorithm.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
* `SinglePassRange1` and `SinglePassRange2` have the same value type.
* `SinglePassRange1`'s value type is a model of the `LessThanComparableConcept`.
* `SinglePassRange2`'s value type is a model of the `LessThanComparableConcept`.
* The ordering of objects of type `SinglePassRange1`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
* The ordering of objects of type `SinglePassRange2`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
[*For the predicate versions:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
* `SinglePassRange1` and `SinglePassRange2` have the same value type.
* `BinaryPredicate` is a model of the `StrictWeakOrderingConcept`.
* `SinglePassRange1`'s value type is convertible to `BinaryPredicate`'s first argument type.
* `SinglePassRange2`'s value type is convertible to `BinaryPredicate`'s second argument types.
[heading Precondition:]
[*For the non-predicate versions:]
`rng1` and `rng2` are sorted in ascending order according to `operator<`.
[*For the predicate versions:]
`rng1` and `rng2` are sorted in ascending order according to `pred`.
[heading Complexity]
Linear. `O(N)`, where `N` is `distance(rng1) + distance(rng2)`.
[endsect]

View File

@ -0,0 +1,58 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:sort sort]
[heading Prototype]
``
template<class RandomAccessRange>
RandomAccessRange& sort(RandomAccessRange& rng);
template<class RandomAccessRange>
const RandomAccessRange& sort(const RandomAccessRange& rng);
template<class RandomAccessRange, class BinaryPredicate>
RandomAccessRange& sort(RandomAccessRange& rng, BinaryPredicate pred);
template<class RandomAccessRange, class BinaryPredicate>
const RandomAccessRange& sort(const RandomAccessRange& rng, BinaryPredicate pred);
``
[heading Description]
`sort` sorts the elements in `rng` into ascending order. `sort` is not guaranteed to be stable. Returns the sorted range.
For versions of the `sort` function without a predicate, ascending order is defined by `operator<()` such that for all adjacent elements `[x,y]`, `y < x == false`.
For versions of the `sort` function with a predicate, ascending order is defined by `pred` such that for all adjacent elements `[x,y]`, `pred(y, x) == false`.
[heading Definition]
Defined in the header file `boost/range/algorithm/sort.hpp`
[heading Requirements]
[*For versions of sort without a predicate:]
* `RandomAccessRange` is a model of the __random_access_range__ Concept.
* `RandomAccessRange` is mutable.
* `RandomAccessRange`'s value type is a model of the `LessThanComparableConcept`.
* The ordering relation on `RandomAccessRange`'s value type is a [*strict weak ordering], as defined in the `LessThanComparableConcept` requirements.
[*For versions of sort with a predicate]
* `RandomAccessRange` is a model of the __random_access_range__ Concept.
* `RandomAccessRange` is mutable.
* `BinaryPredicate` is a model of the `StrictWeakOrderingConcept`.
* `RandomAccessRange`'s value type is convertible to both of `BinaryPredicate`'s argument types.
[heading Complexity]
`O(N log(N))` comparisons (both average and worst-case), where `N` is `distance(rng)`.
[endsect]

View File

@ -0,0 +1,60 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:sort_heap sort_heap]
[heading Prototype]
``
template<class RandomAccessRange>
RandomAccessRange& sort_heap(RandomAccessRange& rng);
template<class RandomAccessRange>
const RandomAccessRange& sort_heap(const RandomAccessRange& rng);
template<class RandomAccessRange, class Compare>
RandomAccessRange& sort_heap(RandomAccessRange& rng, Compare pred);
template<class RandomAccessRange, class Compare>
const RandomAccessRange& sort_heap(const RandomAccessRange& rng, Compare pred);
``
[heading Description]
`sort_heap` turns a heap into a sorted range.
The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions.
[heading Definition]
Defined in the header file `boost/range/algorithm/heap_algorithm.hpp`
[heading Requirements]
[*For the non-predicate versions:]
* `RandomAccessRange` is a model of the __random_access_range__ Concept.
* `RandomAccessRange` is mutable.
* `RandomAccessRange`'s value type is a model of the `LessThanComparableConcept`.
* The ordering of objects of type `RandomAccessRange`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
[*For the predicate versions:]
* `RandomAccessRange` is a model of the __random_access_range__ Concept.
* `RandomAccessRange` is mutable.
* `Compare` is a model of the `StrictWeakOrderingConcept`.
* `RandomAccessRange`'s value type is convertible to both of `Compare`'s argument types.
[heading Precondition:]
`rng` is a heap.
[heading Complexity]
At most `N * log(N)` comparisons, where `N` is `distance(rng)`.
[endsect]

View File

@ -0,0 +1,61 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:stable_partition stable_partition]
[heading Prototype]
``
template<class ForwardRange, class UnaryPredicate>
typename range_iterator<ForwardRange>::type
stable_partition(ForwardRange& rng, UnaryPredicate pred);
template<class ForwardRange, class UnaryPredicate>
typename range_iterator<const ForwardRange>::type
stable_partition(const ForwardRange& rng, UnaryPredicate pred);
template<
range_return_value re,
class ForwardRange,
class UnaryPredicate
>
typename range_return<ForwardRange, re>::type
stable_partition(ForwardRange& rng, UnaryPredicate pred);
template<
range_return_value re,
class ForwardRange,
class UnaryPredicate
>
typename range_return<const ForwardRange, re>::type
stable_partition(const ForwardRange& rng, UnaryPredicate pred);
``
[heading Description]
`stable_partition` reorders the elements in the range `rng` base on the function object `pred`. Once this function has completed all of the elements that satisfy `pred` appear before all of the elements that fail to satisfy it. `stable_partition` differs from `partition` because it preserves relative order. It is stable.
For the versions that return an iterator, the return value is the iterator to the first element that fails to satisfy `pred`.
For versions that return a `range_return`, the `found` iterator is the iterator to the first element that fails to satisfy `pred`.
[heading Definition]
Defined in the header file `boost/range/algorithm/stable_partition.hpp`
[heading Requirements]
* `ForwardRange` is a model of the __forward_range__ Concept.
* `ForwardRange` is mutable.
* `UnaryPredicate` is a model of the `PredicateConcept`.
[heading Complexity]
Best case: `O(N)` where `N` is `distance(rng)`.
Worst case: `N * log(N)` swaps, where `N` is `distance(rng)`.
[endsect]

View File

@ -0,0 +1,59 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:stable_sort stable_sort]
[heading Prototype]
``
template<class RandomAccessRange>
RandomAccessRange& stable_sort(RandomAccessRange& rng);
template<class RandomAccessRange>
const RandomAccessRange& stable_sort(const RandomAccessRange& rng);
template<class RandomAccessRange, class BinaryPredicate>
RandomAccessRange& stable_sort(RandomAccessRange& rng, BinaryPredicate pred);
template<class RandomAccessRange, class BinaryPredicate>
const RandomAccessRange& stable_sort(const RandomAccessRange& rng, BinaryPredicate pred);
``
[heading Description]
`stable_sort` sorts the elements in `rng` into ascending order. `stable_sort` is guaranteed to be stable. The order is preserved for equivalent elements.
For versions of the `stable_sort` function without a predicate ascending order is defined by `operator<()` such that for all adjacent elements `[x,y]`, `y < x == false`.
For versions of the `stable_sort` function with a predicate, ascending order is designed by `pred` such that for all adjacent elements `[x,y]`, `pred(y,x) == false`.
[heading Definition]
Defined in the header file `boost/range/algorithm/stable_sort.hpp`
[heading Requirements]
[*For versions of stable_sort without a predicate]
* `RandomAccessRange` is a model of the __random_access_range__ Concept.
* `RandomAccessRange` is mutable.
* `RandomAccessRange`'s value type is a model of the `LessThanComparableConcept`.
* The ordering relation on `RandomAccessRange`'s value type is a [*strict weak ordering], as defined in the `LessThanComparableConcept` requirements.
[*For versions of stable_sort with a predicate:]
* `RandomAccessRange` is a model of the __random_access_range__ Concept.
* `RandomAccessRange` is mutable.
* `BinaryPredicate` is a model of the `StrictWeakOrderingConcept`.
* `RandomAccessRange`'s value type is convertible to both of `BinaryPredicate`'s argument types.
[heading Complexity]
Best case: `O(N)` where `N` is `distance(rng)`.
Worst case: `O(N log(N)^2)` comparisons, where `N` is `distance(rng)`.
[endsect]

View File

@ -0,0 +1,37 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:swap_ranges swap_ranges]
[heading Prototype]
``
template<class SinglePassRange1, class SinglePassRange2>
SinglePassRange2& swap_ranges(SinglePassRange1& rng1, SinglePassRange& rng2);
``
[heading Description]
`swap_ranges` swaps each element `x` in `rng1` with the corresponding element `y` in `rng2`.
Returns a reference to `rng2`.
[heading Definition]
Defined in the header file `boost/range/algorithm/swap_ranges.hpp`
[heading Requirements]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `SinglePassRange1` is mutable.
* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
* `SinglePassRange2` is mutable.
[heading Complexity]
Linear. Exactly `distance(rng1)` elements are swapped.
[endsect]

View File

@ -0,0 +1,88 @@
[/
Copyright 2010 Neil Groves
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)
/]
[section:transform transform]
[heading Prototype]
``
template<
class SinglePassRange1,
class OutputIterator,
class UnaryOperation
>
OutputIterator transform(const SinglePassRange1& rng,
OutputIterator out,
UnaryOperation fun);
template<
class SinglePassRange1,
class SinglePassRange2,
class OutputIterator,
class BinaryOperation
>
OutputIterator transform(const SinglePassRange1& rng1,
const SinglePassRange2& rng2,
OutputIterator out,
BinaryOperation fun);
``
[heading Description]
[*UnaryOperation version:]
`transform` assigns the value `y` to each element `[out, out + distance(rng)), y = fun(x)` where `x` is the corresponding value to `y` in `rng1`. The return value is `out + distance(rng)`.
[*BinaryOperation version:]
`transform` assigns the value `z` to each element `[out, out + min(distance(rng1), distance(rng2))), z = fun(x,y)` where `x` is the corresponding value in `rng1` and `y` is the corresponding value in `rng2`. This version of `transform` stops upon reaching either the end of `rng1`, or the end of `rng2`. Hence there isn't a requirement for `distance(rng1) == distance(rng2)` since there is a safe guaranteed behaviour, unlike with the iterator counterpart in the standard library.
The return value is `out + min(distance(rng1), distance(rng2))`.
[heading Definition]
Defined in the header file `boost/range/algorithm/transform.hpp`
[heading Requirements]
[*For the unary versions of transform:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
* `UnaryOperation` is a model of the `UnaryFunctionConcept`.
* `SinglePassRange1`'s value type must be convertible to `UnaryFunction`'s argument type.
* `UnaryFunction`'s result type must be convertible to a type in `OutputIterator`'s set of value types.
[*For the binary versions of transform:]
* `SinglePassRange1` is a model of the __single_pass_range__ Concept.
* `SinglePassRange2` is a model of the __single_pass_range__ Concept.
* `OutputIterator` is a model of the `OutputIteratorConcept`.
* `BinaryOperation` is a model of the `BinaryFunctionConcept`.
* `SinglePassRange1`'s value type must be convertible to `BinaryFunction`'s first argument type.
* `SinglePassRange2`'s value type must be convertible to `BinaryFunction`'s second argument type.
* `BinaryOperation`'s result type must be convertible to a type in `OutputIterator`'s set of value types.
[heading Precondition:]
[*For the unary version of transform:]
* `out` is not an iterator within the range `[begin(rng1) + 1, end(rng1))`.
* `[out, out + distance(rng1))` is a valid range.
[*For the binary version of transform:]
* `out` is not an iterator within the range `[begin(rng1) + 1, end(rng1))`.
* `out` is not an iterator within the range `[begin(rng2) + 1, end(rng2))`.
* `[out, out + min(distance(rng1), distance(rng2)))` is a valid range.
[heading Complexity]
Linear. The operation is applied exactly `distance(rng1)` for the unary version and `min(distance(rng1), distance(rng2))` for the binary version.
[endsect]

Some files were not shown because too many files have changed in this diff Show More