By performing the /= operation on a named local variable instead of a
temporary the copy made for the return value can be elided.
PR libstdc++/85671
* include/bits/fs_path.h (operator/): Permit copy elision.
* include/experimental/bits/fs_path.h (operator/): Likewise.
From-SVN: r260009
+2018-05-07 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/85671
+ * include/bits/fs_path.h (operator/): Permit copy elision.
+ * include/experimental/bits/fs_path.h (operator/): Likewise.
+
2018-05-07 Edward Smith-Rowland <3dw4rd@verizon.net>
Moar PR libstdc++/80506
/// Append one path to another
inline path operator/(const path& __lhs, const path& __rhs)
- { return path(__lhs) /= __rhs; }
+ {
+ path __result(__lhs);
+ __result /= __rhs;
+ return __result;
+ }
/// Write a path to a stream
template<typename _CharT, typename _Traits>
/// Append one path to another
inline path operator/(const path& __lhs, const path& __rhs)
- { return path(__lhs) /= __rhs; }
+ {
+ path __result(__lhs);
+ __result /= __rhs;
+ return __result;
+ }
/// Write a path to a stream
template<typename _CharT, typename _Traits>