Add a function that returns a MaxSizedArray.

This way you can use it to construct ie: a boost::string_ref or
just take the buffer and use it as a c-style string.
This commit is contained in:
King_DuckZ 2017-05-02 19:14:53 +01:00
parent 1696acae44
commit 91dca8810a
2 changed files with 25 additions and 0 deletions

View file

@ -256,6 +256,11 @@ namespace dhandy {
return dhandy::implem::lexical_cast<Tag>::template convert<T, F>(parFrom);
}
template <typename C, template <typename> class Tag=tags::dec, typename F=void>
inline auto int_to_string_ary (const F& parFrom) -> MaxSizedArray<C, Tag<F>::count_digits_bt(sprout::numeric_limits<F>::max())> {
return dhandy::lexical_cast<MaxSizedArray<C, Tag<F>::count_digits_bt(sprout::numeric_limits<F>::max())>, Tag, F>(parFrom);
}
namespace customize {
template<>
struct index_to_char<char> {
@ -299,6 +304,12 @@ namespace dhandy {
return std::string(parIn.begin(), parIn.end());
}
};
template<typename C, std::size_t S>
struct array_to_t<C, S, MaxSizedArray<C, S>> {
static MaxSizedArray<C, S> make (MaxSizedArray<C, S>&& parIn) {
return parIn;
}
};
} //namespace customize
} //namespace dhandy
#endif