std::locale::id(3)
π std::locale::id β the group chat lore π
okay bestie so this is std::locale::id(3), from the Library Functions Manual (yes that's the manual name, we're being fancy today β¨). It's a C++ thing from libstdc++ and it's lowkey the reason facets can find themselves in a locale. Let's get into it π«Ά
πΈ NAME πΈ
std::locale::id β the Facet ID class. that's it, that's the name, she's iconic π
β¨ SYNOPSIS β¨
#include <locale>
π Public Member Functions π
id ()β Constructor. the whole personality tbh.size_t _M_id () const throw ()β yeah she's private-ish energy but here she is, listed plain as day.
π¦ Friends π¦
template<typename _Facet> const _Facet * __try_use_facet (const locale &__loc)β a friend, a real one.template<typename _Facet> bool has_facet (const locale &__loc) throw ()β Test for the presence of a facet. the vibe check function fr fr.class localeβ friend of the house πclass locale::_Implβ also friend of the house πtemplate<typename _Facet> const _Facet & use_facet (const locale &__loc)β Return a facet. the actual getting-it function.
π Detailed Description π
Facet ID class. yes bestie, that's the whole description up top, we keep it real.
The ID class provides facets with an index used to identify them. Every facet class must define a public static member locale::id, or be derived from a facet that provides this member β otherwise the facet cannot be used in a locale. (like, at all. no index, no entry, no invitation to the function party π). The locale::id ensures that each class type gets a unique identifier. periodt. π
not me stressing: if you forget your static locale::id member, your facet is just out here, unable to be used in a locale. define it. bestie. please. π
π Constructor & Destructor Documentation π
π§ std::locale::id::id () [inline]
Constructor. she constructs. that's the job. π
π Friends And Related Symbol Documentation π
β template<typename _Facet> bool has_facet (const locale & __loc) [friend]
Test for the presence of a facet. has_facet tests the locale argument for the presence of the facet type provided as the template parameter. Facets derived from the facet parameter will also return true. (derived facets count too, we love inclusivity πΈ)
Template Parameters
_Facetβ The facet type to test the presence of.
Parameters
__locβ The locale to test.
Returns
true if __loc contains a facet of type _Facet, else false. simple as that, no cap β¨
π template<typename _Facet> const _Facet & use_facet (const locale & __loc) [friend]
Return a facet. use_facet looks for and returns a reference to a facet of type Facet where Facet is the template parameter. If has_facet(locale) is true, there is a suitable facet to return. It throws std::bad_cast if the locale doesn't contain a facet of type Facet. π
Template Parameters
_Facetβ The facet type to access.
Parameters
__locβ The locale to use.
Returns
Reference to facet of type Facet.
Exceptions
std::bad_castif__locdoesn't contain a facet of type_Facet.
reminder bestie: ifhas_facetsays no and you calluse_facetanyway, that's astd::bad_castcoming for you. check first, slay later π
π Author π
Generated automatically by Doxygen for libstdc++ from the source code.
and that's the whole page, mwah π β this was libstdc++, std::locale::id(3), brought to you by the Library Functions Manual, signed, sealed, delivered, no date on the footer so we're just gonna say: it's giving timeless. byeee π¦πβ¨
π¦ 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