From 2ec26ecd049238b8a0e481c52de030de812ca3c7 Mon Sep 17 00:00:00 2001 From: studiosi Date: Mon, 17 Aug 2026 21:35:13 +0300 Subject: [PATCH] Solved: 32 - Constexpr and Nullptr --- modules/09_cpp11/include/constexpr_nullptr.hpp | 2 +- modules/09_cpp11/src/constexpr_nullptr.cpp | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/modules/09_cpp11/include/constexpr_nullptr.hpp b/modules/09_cpp11/include/constexpr_nullptr.hpp index 4eb7ba0..aee9d69 100644 --- a/modules/09_cpp11/include/constexpr_nullptr.hpp +++ b/modules/09_cpp11/include/constexpr_nullptr.hpp @@ -7,7 +7,7 @@ namespace cpp11 { enum class Color { Red, Green, Blue }; [[nodiscard]] auto to_index(Color color) -> int; -[[nodiscard]] auto square(int value) -> int; +[[nodiscard]] constexpr auto square(const int value) -> int { return value * value; } [[nodiscard]] auto find_null(int* ptr) -> int*; } // namespace cpp11 diff --git a/modules/09_cpp11/src/constexpr_nullptr.cpp b/modules/09_cpp11/src/constexpr_nullptr.cpp index f2a0c79..9b3c14d 100644 --- a/modules/09_cpp11/src/constexpr_nullptr.cpp +++ b/modules/09_cpp11/src/constexpr_nullptr.cpp @@ -11,10 +11,6 @@ auto to_index(const Color color) -> int { return -1; } -auto square(const int value) -> int { - return value * value; -} - auto find_null(int* ptr) -> int* { return ptr; }