diff --git a/src/tawashi_implem/string_lengths.hpp b/src/tawashi_implem/string_lengths.hpp index ff3509e..8362476 100644 --- a/src/tawashi_implem/string_lengths.hpp +++ b/src/tawashi_implem/string_lengths.hpp @@ -21,36 +21,39 @@ #include "sprout/cstring/strlen.hpp" #include "duckhandy/sequence_bt.hpp" #include +#include namespace tawashi { + typedef uint16_t string_length_type; + namespace implem { template - inline constexpr std::size_t string_length_at_index (const sprout::array& parStrings) { - return sprout::strlen(parStrings[I]); + inline constexpr string_length_type string_length_at_index (const sprout::array& parStrings) { + return static_cast(sprout::strlen(parStrings[I])); } template - inline constexpr sprout::array string_lengths (const sprout::array& parStrings, dhandy::bt::index_seq) { - return sprout::array { + inline constexpr sprout::array string_lengths (const sprout::array& parStrings, dhandy::bt::index_seq) { + return sprout::array { string_length_at_index(parStrings)... }; } template - inline constexpr sprout::array string_lengths (const typename Enum::_name_iterable& parEnumIterable, dhandy::bt::index_seq) { - return sprout::array { - sprout::strlen(parEnumIterable[Indices])... + inline constexpr sprout::array string_lengths (const typename Enum::_name_iterable& parEnumIterable, dhandy::bt::index_seq) { + return sprout::array { + static_cast(sprout::strlen(parEnumIterable[Indices]))... }; } } //namespace implem template - inline constexpr sprout::array string_lengths (const sprout::array& parStrings) { + inline constexpr sprout::array string_lengths (const sprout::array& parStrings) { return implem::string_lengths(parStrings, dhandy::bt::index_range<0, S>()); } template - inline constexpr sprout::array string_lengths() { + inline constexpr sprout::array string_lengths() { return implem::string_lengths(Enum::_names(), dhandy::bt::index_range<0, Enum::_size()>()); } } //namespace tawashi