Search code examples
c++11strlenchar16-t

C++11 char16_t strlen-equivalent function


I have a simple question: Is there a way to do a strlen()-like count of characters in zero-terminated char16_t array?


Solution

  • use

    char_traits<char16_t>::length(your_pointer)
    

    see 21.2.3.2 struct char_traits<char16_t> and table 62 of the C++11-Std.