From 1c64a15342e5e3c5dd9b836a083daeddd75083e9 Mon Sep 17 00:00:00 2001 From: Baptiste Wicht Date: Thu, 5 Apr 2018 11:05:05 +0200 Subject: [PATCH] Refactor TSTL headers --- tstl/include/cstring.hpp | 25 +++++++++++++++++++++++++ tstl/include/string.hpp | 9 +-------- tstl/include/string_view.hpp | 1 + 3 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 tstl/include/cstring.hpp diff --git a/tstl/include/cstring.hpp b/tstl/include/cstring.hpp new file mode 100644 index 00000000..376bee89 --- /dev/null +++ b/tstl/include/cstring.hpp @@ -0,0 +1,25 @@ +//======================================================================= +// Copyright Baptiste Wicht 2013-2018. +// Distributed under the terms of the MIT License. +// (See accompanying file LICENSE or copy at +// http://www.opensource.org/licenses/MIT) +//======================================================================= + +#ifndef CSTRING_H +#define CSTRING_H + +#include + +namespace std { + +inline uint64_t str_len(const char* a){ + uint64_t length = 0; + while(*a++){ + ++length; + } + return length; +} + +} //end of namespace std + +#endif diff --git a/tstl/include/string.hpp b/tstl/include/string.hpp index 59ee4e0e..cd81553b 100644 --- a/tstl/include/string.hpp +++ b/tstl/include/string.hpp @@ -8,6 +8,7 @@ #ifndef STRING_H #define STRING_H +#include #include #include #include @@ -17,14 +18,6 @@ namespace std { -inline uint64_t str_len(const char* a){ - uint64_t length = 0; - while(*a++){ - ++length; - } - return length; -} - template struct base_long { size_t capacity; diff --git a/tstl/include/string_view.hpp b/tstl/include/string_view.hpp index 96851135..f7fe90d0 100644 --- a/tstl/include/string_view.hpp +++ b/tstl/include/string_view.hpp @@ -8,6 +8,7 @@ #ifndef STRING_VIEW_H #define STRING_VIEW_H +#include #include #include #include