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); }
381 seekp(off_type, ios_base::seekdir);
387 #if __cplusplus >= 201103L
389 basic_ostream(basic_iostream<_CharT, _Traits>&) { }
395 { __ios_type::move(__rhs); }
402 operator=(basic_ostream&& __rhs)
409 swap(basic_ostream& __rhs)
410 { __ios_type::swap(__rhs); }
413 template<
typename _ValueT>
415 _M_insert(_ValueT __v);
425 template <
typename _CharT,
typename _Traits>
447 #pragma GCC diagnostic push
448 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
462 if (_M_os.rdbuf() && _M_os.rdbuf()->pubsync() == -1)
466 #pragma GCC diagnostic pop
475 #if __cplusplus >= 201103L
478 operator bool()
const
498 template<
typename _CharT,
typename _Traits>
500 operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
501 {
return __ostream_insert(__out, &__c, 1); }
503 template<
typename _CharT,
typename _Traits>
504 inline basic_ostream<_CharT, _Traits>&
505 operator<<(basic_ostream<_CharT, _Traits>& __out,
char __c)
506 {
return (__out << __out.widen(__c)); }
509 template <
class _Traits>
510 inline basic_ostream<char, _Traits>&
511 operator<<(basic_ostream<char, _Traits>& __out,
char __c)
512 {
return __ostream_insert(__out, &__c, 1); }
515 template<
class _Traits>
516 inline basic_ostream<char, _Traits>&
517 operator<<(basic_ostream<char, _Traits>& __out,
signed char __c)
518 {
return (__out << static_cast<char>(__c)); }
520 template<
class _Traits>
521 inline basic_ostream<char, _Traits>&
522 operator<<(basic_ostream<char, _Traits>& __out,
unsigned char __c)
523 {
return (__out << static_cast<char>(__c)); }
540 template<
typename _CharT,
typename _Traits>
541 inline basic_ostream<_CharT, _Traits>&
542 operator<<(basic_ostream<_CharT, _Traits>& __out,
const _CharT* __s)
547 __ostream_insert(__out, __s,
548 static_cast<streamsize>(_Traits::length(__s)));
552 template<
typename _CharT,
typename _Traits>
553 basic_ostream<_CharT, _Traits> &
554 operator<<(basic_ostream<_CharT, _Traits>& __out,
const char* __s);
557 template<
class _Traits>
558 inline basic_ostream<char, _Traits>&
559 operator<<(basic_ostream<char, _Traits>& __out,
const char* __s)
564 __ostream_insert(__out, __s,
565 static_cast<streamsize>(_Traits::length(__s)));
570 template<
class _Traits>
571 inline basic_ostream<char, _Traits>&
572 operator<<(basic_ostream<char, _Traits>& __out,
const signed char* __s)
573 {
return (__out << reinterpret_cast<const char*>(__s)); }
575 template<
class _Traits>
576 inline basic_ostream<char, _Traits> &
577 operator<<(basic_ostream<char, _Traits>& __out,
const unsigned char* __s)
578 {
return (__out << reinterpret_cast<const char*>(__s)); }
591 template<
typename _CharT,
typename _Traits>
592 inline basic_ostream<_CharT, _Traits>&
594 {
return flush(__os.put(__os.widen(
'\n'))); }
603 template<
typename _CharT,
typename _Traits>
604 inline basic_ostream<_CharT, _Traits>&
606 {
return __os.put(_CharT()); }
613 template<
typename _CharT,
typename _Traits>
614 inline basic_ostream<_CharT, _Traits>&
616 {
return __os.flush(); }
618 #if __cplusplus >= 201103L
619 template<
typename _Ch,
typename _Up>
620 basic_ostream<_Ch, _Up>&
621 __is_convertible_to_basic_ostream_test(basic_ostream<_Ch, _Up>*);
623 template<
typename _Tp,
typename =
void>
624 struct __is_convertible_to_basic_ostream_impl
626 using __ostream_type = void;
629 template<
typename _Tp>
630 using __do_is_convertible_to_basic_ostream_impl =
631 decltype(__is_convertible_to_basic_ostream_test
632 (declval<
typename remove_reference<_Tp>::type*>()));
634 template<
typename _Tp>
635 struct __is_convertible_to_basic_ostream_impl
637 __void_t<__do_is_convertible_to_basic_ostream_impl<_Tp>>>
639 using __ostream_type =
640 __do_is_convertible_to_basic_ostream_impl<_Tp>;
643 template<
typename _Tp>
644 struct __is_convertible_to_basic_ostream
645 : __is_convertible_to_basic_ostream_impl<_Tp>
648 using type = __not_<is_void<
649 typename __is_convertible_to_basic_ostream_impl<_Tp>::__ostream_type>>;
650 constexpr
static bool value = type::value;
653 template<
typename _Ostream,
typename _Tp,
typename =
void>
656 template<
typename _Ostream,
typename _Tp>
657 struct __is_insertable<_Ostream, _Tp,
658 __void_t<decltype(declval<_Ostream&>()
659 << declval<const _Tp&>())>>
662 template<
typename _Ostream>
663 using __rvalue_ostream_type =
664 typename __is_convertible_to_basic_ostream<
665 _Ostream>::__ostream_type;
677 template<
typename _Ostream,
typename _Tp>
679 typename enable_if<__and_<__not_<is_lvalue_reference<_Ostream>>,
680 __is_convertible_to_basic_ostream<_Ostream>,
682 __rvalue_ostream_type<_Ostream>,
684 __rvalue_ostream_type<_Ostream>>::type
687 __rvalue_ostream_type<_Ostream> __ret_os = __os;
693 _GLIBCXX_END_NAMESPACE_VERSION
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...
__ostream_type & seekp(pos_type)
Changing the current write position.
std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const bitset< _Nb > &__x)
Global I/O operators for bitsets.
Performs setup work for output streams.
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
Write a newline and flush the stream.
__ostream_type & put(char_type __c)
Simple insertion.
The base of the I/O class hierarchy.This class defines everything that can be defined about I/O that ...
_GLIBCXX17_DEPRECATED bool uncaught_exception() noexcept __attribute__((__pure__))
basic_ostream(__streambuf_type *__sb)
Base constructor.
integral_constant< bool, false > false_type
The type used as a compile-time boolean with false value.
basic_streambuf< _CharT, _Traits > * rdbuf() const
Accessing the underlying buffer.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
__ostream_type & operator<<(__ostream_type &(*__pf)(__ostream_type &))
Interface for manipulators.
basic_ostream< _CharT, _Traits > & ends(basic_ostream< _CharT, _Traits > &__os)
Write a null character into the output sequence.
__ostream_type & write(const char_type *__s, streamsize __n)
Character string insertion.
pos_type tellp()
Getting the current write position.
basic_ostream< _CharT, _Traits > & flush(basic_ostream< _CharT, _Traits > &__os)
Flushes the output stream.
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
void setstate(iostate __state)
Sets additional flags in the error state.
void _M_write(const char_type *__s, streamsize __n)
Core write functionality, without sentry.
void init(basic_streambuf< _CharT, _Traits > *__sb)
All setup is performed here.
__ostream_type & flush()
Synchronizing the stream buffer.
~sentry()
Possibly flushes the stream.
virtual ~basic_ostream()
Base destructor.