Search code examples
c++type-conversionreinterpret-castdelete-operator

What does the type Ss mean?


I have read a disk file into memory into an array declared as by:

char * buffer = new char [length];

then reinterpreted the array:

std::string strbuf(reinterpret_cast<const char *>(buffer), length);

and immediately check the type of the string provided.

cout << "buffer is: " << typeid(buffer).name() << '\n';
cout << "strbuf is: " << typeid(strbuf).name() << '\n';
buffer is: Pc
strbuf is: Ss */

As you can read, the string "strbuf" is of type Ss. What does that mean?


Solution

  • Ss is the mangled name for std::basic_string<char, std::char_traits<char>, std::allocator<char>> according to the Itanium ABI mangling rules.

    If you have trouble applying the rules in your mind, you can use the c++filt tool:

    $ c++filt <<< _ZSs
    std::basic_string<char, std::char_traits<char>, std::allocator<char> >