33 #ifndef _GLIBCXX_OSTREAM 34 #define _GLIBCXX_OSTREAM 1 36 #pragma GCC system_header 41 namespace std _GLIBCXX_VISIBILITY(default)
43 _GLIBCXX_BEGIN_NAMESPACE_VERSION
57 template<
typename _CharT,
typename _Traits>
58 class basic_ostream :
virtual public basic_ios<_CharT, _Traits>
62 typedef _CharT char_type;
63 typedef typename _Traits::int_type int_type;
64 typedef typename _Traits::pos_type pos_type;
65 typedef typename _Traits::off_type off_type;
66 typedef _Traits traits_type;
69 typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
70 typedef basic_ios<_CharT, _Traits> __ios_type;
71 typedef basic_ostream<_CharT, _Traits> __ostream_type;
72 typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> >
74 typedef ctype<_CharT> __ctype_type;
167 {
return _M_insert(__n); }
171 {
return _M_insert(__n); }
175 {
return _M_insert(__n); }
185 return _M_insert(static_cast<unsigned long>(__n));
196 return _M_insert(static_cast<unsigned long>(__n));
199 #ifdef _GLIBCXX_USE_LONG_LONG 202 {
return _M_insert(__n); }
206 {
return _M_insert(__n); }
221 {
return _M_insert(__f); }
228 return _M_insert(static_cast<double>(__f));
233 {
return _M_insert(__f); }
246 {
return _M_insert(__p); }
248 #if __cplusplus >= 201703L 251 {
return *
this <<
"nullptr"; }
387 seekp(off_type, ios_base::seekdir);
393 #if __cplusplus >= 201103L 401 { __ios_type::move(__rhs); }
416 { __ios_type::swap(__rhs); }
419 template<
typename _ValueT>
421 _M_insert(_ValueT __v);
431 template <
typename _CharT,
typename _Traits>
453 #pragma GCC diagnostic push 454 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 468 if (_M_os.rdbuf() && _M_os.rdbuf()->pubsync() == -1)
472 #pragma GCC diagnostic pop 481 #if __cplusplus >= 201103L 484 operator bool()
const 504 template<
typename _CharT,
typename _Traits>
506 operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
507 {
return __ostream_insert(__out, &__c, 1); }
509 template<
typename _CharT,
typename _Traits>
511 operator<<(basic_ostream<_CharT, _Traits>& __out,
char __c)
512 {
return (__out << __out.widen(__c)); }
515 template <
class _Traits>
517 operator<<(basic_ostream<char, _Traits>& __out,
char __c)
518 {
return __ostream_insert(__out, &__c, 1); }
521 template<
class _Traits>
523 operator<<(basic_ostream<char, _Traits>& __out,
signed char __c)
524 {
return (__out << static_cast<char>(__c)); }
526 template<
class _Traits>
528 operator<<(basic_ostream<char, _Traits>& __out,
unsigned char __c)
529 {
return (__out << static_cast<char>(__c)); }
546 template<
typename _CharT,
typename _Traits>
548 operator<<(basic_ostream<_CharT, _Traits>& __out,
const _CharT* __s)
553 __ostream_insert(__out, __s,
554 static_cast<streamsize>(_Traits::length(__s)));
558 template<
typename _CharT,
typename _Traits>
560 operator<<(basic_ostream<_CharT, _Traits>& __out,
const char* __s);
563 template<
class _Traits>
565 operator<<(basic_ostream<char, _Traits>& __out,
const char* __s)
570 __ostream_insert(__out, __s,
571 static_cast<streamsize>(_Traits::length(__s)));
576 template<
class _Traits>
578 operator<<(basic_ostream<char, _Traits>& __out,
const signed char* __s)
579 {
return (__out << reinterpret_cast<const char*>(__s)); }
581 template<
class _Traits>
583 operator<<(basic_ostream<char, _Traits>& __out,
const unsigned char* __s)
584 {
return (__out << reinterpret_cast<const char*>(__s)); }
597 template<
typename _CharT,
typename _Traits>
600 {
return flush(__os.put(__os.widen(
'\n'))); }
609 template<
typename _CharT,
typename _Traits>
612 {
return __os.put(_CharT()); }
619 template<
typename _CharT,
typename _Traits>
622 {
return __os.flush(); }
624 #if __cplusplus >= 201103L 625 template<
typename _Ch,
typename _Up>
629 template<
typename _Tp,
typename =
void>
630 struct __is_convertible_to_basic_ostream_impl
632 using __ostream_type = void;
635 template<
typename _Tp>
636 using __do_is_convertible_to_basic_ostream_impl =
637 decltype(__is_convertible_to_basic_ostream_test
638 (declval<
typename remove_reference<_Tp>::type*>()));
640 template<
typename _Tp>
641 struct __is_convertible_to_basic_ostream_impl
643 __void_t<__do_is_convertible_to_basic_ostream_impl<_Tp>>>
645 using __ostream_type =
646 __do_is_convertible_to_basic_ostream_impl<_Tp>;
649 template<
typename _Tp>
650 struct __is_convertible_to_basic_ostream
651 : __is_convertible_to_basic_ostream_impl<_Tp>
655 typename __is_convertible_to_basic_ostream_impl<_Tp>::__ostream_type>>;
656 constexpr
static bool value = type::value;
659 template<
typename _Ostream,
typename _Tp,
typename =
void>
662 template<
typename _Ostream,
typename _Tp>
663 struct __is_insertable<_Ostream, _Tp,
664 __void_t<decltype(declval<_Ostream&>()
665 << declval<const _Tp&>())>>
668 template<
typename _Ostream>
669 using __rvalue_ostream_type =
670 typename __is_convertible_to_basic_ostream<
671 _Ostream>::__ostream_type;
683 template<
typename _Ostream,
typename _Tp>
686 __is_convertible_to_basic_ostream<_Ostream>,
688 __rvalue_ostream_type<_Ostream>,
690 __rvalue_ostream_type<_Ostream>>::type
693 __rvalue_ostream_type<_Ostream> __ret_os = __os;
699 _GLIBCXX_END_NAMESPACE_VERSION
__ostream_type & operator<<(__ostream_type &(*__pf)(__ostream_type &))
Interface for manipulators.
Define a member typedef type only if a boolean constant is true.
static const iostate badbit
Indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error fro...
void _M_write(const char_type *__s, streamsize __n)
Core write functionality, without sentry.
basic_ostream< _CharT, _Traits > & ends(basic_ostream< _CharT, _Traits > &__os)
Write a null character into the output sequence.
basic_ostream(__streambuf_type *__sb)
Base constructor.
The base of the I/O class hierarchy.This class defines everything that can be defined about I/O that ...
ISO C++ entities toplevel namespace is std.
Template class basic_iostream.
Performs setup work for output streams.
void setstate(iostate __state)
Sets additional flags in the error state.
Template class basic_ostream.
_GLIBCXX17_DEPRECATED bool uncaught_exception() noexcept __attribute__((__pure__))
__ostream_type & put(char_type __c)
Simple insertion.
virtual ~basic_ostream()
Base destructor.
~sentry()
Possibly flushes the stream.
__ostream_type & flush()
Synchronizing the stream buffer.
static const fmtflags unitbuf
Flushes output after each output operation.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
void init(basic_streambuf< _CharT, _Traits > *__sb)
All setup is performed here.
__ostream_type & seekp(pos_type)
Changing the current write position.
basic_streambuf< _CharT, _Traits > * rdbuf() const
Accessing the underlying buffer.
pos_type tellp()
Getting the current write position.
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
Write a newline and flush the stream.
__ostream_type & write(const char_type *__s, streamsize __n)
Character string insertion.