utx::str_size - A function object to get the length of a string: get the character counter.
The function object is the object of instantiated template class utx::str_size_class .
It gets string size by template type traits.
It gets string size by searching until '\0' is found.
It works on both string literal or string made by new.
For utx::str_size, type_xt is char; for utx::wstr_size, type_xt is wchar_t, ..., etc.
#include <utxcpp/core.hpp> #include <utxcpp/numeric.hpp> // utx::iota int main() { char s1[] = "Hell c++!"; constexpr const char * s2 = "Hell c++!!"; char * s3 = new char[23]; utx::iota(s3, '0'); s3[11] = '\0'); constexpr auto sz1 = utx::str_size(s1); constexpr auto sz2 = utx::str_size(s2); auto sz3 = utx::str_size(s3); utx::print(sz1, sz2, sz3); }