From 6ec2f9f08bc94ff3003e7ca2d78351c658b51be9 Mon Sep 17 00:00:00 2001 From: VAN BOSSUYT Nicolas Date: Sun, 4 Aug 2024 10:42:59 +0200 Subject: [PATCH] Add integral_constant. --- readme.md | 4 ++++ src/ce-stdcpp/type_traits | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/readme.md b/readme.md index ad0f969..9b084a5 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,7 @@ # 👷 Cute Engineering C++ Standard Library The ISO C++ Standard Library, ISO/IEC 14882 + +## Overview + +The Cute Engineering C++ Standard Library is a minimalist implementation of the ISO C++ Standard Library. It provides only the essential features needed to fully utilize most core C++ language functionalities. diff --git a/src/ce-stdcpp/type_traits b/src/ce-stdcpp/type_traits index df8390a..ce1134e 100644 --- a/src/ce-stdcpp/type_traits +++ b/src/ce-stdcpp/type_traits @@ -60,4 +60,16 @@ template struct remove_cvref { template using remove_cvref_t = typename remove_cvref::type; +// MARK: Integral Constant ----------------------------------------------------- + +template struct integral_constant { + static constexpr T value = v; + using value_type = T; + using type = integral_constant; + + constexpr operator value_type() const noexcept { return value; } + + constexpr value_type operator()() const noexcept { return value; } +}; + } // namespace std