STD::WSTRING_CONVERT(3)

πŸ’– NAME πŸ’–

std::wstring_convert< _Codecvt, _Elem, _Wide_alloc, _Byte_alloc > β€” string conversions, bestie. πŸ’…

It's the libstdc++ glow-up that takes your bytes and turns them into wide strings, and takes your wide strings and turns them back into bytes. No cap. This page lives in the Library Functions Manual, and honestly it's giving "I convert charsets so you don't have to." ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <locale>

πŸŽ€ Public Types πŸŽ€

  • typedef basic_string< char, char_traits< char >, _Byte_alloc > byte_string
  • typedef wide_string::traits_type::int_type int_type
  • typedef _Codecvt::state_type state_type
  • typedef basic_string< _Elem, char_traits< _Elem >, _Wide_alloc > wide_string

πŸ‘‘ Public Member Functions πŸ‘‘

  • wstring_convert () β€” default constructor. Default constructor energy.
  • wstring_convert (_Codecvt *__pcvt)
  • wstring_convert (_Codecvt *__pcvt, state_type __state)
  • wstring_convert (const byte_string &__byte_err, const wide_string &__wide_err=wide_string())
  • wstring_convert (const wstring_convert &)=delete
  • size_t converted () const noexcept β€” the number of elements successfully converted in the last conversion.
  • wstring_convert & operator= (const wstring_convert &)=delete
  • state_type state () const β€” the final conversion state of the last conversion.
  • wide_string from_bytes (char __byte) β€” convert from bytes.
  • wide_string from_bytes (const char *__ptr) β€” convert from bytes.
  • wide_string from_bytes (const byte_string &__str) β€” convert from bytes.
  • wide_string from_bytes (const char *__first, const char *__last) β€” convert from bytes.
  • byte_string to_bytes (_Elem __wchar) β€” convert to bytes.
  • byte_string to_bytes (const _Elem *__ptr) β€” convert to bytes.
  • byte_string to_bytes (const wide_string &__wstr) β€” convert to bytes.
  • byte_string to_bytes (const _Elem *__first, const _Elem *__last) β€” convert to bytes.

🌈 DETAILED DESCRIPTION 🌈

template<typename _Codecvt, typename _Elem = wchar_t, typename _Wide_alloc = allocator<_Elem>, typename _Byte_alloc = allocator<char>>
class std::wstring_convert< _Codecvt, _Elem, _Wide_alloc, _Byte_alloc >

String conversions. That's the whole personality, and it's thriving. 🌸


🧚 CONSTRUCTOR & DESTRUCTOR DOCUMENTATION 🧚

wstring_convert () [inline]

template<typename _Codecvt, typename _Elem = wchar_t, typename _Wide_alloc = allocator<_Elem>, typename _Byte_alloc = allocator<char>>
std::wstring_convert< _Codecvt, _Elem, _Wide_alloc, _Byte_alloc >::wstring_convert ()

Default constructor. Yes bestie, it just exists. 🫢

wstring_convert (_Codecvt * __pcvt) [inline], [explicit]

template<typename _Codecvt, typename _Elem = wchar_t, typename _Wide_alloc = allocator<_Elem>, typename _Byte_alloc = allocator<char>>
std::wstring_convert< _Codecvt, _Elem, _Wide_alloc, _Byte_alloc >::wstring_convert (_Codecvt * __pcvt)

Constructor.

Parameters

  • __pcvt β€” the facet to use for conversions.
Heads up bestie: it takes ownership of __pcvt and will delete it in the destructor. It said "what's mine is mine" and meant it. πŸ’€

wstring_convert (_Codecvt * __pcvt, state_type __state) [inline]

template<typename _Codecvt, typename _Elem = wchar_t, typename _Wide_alloc = allocator<_Elem>, typename _Byte_alloc = allocator<char>>
std::wstring_convert< _Codecvt, _Elem, _Wide_alloc, _Byte_alloc >::wstring_convert (_Codecvt * __pcvt, state_type __state)

Construct with an initial converstion state. ✨

Parameters

  • __pcvt β€” the facet to use for conversions.
  • __state β€” initial conversion state.
Also takes ownership of __pcvt and will delete it in the destructor. And listen β€” the object's conversion state will persist between conversions. It remembers. It's got main character memory. πŸ‘‘

wstring_convert (const byte_string & __byte_err, const wide_string & __wide_err = wide_string()) [inline], [explicit]

template<typename _Codecvt, typename _Elem = wchar_t, typename _Wide_alloc = allocator<_Elem>, typename _Byte_alloc = allocator<char>>
std::wstring_convert< _Codecvt, _Elem, _Wide_alloc, _Byte_alloc >::wstring_convert (const byte_string & __byte_err, const wide_string & __wide_err = wide_string())

Construct with error strings. So when a conversion flops, you get a little consolation prize instead of chaos. πŸŽ€

Parameters

  • __byte_err β€” a string to return on failed conversions.
  • __wide_err β€” a wide string to return on failed conversions.

πŸ’œ MEMBER FUNCTION DOCUMENTATION πŸ’œ

size_t converted () const [inline], [noexcept]

