From b854a54293320b6f6889e0033e2867db784d8678 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Tue, 2 May 2017 20:01:41 +0100 Subject: [PATCH] Move the new function to its own header. --- include/duckhandy/int_to_string_ary.hpp | 39 +++++++++++++++++++++++++ include/duckhandy/lexical_cast.hpp | 11 ------- test/unit/lexical_cast_test.cpp | 1 + 3 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 include/duckhandy/int_to_string_ary.hpp diff --git a/include/duckhandy/int_to_string_ary.hpp b/include/duckhandy/int_to_string_ary.hpp new file mode 100644 index 0000000..22513ac --- /dev/null +++ b/include/duckhandy/int_to_string_ary.hpp @@ -0,0 +1,39 @@ +/* Copyright 2017 Michele Santullo + * This file is part of "duckhandy". + * + * "duckhandy" is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * "duckhandy" is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with "duckhandy". If not, see . + */ + +#ifndef idB123739E9F8846899541DB26BEA86386 +#define idB123739E9F8846899541DB26BEA86386 + +#include "lexical_cast.hpp" + +namespace dhandy { + namespace customize { + template + struct array_to_t> { + static MaxSizedArray make (MaxSizedArray&& parIn) { + return parIn; + } + }; + } //namespace customize + + template class Tag=tags::dec, typename F=void> + inline auto int_to_string_ary (const F& parFrom) -> MaxSizedArray::count_digits_bt(sprout::numeric_limits::max())> { + return dhandy::lexical_cast::count_digits_bt(sprout::numeric_limits::max())>, Tag, F>(parFrom); + } +} //namespace dhandy + +#endif diff --git a/include/duckhandy/lexical_cast.hpp b/include/duckhandy/lexical_cast.hpp index 9c9d0e3..3d9d6cb 100644 --- a/include/duckhandy/lexical_cast.hpp +++ b/include/duckhandy/lexical_cast.hpp @@ -256,11 +256,6 @@ namespace dhandy { return dhandy::implem::lexical_cast::template convert(parFrom); } - template class Tag=tags::dec, typename F=void> - inline auto int_to_string_ary (const F& parFrom) -> MaxSizedArray::count_digits_bt(sprout::numeric_limits::max())> { - return dhandy::lexical_cast::count_digits_bt(sprout::numeric_limits::max())>, Tag, F>(parFrom); - } - namespace customize { template<> struct index_to_char { @@ -304,12 +299,6 @@ namespace dhandy { return std::string(parIn.begin(), parIn.end()); } }; - template - struct array_to_t> { - static MaxSizedArray make (MaxSizedArray&& parIn) { - return parIn; - } - }; } //namespace customize } //namespace dhandy #endif diff --git a/test/unit/lexical_cast_test.cpp b/test/unit/lexical_cast_test.cpp index 65fcfa2..4dd5c64 100644 --- a/test/unit/lexical_cast_test.cpp +++ b/test/unit/lexical_cast_test.cpp @@ -17,6 +17,7 @@ #include "catch.hpp" #include "duckhandy/lexical_cast.hpp" +#include "duckhandy/int_to_string_ary.hpp" #include #include #include