From 9a0a7b1093c50d06461d2f355b1f2d8c03d1da5c Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 16 Jun 2018 20:02:29 +0100 Subject: Template strings don't need to be extern C++17, just constexpr --- libadhocutil/compileTimeFormatter.h | 2 +- .../unittests/testCompileTimeFormatter.cpp | 36 +++++++++++----------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/libadhocutil/compileTimeFormatter.h b/libadhocutil/compileTimeFormatter.h index 17af36d..6e85f8e 100644 --- a/libadhocutil/compileTimeFormatter.h +++ b/libadhocutil/compileTimeFormatter.h @@ -227,7 +227,7 @@ namespace AdHoc { } #define AdHocFormatterTypedef(name, str, id) \ - inline extern constexpr auto id = str; \ + inline constexpr auto id = str; \ typedef ::AdHoc::Formatter name #define AdHocFormatter(name, str) \ AdHocFormatterTypedef(name, str, MAKE_UNIQUE(name)) diff --git a/libadhocutil/unittests/testCompileTimeFormatter.cpp b/libadhocutil/unittests/testCompileTimeFormatter.cpp index 9089243..cb49bd2 100644 --- a/libadhocutil/unittests/testCompileTimeFormatter.cpp +++ b/libadhocutil/unittests/testCompileTimeFormatter.cpp @@ -7,24 +7,24 @@ using namespace AdHoc; -extern constexpr const char * formatEdgeCaseEmpty = ""; -extern constexpr const char * formatEdgeCaseSingle = "1"; -extern constexpr const char * formatEdgeCaseFormatStart = "%? after"; -extern constexpr const char * formatEdgeCaseFormatEnd = "before %?"; -extern constexpr const char * formatEdgeCaseFormatLonely = "%?"; -extern constexpr const char * formatStringLiteral = "literal"; -extern constexpr const char * formatStringSingle = "single %?."; -extern constexpr const char * formatStringMulti = "First %?, then %?."; -extern constexpr const char * formatStringCustom = "custom %()"; -extern constexpr const char * formatStringCustomParam1 = "custom %(\x3)"; -extern constexpr const char * formatStringCustomParam2 = "custom %(\x9)"; -extern constexpr const char * formatStringCustomLong = "custom %(longname)"; -extern constexpr const char * formatStringLong = " "; -extern constexpr const char * formatStringMultiArg = "value%ra"; -extern constexpr const char * formatStringEscape1 = "literal %% percentage."; -extern constexpr const char * formatStringEscape2 = "literal %%? percentage."; -extern constexpr const char * formatStringEscape3 = "literal %%%? percentage."; -extern constexpr const char * formatStringEscape4 = "literal %%%?%% percentage."; +constexpr const char * formatEdgeCaseEmpty = ""; +constexpr const char * formatEdgeCaseSingle = "1"; +constexpr const char * formatEdgeCaseFormatStart = "%? after"; +constexpr const char * formatEdgeCaseFormatEnd = "before %?"; +constexpr const char * formatEdgeCaseFormatLonely = "%?"; +constexpr const char * formatStringLiteral = "literal"; +constexpr const char * formatStringSingle = "single %?."; +constexpr const char * formatStringMulti = "First %?, then %?."; +constexpr const char * formatStringCustom = "custom %()"; +constexpr const char * formatStringCustomParam1 = "custom %(\x3)"; +constexpr const char * formatStringCustomParam2 = "custom %(\x9)"; +constexpr const char * formatStringCustomLong = "custom %(longname)"; +constexpr const char * formatStringLong = " "; +constexpr const char * formatStringMultiArg = "value%ra"; +constexpr const char * formatStringEscape1 = "literal %% percentage."; +constexpr const char * formatStringEscape2 = "literal %%? percentage."; +constexpr const char * formatStringEscape3 = "literal %%%? percentage."; +constexpr const char * formatStringEscape4 = "literal %%%?%% percentage."; namespace AdHoc { // Custom stream writer formatter, formats as -- cgit v1.2.3