From 2bf100bdd0522f1427fc6da5ac093895a3c80ce0 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 27 Aug 2016 10:46:49 +0100 Subject: [PATCH] Add a to_string overload for unsigned int --- src/string.cc | 7 +++++++ src/string.hh | 1 + 2 files changed, 8 insertions(+) diff --git a/src/string.cc b/src/string.cc index edfd4cf6..69c8f946 100644 --- a/src/string.cc +++ b/src/string.cc @@ -307,6 +307,13 @@ InplaceString<15> to_string(int val) return res; } +InplaceString<15> to_string(unsigned val) +{ + InplaceString<15> res; + res.m_length = sprintf(res.m_data, "%u", val); + return res; +} + InplaceString<23> to_string(long int val) { InplaceString<23> res; diff --git a/src/string.hh b/src/string.hh index 74fbb51a..d1c6aa0e 100644 --- a/src/string.hh +++ b/src/string.hh @@ -327,6 +327,7 @@ inline Hex hex(size_t val) { return {val}; } InplaceString<15> to_string(int val); InplaceString<23> to_string(long int val); +InplaceString<15> to_string(unsigned val); InplaceString<23> to_string(size_t val); InplaceString<23> to_string(Hex val); InplaceString<23> to_string(float val);