33#ifndef _GLIBCXX_OSTREAM
34#define _GLIBCXX_OSTREAM 1
36#pragma GCC system_header
43namespace std _GLIBCXX_VISIBILITY(default)
45_GLIBCXX_BEGIN_NAMESPACE_VERSION
59 template<
typename _CharT,
typename _Traits>
64 typedef _CharT char_type;
65 typedef typename _Traits::int_type int_type;
66 typedef typename _Traits::pos_type pos_type;
67 typedef typename _Traits::off_type off_type;
68 typedef _Traits traits_type;
169 {
return _M_insert(__n); }
173 {
return _M_insert(__n); }
177 {
return _M_insert(__n); }
187 return _M_insert(
static_cast<unsigned long>(__n));
198 return _M_insert(
static_cast<unsigned long>(__n));
201#ifdef _GLIBCXX_USE_LONG_LONG
204 {
return _M_insert(__n); }
208 {
return _M_insert(__n); }
223 {
return _M_insert(__f); }
230 return _M_insert(
static_cast<double>(__f));
235 {
return _M_insert(__f); }
248 {
return _M_insert(__p); }
250#if __cplusplus >= 201703L
253 {
return *
this <<
"nullptr"; }
256#if __cplusplus > 202002L
257 __attribute__((__always_inline__))
260 {
return _M_insert(
const_cast<const void*
>(__p)); }
389#if __cplusplus >= 201103L
397 { __ios_type::move(__rhs); }
404 operator=(basic_ostream&& __rhs)
411 swap(basic_ostream& __rhs)
412 { __ios_type::swap(__rhs); }
415 template<
typename _ValueT>
417 _M_insert(_ValueT __v);
420#if !_GLIBCXX_INLINE_VERSION
422 _M_write(
const char_type* __s,
streamsize __n)
423 { std::__ostream_insert(*
this, __s, __n); }
434 template <
typename _CharT,
typename _Traits>
456#pragma GCC diagnostic push
457#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
471 if (_M_os.
rdbuf() && _M_os.
rdbuf()->pubsync() == -1)
475#pragma GCC diagnostic pop
484#if __cplusplus >= 201103L
487 operator bool()
const
507 template<
typename _CharT,
typename _Traits>
511 if (__out.
width() != 0)
512 return __ostream_insert(__out, &__c, 1);
517 template<
typename _CharT,
typename _Traits>
518 inline basic_ostream<_CharT, _Traits>&
519 operator<<(basic_ostream<_CharT, _Traits>& __out,
char __c)
520 {
return (__out << __out.widen(__c)); }
523 template<
typename _Traits>
524 inline basic_ostream<char, _Traits>&
525 operator<<(basic_ostream<char, _Traits>& __out,
char __c)
527 if (__out.width() != 0)
528 return __ostream_insert(__out, &__c, 1);
534 template<
typename _Traits>
535 inline basic_ostream<char, _Traits>&
536 operator<<(basic_ostream<char, _Traits>& __out,
signed char __c)
537 {
return (__out <<
static_cast<char>(__c)); }
539 template<
typename _Traits>
540 inline basic_ostream<char, _Traits>&
541 operator<<(basic_ostream<char, _Traits>& __out,
unsigned char __c)
542 {
return (__out <<
static_cast<char>(__c)); }
544#if __cplusplus > 201703L
548 template<
typename _Traits>
549 basic_ostream<char, _Traits>&
550 operator<<(basic_ostream<char, _Traits>&,
wchar_t) =
delete;
552#ifdef _GLIBCXX_USE_CHAR8_T
553 template<
typename _Traits>
554 basic_ostream<char, _Traits>&
555 operator<<(basic_ostream<char, _Traits>&,
char8_t) =
delete;
558 template<
typename _Traits>
559 basic_ostream<char, _Traits>&
560 operator<<(basic_ostream<char, _Traits>&,
char16_t) =
delete;
562 template<
typename _Traits>
563 basic_ostream<char, _Traits>&
564 operator<<(basic_ostream<char, _Traits>&,
char32_t) =
delete;
566#ifdef _GLIBCXX_USE_WCHAR_T
567#ifdef _GLIBCXX_USE_CHAR8_T
568 template<
typename _Traits>
569 basic_ostream<wchar_t, _Traits>&
570 operator<<(basic_ostream<wchar_t, _Traits>&,
char8_t) =
delete;
573 template<
typename _Traits>
574 basic_ostream<wchar_t, _Traits>&
575 operator<<(basic_ostream<wchar_t, _Traits>&,
char16_t) =
delete;
577 template<
typename _Traits>
578 basic_ostream<wchar_t, _Traits>&
579 operator<<(basic_ostream<wchar_t, _Traits>&,
char32_t) =
delete;
598 template<
typename _CharT,
typename _Traits>
599 inline basic_ostream<_CharT, _Traits>&
600 operator<<(basic_ostream<_CharT, _Traits>& __out,
const _CharT* __s)
605 __ostream_insert(__out, __s,
606 static_cast<streamsize>(_Traits::length(__s)));
610 template<
typename _CharT,
typename _Traits>
611 basic_ostream<_CharT, _Traits> &
612 operator<<(basic_ostream<_CharT, _Traits>& __out,
const char* __s);
615 template<
typename _Traits>
616 inline basic_ostream<char, _Traits>&
617 operator<<(basic_ostream<char, _Traits>& __out,
const char* __s)
622 __ostream_insert(__out, __s,
623 static_cast<streamsize>(_Traits::length(__s)));
628 template<
typename _Traits>
629 inline basic_ostream<char, _Traits>&
630 operator<<(basic_ostream<char, _Traits>& __out,
const signed char* __s)
631 {
return (__out <<
reinterpret_cast<const char*
>(__s)); }
633 template<
typename _Traits>
634 inline basic_ostream<char, _Traits> &
635 operator<<(basic_ostream<char, _Traits>& __out,
const unsigned char* __s)
636 {
return (__out <<
reinterpret_cast<const char*
>(__s)); }
638#if __cplusplus > 201703L
642 template<
typename _Traits>
643 basic_ostream<char, _Traits>&
644 operator<<(basic_ostream<char, _Traits>&,
const wchar_t*) =
delete;
646#ifdef _GLIBCXX_USE_CHAR8_T
647 template<
typename _Traits>
648 basic_ostream<char, _Traits>&
649 operator<<(basic_ostream<char, _Traits>&,
const char8_t*) =
delete;
652 template<
typename _Traits>
653 basic_ostream<char, _Traits>&
654 operator<<(basic_ostream<char, _Traits>&,
const char16_t*) =
delete;
656 template<
typename _Traits>
657 basic_ostream<char, _Traits>&
658 operator<<(basic_ostream<char, _Traits>&,
const char32_t*) =
delete;
660#ifdef _GLIBCXX_USE_WCHAR_T
661#ifdef _GLIBCXX_USE_CHAR8_T
662 template<
typename _Traits>
663 basic_ostream<wchar_t, _Traits>&
664 operator<<(basic_ostream<wchar_t, _Traits>&,
const char8_t*) =
delete;
667 template<
typename _Traits>
668 basic_ostream<wchar_t, _Traits>&
669 operator<<(basic_ostream<wchar_t, _Traits>&,
const char16_t*) =
delete;
671 template<
typename _Traits>
672 basic_ostream<wchar_t, _Traits>&
673 operator<<(basic_ostream<wchar_t, _Traits>&,
const char32_t*) =
delete;
688 template<
typename _CharT,
typename _Traits>
689 inline basic_ostream<_CharT, _Traits>&
700 template<
typename _CharT,
typename _Traits>
701 inline basic_ostream<_CharT, _Traits>&
703 {
return __os.
put(_CharT()); }
710 template<
typename _CharT,
typename _Traits>
711 inline basic_ostream<_CharT, _Traits>&
713 {
return __os.
flush(); }
715#if __cplusplus >= 201103L
720#if __cpp_lib_concepts
722 template<
typename _Tp>
723 concept __derived_from_ios_base = is_class_v<_Tp>
724 && (!is_same_v<_Tp, ios_base>)
725 &&
requires (_Tp* __t, ios_base* __b) { __b = __t; };
727 template<
typename _Os,
typename _Tp>
728 requires __derived_from_ios_base<_Os>
729 &&
requires (_Os& __os,
const _Tp& __t) { __os << __t; }
730 using __rvalue_stream_insertion_t = _Os&&;
732 template<
typename _Tp>
733 using _Require_derived_from_ios_base
734 = _Require<is_class<_Tp>, __not_<is_same<_Tp, ios_base>>,
735 is_convertible<typename add_pointer<_Tp>::type, ios_base*>>;
737 template<
typename _Os,
typename _Tp,
738 typename = _Require_derived_from_ios_base<_Os>,
740 =
decltype(std::declval<_Os&>() << std::declval<const _Tp&>())>
741 using __rvalue_stream_insertion_t = _Os&&;
754 template<
typename _Ostream,
typename _Tp>
755 inline __rvalue_stream_insertion_t<_Ostream, _Tp>
762#if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI
763 template<
typename _CharT,
typename _Traits>
764 class __syncbuf_base :
public basic_streambuf<_CharT, _Traits>
768 _S_get(basic_streambuf<_CharT, _Traits>* __buf [[maybe_unused]])
noexcept
771 if (
auto __p =
dynamic_cast<__syncbuf_base*
>(__buf))
772 return &__p->_M_emit_on_sync;
778 __syncbuf_base(basic_streambuf<_CharT, _Traits>* __w =
nullptr)
782 basic_streambuf<_CharT, _Traits>* _M_wrapped =
nullptr;
783 bool _M_emit_on_sync =
false;
784 bool _M_needs_sync =
false;
787 template<
typename _CharT,
typename _Traits>
788 inline basic_ostream<_CharT, _Traits>&
789 emit_on_flush(basic_ostream<_CharT, _Traits>& __os)
791 if (
bool* __flag = __syncbuf_base<_CharT, _Traits>::_S_get(__os.rdbuf()))
796 template<
typename _CharT,
typename _Traits>
797 inline basic_ostream<_CharT, _Traits>&
798 noemit_on_flush(basic_ostream<_CharT, _Traits>& __os)
800 if (
bool* __flag = __syncbuf_base<_CharT, _Traits>::_S_get(__os.rdbuf()))
805 template<
typename _CharT,
typename _Traits>
806 inline basic_ostream<_CharT, _Traits>&
807 flush_emit(basic_ostream<_CharT, _Traits>& __os)
811 ~_Restore() { *_M_flag = _M_prev; }
813 bool _M_prev =
false;
814 bool* _M_flag = &_M_prev;
817 if (
bool* __flag = __syncbuf_base<_CharT, _Traits>::_S_get(__os.rdbuf()))
819 __restore._M_prev = *__flag;
820 __restore._M_flag = __flag;
832_GLIBCXX_END_NAMESPACE_VERSION
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.
basic_ostream< _CharT, _Traits > & ends(basic_ostream< _CharT, _Traits > &__os)
Write a null character into the output sequence.
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
Write a newline and flush the stream.
basic_ostream< _CharT, _Traits > & flush(basic_ostream< _CharT, _Traits > &__os)
Flushes the output stream.
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_ios, virtual base class for all stream classes.
void setstate(iostate __state)
Sets additional flags in the error state.
void init(basic_streambuf< _CharT, _Traits > *__sb)
All setup is performed here.
char_type widen(char __c) const
Widens characters.
basic_streambuf< _CharT, _Traits > * rdbuf() const
Accessing the underlying buffer.
The actual work of input and output (interface).
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 & 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.
Performs setup work for output streams.
~sentry()
Possibly flushes the stream.
The base of the I/O class hierarchy.
fmtflags flags() const
Access to format flags.
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.
Primary class template ctype facet.
Primary class template num_put.