mirror of
https://github.com/boostorg/algorithm.git
synced 2025-06-26 12:31:44 +02:00
Compare commits
111 Commits
develop
...
boost-1.82
Author | SHA1 | Date | |
---|---|---|---|
28dd87b90e | |||
1c5f74ae25 | |||
1cfd9592f7 | |||
559835eaa5 | |||
3b3bd8d3db | |||
ca77e55428 | |||
7f527f3c4d | |||
e59958cc4d | |||
44527f4c81 | |||
1b65b8de02 | |||
5af3e3b174 | |||
badf1b3f0c | |||
4f9afb0682 | |||
6d0126df8a | |||
daef6d41c5 | |||
055075aa61 | |||
d029402f05 | |||
24d2cceb27 | |||
c5b41eba46 | |||
e5ea93bab1 | |||
5412438df5 | |||
baa6eca18c | |||
073eb62f64 | |||
cc1392cae6 | |||
a09963bf93 | |||
cf249c090c | |||
645be22fa7 | |||
28b12d7264 | |||
4d28d579e3 | |||
5adab54486 | |||
685a76f094 | |||
5988a55b96 | |||
850fc02667 | |||
5279c8f061 | |||
8b89b5ba27 | |||
ca23b6f4f8 | |||
55cb3afefa | |||
beeedadba9 | |||
1a70166889 | |||
63da6f5713 | |||
2381d0bdac | |||
40b5941652 | |||
00dfda98b2 | |||
52eef989da | |||
8132864884 | |||
6e098b27aa | |||
60010b4165 | |||
1660dc9d48 | |||
5ae4f848b3 | |||
fe3e0bb9c4 | |||
311e169376 | |||
3dddfa1930 | |||
be6d8f9665 | |||
bced4ed8dd | |||
1b57e905ab | |||
29bd9f53d9 | |||
6341cfb1a6 | |||
7f4acd6170 | |||
314f6dcfe0 | |||
167aa6e31c | |||
d228e91494 | |||
9cc573fbd0 | |||
28a7d3eb4b | |||
883cce61a8 | |||
96d4708367 | |||
563fe27a59 | |||
76cd99ed53 | |||
0f2399fef0 | |||
044d667e79 | |||
be9da63894 | |||
787c94bc53 | |||
e87ce37b34 | |||
199a89a1e9 | |||
01492a93c6 | |||
50703b8c97 | |||
0f8d556130 | |||
bbd3220a1e | |||
9068069106 | |||
a37af3c81e | |||
f5885c6fb0 | |||
d45bb3545e | |||
d735b9fa1e | |||
62ec675581 | |||
e7cd4da67b | |||
6076f5a18e | |||
60cd5a0500 | |||
c33dad924d | |||
2f2935f07e | |||
3cbaafc27f | |||
c067b348bf | |||
c33935fa1f | |||
98a8b08afb | |||
fc0f3dcffc | |||
822636418b | |||
352e16aade | |||
89c76ea1bb | |||
50b5726a6f | |||
d4b95734dd | |||
05af96f84c | |||
5bdbb2b308 | |||
1a02969303 | |||
6309379618 | |||
37581bac55 | |||
a71a4ed5b1 | |||
c509c3fbad | |||
d8683f2498 | |||
7c0101aa51 | |||
6f3e85528f | |||
8af639b7cf | |||
d9bc7e800b | |||
b4ed9beb90 |
11
Jamfile
Normal file
11
Jamfile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Boost.Algorithm Library Jamfile
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 James E. King III
|
||||||
|
#
|
||||||
|
# Use, modification, and distribution are subject to the
|
||||||
|
# Boost Software License, Version 1.0. (See accompanying file
|
||||||
|
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
# please order by name to ease maintenance
|
||||||
|
build-project example ;
|
||||||
|
build-project test ;
|
42
build.jam
42
build.jam
@ -1,42 +0,0 @@
|
|||||||
# Copyright René Ferdinand Rivera Morell 2023-2024
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
require-b2 5.2 ;
|
|
||||||
|
|
||||||
constant boost_dependencies :
|
|
||||||
/boost/array//boost_array
|
|
||||||
/boost/assert//boost_assert
|
|
||||||
/boost/bind//boost_bind
|
|
||||||
/boost/concept_check//boost_concept_check
|
|
||||||
/boost/config//boost_config
|
|
||||||
/boost/core//boost_core
|
|
||||||
/boost/exception//boost_exception
|
|
||||||
/boost/function//boost_function
|
|
||||||
/boost/iterator//boost_iterator
|
|
||||||
/boost/mpl//boost_mpl
|
|
||||||
/boost/range//boost_range
|
|
||||||
/boost/regex//boost_regex
|
|
||||||
/boost/static_assert//boost_static_assert
|
|
||||||
/boost/throw_exception//boost_throw_exception
|
|
||||||
/boost/tuple//boost_tuple
|
|
||||||
/boost/type_traits//boost_type_traits
|
|
||||||
/boost/unordered//boost_unordered ;
|
|
||||||
|
|
||||||
project /boost/algorithm
|
|
||||||
: common-requirements
|
|
||||||
<include>include
|
|
||||||
;
|
|
||||||
|
|
||||||
explicit
|
|
||||||
[ alias boost_algorithm : : : : <library>$(boost_dependencies) ]
|
|
||||||
[ alias all : boost_algorithm test
|
|
||||||
example
|
|
||||||
minmax/example minmax/test
|
|
||||||
string/example string/test
|
|
||||||
]
|
|
||||||
;
|
|
||||||
|
|
||||||
call-if : boost-library algorithm
|
|
||||||
;
|
|
@ -18,11 +18,11 @@ using boostbook ;
|
|||||||
|
|
||||||
doxygen autodoc
|
doxygen autodoc
|
||||||
:
|
:
|
||||||
[ glob ../include/boost/algorithm/*.hpp
|
[ glob ../../../boost/algorithm/*.hpp
|
||||||
../include/boost/algorithm/searching/*.hpp
|
../../../boost/algorithm/searching/*.hpp
|
||||||
../include/boost/algorithm/cxx11/*.hpp
|
../../../boost/algorithm/cxx11/*.hpp
|
||||||
../include/boost/algorithm/cxx14/*.hpp
|
../../../boost/algorithm/cxx14/*.hpp
|
||||||
../include/boost/algorithm/cxx17/*.hpp
|
../../../boost/algorithm/cxx17/*.hpp
|
||||||
]
|
]
|
||||||
:
|
:
|
||||||
<doxygen:param>"PREDEFINED=\"BOOST_ALGORITHM_DOXYGEN=1\""
|
<doxygen:param>"PREDEFINED=\"BOOST_ALGORITHM_DOXYGEN=1\""
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
# See http://www.boost.org for updates, documentation, and revision history.
|
# See http://www.boost.org for updates, documentation, and revision history.
|
||||||
|
|
||||||
|
|
||||||
project
|
project /boost/algorithm/example
|
||||||
: requirements
|
: requirements
|
||||||
<library>/boost/algorithm//boost_algorithm
|
<include>../../../
|
||||||
<optimization>speed
|
<optimization>speed
|
||||||
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
|
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
|
||||||
<toolset>msvc:<define>NOMINMAX
|
<toolset>msvc:<define>NOMINMAX
|
||||||
|
@ -106,11 +106,11 @@ template <
|
|||||||
typename BidirectionalRange, //
|
typename BidirectionalRange, //
|
||||||
typename Pred> // Pred models UnaryPredicate
|
typename Pred> // Pred models UnaryPredicate
|
||||||
std::pair<
|
std::pair<
|
||||||
typename boost::range_iterator<BidirectionalRange>::type,
|
typename boost::range_iterator<const BidirectionalRange>::type,
|
||||||
typename boost::range_iterator<BidirectionalRange>::type>
|
typename boost::range_iterator<const BidirectionalRange>::type>
|
||||||
gather (
|
gather (
|
||||||
BidirectionalRange &range,
|
const BidirectionalRange &range,
|
||||||
typename boost::range_iterator<BidirectionalRange>::type pivot,
|
typename boost::range_iterator<const BidirectionalRange>::type pivot,
|
||||||
Pred pred )
|
Pred pred )
|
||||||
{
|
{
|
||||||
return boost::algorithm::gather ( boost::begin ( range ), boost::end ( range ), pivot, pred );
|
return boost::algorithm::gather ( boost::begin ( range ), boost::end ( range ), pivot, pred );
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#ifndef BOOST_ALGORITHM_BOYER_MOORE_SEARCH_HPP
|
#ifndef BOOST_ALGORITHM_BOYER_MOORE_SEARCH_HPP
|
||||||
#define BOOST_ALGORITHM_BOYER_MOORE_SEARCH_HPP
|
#define BOOST_ALGORITHM_BOYER_MOORE_SEARCH_HPP
|
||||||
|
|
||||||
#include <algorithm> // for std::reverse_copy
|
|
||||||
#include <iterator> // for std::iterator_traits
|
#include <iterator> // for std::iterator_traits
|
||||||
|
|
||||||
#include <boost/config.hpp>
|
#include <boost/config.hpp>
|
||||||
|
@ -85,22 +85,6 @@ namespace boost {
|
|||||||
return detail::is_classifiedF(std::ctype_base::alpha, Loc);
|
return detail::is_classifiedF(std::ctype_base::alpha, Loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef BOOST_NO_CXX11
|
|
||||||
//! is_blank predicate
|
|
||||||
/*!
|
|
||||||
Construct the \c is_classified predicate for the \c ctype_base::blank category.
|
|
||||||
|
|
||||||
\param Loc A locale used for classification
|
|
||||||
\return An instance of the \c is_classified predicate
|
|
||||||
\since c++11
|
|
||||||
*/
|
|
||||||
inline detail::is_classifiedF
|
|
||||||
is_blank(const std::locale& Loc=std::locale())
|
|
||||||
{
|
|
||||||
return detail::is_classifiedF(std::ctype_base::blank, Loc);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//! is_cntrl predicate
|
//! is_cntrl predicate
|
||||||
/*!
|
/*!
|
||||||
Construct the \c is_classified predicate for the \c ctype_base::cntrl category.
|
Construct the \c is_classified predicate for the \c ctype_base::cntrl category.
|
||||||
@ -310,9 +294,6 @@ namespace boost {
|
|||||||
// pull names to the boost namespace
|
// pull names to the boost namespace
|
||||||
using algorithm::is_classified;
|
using algorithm::is_classified;
|
||||||
using algorithm::is_space;
|
using algorithm::is_space;
|
||||||
#ifndef BOOST_NO_CXX11
|
|
||||||
using algorithm::is_blank;
|
|
||||||
#endif
|
|
||||||
using algorithm::is_alnum;
|
using algorithm::is_alnum;
|
||||||
using algorithm::is_alpha;
|
using algorithm::is_alpha;
|
||||||
using algorithm::is_cntrl;
|
using algorithm::is_cntrl;
|
||||||
|
@ -108,6 +108,7 @@ namespace boost {
|
|||||||
|
|
||||||
\param Input An input sequence
|
\param Input An input sequence
|
||||||
\param Loc A locale used for 'space' classification
|
\param Loc A locale used for 'space' classification
|
||||||
|
\return A trimmed copy of the input
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT>
|
template<typename SequenceT>
|
||||||
inline void trim_all(SequenceT& Input, const std::locale& Loc =std::locale())
|
inline void trim_all(SequenceT& Input, const std::locale& Loc =std::locale())
|
||||||
@ -190,6 +191,7 @@ namespace boost {
|
|||||||
\param Input An input sequence
|
\param Input An input sequence
|
||||||
\param Fill A string used to fill the inner spaces
|
\param Fill A string used to fill the inner spaces
|
||||||
\param Loc A locale used for 'space' classification
|
\param Loc A locale used for 'space' classification
|
||||||
|
\return A trimmed copy of the input
|
||||||
*/
|
*/
|
||||||
template<typename SequenceT, typename RangeT>
|
template<typename SequenceT, typename RangeT>
|
||||||
inline void trim_fill(SequenceT& Input, const RangeT& Fill, const std::locale& Loc =std::locale())
|
inline void trim_fill(SequenceT& Input, const RangeT& Fill, const std::locale& Loc =std::locale())
|
||||||
|
@ -7,11 +7,6 @@
|
|||||||
# http://www.boost.org/LICENSE_1_0.txt)
|
# http://www.boost.org/LICENSE_1_0.txt)
|
||||||
#
|
#
|
||||||
|
|
||||||
project
|
|
||||||
: requirements
|
|
||||||
<library>/boost/algorithm//boost_algorithm
|
|
||||||
<library>/boost/timer//boost_timer ;
|
|
||||||
|
|
||||||
exe minmax_ex : minmax_ex.cpp ;
|
exe minmax_ex : minmax_ex.cpp ;
|
||||||
exe minmax_timer : minmax_timer.cpp ;
|
exe minmax_timer : minmax_timer.cpp ;
|
||||||
|
|
||||||
|
@ -15,10 +15,8 @@
|
|||||||
// What's the proper BOOST_ flag for <iomanip.h> vs <ios>
|
// What's the proper BOOST_ flag for <iomanip.h> vs <ios>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
|
#include <boost/timer.hpp>
|
||||||
#include <boost/algorithm/minmax.hpp>
|
#include <boost/algorithm/minmax.hpp>
|
||||||
#include <boost/algorithm/minmax_element.hpp>
|
|
||||||
#include <boost/iterator/filter_iterator.hpp>
|
|
||||||
#include <boost/timer/timer.hpp>
|
|
||||||
|
|
||||||
template <class T1, class T2>
|
template <class T1, class T2>
|
||||||
void tie(std::pair<T1, T2> p, T1& min, T2& max)
|
void tie(std::pair<T1, T2> p, T1& min, T2& max)
|
||||||
@ -58,19 +56,17 @@ inline int opt_boost_minmax_count(int n) {
|
|||||||
int repeats = 10;
|
int repeats = 10;
|
||||||
|
|
||||||
#define TIMER( n, cmd , cmdname ) \
|
#define TIMER( n, cmd , cmdname ) \
|
||||||
t.start(); \
|
t.restart(); \
|
||||||
for (int i=0; i<n*repeats; ++i) { cmd ; } \
|
for (int i=0; i<repeats; ++i) { cmd ; } \
|
||||||
t.stop(); \
|
|
||||||
std::cout << " " << std::setprecision(4) \
|
std::cout << " " << std::setprecision(4) \
|
||||||
<< 1e3 * (double)(n*repeats) / (double)t.elapsed().wall \
|
<< (double)n*repeats/t.elapsed()/1.0E6 \
|
||||||
<< "M items/sec " << cmdname << "\n"
|
<< "M items/sec " << cmdname << "\n"
|
||||||
|
|
||||||
#define CTIMER( n, cmd , cmdname, count, opt ) \
|
#define CTIMER( n, cmd , cmdname, count, opt ) \
|
||||||
t.start(); lc.reset(); \
|
t.restart(); lc.reset(); \
|
||||||
for (int i=0; i<n*repeats; ++i) { cmd ; } \
|
for (int i=0; i<repeats; ++i) { cmd ; } \
|
||||||
t.stop(); \
|
|
||||||
std::cout << " " << std::setprecision(4) \
|
std::cout << " " << std::setprecision(4) \
|
||||||
<< 1e3 * (double)(n*repeats) / (double)t.elapsed().wall \
|
<< (double)n*repeats/t.elapsed()/1.0E6 \
|
||||||
<< "M items/sec " << cmdname \
|
<< "M items/sec " << cmdname \
|
||||||
<< " ("<< (count)/repeats << " vs " << opt << ")\n"
|
<< " ("<< (count)/repeats << " vs " << opt << ")\n"
|
||||||
|
|
||||||
@ -78,7 +74,7 @@ template <class CIterator>
|
|||||||
void test_minmax_element(CIterator first, CIterator last, int n, char* name)
|
void test_minmax_element(CIterator first, CIterator last, int n, char* name)
|
||||||
{
|
{
|
||||||
typedef typename std::iterator_traits<CIterator>::value_type vtype;
|
typedef typename std::iterator_traits<CIterator>::value_type vtype;
|
||||||
boost::timer::cpu_timer t;
|
boost::timer t;
|
||||||
|
|
||||||
std::cout << " ON " << name << " WITH OPERATOR<()\n";
|
std::cout << " ON " << name << " WITH OPERATOR<()\n";
|
||||||
TIMER( n, std::min_element(first, last),
|
TIMER( n, std::min_element(first, last),
|
||||||
@ -103,11 +99,15 @@ void test_minmax_element(CIterator first, CIterator last, int n, char* name)
|
|||||||
"boost::last_min_last_max_element" << name << " ");
|
"boost::last_min_last_max_element" << name << " ");
|
||||||
|
|
||||||
#define pred std::bind2nd( std::greater<vtype>(), vtype(10) )
|
#define pred std::bind2nd( std::greater<vtype>(), vtype(10) )
|
||||||
TIMER( n, std::min_element(boost::make_filter_iterator(pred, first, last),
|
TIMER( n, boost::min_element_if(first, last, pred),
|
||||||
boost::make_filter_iterator(pred, last, last)),
|
"boost::min_element_if" << name << "");
|
||||||
|
TIMER( n, boost::max_element_if(first, last, pred),
|
||||||
|
"boost::max_element_if" << name << "");
|
||||||
|
TIMER( n, std::min_element(boost::make_filter_iterator(first, last, pred),
|
||||||
|
boost::make_filter_iterator(last, last, pred)),
|
||||||
"std::min_element_with_filter_iterator" << name << "");
|
"std::min_element_with_filter_iterator" << name << "");
|
||||||
TIMER( n, std::max_element(boost::make_filter_iterator(pred, first, last),
|
TIMER( n, std::max_element(boost::make_filter_iterator(first, last, pred),
|
||||||
boost::make_filter_iterator(pred, last, last)),
|
boost::make_filter_iterator(last, last, pred)),
|
||||||
"std::max_element_if_with_filter_iterator" << name << "");
|
"std::max_element_if_with_filter_iterator" << name << "");
|
||||||
#undef pred
|
#undef pred
|
||||||
|
|
||||||
@ -199,9 +199,10 @@ void test(int n)
|
|||||||
test_range(first, last, n);
|
test_range(first, last, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int
|
||||||
|
main(char argc, char** argv)
|
||||||
{
|
{
|
||||||
int n = 1000;
|
int n = 100;
|
||||||
if (argc > 1) n = atoi(argv[1]);
|
if (argc > 1) n = atoi(argv[1]);
|
||||||
if (argc > 2) repeats = atoi(argv[2]);
|
if (argc > 2) repeats = atoi(argv[2]);
|
||||||
|
|
||||||
|
@ -9,11 +9,9 @@
|
|||||||
|
|
||||||
import testing ;
|
import testing ;
|
||||||
|
|
||||||
project : requirements <library>/boost/algorithm//boost_algorithm ;
|
|
||||||
|
|
||||||
alias unit_test_framework
|
alias unit_test_framework
|
||||||
: # sources
|
: # sources
|
||||||
/boost/test//boost_unit_test_framework
|
/boost//unit_test_framework
|
||||||
;
|
;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -18,32 +18,32 @@ boostbook string_algo : string_algo.xml autodoc
|
|||||||
|
|
||||||
doxygen autodoc
|
doxygen autodoc
|
||||||
:
|
:
|
||||||
[ glob ../../include/boost/algorithm/string.hpp ]
|
[ glob ../../../../boost/algorithm/string.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string_regex.hpp ]
|
[ glob ../../../../boost/algorithm/string_regex.hpp ]
|
||||||
|
|
||||||
[ glob ../../include/boost/algorithm/string/classification.hpp ]
|
[ glob ../../../../boost/algorithm/string/classification.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/iterator_range.hpp ]
|
[ glob ../../../../boost/algorithm/string/iterator_range.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/sequence_traits.hpp ]
|
[ glob ../../../../boost/algorithm/string/sequence_traits.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/std_containers_traits.hpp ]
|
[ glob ../../../../boost/algorithm/string/std_containers_traits.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/concept.hpp ]
|
[ glob ../../../../boost/algorithm/string/concept.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/compare.hpp ]
|
[ glob ../../../../boost/algorithm/string/compare.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/constants.hpp ]
|
[ glob ../../../../boost/algorithm/string/constants.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/case_conv.hpp ]
|
[ glob ../../../../boost/algorithm/string/case_conv.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/find.hpp ]
|
[ glob ../../../../boost/algorithm/string/find.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/finder.hpp ]
|
[ glob ../../../../boost/algorithm/string/finder.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/find_iterator.hpp ]
|
[ glob ../../../../boost/algorithm/string/find_iterator.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/trim.hpp ]
|
[ glob ../../../../boost/algorithm/string/trim.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/predicate.hpp ]
|
[ glob ../../../../boost/algorithm/string/predicate.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/split.hpp ]
|
[ glob ../../../../boost/algorithm/string/split.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/iter_find.hpp ]
|
[ glob ../../../../boost/algorithm/string/iter_find.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/erase.hpp ]
|
[ glob ../../../../boost/algorithm/string/erase.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/join.hpp ]
|
[ glob ../../../../boost/algorithm/string/join.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/replace.hpp ]
|
[ glob ../../../../boost/algorithm/string/replace.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/find_format.hpp ]
|
[ glob ../../../../boost/algorithm/string/find_format.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/formatter.hpp ]
|
[ glob ../../../../boost/algorithm/string/formatter.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/regex.hpp ]
|
[ glob ../../../../boost/algorithm/string/regex.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/regex_find_format.hpp ]
|
[ glob ../../../../boost/algorithm/string/regex_find_format.hpp ]
|
||||||
[ glob ../../include/boost/algorithm/string/trim_all.hpp ]
|
[ glob ../../../../boost/algorithm/string/trim_all.hpp ]
|
||||||
:
|
:
|
||||||
<doxygen:param>HIDE_UNDOC_MEMBERS=YES
|
<doxygen:param>HIDE_UNDOC_MEMBERS=YES
|
||||||
<doxygen:param>EXTRACT_PRIVATE=NO
|
<doxygen:param>EXTRACT_PRIVATE=NO
|
||||||
|
@ -667,13 +667,6 @@
|
|||||||
<functionname>is_space()</functionname>
|
<functionname>is_space()</functionname>
|
||||||
</entry>
|
</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
|
||||||
<entry>is_blank</entry>
|
|
||||||
<entry>Recognize blanks</entry>
|
|
||||||
<entry>
|
|
||||||
<functionname>is_blank()</functionname>
|
|
||||||
</entry>
|
|
||||||
</row>
|
|
||||||
<row>
|
<row>
|
||||||
<entry>is_alnum</entry>
|
<entry>is_alnum</entry>
|
||||||
<entry>Recognize alphanumeric characters</entry>
|
<entry>Recognize alphanumeric characters</entry>
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#
|
#
|
||||||
# See http://www.boost.org for updates, documentation, and revision history.
|
# See http://www.boost.org for updates, documentation, and revision history.
|
||||||
|
|
||||||
project : requirements <library>/boost/algorithm//boost_algorithm ;
|
|
||||||
|
|
||||||
exe conv_example : conv_example.cpp ;
|
exe conv_example : conv_example.cpp ;
|
||||||
exe predicate_example : predicate_example.cpp ;
|
exe predicate_example : predicate_example.cpp ;
|
||||||
|
@ -9,11 +9,9 @@
|
|||||||
|
|
||||||
import testing ;
|
import testing ;
|
||||||
|
|
||||||
project : requirements <library>/boost/algorithm//boost_algorithm ;
|
|
||||||
|
|
||||||
alias unit_test_framework
|
alias unit_test_framework
|
||||||
: # sources
|
: # sources
|
||||||
/boost/test//boost_unit_test_framework
|
/boost//unit_test_framework
|
||||||
;
|
;
|
||||||
|
|
||||||
test-suite algorithm/string
|
test-suite algorithm/string
|
||||||
|
@ -139,11 +139,6 @@ void classification_test()
|
|||||||
TEST_CLASS( is_any_of( "abc" ), "aaabbcc", "aaxb" );
|
TEST_CLASS( is_any_of( "abc" ), "aaabbcc", "aaxb" );
|
||||||
TEST_CLASS( is_from_range( 'a', 'c' ), "aaabbcc", "aaxb" );
|
TEST_CLASS( is_from_range( 'a', 'c' ), "aaabbcc", "aaxb" );
|
||||||
|
|
||||||
#ifndef BOOST_NO_CXX11
|
|
||||||
TEST_CLASS( is_blank(), " \t", "\t \n\r" );
|
|
||||||
TEST_CLASS( !is_blank(), "abc\n\v\f\r", "a x\t" );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
TEST_CLASS( !is_classified(std::ctype_base::space), "...", "..\n\r\t " );
|
TEST_CLASS( !is_classified(std::ctype_base::space), "...", "..\n\r\t " );
|
||||||
TEST_CLASS( ( !is_any_of("abc") && is_from_range('a','e') ) || is_space(), "d e", "abcde" );
|
TEST_CLASS( ( !is_any_of("abc") && is_from_range('a','e') ) || is_space(), "d e", "abcde" );
|
||||||
|
|
||||||
|
@ -9,11 +9,9 @@
|
|||||||
|
|
||||||
import testing ;
|
import testing ;
|
||||||
|
|
||||||
project : requirements <library>/boost/algorithm//boost_algorithm ;
|
|
||||||
|
|
||||||
alias unit_test_framework
|
alias unit_test_framework
|
||||||
: # sources
|
: # sources
|
||||||
/boost/test//boost_unit_test_framework
|
/boost//unit_test_framework
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
namespace ba = boost::algorithm;
|
namespace ba = boost::algorithm;
|
||||||
// namespace ba = boost;
|
// namespace ba = boost;
|
||||||
|
|
||||||
BOOST_CXX14_CONSTEXPR bool is_true ( int ) { return true; }
|
BOOST_CXX14_CONSTEXPR bool is_true ( int v ) { return true; }
|
||||||
BOOST_CXX14_CONSTEXPR bool is_false ( int ) { return false; }
|
BOOST_CXX14_CONSTEXPR bool is_false ( int v ) { return false; }
|
||||||
BOOST_CXX14_CONSTEXPR bool is_even ( int v ) { return v % 2 == 0; }
|
BOOST_CXX14_CONSTEXPR bool is_even ( int v ) { return v % 2 == 0; }
|
||||||
BOOST_CXX14_CONSTEXPR bool is_odd ( int v ) { return v % 2 == 1; }
|
BOOST_CXX14_CONSTEXPR bool is_odd ( int v ) { return v % 2 == 1; }
|
||||||
BOOST_CXX14_CONSTEXPR bool is_zero ( int v ) { return v == 0; }
|
BOOST_CXX14_CONSTEXPR bool is_zero ( int v ) { return v == 0; }
|
||||||
|
@ -25,7 +25,7 @@ void test_short_input1 () {
|
|||||||
std::string s;
|
std::string s;
|
||||||
|
|
||||||
try { ba::unhex ( std::string ( "A" ), std::back_inserter(s)); }
|
try { ba::unhex ( std::string ( "A" ), std::back_inserter(s)); }
|
||||||
catch ( const std::exception & ) { return; }
|
catch ( const std::exception &ex ) { return; }
|
||||||
BOOST_TEST_MESSAGE ( "Failed to catch std::exception in test_short_input1" );
|
BOOST_TEST_MESSAGE ( "Failed to catch std::exception in test_short_input1" );
|
||||||
BOOST_CHECK ( false );
|
BOOST_CHECK ( false );
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ void test_short_input2 () {
|
|||||||
std::string s;
|
std::string s;
|
||||||
|
|
||||||
try { ba::unhex ( std::string ( "A" ), std::back_inserter(s)); }
|
try { ba::unhex ( std::string ( "A" ), std::back_inserter(s)); }
|
||||||
catch ( const ba::hex_decode_error & ) { return; }
|
catch ( const ba::hex_decode_error &ex ) { return; }
|
||||||
BOOST_TEST_MESSAGE ( "Failed to catch ba::hex_decode_error in test_short_input2" );
|
BOOST_TEST_MESSAGE ( "Failed to catch ba::hex_decode_error in test_short_input2" );
|
||||||
BOOST_CHECK ( false );
|
BOOST_CHECK ( false );
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ void test_short_input3 () {
|
|||||||
std::string s;
|
std::string s;
|
||||||
|
|
||||||
try { ba::unhex ( std::string ( "A" ), std::back_inserter(s)); }
|
try { ba::unhex ( std::string ( "A" ), std::back_inserter(s)); }
|
||||||
catch ( const ba::not_enough_input & ) { return; }
|
catch ( const ba::not_enough_input &ex ) { return; }
|
||||||
BOOST_TEST_MESSAGE ( "Failed to catch ba::not_enough_input in test_short_input3" );
|
BOOST_TEST_MESSAGE ( "Failed to catch ba::not_enough_input in test_short_input3" );
|
||||||
BOOST_CHECK ( false );
|
BOOST_CHECK ( false );
|
||||||
}
|
}
|
||||||
@ -53,8 +53,8 @@ void test_short_input4 () {
|
|||||||
std::string s;
|
std::string s;
|
||||||
|
|
||||||
try { ba::unhex ( std::string ( "A" ), std::back_inserter(s)); }
|
try { ba::unhex ( std::string ( "A" ), std::back_inserter(s)); }
|
||||||
catch ( const ba::non_hex_input & ) { BOOST_CHECK ( false ); }
|
catch ( const ba::non_hex_input &ex ) { BOOST_CHECK ( false ); }
|
||||||
catch ( const ba::not_enough_input & ) { return; }
|
catch ( const ba::not_enough_input &ex ) { return; }
|
||||||
catch ( ... ) { BOOST_CHECK ( false ); }
|
catch ( ... ) { BOOST_CHECK ( false ); }
|
||||||
BOOST_CHECK ( false );
|
BOOST_CHECK ( false );
|
||||||
}
|
}
|
||||||
@ -64,8 +64,8 @@ void test_short_input5 () {
|
|||||||
std::string s;
|
std::string s;
|
||||||
|
|
||||||
try { ba::unhex ( "A", std::back_inserter(s)); }
|
try { ba::unhex ( "A", std::back_inserter(s)); }
|
||||||
catch ( const ba::non_hex_input & ) { BOOST_CHECK ( false ); }
|
catch ( const ba::non_hex_input &ex ) { BOOST_CHECK ( false ); }
|
||||||
catch ( const ba::not_enough_input & ) { return; }
|
catch ( const ba::not_enough_input &ex ) { return; }
|
||||||
catch ( ... ) { BOOST_CHECK ( false ); }
|
catch ( ... ) { BOOST_CHECK ( false ); }
|
||||||
BOOST_CHECK ( false );
|
BOOST_CHECK ( false );
|
||||||
}
|
}
|
||||||
@ -125,8 +125,8 @@ void test_nonhex_input4 () {
|
|||||||
std::string s;
|
std::string s;
|
||||||
|
|
||||||
try { ba::unhex ( "P1234FA1234", std::back_inserter(s)); }
|
try { ba::unhex ( "P1234FA1234", std::back_inserter(s)); }
|
||||||
catch ( const ba::not_enough_input & ) { BOOST_CHECK ( false ); }
|
catch ( const ba::not_enough_input &ex ) { BOOST_CHECK ( false ); }
|
||||||
catch ( const ba::non_hex_input & ) { return; }
|
catch ( const ba::non_hex_input &ex ) { return; }
|
||||||
catch ( ... ) { BOOST_CHECK ( false ); }
|
catch ( ... ) { BOOST_CHECK ( false ); }
|
||||||
BOOST_CHECK ( false );
|
BOOST_CHECK ( false );
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ void test_sequence1 () {
|
|||||||
std::vector<int> v, v1;
|
std::vector<int> v, v1;
|
||||||
|
|
||||||
v.clear ();
|
v.clear ();
|
||||||
for ( int i = 5; i < 15; ++i )
|
for ( std::size_t i = 5; i < 15; ++i )
|
||||||
v.push_back ( i );
|
v.push_back ( i );
|
||||||
v1 = v;
|
v1 = v;
|
||||||
BOOST_CHECK ( ba::is_permutation ( v.begin (), v.end (), v.begin ())); // better be a permutation of itself!
|
BOOST_CHECK ( ba::is_permutation ( v.begin (), v.end (), v.begin ())); // better be a permutation of itself!
|
||||||
|
@ -32,7 +32,7 @@ namespace {
|
|||||||
|
|
||||||
// Check using iterators
|
// Check using iterators
|
||||||
template<typename Container>
|
template<typename Container>
|
||||||
void check_one_iter ( const Container &haystack, const std::string &needle, std::ptrdiff_t expected ) {
|
void check_one_iter ( const Container &haystack, const std::string &needle, int expected ) {
|
||||||
typedef typename Container::const_iterator iter_type;
|
typedef typename Container::const_iterator iter_type;
|
||||||
typedef typename std::pair<iter_type, iter_type> ret_type;
|
typedef typename std::pair<iter_type, iter_type> ret_type;
|
||||||
typedef std::string::const_iterator pattern_type;
|
typedef std::string::const_iterator pattern_type;
|
||||||
@ -53,7 +53,7 @@ namespace {
|
|||||||
// iter_type it1r = ret1r.first;
|
// iter_type it1r = ret1r.first;
|
||||||
// iter_type it2 = ret2.first;
|
// iter_type it2 = ret2.first;
|
||||||
// iter_type it3 = ret3.first;
|
// iter_type it3 = ret3.first;
|
||||||
const std::ptrdiff_t dist = ret1.first == hEnd ? -1 : std::distance ( hBeg, ret1.first );
|
const int dist = ret1.first == hEnd ? -1 : std::distance ( hBeg, ret1.first );
|
||||||
|
|
||||||
std::cout << "(Iterators) Pattern is " << needle.length () << ", haysstack is " << haystack.length () << " chars long; " << std::endl;
|
std::cout << "(Iterators) Pattern is " << needle.length () << ", haysstack is " << haystack.length () << " chars long; " << std::endl;
|
||||||
try {
|
try {
|
||||||
@ -97,7 +97,7 @@ namespace {
|
|||||||
// Check using pointers
|
// Check using pointers
|
||||||
// We're assuming that the container implements contiguous storage here.
|
// We're assuming that the container implements contiguous storage here.
|
||||||
template<typename Container>
|
template<typename Container>
|
||||||
void check_one_pointer ( const Container &haystack, const std::string &needle, std::ptrdiff_t expected ) {
|
void check_one_pointer ( const Container &haystack, const std::string &needle, int expected ) {
|
||||||
typedef const typename Container::value_type *ptr_type;
|
typedef const typename Container::value_type *ptr_type;
|
||||||
typedef typename std::pair<ptr_type, ptr_type> ret_type;
|
typedef typename std::pair<ptr_type, ptr_type> ret_type;
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ namespace {
|
|||||||
ret_type ret1 = ba::boyer_moore_search (hBeg, hEnd, nBeg, nEnd);
|
ret_type ret1 = ba::boyer_moore_search (hBeg, hEnd, nBeg, nEnd);
|
||||||
ret_type ret2 = ba::boyer_moore_horspool_search (hBeg, hEnd, nBeg, nEnd);
|
ret_type ret2 = ba::boyer_moore_horspool_search (hBeg, hEnd, nBeg, nEnd);
|
||||||
ret_type ret3 = ba::knuth_morris_pratt_search (hBeg, hEnd, nBeg, nEnd);
|
ret_type ret3 = ba::knuth_morris_pratt_search (hBeg, hEnd, nBeg, nEnd);
|
||||||
const std::ptrdiff_t dist = ret1.first == hEnd ? -1 : std::distance ( hBeg, ret1.first );
|
const int dist = ret1.first == hEnd ? -1 : std::distance ( hBeg, ret1.first );
|
||||||
|
|
||||||
std::cout << "(Pointers) Pattern is " << needle.length () << ", haysstack is " << haystack.length () << " chars long; " << std::endl;
|
std::cout << "(Pointers) Pattern is " << needle.length () << ", haysstack is " << haystack.length () << " chars long; " << std::endl;
|
||||||
try {
|
try {
|
||||||
@ -147,7 +147,7 @@ namespace {
|
|||||||
|
|
||||||
// Check using objects
|
// Check using objects
|
||||||
template<typename Container>
|
template<typename Container>
|
||||||
void check_one_object ( const Container &haystack, const std::string &needle, std::ptrdiff_t expected ) {
|
void check_one_object ( const Container &haystack, const std::string &needle, int expected ) {
|
||||||
typedef typename Container::const_iterator iter_type;
|
typedef typename Container::const_iterator iter_type;
|
||||||
typedef typename std::pair<iter_type, iter_type> ret_type;
|
typedef typename std::pair<iter_type, iter_type> ret_type;
|
||||||
typedef std::string::const_iterator pattern_type;
|
typedef std::string::const_iterator pattern_type;
|
||||||
@ -169,7 +169,7 @@ namespace {
|
|||||||
ret_type retr1r = bm_r (haystack);
|
ret_type retr1r = bm_r (haystack);
|
||||||
ret_type ret2 = bmh (hBeg, hEnd);
|
ret_type ret2 = bmh (hBeg, hEnd);
|
||||||
ret_type ret3 = kmp (hBeg, hEnd);
|
ret_type ret3 = kmp (hBeg, hEnd);
|
||||||
const std::ptrdiff_t dist = ret1.first == hEnd ? -1 : std::distance ( hBeg, ret1.first );
|
const int dist = ret1.first == hEnd ? -1 : std::distance ( hBeg, ret1.first );
|
||||||
|
|
||||||
std::cout << "(Objects) Pattern is " << needle.length () << ", haysstack is " << haystack.length () << " chars long; " << std::endl;
|
std::cout << "(Objects) Pattern is " << needle.length () << ", haysstack is " << haystack.length () << " chars long; " << std::endl;
|
||||||
try {
|
try {
|
||||||
@ -224,7 +224,7 @@ namespace {
|
|||||||
|
|
||||||
|
|
||||||
template<typename Container>
|
template<typename Container>
|
||||||
void check_one ( const Container &haystack, const std::string &needle, std::ptrdiff_t expected ) {
|
void check_one ( const Container &haystack, const std::string &needle, int expected ) {
|
||||||
check_one_iter ( haystack, needle, expected );
|
check_one_iter ( haystack, needle, expected );
|
||||||
check_one_pointer ( haystack, needle, expected );
|
check_one_pointer ( haystack, needle, expected );
|
||||||
check_one_object ( haystack, needle, expected );
|
check_one_object ( haystack, needle, expected );
|
||||||
|
@ -85,7 +85,7 @@ namespace {
|
|||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void check_one ( const vec &haystack, const vec &needle, std::ptrdiff_t expected ) {
|
void check_one ( const vec &haystack, const vec &needle, int expected ) {
|
||||||
std::size_t i;
|
std::size_t i;
|
||||||
std::clock_t sTime;
|
std::clock_t sTime;
|
||||||
unsigned long stdDiff;
|
unsigned long stdDiff;
|
||||||
@ -147,7 +147,7 @@ BOOST_AUTO_TEST_CASE( test_main )
|
|||||||
std::cout << "---- Middle -----" << std::endl;
|
std::cout << "---- Middle -----" << std::endl;
|
||||||
check_one ( c1, p1f, -2 ); // Don't know answer
|
check_one ( c1, p1f, -2 ); // Don't know answer
|
||||||
std::cout << "------ End ------" << std::endl;
|
std::cout << "------ End ------" << std::endl;
|
||||||
check_one ( c1, p1e, static_cast<std::ptrdiff_t>(c1.size() - p1e.size ()));
|
check_one ( c1, p1e, c1.size() - p1e.size ());
|
||||||
std::cout << "--- Not found ---" << std::endl;
|
std::cout << "--- Not found ---" << std::endl;
|
||||||
check_one ( c1, p1n, -1 ); // Not found
|
check_one ( c1, p1n, -1 ); // Not found
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ namespace {
|
|||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void check_one ( const vec &haystack, const vec &needle, std::ptrdiff_t expected ) {
|
void check_one ( const vec &haystack, const vec &needle, int expected ) {
|
||||||
std::size_t i;
|
std::size_t i;
|
||||||
std::clock_t sTime;
|
std::clock_t sTime;
|
||||||
unsigned long stdDiff;
|
unsigned long stdDiff;
|
||||||
@ -147,7 +147,7 @@ BOOST_AUTO_TEST_CASE( test_main )
|
|||||||
std::cout << "---- Middle -----" << std::endl;
|
std::cout << "---- Middle -----" << std::endl;
|
||||||
check_one ( c1, p1f, -2 ); // Don't know answer
|
check_one ( c1, p1f, -2 ); // Don't know answer
|
||||||
std::cout << "------ End ------" << std::endl;
|
std::cout << "------ End ------" << std::endl;
|
||||||
check_one ( c1, p1e, static_cast<std::ptrdiff_t>(c1.size() - p1e.size ()));
|
check_one ( c1, p1e, c1.size() - p1e.size ());
|
||||||
std::cout << "--- Not found ---" << std::endl;
|
std::cout << "--- Not found ---" << std::endl;
|
||||||
check_one ( c1, p1n, -1 ); // Not found
|
check_one ( c1, p1n, -1 ); // Not found
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ namespace {
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void check_one ( const vec &haystack, const vec &needle, std::ptrdiff_t expected ) {
|
void check_one ( const vec &haystack, const vec &needle, int expected ) {
|
||||||
|
|
||||||
std::pair<vec::const_iterator, vec::const_iterator> res;
|
std::pair<vec::const_iterator, vec::const_iterator> res;
|
||||||
std::pair<vec::const_iterator, vec::const_iterator> exp; // the expected result
|
std::pair<vec::const_iterator, vec::const_iterator> exp; // the expected result
|
||||||
@ -117,7 +117,7 @@ BOOST_AUTO_TEST_CASE( test_main )
|
|||||||
std::cout << "---- Middle -----" << std::endl;
|
std::cout << "---- Middle -----" << std::endl;
|
||||||
check_one ( c1, p1f, -2 ); // Don't know answer
|
check_one ( c1, p1f, -2 ); // Don't know answer
|
||||||
std::cout << "------ End ------" << std::endl;
|
std::cout << "------ End ------" << std::endl;
|
||||||
check_one ( c1, p1e, static_cast<std::ptrdiff_t>(c1.size() - p1e.size ()));
|
check_one ( c1, p1e, c1.size() - p1e.size ());
|
||||||
std::cout << "--- Not found ---" << std::endl;
|
std::cout << "--- Not found ---" << std::endl;
|
||||||
check_one ( c1, p1n, -1 ); // Not found
|
check_one ( c1, p1n, -1 ); // Not found
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user