From 50b31641b0bd49b53a17e40f87689d55f4871d1e Mon Sep 17 00:00:00 2001 From: ITHelpDec <34002836+ITHelpDec@users.noreply.github.com> Date: Thu, 27 Apr 2023 12:18:51 +0300 Subject: [PATCH 1/2] `beg` / `begin` changed to it same change as from #31 --- listings/listing_4.23.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/listings/listing_4.23.cpp b/listings/listing_4.23.cpp index 6e153ea..a8c0832 100644 --- a/listings/listing_4.23.cpp +++ b/listings/listing_4.23.cpp @@ -3,13 +3,13 @@ std::experimental::future process_data( { size_t const chunk_size=whatever; std::vector> results; - for(auto begin=vec.begin(),end=vec.end();beg!=end;){ - size_t const remaining_size=end-begin; + for(auto it=vec.begin(),end=vec.end();it!=end;){ + size_t const remaining_size=end-it; size_t const this_chunk_size=std::min(remaining_size,chunk_size); results.push_back( spawn_async( - process_chunk,begin,begin+this_chunk_size)); - begin+=this_chunk_size; + process_chunk,it,it+this_chunk_size)); + it+=this_chunk_size; } return std::experimental::when_all( results.begin(),results.end()).then( From e7d1dfb659c7e35594e0d3ddb7ad44ac5a267dae Mon Sep 17 00:00:00 2001 From: ITHelpDec <34002836+ITHelpDec@users.noreply.github.com> Date: Thu, 27 Apr 2023 12:25:55 +0300 Subject: [PATCH 2/2] whitespace removal no space needed between `ready_results` and `.get()` --- listings/listing_4.23.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/listings/listing_4.23.cpp b/listings/listing_4.23.cpp index a8c0832..c114733 100644 --- a/listings/listing_4.23.cpp +++ b/listings/listing_4.23.cpp @@ -17,7 +17,7 @@ std::experimental::future process_data( std::experimental::future>> ready_results) { std::vector> - all_results=ready_results .get(); + all_results=ready_results.get(); std::vector v; v.reserve(all_results.size()); for(auto& f: all_results)