From 27858f2b33b153cabcbd64fb577149a232e2cc7f Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Thu, 11 Apr 2019 20:56:16 +0100 Subject: [PATCH] my_value toy class refactored --- test/test_quantity.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/test_quantity.cpp b/test/test_quantity.cpp index f240d814..649e0b21 100644 --- a/test/test_quantity.cpp +++ b/test/test_quantity.cpp @@ -32,16 +32,14 @@ namespace { template class my_value { T value_{}; - public: my_value() = default; - constexpr my_value(T v) : value_{v} {} + constexpr my_value(T v) : value_{std::move(v)} {} constexpr my_value& operator+=(const my_value& other) { value_ += other.value_; return *this; } constexpr my_value& operator-=(const my_value& other) { value_ -= other.value_; return *this; } constexpr my_value& operator*=(const my_value& other) { value_ *= other.value_; return *this; } constexpr my_value& operator/=(const my_value& other) { value_ /= other.value_; return *this; } - constexpr operator const T&() const { return value_; } - constexpr operator T&() { return value_; } + constexpr operator const T&() const & { return value_; } }; } // namespace