template<typename _Codecvt, typename _Elem = wchar_t, typename _Wide_alloc = allocator<_Elem>, typename _Byte_alloc = allocator<char>>
size_t std::wstring_convert< _Codecvt, _Elem, _Wide_alloc, _Byte_alloc >::converted () const

The number of elements successfully converted in the last conversion. Receipts. 🧾✨

wide_string from_bytes (char __byte) [inline]

template<typename _Codecvt, typename _Elem = wchar_t, typename _Wide_alloc = allocator<_Elem>, typename _Byte_alloc = allocator<char>>
wide_string std::wstring_convert< _Codecvt, _Elem, _Wide_alloc, _Byte_alloc >::from_bytes (char __byte)

Convert from bytes.

  • References from_bytes().
  • Referenced by from_bytes(), from_bytes(), and from_bytes().

wide_string from_bytes (const byte_string & __str) [inline]

template<typename _Codecvt, typename _Elem = wchar_t, typename _Wide_alloc = allocator<_Elem>, typename _Byte_alloc = allocator<char>>
wide_string std::wstring_convert< _Codecvt, _Elem, _Wide_alloc, _Byte_alloc >::from_bytes (const byte_string & __str)

Convert from bytes.

  • References std::basic_string< _CharT, _Traits, _Alloc >::data(), from_bytes(), and std::basic_string< _CharT, _Traits, _Alloc >::size().

wide_string from_bytes (const char * __first, const char * __last) [inline]

template<typename _Codecvt, typename _Elem = wchar_t, typename _Wide_alloc = allocator<_Elem>, typename _Byte_alloc = allocator<char>>
wide_string std::wstring_convert< _Codecvt, _Elem, _Wide_alloc, _Byte_alloc >::from_bytes (const char * __first, const char * __last)

Convert from bytes. πŸ¦‹

wide_string from_bytes (const char * __ptr) [inline]

template<typename _Codecvt, typename _Elem = wchar_t, typename _Wide_alloc = allocator<_Elem>, typename _Byte_alloc = allocator<char>>
wide_string std::wstring_convert< _Codecvt, _Elem, _Wide_alloc, _Byte_alloc >::from_bytes (const char * __ptr)

Convert from bytes.

  • References from_bytes().

state_type state () const [inline]

template<typename _Codecvt, typename _Elem = wchar_t, typename _Wide_alloc = allocator<_Elem>, typename _Byte_alloc = allocator<char>>
state_type std::wstring_convert< _Codecvt, _Elem, _Wide_alloc, _Byte_alloc >::state () const

The final conversion state of the last conversion. Where it left off, emotionally. 😭

byte_string to_bytes (_Elem __wchar) [inline]

template<typename _Codecvt, typename _Elem = wchar_t, typename _Wide_alloc = allocator<_Elem>, typename _Byte_alloc = allocator<char>>
byte_string std::wstring_convert< _Codecvt, _Elem, _Wide_alloc, _Byte_alloc >::to_bytes (_Elem __wchar)

Convert to bytes.

  • References to_bytes().
  • Referenced by to_bytes(), to_bytes(), and to_bytes().

byte_string to_bytes (const _Elem * __first, const _Elem * __last) [inline]

template<typename _Codecvt, typename _Elem = wchar_t, typename _Wide_alloc = allocator<_Elem>, typename _Byte_alloc = allocator<char>>
byte_string std::wstring_convert< _Codecvt, _Elem, _Wide_alloc, _Byte_alloc >::to_bytes (const _Elem * __first, const _Elem * __last)

Convert to bytes. 🌟

byte_string to_bytes (const _Elem * __ptr) [inline]

template<typename _Codecvt, typename _Elem = wchar_t, typename _Wide_alloc = allocator<_Elem>, typename _Byte_alloc = allocator<char>>
byte_string std::wstring_convert< _Codecvt, _Elem, _Wide_alloc, _Byte_alloc >::to_bytes (const _Elem * __ptr)

Convert to bytes.

  • References std::basic_string< _Elem, char_traits< _Elem >, _Wide_alloc >::length(), and to_bytes().

byte_string to_bytes (const wide_string & __wstr) [inline]

template<typename _Codecvt, typename _Elem = wchar_t, typename _Wide_alloc = allocator<_Elem>, typename _Byte_alloc = allocator<char>>
byte_string std::wstring_convert< _Codecvt, _Elem, _Wide_alloc, _Byte_alloc >::to_bytes (const wide_string & __wstr)

Convert to bytes.

  • References std::basic_string< _CharT, _Traits, _Alloc >::data(), std::basic_string< _CharT, _Traits, _Alloc >::size(), and to_bytes().

πŸ“ AUTHOR πŸ“

Generated automatically by Doxygen for libstdc++ from the source code.


okay that's the whole page bestie, you ate πŸ’…βœ¨ This was libstdc++ doing its thing β€” no cap, iykyk. πŸŽ€πŸ¦‹πŸŒΈπŸ’–

πŸ“¦ where this page comes from
  • arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
  • fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 44: libstdc++-docs 16.2.1-2.fc44
  • fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms