Skip to content

Commit 119804d

Browse files
committed
mark Quantity double operator overload const
1 parent 1d7008b commit 119804d

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ IS_LIBRARY:=1
2929
# Be sure that your header files are in the include directory inside of a folder with the
3030
# same name as what you set LIBNAME to below.
3131
LIBNAME:=units
32-
VERSION:=0.7.0
32+
VERSION:=0.7.1
3333
# EXCLUDE_SRC_FROM_LIB= $(SRCDIR)/unpublishedfile.c
3434
# this line excludes opcontrol.c and similar files
3535
EXCLUDE_SRC_FROM_LIB+=$(foreach file, $(SRCDIR)/main,$(foreach cext,$(CEXTS),$(file).$(cext)) $(foreach cxxext,$(CXXEXTS),$(file).$(cxxext)))

include/units/units.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class Quantity {
8585
requires std::is_same_v<Self, Dimensionless>
8686
: value(value) {}
8787

88-
constexpr operator double()
88+
constexpr operator double() const
8989
requires std::is_same_v<Self, Dimensionless>
9090
{
9191
return value;

src/main.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ constexpr void numberOperatorTests() {
3434
Number c = 1 / Number(2);
3535
Number d = Number(2) / 2;
3636
auto e = 1 / 1_in;
37+
auto f = 0 == Number(2);
38+
auto g = 0 != Number(2);
39+
auto h = Number(2) != 0;
3740
}
3841

3942
constexpr void miscTests() {

0 commit comments

Comments
 (0)