Skip to content

Commit

Permalink
storage_proxy: adjust for C++20 std::accumulate() pass-by-value
Browse files Browse the repository at this point in the history
C++20 passes the input to the binary operation by value (which is
sensible), but is not compatible with C++17. Add some #if logic
to support both methods. We can remove the logic when we fully
transition to C++20.
Message-Id: <[email protected]>
  • Loading branch information
avikivity authored and tgrabiec committed May 12, 2020
1 parent df4b698 commit 89ea879
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion service/storage_proxy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3229,7 +3229,12 @@ class data_read_resolver : public abstract_read_resolver {
auto it = boost::range::find_if(v, [] (auto&& ver) {
return bool(ver.par);
});
auto m = boost::accumulate(v, mutation(schema, it->par->mut().key()), [this, schema] (mutation& m, const version& ver) {
#if __cplusplus <= 201703L
using mutation_ref = mutation&;
#else
using mutation_ref = mutation&&;
#endif
auto m = boost::accumulate(v, mutation(schema, it->par->mut().key()), [this, schema] (mutation_ref m, const version& ver) {
if (ver.par) {
mutation_application_stats app_stats;
m.partition().apply(*schema, ver.par->mut().partition(), *schema, app_stats);
Expand Down

0 comments on commit 89ea879

Please sign in to comment.