From f9500954af2d6130069087970f8ed97ab61d13c2 Mon Sep 17 00:00:00 2001 From: Thomas Holder Date: Sun, 30 Sep 2018 20:31:21 +0200 Subject: c++11 refactor: ifdef CPP11 -> std::forward --- src/2geom/piecewise.h | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/2geom/piecewise.h b/src/2geom/piecewise.h index 3a12671e0..174ac2733 100644 --- a/src/2geom/piecewise.h +++ b/src/2geom/piecewise.h @@ -138,28 +138,22 @@ class Piecewise { /**Convenience/implementation hiding function to add segment/cut pairs. * Asserts that basic size and order invariants are correct */ - inline void push(const T &s, double to) { + template + inline void push(F &&s, double to) { assert(cuts.size() - segs.size() == 1); - push_seg(s); - push_cut(to); - } -#ifdef CPP11 - inline void push(T &&s, double to) { - assert(cuts.size() - segs.size() == 1); - push_seg(s); + push_seg(std::forward(s)); push_cut(to); } -#endif //Convenience/implementation hiding function to add cuts. inline void push_cut(double c) { ASSERT_INVARIANTS(cuts.empty() || c > cuts.back()); cuts.push_back(c); } //Convenience/implementation hiding function to add segments. - inline void push_seg(const T &s) { segs.push_back(s); } -#ifdef CPP11 - inline void push_seg(T &&s) { segs.emplace_back(s); } -#endif + template + inline void push_seg(F &&s) { + segs.emplace_back(std::forward(s)); + } /**Returns the segment index which corresponds to a 'global' piecewise time. * Also takes optional low/high parameters to expedite the search for the segment. -- cgit v1.2.3