Skip to content

Commit 9093abb

Browse files
committed
Update examples so that they build
1 parent 77bbc6c commit 9093abb

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

example/Jamfile.v2

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ project /boost/algorithm/example
1818
:
1919
;
2020

21-
exe clamp_example : clamp_example.cpp ;
21+
exe clamp_example : clamp_example.cpp : ;
2222
exe search_example : search_example.cpp ;
23-
exe is_palindrome_example : is_palindrome_example.cpp;
24-
exe is_partitioned_until_example : is_partitioned_until_example.cpp;
25-
exe apply_permutation_example : apply_permutation_example.cpp;
23+
exe is_palindrome_example : is_palindrome_example.cpp : <cxxstd>11 ;
24+
exe is_partitioned_until_example : is_partitioned_until_example.cpp : <cxxstd>11 ;
25+
exe apply_permutation_example : apply_permutation_example.cpp : <cxxstd>11 ;

example/is_partitioned_until_example.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ struct isOddComp
3232

3333
int main ( int /*argc*/, char * /*argv*/ [] )
3434
{
35-
std::vector<int> good({1, 2, 4});
36-
std::vector<int> bad({1, 2, 3});
35+
std::vector<int> good{1, 2, 4};
36+
std::vector<int> bad{1, 2, 3};
3737

3838
//Use custom function
3939
auto it1 = ba::is_partitioned_until(good.begin(), good.end(), isOdd);

example/search_example.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ int main ( int /*argc*/, char * /*argv*/ [] ) {
2727
// algorithms. They all have the same (dual) interface.
2828

2929
// There is a procedural interface, based on std::search:
30-
if ( ba::boyer_moore_search ( haystack.begin (), haystack.end (), needle1.begin (), needle1.end ()) != haystack.end ())
30+
if ( ba::boyer_moore_search ( haystack.begin (), haystack.end (), needle1.begin (), needle1.end ()) != std::make_pair(haystack.end(), haystack.end()))
3131
std::cout << "Found '" << needle1 << "' in '" << haystack << "' (boyer-moore 1)" << std::endl;
3232
else
3333
std::cout << "Did NOT find '" << needle1 << "' in '" << haystack << "' (boyer-moore 1)" << std::endl;
@@ -36,19 +36,19 @@ int main ( int /*argc*/, char * /*argv*/ [] ) {
3636
// you can create a search object and use that over and over again - amortizing the setup
3737
// costs across several searches
3838
ba::boyer_moore<std::string::const_iterator> search1 ( needle1.begin (), needle1.end ());
39-
if ( search1 ( haystack.begin (), haystack.end ()) != haystack.end ())
39+
if ( search1 ( haystack.begin (), haystack.end ()) != std::make_pair(haystack.end(), haystack.end()))
4040
std::cout << "Found '" << needle1 << "' in '" << haystack << "' (boyer-moore 2)" << std::endl;
4141
else
4242
std::cout << "Did NOT find '" << needle1 << "' in '" << haystack << "' (boyer-moore 2)" << std::endl;
4343

4444
// There is also an implementation of boyer-moore-horspool searching
45-
if ( ba::boyer_moore_horspool_search ( haystack.begin (), haystack.end (), needle1.begin (), needle1.end ()) != haystack.end ())
45+
if ( ba::boyer_moore_horspool_search ( haystack.begin (), haystack.end (), needle1.begin (), needle1.end ()) != std::make_pair(haystack.end(), haystack.end()))
4646
std::cout << "Found '" << needle1 << "' in '" << haystack << "' (boyer-moore-horspool)" << std::endl;
4747
else
4848
std::cout << "Did NOT find '" << needle1 << "' in '" << haystack << "' (boyer-moore-horspool)" << std::endl;
4949

5050
// And also the knuth-pratt-morris search algorithm
51-
if ( ba::knuth_morris_pratt_search ( haystack.begin (), haystack.end (), needle1.begin (), needle1.end ()) != haystack.end ())
51+
if ( ba::knuth_morris_pratt_search ( haystack.begin (), haystack.end (), needle1.begin (), needle1.end ()) != std::make_pair(haystack.end(), haystack.end()))
5252
std::cout << "Found '" << needle1 << "' in '" << haystack << "' (knuth_morris_pratt)" << std::endl;
5353
else
5454
std::cout << "Did NOT find '" << needle1 << "' in '" << haystack << "' (knuth_morris_pratt)" << std::endl;

0 commit comments

Comments
 (0)