Browse Source

refactor: return-by-reference
chore: mark c++20

Sam Jaffe 2 years ago
parent
commit
ed63030986
3 changed files with 8 additions and 8 deletions
  1. 2 2
      include/math/dyn_limit.h
  2. 2 2
      include/math/limit.h
  3. 4 4
      limit.xcodeproj/project.pbxproj

+ 2 - 2
include/math/dyn_limit.h

@@ -34,8 +34,8 @@ public:
       : lower_bound_(MINIMUM_VALUE), upper_bound_(MAXIMUM_VALUE),
         value_(other) {}
 
-  operator value_type() const { return value_; }
-  value_type operator*() const { return value_; }
+  operator value_type const &() const { return value_; }
+  value_type const &operator*() const { return value_; }
   value_type const *operator->() const { return &value_; }
   
   auto operator<=>(DynBound const &other) const noexcept = default;

+ 2 - 2
include/math/limit.h

@@ -41,8 +41,8 @@ public:
 
   Bound(AssertBounds, value_type val) : value_(assert_in_bounds(val, min, max)) {}
 
-  operator value_type() const { return value_; }
-  value_type operator*() const { return value_; }
+  operator value_type const &() const { return value_; }
+  value_type const &operator*() const { return value_; }
   value_type const *operator->() const { return &value_; }
 
   auto operator<=>(Bound const &other) const noexcept = default;

+ 4 - 4
limit.xcodeproj/project.pbxproj

@@ -409,7 +409,7 @@
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				CLANG_ANALYZER_NONNULL = YES;
 				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
-				CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
+				CLANG_CXX_LANGUAGE_STANDARD = "c++20";
 				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				CLANG_ENABLE_OBJC_WEAK = YES;
@@ -443,7 +443,7 @@
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				CLANG_ANALYZER_NONNULL = YES;
 				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
-				CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
+				CLANG_CXX_LANGUAGE_STANDARD = "c++20";
 				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				CLANG_ENABLE_OBJC_WEAK = YES;
@@ -473,7 +473,7 @@
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				CLANG_ANALYZER_NONNULL = YES;
 				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
-				CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
+				CLANG_CXX_LANGUAGE_STANDARD = "c++20";
 				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				CLANG_ENABLE_OBJC_WEAK = YES;
@@ -513,7 +513,7 @@
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				CLANG_ANALYZER_NONNULL = YES;
 				CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
-				CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
+				CLANG_CXX_LANGUAGE_STANDARD = "c++20";
 				CLANG_ENABLE_MODULES = YES;
 				CLANG_ENABLE_OBJC_ARC = YES;
 				CLANG_ENABLE_OBJC_WEAK = YES;