refactor: use perfect forwarding for make functions

Addresses https://github.com/mpusz/units/pull/261#discussion_r597131272.
This commit is contained in:
Johel Ernesto Guerrero Peña authored and Mateusz Pusz committed 2021-03-18 22:37:25 +01:00
1 parent c61b8643d7
commit 234337d310
2 files changed
+6 -6

No files matched your search

+3 -3
View File
@@ -34,9 +34,9 @@ namespace units {
namespace detail {
template<Kind K>
inline constexpr auto make_quantity_kind_fn = [](auto q) {
using Q = decltype(q);
return quantity_kind<K, typename Q::unit, typename Q::rep>(std::move(q));
inline constexpr auto make_quantity_kind_fn = [](auto&& q) {
using Q = std::remove_reference_t<decltype(q)>;
return quantity_kind<K, typename Q::unit, typename Q::rep>(std::forward<decltype(q)>(q));
};
template<QuantityKind QK>