constexpr all the things

It’s frustrating when you go all “in on” constexpr, only to be hamstrung by bits of the Standard Library that aren’t yet constexpr.

See the repo.

This is static library that provides an implementation for my other projects.

Goals


-- The CXX compiler identification is GNU 15.0.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/local/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Configuring done (0.4s)
-- Generating done (0.0s)
-- Build files have been written to: /builds/deanturpin/constd/build
gmake[1]: Entering directory '/builds/deanturpin/constd/build'
gmake[2]: Entering directory '/builds/deanturpin/constd/build'
gmake[3]: Entering directory '/builds/deanturpin/constd/build'
gmake[3]: Leaving directory '/builds/deanturpin/constd/build'
gmake[3]: Entering directory '/builds/deanturpin/constd/build'
[ 11%] Building CXX object CMakeFiles/constd.dir/src/constd.cxx.o
[ 22%] Linking CXX static library libconstd.a
gmake[3]: Leaving directory '/builds/deanturpin/constd/build'
[ 22%] Built target constd
gmake[3]: Entering directory '/builds/deanturpin/constd/build'
gmake[3]: Entering directory '/builds/deanturpin/constd/build'
gmake[3]: Leaving directory '/builds/deanturpin/constd/build'
gmake[3]: Leaving directory '/builds/deanturpin/constd/build'
gmake[3]: Entering directory '/builds/deanturpin/constd/build'
gmake[3]: Entering directory '/builds/deanturpin/constd/build'
[ 33%] Building CXX object CMakeFiles/constd_benchmark.dir/src/benchmark.cxx.o
[ 44%] Building CXX object CMakeFiles/constd_main.dir/src/main.cxx.o
[ 55%] Building CXX object CMakeFiles/constd_benchmark.dir/src/isprint.cxx.o
[ 66%] Building CXX object CMakeFiles/constd_benchmark.dir/src/isxdigit.cxx.o
[ 77%] Building CXX object CMakeFiles/constd_benchmark.dir/src/stod.cxx.o
[ 88%] Linking CXX executable constd_main
gmake[3]: Leaving directory '/builds/deanturpin/constd/build'
[ 88%] Built target constd_main
[100%] Linking CXX executable constd_benchmark
gmake[3]: Leaving directory '/builds/deanturpin/constd/build'
[100%] Built target constd_benchmark
gmake[2]: Leaving directory '/builds/deanturpin/constd/build'
gmake[1]: Leaving directory '/builds/deanturpin/constd/build'
--------------------------------------------------------------------
Benchmark                          Time             CPU   Iterations
--------------------------------------------------------------------
BM_isprint_constexpr           0.167 ns        0.166 ns   1000000000
BM_isprint                      2.65 ns         2.65 ns    260787436
BM_isprint_fuzz_constexpr      0.685 ns        0.685 ns   1000000000
BM_isprint_fuzz                 2.82 ns         2.82 ns    248762565
BM_isxdigit_constexpr          0.170 ns        0.170 ns   1000000000
BM_isxdigit                    0.166 ns        0.166 ns   1000000000
BM_stod_constexpr              0.166 ns        0.166 ns   1000000000
BM_stod_constexpr2             0.166 ns        0.166 ns   1000000000
BM_stod                         19.4 ns         19.4 ns     34299829
BM_stod2                        68.3 ns         68.3 ns     10404815
commit 621f0a52af7ee731cadc38d4e8c813faff1e105d
Author: Dean Turpin <gitlab@turpin.dev>
Date:   Tue May 28 14:43:12 2024 +0000

    Update .gitlab-ci.yml file

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e7cb206..cfba9b4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -11,7 +11,7 @@ pages:
   - git log -1 -p >> index.md
   - make stats >> index.md
   - echo '```' >> index.md
-w
+
   # Publish
   - mkdir public/
   - pandoc index.md --standalone -o public/index.html
SLOC    Directory   SLOC-by-Language (Sorted)
Total Physical Source Lines of Code (SLOC)                = 115
 (Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))
Total Estimated Cost to Develop                           = $ 2,789
SLOCCount, Copyright (C) 2001-2004 David A. Wheeler
SLOCCount is Open Source Software/Free Software, licensed under the GNU GPL.
SLOCCount comes with ABSOLUTELY NO WARRANTY, and you are welcome to
Please credit this data as "generated using David A. Wheeler's 'SLOCCount'."