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 395 { __ios_type::move(__rhs); }
410 { __ios_type::swap(__rhs); }
413 template<
typename _ValueT>
415 _M_insert(_ValueT __v);
425 template <
typename _CharT,
typename _Traits>
460 if (_M_os.rdbuf() && _M_os.rdbuf()->pubsync() == -1)
472 #if __cplusplus >= 201103L 475 operator bool()
const 495 template<
typename _CharT,
typename _Traits>
497 operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
498 {
return __ostream_insert(__out, &__c, 1); }
500 template<
typename _CharT,
typename _Traits>
502 operator<<(basic_ostream<_CharT, _Traits>& __out,
char __c)
503 {
return (__out << __out.widen(__c)); }
506 template <
class _Traits>
508 operator<<(basic_ostream<char, _Traits>& __out,
char __c)
509 {
return __ostream_insert(__out, &__c, 1); }
512 template<
class _Traits>
514 operator<<(basic_ostream<char, _Traits>& __out,
signed char __c)
515 {
return (__out << static_cast<char>(__c)); }
517 template<
class _Traits>
519 operator<<(basic_ostream<char, _Traits>& __out,
unsigned char __c)
520 {
return (__out << static_cast<char>(__c)); }
537 template<
typename _CharT,
typename _Traits>
539 operator<<(basic_ostream<_CharT, _Traits>& __out,
const _CharT* __s)
544 __ostream_insert(__out, __s,
545 static_cast<streamsize>(_Traits::length(__s)));
549 template<
typename _CharT,
typename _Traits>
551 operator<<(basic_ostream<_CharT, _Traits>& __out,
const char* __s);
554 template<
class _Traits>
556 operator<<(basic_ostream<char, _Traits>& __out,
const char* __s)
561 __ostream_insert(__out, __s,
562 static_cast<streamsize>(_Traits::length(__s)));
567 template<
class _Traits>
569 operator<<(basic_ostream<char, _Traits>& __out,
const signed char* __s)
570 {
return (__out << reinterpret_cast<const char*>(__s)); }
572 template<
class _Traits>
574 operator<<(basic_ostream<char, _Traits>& __out,
const unsigned char* __s)
575 {
return (__out << reinterpret_cast<const char*>(__s)); }
588 template<
typename _CharT,
typename _Traits>
591 {
return flush(__os.put(__os.widen(
'\n'))); }
600 template<
typename _CharT,
typename _Traits>
603 {
return __os.put(_CharT()); }
610 template<
typename _CharT,
typename _Traits>
613 {
return __os.flush(); }
615 #if __cplusplus >= 201103L 616 template<
typename _Tp>
617 struct __is_convertible_to_basic_ostream
619 template<
typename _Ch,
typename _Up>
622 static void __check(...);
625 decltype(__check(declval<
typename remove_reference<_Tp>::type*>()));
626 using type = __not_<is_same<ostream_type, void>>;
627 constexpr
static bool value = type::value;
630 template<
typename _Ostream,
typename _Tp,
typename =
void>
633 template<
typename _Ostream,
typename _Tp>
634 struct __is_insertable<_Ostream, _Tp,
635 __void_t<decltype(declval<_Ostream&>()
636 << declval<const _Tp&>())>>
649 template<
typename _Ostream,
typename _Tp>
651 typename enable_if<__and_<__not_<is_lvalue_reference<_Ostream>>,
652 __is_convertible_to_basic_ostream<_Ostream>,
653 __is_insertable<_Ostream&, const _Tp&>>::value,
654 typename __is_convertible_to_basic_ostream<
655 _Ostream>::ostream_type>::type
663 _GLIBCXX_END_NAMESPACE_VERSION
__ostream_type & flush()
Synchronizing the stream buffer.
Template class basic_iostream.
bool uncaught_exception() noexcept __attribute__((__pure__))
~sentry()
Possibly flushes the stream.
void setstate(iostate __state)
Sets additional flags in the error state.
basic_ostream< _CharT, _Traits > & ends(basic_ostream< _CharT, _Traits > &__os)
Write a null character into the output sequence.
ISO C++ entities toplevel namespace is std.
Performs setup work for output streams.
void init(basic_streambuf< _CharT, _Traits > *__sb)
All setup is performed here.
virtual ~basic_ostream()
Base destructor.
static const fmtflags unitbuf
Flushes output after each output operation.
Template class basic_ostream.
__ostream_type & seekp(pos_type)
Changing the current write position.
basic_ostream(__streambuf_type *__sb)
Base constructor.
basic_streambuf< _CharT, _Traits > * rdbuf() const
Accessing the underlying buffer.
static const iostate badbit
Indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error fro...
__ostream_type & write(const char_type *__s, streamsize __n)
Character string insertion.
__ostream_type & operator<<(__ostream_type &(*__pf)(__ostream_type &))
Interface for manipulators.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
void _M_write(const char_type *__s, streamsize __n)
Core write functionality, without sentry.
__ostream_type & put(char_type __c)
Simple insertion.
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
Write a newline and flush the stream.
pos_type tellp()
Getting the current write position.
The base of the I/O class hierarchy.This class defines everything that can be defined about I/O that ...