From 8e5c1eab1f0ab69f6b400f388579157bc2aca236 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sun, 23 May 2021 19:17:50 +0200 Subject: [PATCH] WIP: Use charconv functions --- CMakeLists.txt | 10 ++++++++++ conversion/stringconversion.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 913f971..cba5a78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,6 +197,16 @@ if (NOT ENABLE_THREAD_LOCAL) PROPERTY COMPILE_DEFINITIONS ${META_PROJECT_VARNAME}_NO_THREAD_LOCAL) endif () +# configure use of charconv +option(ENABLE_CHARCONV "enables use charconv for integer conversions" ON) +option(ENABLE_CHARCONV_FP "enables use charconv for floating point conversions" ON) +if (ENABLE_CHARCONV) + list(APPEND META_PUBLIC_COMPILE_DEFINITIONS ${META_PROJECT_VARNAME}_ENABLE_CHARCONV) +endif () +if (ENABLE_CHARCONV_FP) + list(APPEND META_PUBLIC_COMPILE_DEFINITIONS ${META_PROJECT_VARNAME}_ENABLE_CHARCONV_FP) +endif () + # include modules to apply configuration include(BasicConfig) include(WindowsResources) diff --git a/conversion/stringconversion.h b/conversion/stringconversion.h index 701dce0..09c8c6e 100644 --- a/conversion/stringconversion.h +++ b/conversion/stringconversion.h @@ -25,6 +25,10 @@ #include #endif +#if defined(CPP_UTILITIES_ENABLE_CHARCONV) || defined(CPP_UTILITIES_ENABLE_CHARCONV_FP) +#include +#endif + namespace CppUtilities { /*!