summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2018-08-30 21:14:37 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2018-08-30 21:14:37 +0100
commit4e11afe5b5d73ce90169a2658f019384f2de33e8 (patch)
treeeb91d557907abc481cf0d28de170eb15ce3e4ae3
parentAdd in a template type arg for enable_if (diff)
downloadlibadhocutil-4e11afe5b5d73ce90169a2658f019384f2de33e8.tar.bz2
libadhocutil-4e11afe5b5d73ce90169a2658f019384f2de33e8.tar.xz
libadhocutil-4e11afe5b5d73ce90169a2658f019384f2de33e8.zip
Add constexpr functions for identifying char ranges
-rw-r--r--libadhocutil/compileTimeFormatter.h13
1 files changed, 13 insertions, 0 deletions
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<typename char_type>
+ constexpr bool isdigit(const char_type & ch)
+ {
+ return (ch >= '0' && ch <= '9');
+ }
+
+ template<typename char_type>
+ constexpr bool ispositivedigit(const char_type & ch)
+ {
+ return (ch >= '1' && ch <= '9');
+ }
+
// Template string utils
template<const auto & S>
static constexpr auto strlen()