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_stringtypedef wide_string::traits_type::int_type int_typetypedef _Codecvt::state_type state_typetypedef 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 &)=deletesize_t converted () const noexceptβ the number of elements successfully converted in the last conversion.wstring_convert & operator= (const wstring_convert &)=deletestate_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(), andfrom_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(), andstd::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(), andto_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(), andto_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(), andto_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