From 4e11afe5b5d73ce90169a2658f019384f2de33e8 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 30 Aug 2018 21:14:37 +0100 Subject: Add constexpr functions for identifying char ranges --- libadhocutil/compileTimeFormatter.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libadhocutil/compileTimeFormatter.h b/libadhocutil/compileTimeFormatter.h index 8d60800..bb80edf 100644 --- a/libadhocutil/compileTimeFormatter.h +++ b/libadhocutil/compileTimeFormatter.h @@ -7,6 +7,19 @@ #include "unique.h" namespace AdHoc { + // Template char utils + template + constexpr bool isdigit(const char_type & ch) + { + return (ch >= '0' && ch <= '9'); + } + + template + constexpr bool ispositivedigit(const char_type & ch) + { + return (ch >= '1' && ch <= '9'); + } + // Template string utils template static constexpr auto strlen() -- cgit v1.2.3