diff options
| author | Thomas Holder <thomas@thomas-holder.de> | 2018-09-30 18:31:21 +0000 |
|---|---|---|
| committer | Thomas Holder <thomas@thomas-holder.de> | 2018-09-30 18:31:21 +0000 |
| commit | f9500954af2d6130069087970f8ed97ab61d13c2 (patch) | |
| tree | e4b2809f9ce664db2d471e93375d1a51bbdf1156 /src/2geom | |
| parent | c++11 refactor: std::auto_ptr -> std::unique_ptr (diff) | |
| download | inkscape-f9500954af2d6130069087970f8ed97ab61d13c2.tar.gz inkscape-f9500954af2d6130069087970f8ed97ab61d13c2.zip | |
c++11 refactor: ifdef CPP11 -> std::forward
Diffstat (limited to 'src/2geom')
| -rw-r--r-- | src/2geom/piecewise.h | 20 |
1 files 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 <typename F> + 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<F>(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 <typename F> + inline void push_seg(F &&s) { + segs.emplace_back(std::forward<F>(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. |
