diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-09-10 13:58:36 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-09-10 13:58:36 +0100 |
commit | 85da06f0c4adb3f1fa238e5292d1a3f49f7f9815 (patch) | |
tree | 4219cbe9b3b77105ab9d365a0b8be4be3ad29867 | |
parent | Constinit strings which are short enough to not allocate (diff) | |
download | slicer-85da06f0c4adb3f1fa238e5292d1a3f49f7f9815.tar.bz2 slicer-85da06f0c4adb3f1fa238e5292d1a3f49f7f9815.tar.xz slicer-85da06f0c4adb3f1fa238e5292d1a3f49f7f9815.zip |
Apply same length check to built-in strings
-rw-r--r-- | slicer/slicer/modelPartsTypes.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/slicer/slicer/modelPartsTypes.cpp b/slicer/slicer/modelPartsTypes.cpp index b34bbc8..e78c6c6 100644 --- a/slicer/slicer/modelPartsTypes.cpp +++ b/slicer/slicer/modelPartsTypes.cpp @@ -74,19 +74,21 @@ namespace Slicer { return name; } -#define Roots(Type, Name) \ - template<> constinit const std::string Slicer::ModelPartForRoot<Type>::rootName {#Name}; \ - template<> constinit const std::string Slicer::ModelPartForRoot<Ice::optional<Type>>::rootName {"Optional" #Name}; \ +#define Roots(Type, Name, NameLen) \ + template<> CONSTSTR(NameLen) Slicer::ModelPartForRoot<Type>::rootName {#Name}; \ + template<> \ + CONSTSTR(BOOST_PP_ADD(8, NameLen)) \ + Slicer::ModelPartForRoot<Ice::optional<Type>>::rootName {"Optional" #Name}; \ MODELPARTFOR(Type, ModelPartForSimple) - Roots(std::string, String); - Roots(bool, Boolean); - Roots(Ice::Float, Float); - Roots(Ice::Double, Double); - Roots(Ice::Byte, Byte); - Roots(Ice::Short, Short); - Roots(Ice::Int, Int); - Roots(Ice::Long, Long); + Roots(std::string, String, 6); + Roots(bool, Boolean, 8); + Roots(Ice::Float, Float, 5); + Roots(Ice::Double, Double, 6); + Roots(Ice::Byte, Byte, 4); + Roots(Ice::Short, Short, 5); + Roots(Ice::Int, Int, 3); + Roots(Ice::Long, Long, 4); #undef RootNames bool |