34#ifndef _GLIBCXX_OSTREAM_H
35#define _GLIBCXX_OSTREAM_H 1
38#pragma GCC system_header
43#include <bits/iosfwd.h>
51# define __glibcxx_want_print
54namespace std _GLIBCXX_VISIBILITY(default)
56_GLIBCXX_BEGIN_NAMESPACE_VERSION
70 template<
typename _CharT,
typename _Traits>
75 typedef _CharT char_type;
76 typedef typename _Traits::int_type int_type;
77 typedef typename _Traits::pos_type pos_type;
78 typedef typename _Traits::off_type off_type;
79 typedef _Traits traits_type;
121 operator<<(__ostream_type& (*__pf)(__ostream_type&))
180 {
return _M_insert(__n); }
184 {
return _M_insert(__n); }
188 {
return _M_insert(__n); }
198 return _M_insert(
static_cast<unsigned long>(__n));
209 return _M_insert(
static_cast<unsigned long>(__n));
212#ifdef _GLIBCXX_USE_LONG_LONG
213#pragma GCC diagnostic push
214#pragma GCC diagnostic ignored "-Wlong-long"
217 {
return _M_insert(__n); }
221 {
return _M_insert(__n); }
222#pragma GCC diagnostic pop
237 {
return _M_insert(__f); }
244 return _M_insert(_S_cast_flt<double>(__f));
249 {
return _M_insert(__f); }
252#if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
253 __attribute__((__always_inline__))
257 return _M_insert(_S_cast_flt<double>(__f));
261#if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
262 __attribute__((__always_inline__))
266 return _M_insert(_S_cast_flt<double>(__f));
270#if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
271 __attribute__((__always_inline__))
275 return _M_insert(_S_cast_flt<double>(__f));
279#if defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128)
280 __attribute__((__always_inline__))
284 return _M_insert(_S_cast_flt<long double>(__f));
288#if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
289 __attribute__((__always_inline__))
293 return _M_insert(_S_cast_flt<double>(__f));
307 {
return _M_insert(__p); }
309#if __cplusplus >= 201703L
312 {
return *
this <<
"nullptr"; }
315#if __cplusplus > 202002L
316 __attribute__((__always_inline__))
319 {
return _M_insert(
const_cast<const void*
>(__p)); }
448#if __cplusplus >= 201103L
456 { __ios_type::move(__rhs); }
471 { __ios_type::swap(__rhs); }
474 template<
typename _ValueT>
476 _M_insert(_ValueT __v);
479#if !_GLIBCXX_INLINE_VERSION
481 _M_write(
const char_type* __s,
streamsize __n)
482 { std::__ostream_insert(*
this, __s, __n); }
485#pragma GCC diagnostic push
486#pragma GCC diagnostic ignored "-Wc++17-extensions"
487 template<
typename _To,
typename _From>
489 _S_cast_flt(_From __f)
491 _To __d =
static_cast<_To
>(__f);
496#if __cpp_constexpr && __has_builtin(__builtin_bit_cast)
497 if constexpr (
sizeof(__f) ==
sizeof(short))
498 __sign =
static_cast<_To
>(__builtin_bit_cast(
short, __f));
499 else if constexpr (
sizeof(__f) ==
sizeof(int))
500 __sign =
static_cast<_To
>(__builtin_bit_cast(
int, __f));
501 else if constexpr (
sizeof(__f) ==
sizeof(
long long))
502 __sign =
static_cast<_To
>(__builtin_bit_cast(
long long, __f));
505 __sign = __builtin_signbit(__f) ? _To(-1.0) : _To(+1.0);
507 if _GLIBCXX_CONSTEXPR (__is_same(_To,
double))
508 __d = __builtin_copysign(__d, __sign);
509 else if _GLIBCXX_CONSTEXPR (__is_same(_To,
long double))
510 __d = __builtin_copysignl(__d, __sign);
514#pragma GCC diagnostic pop
517 struct _Disable_exceptions
520 : _M_os(__os), _M_exception(_M_os._M_exception)
523 ~_Disable_exceptions()
524 { _M_os._M_exception = _M_exception; }
526#pragma GCC diagnostic push
527#pragma GCC diagnostic ignored "-Wc++11-extensions"
528 _Disable_exceptions(
const _Disable_exceptions&) =
delete;
529 _Disable_exceptions& operator=(
const _Disable_exceptions&) =
delete;
530#pragma GCC diagnostic pop
545 template <
typename _CharT,
typename _Traits>
567#pragma GCC diagnostic push
568#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
585 _Disable_exceptions __noex(_M_os);
590 if (_M_os.rdbuf() && _M_os.rdbuf()->pubsync() == -1)
597#pragma GCC diagnostic pop
606#if __cplusplus >= 201103L
609 operator bool()
const
629 template<
typename _CharT,
typename _Traits>
633 if (__out.
width() != 0)
634 return __ostream_insert(__out, &__c, 1);
639 template<
typename _CharT,
typename _Traits>
640 inline basic_ostream<_CharT, _Traits>&
641 operator<<(basic_ostream<_CharT, _Traits>& __out,
char __c)
642 {
return (__out << __out.widen(__c)); }
645 template<
typename _Traits>
649 if (__out.width() != 0)
650 return __ostream_insert(__out, &__c, 1);
656 template<
typename _Traits>
659 {
return (__out <<
static_cast<char>(__c)); }
661 template<
typename _Traits>
664 {
return (__out <<
static_cast<char>(__c)); }
667#if __cplusplus > 201703L
671 template<
typename _Traits>
675#ifdef _GLIBCXX_USE_CHAR8_T
676 template<
typename _Traits>
681 template<
typename _Traits>
685 template<
typename _Traits>
689#ifdef _GLIBCXX_USE_WCHAR_T
690#ifdef _GLIBCXX_USE_CHAR8_T
691 template<
typename _Traits>
696 template<
typename _Traits>
700 template<
typename _Traits>
720 template<
typename _CharT,
typename _Traits>
727 __ostream_insert(__out, __s,
728 static_cast<streamsize>(_Traits::length(__s)));
732 template<
typename _CharT,
typename _Traits>
737 template<
typename _Traits>
744 __ostream_insert(__out, __s,
745 static_cast<streamsize>(_Traits::length(__s)));
750 template<
typename _Traits>
753 {
return (__out <<
reinterpret_cast<const char*
>(__s)); }
755 template<
typename _Traits>
758 {
return (__out <<
reinterpret_cast<const char*
>(__s)); }
761#if __cplusplus > 201703L
765 template<
typename _Traits>
769#ifdef _GLIBCXX_USE_CHAR8_T
770 template<
typename _Traits>
775 template<
typename _Traits>
779 template<
typename _Traits>
783#ifdef _GLIBCXX_USE_WCHAR_T
784#ifdef _GLIBCXX_USE_CHAR8_T
785 template<
typename _Traits>
790 template<
typename _Traits>
794 template<
typename _Traits>
800#if __cplusplus >= 201103L
805#if __cpp_concepts >= 201907L && __glibcxx_type_trait_variable_templates
807 template<
typename _Tp>
808 concept __derived_from_ios_base = is_class_v<_Tp>
809 && (!is_same_v<_Tp, ios_base>)
810 &&
requires (_Tp* __t,
ios_base* __b) { __b = __t; };
812 template<
typename _Os,
typename _Tp>
813 requires __derived_from_ios_base<_Os>
814 &&
requires (_Os& __os,
const _Tp& __t) { __os << __t; }
815 using __rvalue_stream_insertion_t = _Os&&;
817 template<
typename _Tp>
818 using _Require_derived_from_ios_base
819 = _Require<is_class<_Tp>, __not_<is_same<_Tp, ios_base>>,
820 is_convertible<typename add_pointer<_Tp>::type,
ios_base*>>;
822 template<
typename _Os,
typename _Tp,
823 typename = _Require_derived_from_ios_base<_Os>,
826 using __rvalue_stream_insertion_t = _Os&&;
839 template<
typename _Ostream,
typename _Tp>
840 inline __rvalue_stream_insertion_t<_Ostream, _Tp>
848_GLIBCXX_END_NAMESPACE_VERSION
auto declval() noexcept -> decltype(__declval< _Tp >(0))
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
bool uncaught_exception() noexcept
ISO C++ entities toplevel namespace is std.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const bitset< _Nb > &__x)
Global I/O operators for bitsets.
Template class basic_iostream.
The actual work of input and output (interface).
void setstate(iostate __state)
Sets additional flags in the error state.
void init(basic_streambuf< _CharT, _Traits > *__sb)
All setup is performed here.
basic_ios(basic_streambuf< _CharT, _Traits > *__sb)
Constructor performs initialization.
The base of the I/O class hierarchy.
_Ios_Iostate iostate
This is a bitmask type.
static const iostate goodbit
Indicates all is well.
static const fmtflags unitbuf
Flushes output after each output operation.
static const iostate badbit
Indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error fro...
streamsize width() const
Flags access.
_Ios_Seekdir seekdir
This is an enumerated type.
Template class basic_ostream.
__ostream_type & write(const char_type *__s, streamsize __n)
Character string insertion.
pos_type tellp()
Getting the current write position.
__ostream_type & seekp(off_type, ios_base::seekdir)
Changing the current write position.
__ostream_type & put(char_type __c)
Simple insertion.
basic_ostream(__streambuf_type *__sb)
Base constructor.
__ostream_type & flush()
Synchronizing the stream buffer.
__ostream_type & seekp(pos_type)
Changing the current write position.
virtual ~basic_ostream()
Base destructor.
__ostream_type & operator<<(__ostream_type &(*__pf)(__ostream_type &))
Interface for manipulators.
Primary class template ctype facet.
Primary class template num_put.
~sentry()
Possibly flushes the stream.
sentry(basic_ostream< _CharT, _Traits > &__os)
The constructor performs preparatory work.