- return docstring(ucs4.begin(), ucs4.end());
-#else
- int const ls = qstr.size();
- docstring ucs4;
- for (int i = 0; i < ls; ++i) {
- char_type const c = static_cast<char_type>(qstr[i].unicode());
- if (is_utf16(c))
- // Use a simple cast in the common case for speed
- // reasons
- ucs4 += c;
- else {
- // A simple cast is not possible, so we need to use
- // the full blown conversion.
- std::vector<char_type> const v = utf16_to_ucs4(
- reinterpret_cast<unsigned short const *>(qstr.utf16()),
- qstr.size());
- // Enable the compiler to do NRVO
- ucs4 = docstring(v.begin(), v.end());
- break;
- }
- }
- return ucs4;
-#endif