STD::BASIC_ISTREAM_SENTRY(3)

πŸ’– std::basic_istream< _CharT, _Traits >::sentry β€” Library Functions Manual πŸ’–

okay bestie, listen up: this is a page straight out of the libstdc++ manual, all about std::basic_istream< _CharT, _Traits >::sentry, and it's genuinely one of those little behind-the-scenes icons that does SO much work while nobody claps for it. main character energy, fr fr. let's get into it πŸŽ€


✨ NAME ✨

std::basic_istream< _CharT, _Traits >::sentry β€” Performs setup work for input streams.

like... that's it, that's the whole vibe. it sets stuff up. no cap. πŸ’…


🌸 SYNOPSIS 🌸

#include <istream>

πŸ¦‹ Public Types

typedef __istream_type::__ctype_type __ctype_type
typedef _Traits::int_type __int_type
typedef basic_istream< _CharT, _Traits > __istream_type
typedef basic_streambuf< _CharT, _Traits > __streambuf_type
typedef _Traits traits_type

and the last one there? traits_type is your easy access to dependent types, bestie. a lil shortcut, we love her 🫢

🧚 Public Member Functions

sentry (basic_istream< _CharT, _Traits > &__is, bool __noskipws=false)

The constructor performs all the work.

operator bool () const

Quick status checking.


πŸ‘‘ Detailed Description

template<typename _CharT, typename _Traits>
class std::basic_istream< _CharT, _Traits >::sentry

"Performs setup work for input streams." ✨

okay so here's the tea β˜• β€” objects of this class get created before all of the standard extractors are run. she's the girl who shows up early and gets everything ready before the party starts. she is responsible for exception-safe prefix and suffix operations, although ngl, only prefix actions are currently required by the standard. the suffix ones are out here living their best unsupervised life πŸ™ˆ


πŸ’œ Member Typedef Documentation

template<typename _CharT, typename _Traits> typedef _Traits
std::basic_istream< _CharT, _Traits >::sentry::traits_type

Easy access to dependent types. literally just that. she's a convenience girlie and she knows it πŸ’…


πŸŽ€ Constructor & Destructor Documentation

template<typename _CharT, typename _Traits> std::basic_istream< _CharT,
    _Traits >::sentry::sentry (basic_istream< _CharT, _Traits > & __is, bool
    __noskipws = false) [explicit]

The constructor performs all the work. yes, ALL of it. she's carrying the entire operation on her back and doesn't even complain 😭

Parameters

  • __is β€” The input stream to guard.
  • __noskipws β€” Whether to consume whitespace or not.
okay so here's the important part, don't skim this 🫢 If the stream state is good (__is.good() is true), then the following actions are performed, otherwise the sentry state is false (not okay) and failbit is set in the stream state.

The sentry's preparatory actions are:

  1. if the stream is tied to an output stream, is.tie()->flush() is called to synchronize the output sequence
  2. if __noskipws is false, and ios_base::skipws is set in is.flags(), the sentry extracts and discards whitespace characters from the stream. The currently imbued locale is used to determine whether each character is whitespace.

If the stream state is still good, then the sentry state becomes true (okay). slay ✨

References std::basic_istream< _CharT, _Traits >::basic_istream(), std::ios_base::badbit, std::basic_ios< _CharT, _Traits >::good(), and std::ios_base::goodbit.


⭐ Member Function Documentation

template<typename _CharT, typename _Traits> std::basic_istream< _CharT,
    _Traits >::sentry::operator bool () const [inline],  [explicit]

Quick status checking. πŸ‘€

Returns

  • The sentry state.

For ease of use, sentries may be converted to booleans. The return value is that of the sentry state (true == okay). obsessed with the simplicity honestly 🌈


🌷 Author

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


and that's the whole page bestie, no notes πŸ’– this came straight from the libstdc++ manual, same title, same std::basic...s >::sentry(3) energy β€” go forth and let your sentries guard your streams, periodt πŸ¦‹βœ¨πŸ‘‘

πŸ“¦ 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