From b4fd091cf64f38a3965b44f320cab7ce3f9d8f87 Mon Sep 17 00:00:00 2001 From: sabudilovskiy Date: Wed, 2 Oct 2024 18:23:28 +0000 Subject: [PATCH] - --- .github/workflows/CI_ubuntu.yaml | 6 +++--- include/tgbm/api/optional.hpp | 12 +++++------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/CI_ubuntu.yaml b/.github/workflows/CI_ubuntu.yaml index 2718c328..66032c0c 100644 --- a/.github/workflows/CI_ubuntu.yaml +++ b/.github/workflows/CI_ubuntu.yaml @@ -31,12 +31,12 @@ jobs: - type: Debug compiler: gcc cxx_compiler: g++ - version: 11 - + version: 11 + - type: Debug compiler: gcc cxx_compiler: g++ - version: 14 + version: 12 name: '${{matrix.type}} ${{matrix.compiler}}-${{matrix.version}}' runs-on: ubuntu-22.04 #bug in std library(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115119) diff --git a/include/tgbm/api/optional.hpp b/include/tgbm/api/optional.hpp index fc9843a6..1f07eabf 100644 --- a/include/tgbm/api/optional.hpp +++ b/include/tgbm/api/optional.hpp @@ -291,10 +291,8 @@ struct optional { using value_type = Integer; private: - static consteval Integer empty() { - return Integer(std::numeric_limits::max()); - } - Integer _val = empty(); + static constexpr Integer empty_ = std::numeric_limits::max(); + Integer _val = empty_; public: constexpr optional() noexcept = default; @@ -303,7 +301,7 @@ struct optional { constexpr optional(std::nullopt_t) noexcept : optional() { } constexpr optional& operator=(std::nullopt_t) noexcept { - _val = empty(); + _val = empty_; return *this; } constexpr optional& operator=(value_type b) noexcept { @@ -311,13 +309,13 @@ struct optional { return *this; } constexpr bool has_value() const noexcept { - return _val != empty(); + return _val != empty_; } constexpr explicit operator bool() const noexcept { return has_value(); } constexpr void reset() noexcept { - _val = empty(); + _val = empty_; } constexpr value_type& emplace(value_type v = value_type{}) noexcept { return _val = v;