Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
std::ios_base::Init(3)	      C++ Standard Libary	std::ios_base::Init(3)

NAME
       std::ios_base::Init - std::ios_base::Init

Synopsis
	  class	Init;

	  This class is	used to	ensure that the	default	C++ streams (std::cin,
       std::cout,
	  etc.)	 are properly initialized and destructed. The class tracks how
       many instances
	  of it	are created and	initializes the	C++ streams when the first in-
       stance is
	  constructed as well as flushes the output streams when the last  in-
       stance is
	  destructed.

	  The  header  <iostream>  behaves as if it defines (directly or indi-
       rectly) an instance
	  of std::ios_base::Init with static storage duration: this  makes  it
       safe to access
	  the standard I/O streams in the constructors and destructors of sta-
       tic objects with
	  ordered  initialization  (as	long  as <iostream> is included	in the
       translation unit
	  before these objects were defined).

	  Each C++ library module in a hosted implementation behaves as	if it
	  contains an interface	unit that defines an unexported
	  std::ios_base::Init variable with ordered initialization.
										 (since
       C++23)
	  As a result, the definition of that variable is appearance-ordered
	  before any declaration following the point of	importation of a C++
	  library module. Whether such a definition exists is unobservable  by
       a
	  program  that	 does  not  reference any of the standard iostream ob-
       jects.

Member functions
	  constructor	initializes the	default	C++ streams if they  have  not
       been created yet
			(public	member function)
			flushes	 the  default C++ streams if *this is the last
       instance	to be
	  destructor	destroyed
			(public	member function)

	  Defect reports

	  The following	behavior-changing defect reports were applied retroac-
       tively to
	  previously published C++ standards.

	     DR	      Applied	 to		 Behavior     as     published
       Correct behavior
			      the behaviors of the constructor and the
	  LWG  1123  C++98	 destructor				   re-
       moved the dependency
			      depend on	an exposition-only static data
			      member init_cnt

See also
	  cin	reads from the standard	C input	stream stdin
	  wcin	(global	object)
	  cout	writes to the standard C output	stream stdout
	  wcout	(global	object)
	  cerr	writes to the standard C error stream stderr, unbuffered
	  wcerr	(global	object)
	  clog	writes to the standard C error stream stderr
	  wclog	(global	object)

http://cppreference.com		  2024.06.10		std::ios_base::Init(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::ios_base::Init&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help