From 4460c330501d6bf6695e45781e94692ffe14e49f Mon Sep 17 00:00:00 2001 From: Martin Moene Date: Wed, 20 Apr 2016 14:18:54 +0200 Subject: [PATCH] Add const to constexpr methods --- phys/units/quantity.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phys/units/quantity.hpp b/phys/units/quantity.hpp index ae53960..0187c45 100644 --- a/phys/units/quantity.hpp +++ b/phys/units/quantity.hpp @@ -299,13 +299,13 @@ class quantity // /** // * convert to compatible unit, for example: (3._dm).to(meter) gives 0.3; // */ -// constexpr value_type to( quantity const & x ) { return *this / x; } +// constexpr value_type to( quantity const & x ) const { return *this / x; } /** * convert to given unit, for example: (3._dm).to(meter) gives 0.3; */ template - constexpr auto to( quantity const & x ) -> detail::Quotient + constexpr auto to( quantity const & x ) const -> detail::Quotient { return *this / x; } @@ -313,12 +313,12 @@ class quantity /** * the quantity's magnitude. */ - constexpr value_type magnitude() { return m_value; } + constexpr value_type magnitude() const { return m_value; } /** * the quantity's dimensions. */ - constexpr dimension_type dimension() { return dimension_type{}; } + constexpr dimension_type dimension() const { return dimension_type{}; } /** * We need a "zero" of each type -- for comparisons, to initialize running