From 9093abbda95588f2f8c9cd875c1c2058075e05ff Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Wed, 27 Nov 2019 10:58:37 -0800 Subject: [PATCH] Update examples so that they build --- example/Jamfile.v2 | 8 ++++---- example/is_partitioned_until_example.cpp | 4 ++-- example/search_example.cpp | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/example/Jamfile.v2 b/example/Jamfile.v2 index 100878c..64a4055 100644 --- a/example/Jamfile.v2 +++ b/example/Jamfile.v2 @@ -18,8 +18,8 @@ project /boost/algorithm/example : ; -exe clamp_example : clamp_example.cpp ; +exe clamp_example : clamp_example.cpp : ; exe search_example : search_example.cpp ; -exe is_palindrome_example : is_palindrome_example.cpp; -exe is_partitioned_until_example : is_partitioned_until_example.cpp; -exe apply_permutation_example : apply_permutation_example.cpp; +exe is_palindrome_example : is_palindrome_example.cpp : 11 ; +exe is_partitioned_until_example : is_partitioned_until_example.cpp : 11 ; +exe apply_permutation_example : apply_permutation_example.cpp : 11 ; diff --git a/example/is_partitioned_until_example.cpp b/example/is_partitioned_until_example.cpp index 759176b..4bf44e8 100644 --- a/example/is_partitioned_until_example.cpp +++ b/example/is_partitioned_until_example.cpp @@ -32,8 +32,8 @@ struct isOddComp int main ( int /*argc*/, char * /*argv*/ [] ) { - std::vector good({1, 2, 4}); - std::vector bad({1, 2, 3}); + std::vector good{1, 2, 4}; + std::vector bad{1, 2, 3}; //Use custom function auto it1 = ba::is_partitioned_until(good.begin(), good.end(), isOdd); diff --git a/example/search_example.cpp b/example/search_example.cpp index 438bee9..3ae6911 100644 --- a/example/search_example.cpp +++ b/example/search_example.cpp @@ -27,7 +27,7 @@ int main ( int /*argc*/, char * /*argv*/ [] ) { // algorithms. They all have the same (dual) interface. // There is a procedural interface, based on std::search: - if ( ba::boyer_moore_search ( haystack.begin (), haystack.end (), needle1.begin (), needle1.end ()) != haystack.end ()) + if ( ba::boyer_moore_search ( haystack.begin (), haystack.end (), needle1.begin (), needle1.end ()) != std::make_pair(haystack.end(), haystack.end())) std::cout << "Found '" << needle1 << "' in '" << haystack << "' (boyer-moore 1)" << std::endl; else std::cout << "Did NOT find '" << needle1 << "' in '" << haystack << "' (boyer-moore 1)" << std::endl; @@ -36,19 +36,19 @@ int main ( int /*argc*/, char * /*argv*/ [] ) { // you can create a search object and use that over and over again - amortizing the setup // costs across several searches ba::boyer_moore search1 ( needle1.begin (), needle1.end ()); - if ( search1 ( haystack.begin (), haystack.end ()) != haystack.end ()) + if ( search1 ( haystack.begin (), haystack.end ()) != std::make_pair(haystack.end(), haystack.end())) std::cout << "Found '" << needle1 << "' in '" << haystack << "' (boyer-moore 2)" << std::endl; else std::cout << "Did NOT find '" << needle1 << "' in '" << haystack << "' (boyer-moore 2)" << std::endl; // There is also an implementation of boyer-moore-horspool searching - if ( ba::boyer_moore_horspool_search ( haystack.begin (), haystack.end (), needle1.begin (), needle1.end ()) != haystack.end ()) + if ( ba::boyer_moore_horspool_search ( haystack.begin (), haystack.end (), needle1.begin (), needle1.end ()) != std::make_pair(haystack.end(), haystack.end())) std::cout << "Found '" << needle1 << "' in '" << haystack << "' (boyer-moore-horspool)" << std::endl; else std::cout << "Did NOT find '" << needle1 << "' in '" << haystack << "' (boyer-moore-horspool)" << std::endl; // And also the knuth-pratt-morris search algorithm - if ( ba::knuth_morris_pratt_search ( haystack.begin (), haystack.end (), needle1.begin (), needle1.end ()) != haystack.end ()) + if ( ba::knuth_morris_pratt_search ( haystack.begin (), haystack.end (), needle1.begin (), needle1.end ()) != std::make_pair(haystack.end(), haystack.end())) std::cout << "Found '" << needle1 << "' in '" << haystack << "' (knuth_morris_pratt)" << std::endl; else std::cout << "Did NOT find '" << needle1 << "' in '" << haystack << "' (knuth_morris_pratt)" << std::endl;