14684ddb6SLionel Sambuc// -*- C++ -*- 24684ddb6SLionel Sambuc//===-------------------------- ostream -----------------------------------===// 34684ddb6SLionel Sambuc// 44684ddb6SLionel Sambuc// The LLVM Compiler Infrastructure 54684ddb6SLionel Sambuc// 64684ddb6SLionel Sambuc// This file is dual licensed under the MIT and the University of Illinois Open 74684ddb6SLionel Sambuc// Source Licenses. See LICENSE.TXT for details. 84684ddb6SLionel Sambuc// 94684ddb6SLionel Sambuc//===----------------------------------------------------------------------===// 104684ddb6SLionel Sambuc 114684ddb6SLionel Sambuc#ifndef _LIBCPP_OSTREAM 124684ddb6SLionel Sambuc#define _LIBCPP_OSTREAM 134684ddb6SLionel Sambuc 144684ddb6SLionel Sambuc/* 154684ddb6SLionel Sambuc ostream synopsis 164684ddb6SLionel Sambuc 174684ddb6SLionel Sambuctemplate <class charT, class traits = char_traits<charT> > 184684ddb6SLionel Sambucclass basic_ostream 194684ddb6SLionel Sambuc : virtual public basic_ios<charT,traits> 204684ddb6SLionel Sambuc{ 214684ddb6SLionel Sambucpublic: 224684ddb6SLionel Sambuc // types (inherited from basic_ios (27.5.4)): 234684ddb6SLionel Sambuc typedef charT char_type; 244684ddb6SLionel Sambuc typedef traits traits_type; 254684ddb6SLionel Sambuc typedef typename traits_type::int_type int_type; 264684ddb6SLionel Sambuc typedef typename traits_type::pos_type pos_type; 274684ddb6SLionel Sambuc typedef typename traits_type::off_type off_type; 284684ddb6SLionel Sambuc 294684ddb6SLionel Sambuc // 27.7.2.2 Constructor/destructor: 304684ddb6SLionel Sambuc explicit basic_ostream(basic_streambuf<char_type,traits>* sb); 314684ddb6SLionel Sambuc basic_ostream(basic_ostream&& rhs); 324684ddb6SLionel Sambuc virtual ~basic_ostream(); 334684ddb6SLionel Sambuc 344684ddb6SLionel Sambuc // 27.7.2.3 Assign/swap 354684ddb6SLionel Sambuc basic_ostream& operator=(const basic_ostream& rhs) = delete; // C++14 364684ddb6SLionel Sambuc basic_ostream& operator=(basic_ostream&& rhs); 374684ddb6SLionel Sambuc void swap(basic_ostream& rhs); 384684ddb6SLionel Sambuc 394684ddb6SLionel Sambuc // 27.7.2.4 Prefix/suffix: 404684ddb6SLionel Sambuc class sentry; 414684ddb6SLionel Sambuc 424684ddb6SLionel Sambuc // 27.7.2.6 Formatted output: 434684ddb6SLionel Sambuc basic_ostream& operator<<(basic_ostream& (*pf)(basic_ostream&)); 444684ddb6SLionel Sambuc basic_ostream& operator<<(basic_ios<charT, traits>& (*pf)(basic_ios<charT,traits>&)); 454684ddb6SLionel Sambuc basic_ostream& operator<<(ios_base& (*pf)(ios_base&)); 464684ddb6SLionel Sambuc basic_ostream& operator<<(bool n); 474684ddb6SLionel Sambuc basic_ostream& operator<<(short n); 484684ddb6SLionel Sambuc basic_ostream& operator<<(unsigned short n); 494684ddb6SLionel Sambuc basic_ostream& operator<<(int n); 504684ddb6SLionel Sambuc basic_ostream& operator<<(unsigned int n); 514684ddb6SLionel Sambuc basic_ostream& operator<<(long n); 524684ddb6SLionel Sambuc basic_ostream& operator<<(unsigned long n); 534684ddb6SLionel Sambuc basic_ostream& operator<<(long long n); 544684ddb6SLionel Sambuc basic_ostream& operator<<(unsigned long long n); 554684ddb6SLionel Sambuc basic_ostream& operator<<(float f); 564684ddb6SLionel Sambuc basic_ostream& operator<<(double f); 574684ddb6SLionel Sambuc basic_ostream& operator<<(long double f); 584684ddb6SLionel Sambuc basic_ostream& operator<<(const void* p); 594684ddb6SLionel Sambuc basic_ostream& operator<<(basic_streambuf<char_type,traits>* sb); 604684ddb6SLionel Sambuc 614684ddb6SLionel Sambuc // 27.7.2.7 Unformatted output: 624684ddb6SLionel Sambuc basic_ostream& put(char_type c); 634684ddb6SLionel Sambuc basic_ostream& write(const char_type* s, streamsize n); 644684ddb6SLionel Sambuc basic_ostream& flush(); 654684ddb6SLionel Sambuc 664684ddb6SLionel Sambuc // 27.7.2.5 seeks: 674684ddb6SLionel Sambuc pos_type tellp(); 684684ddb6SLionel Sambuc basic_ostream& seekp(pos_type); 694684ddb6SLionel Sambuc basic_ostream& seekp(off_type, ios_base::seekdir); 70*0a6a1f1dSLionel Sambucprotected: 71*0a6a1f1dSLionel Sambuc basic_ostream(const basic_ostream& rhs) = delete; 72*0a6a1f1dSLionel Sambuc basic_ostream(basic_ostream&& rhs); 73*0a6a1f1dSLionel Sambuc // 27.7.3.3 Assign/swap 74*0a6a1f1dSLionel Sambuc basic_ostream& operator=(basic_ostream& rhs) = delete; 75*0a6a1f1dSLionel Sambuc basic_ostream& operator=(const basic_ostream&& rhs); 76*0a6a1f1dSLionel Sambuc void swap(basic_ostream& rhs); 774684ddb6SLionel Sambuc}; 784684ddb6SLionel Sambuc 794684ddb6SLionel Sambuc// 27.7.2.6.4 character inserters 804684ddb6SLionel Sambuc 814684ddb6SLionel Sambuctemplate<class charT, class traits> 824684ddb6SLionel Sambuc basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>&, charT); 834684ddb6SLionel Sambuc 844684ddb6SLionel Sambuctemplate<class charT, class traits> 854684ddb6SLionel Sambuc basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>&, char); 864684ddb6SLionel Sambuc 874684ddb6SLionel Sambuctemplate<class traits> 884684ddb6SLionel Sambuc basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&, char); 894684ddb6SLionel Sambuc 904684ddb6SLionel Sambuc// signed and unsigned 914684ddb6SLionel Sambuc 924684ddb6SLionel Sambuctemplate<class traits> 934684ddb6SLionel Sambuc basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&, signed char); 944684ddb6SLionel Sambuc 954684ddb6SLionel Sambuctemplate<class traits> 964684ddb6SLionel Sambuc basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&, unsigned char); 974684ddb6SLionel Sambuc 984684ddb6SLionel Sambuc// NTBS 994684ddb6SLionel Sambuctemplate<class charT, class traits> 1004684ddb6SLionel Sambuc basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>&, const charT*); 1014684ddb6SLionel Sambuc 1024684ddb6SLionel Sambuctemplate<class charT, class traits> 1034684ddb6SLionel Sambuc basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>&, const char*); 1044684ddb6SLionel Sambuc 1054684ddb6SLionel Sambuctemplate<class traits> 1064684ddb6SLionel Sambuc basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&, const char*); 1074684ddb6SLionel Sambuc 1084684ddb6SLionel Sambuc// signed and unsigned 1094684ddb6SLionel Sambuctemplate<class traits> 1104684ddb6SLionel Sambucbasic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&, const signed char*); 1114684ddb6SLionel Sambuc 1124684ddb6SLionel Sambuctemplate<class traits> 1134684ddb6SLionel Sambuc basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>&, const unsigned char*); 1144684ddb6SLionel Sambuc 1154684ddb6SLionel Sambuc// swap: 1164684ddb6SLionel Sambuctemplate <class charT, class traits> 1174684ddb6SLionel Sambuc void swap(basic_ostream<charT, traits>& x, basic_ostream<charT, traits>& y); 1184684ddb6SLionel Sambuc 1194684ddb6SLionel Sambuctemplate <class charT, class traits> 1204684ddb6SLionel Sambuc basic_ostream<charT,traits>& endl(basic_ostream<charT,traits>& os); 1214684ddb6SLionel Sambuc 1224684ddb6SLionel Sambuctemplate <class charT, class traits> 1234684ddb6SLionel Sambuc basic_ostream<charT,traits>& ends(basic_ostream<charT,traits>& os); 1244684ddb6SLionel Sambuc 1254684ddb6SLionel Sambuctemplate <class charT, class traits> 1264684ddb6SLionel Sambuc basic_ostream<charT,traits>& flush(basic_ostream<charT,traits>& os); 1274684ddb6SLionel Sambuc 1284684ddb6SLionel Sambuc// rvalue stream insertion 1294684ddb6SLionel Sambuctemplate <class charT, class traits, class T> 1304684ddb6SLionel Sambuc basic_ostream<charT, traits>& 1314684ddb6SLionel Sambuc operator<<(basic_ostream<charT, traits>&& os, const T& x); 1324684ddb6SLionel Sambuc 1334684ddb6SLionel Sambuc} // std 1344684ddb6SLionel Sambuc 1354684ddb6SLionel Sambuc*/ 1364684ddb6SLionel Sambuc 1374684ddb6SLionel Sambuc#include <__config> 1384684ddb6SLionel Sambuc#include <ios> 1394684ddb6SLionel Sambuc#include <streambuf> 1404684ddb6SLionel Sambuc#include <locale> 1414684ddb6SLionel Sambuc#include <iterator> 1424684ddb6SLionel Sambuc#include <bitset> 1434684ddb6SLionel Sambuc 1444684ddb6SLionel Sambuc#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 1454684ddb6SLionel Sambuc#pragma GCC system_header 1464684ddb6SLionel Sambuc#endif 1474684ddb6SLionel Sambuc 1484684ddb6SLionel Sambuc_LIBCPP_BEGIN_NAMESPACE_STD 1494684ddb6SLionel Sambuc 1504684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 1514684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY basic_ostream 1524684ddb6SLionel Sambuc : virtual public basic_ios<_CharT, _Traits> 1534684ddb6SLionel Sambuc{ 1544684ddb6SLionel Sambucpublic: 1554684ddb6SLionel Sambuc // types (inherited from basic_ios (27.5.4)): 1564684ddb6SLionel Sambuc typedef _CharT char_type; 1574684ddb6SLionel Sambuc typedef _Traits traits_type; 1584684ddb6SLionel Sambuc typedef typename traits_type::int_type int_type; 1594684ddb6SLionel Sambuc typedef typename traits_type::pos_type pos_type; 1604684ddb6SLionel Sambuc typedef typename traits_type::off_type off_type; 1614684ddb6SLionel Sambuc 1624684ddb6SLionel Sambuc // 27.7.2.2 Constructor/destructor: 1634684ddb6SLionel Sambuc explicit basic_ostream(basic_streambuf<char_type, traits_type>* __sb); 1644684ddb6SLionel Sambuc virtual ~basic_ostream(); 1654684ddb6SLionel Sambucprotected: 1664684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1674684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY 1684684ddb6SLionel Sambuc basic_ostream(basic_ostream&& __rhs); 1694684ddb6SLionel Sambuc#endif 1704684ddb6SLionel Sambuc 1714684ddb6SLionel Sambuc // 27.7.2.3 Assign/swap 1724684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 1734684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY 1744684ddb6SLionel Sambuc basic_ostream& operator=(basic_ostream&& __rhs); 1754684ddb6SLionel Sambuc#endif 1764684ddb6SLionel Sambuc void swap(basic_ostream& __rhs); 177*0a6a1f1dSLionel Sambuc 178*0a6a1f1dSLionel Sambuc#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS 179*0a6a1f1dSLionel Sambuc basic_ostream (const basic_ostream& __rhs) = delete; 180*0a6a1f1dSLionel Sambuc basic_ostream& operator=(const basic_ostream& __rhs) = delete; 181*0a6a1f1dSLionel Sambuc#else 182*0a6a1f1dSLionel Sambuc basic_ostream (const basic_ostream& __rhs); // not defined 183*0a6a1f1dSLionel Sambuc basic_ostream& operator=(const basic_ostream& __rhs); // not defined 184*0a6a1f1dSLionel Sambuc#endif 1854684ddb6SLionel Sambucpublic: 1864684ddb6SLionel Sambuc 1874684ddb6SLionel Sambuc // 27.7.2.4 Prefix/suffix: 1884684ddb6SLionel Sambuc class _LIBCPP_TYPE_VIS_ONLY sentry; 1894684ddb6SLionel Sambuc 1904684ddb6SLionel Sambuc // 27.7.2.6 Formatted output: 1914684ddb6SLionel Sambuc basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&)); 1924684ddb6SLionel Sambuc basic_ostream& operator<<(basic_ios<char_type, traits_type>& 1934684ddb6SLionel Sambuc (*__pf)(basic_ios<char_type,traits_type>&)); 1944684ddb6SLionel Sambuc basic_ostream& operator<<(ios_base& (*__pf)(ios_base&)); 1954684ddb6SLionel Sambuc basic_ostream& operator<<(bool __n); 1964684ddb6SLionel Sambuc basic_ostream& operator<<(short __n); 1974684ddb6SLionel Sambuc basic_ostream& operator<<(unsigned short __n); 1984684ddb6SLionel Sambuc basic_ostream& operator<<(int __n); 1994684ddb6SLionel Sambuc basic_ostream& operator<<(unsigned int __n); 2004684ddb6SLionel Sambuc basic_ostream& operator<<(long __n); 2014684ddb6SLionel Sambuc basic_ostream& operator<<(unsigned long __n); 2024684ddb6SLionel Sambuc basic_ostream& operator<<(long long __n); 2034684ddb6SLionel Sambuc basic_ostream& operator<<(unsigned long long __n); 2044684ddb6SLionel Sambuc basic_ostream& operator<<(float __f); 2054684ddb6SLionel Sambuc basic_ostream& operator<<(double __f); 2064684ddb6SLionel Sambuc basic_ostream& operator<<(long double __f); 2074684ddb6SLionel Sambuc basic_ostream& operator<<(const void* __p); 2084684ddb6SLionel Sambuc basic_ostream& operator<<(basic_streambuf<char_type, traits_type>* __sb); 2094684ddb6SLionel Sambuc 2104684ddb6SLionel Sambuc // 27.7.2.7 Unformatted output: 2114684ddb6SLionel Sambuc basic_ostream& put(char_type __c); 2124684ddb6SLionel Sambuc basic_ostream& write(const char_type* __s, streamsize __n); 2134684ddb6SLionel Sambuc basic_ostream& flush(); 2144684ddb6SLionel Sambuc 2154684ddb6SLionel Sambuc // 27.7.2.5 seeks: 2164684ddb6SLionel Sambuc pos_type tellp(); 2174684ddb6SLionel Sambuc basic_ostream& seekp(pos_type __pos); 2184684ddb6SLionel Sambuc basic_ostream& seekp(off_type __off, ios_base::seekdir __dir); 2194684ddb6SLionel Sambuc 2204684ddb6SLionel Sambucprotected: 2214684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 2224684ddb6SLionel Sambuc basic_ostream() {} // extension, intentially does not initialize 2234684ddb6SLionel Sambuc}; 2244684ddb6SLionel Sambuc 2254684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 2264684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY basic_ostream<_CharT, _Traits>::sentry 2274684ddb6SLionel Sambuc{ 2284684ddb6SLionel Sambuc bool __ok_; 2294684ddb6SLionel Sambuc basic_ostream<_CharT, _Traits>& __os_; 2304684ddb6SLionel Sambuc 2314684ddb6SLionel Sambuc sentry(const sentry&); // = delete; 2324684ddb6SLionel Sambuc sentry& operator=(const sentry&); // = delete; 2334684ddb6SLionel Sambuc 2344684ddb6SLionel Sambucpublic: 2354684ddb6SLionel Sambuc explicit sentry(basic_ostream<_CharT, _Traits>& __os); 2364684ddb6SLionel Sambuc ~sentry(); 2374684ddb6SLionel Sambuc 2384684ddb6SLionel Sambuc _LIBCPP_ALWAYS_INLINE 2394684ddb6SLionel Sambuc _LIBCPP_EXPLICIT 2404684ddb6SLionel Sambuc operator bool() const {return __ok_;} 2414684ddb6SLionel Sambuc}; 2424684ddb6SLionel Sambuc 2434684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 2444684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::sentry::sentry(basic_ostream<_CharT, _Traits>& __os) 2454684ddb6SLionel Sambuc : __ok_(false), 2464684ddb6SLionel Sambuc __os_(__os) 2474684ddb6SLionel Sambuc{ 2484684ddb6SLionel Sambuc if (__os.good()) 2494684ddb6SLionel Sambuc { 2504684ddb6SLionel Sambuc if (__os.tie()) 2514684ddb6SLionel Sambuc __os.tie()->flush(); 2524684ddb6SLionel Sambuc __ok_ = true; 2534684ddb6SLionel Sambuc } 2544684ddb6SLionel Sambuc} 2554684ddb6SLionel Sambuc 2564684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 2574684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::sentry::~sentry() 2584684ddb6SLionel Sambuc{ 2594684ddb6SLionel Sambuc if (__os_.rdbuf() && __os_.good() && (__os_.flags() & ios_base::unitbuf) 2604684ddb6SLionel Sambuc && !uncaught_exception()) 2614684ddb6SLionel Sambuc { 2624684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 2634684ddb6SLionel Sambuc try 2644684ddb6SLionel Sambuc { 2654684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 2664684ddb6SLionel Sambuc if (__os_.rdbuf()->pubsync() == -1) 2674684ddb6SLionel Sambuc __os_.setstate(ios_base::badbit); 2684684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 2694684ddb6SLionel Sambuc } 2704684ddb6SLionel Sambuc catch (...) 2714684ddb6SLionel Sambuc { 2724684ddb6SLionel Sambuc } 2734684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 2744684ddb6SLionel Sambuc } 2754684ddb6SLionel Sambuc} 2764684ddb6SLionel Sambuc 2774684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 2784684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 2794684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::basic_ostream(basic_streambuf<char_type, traits_type>* __sb) 2804684ddb6SLionel Sambuc{ 2814684ddb6SLionel Sambuc this->init(__sb); 2824684ddb6SLionel Sambuc} 2834684ddb6SLionel Sambuc 2844684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 2854684ddb6SLionel Sambuc 2864684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 2874684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 2884684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::basic_ostream(basic_ostream&& __rhs) 2894684ddb6SLionel Sambuc{ 2904684ddb6SLionel Sambuc this->move(__rhs); 2914684ddb6SLionel Sambuc} 2924684ddb6SLionel Sambuc 2934684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 2944684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 2954684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 2964684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::operator=(basic_ostream&& __rhs) 2974684ddb6SLionel Sambuc{ 2984684ddb6SLionel Sambuc swap(__rhs); 2994684ddb6SLionel Sambuc return *this; 3004684ddb6SLionel Sambuc} 3014684ddb6SLionel Sambuc 3024684ddb6SLionel Sambuc#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 3034684ddb6SLionel Sambuc 3044684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 3054684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::~basic_ostream() 3064684ddb6SLionel Sambuc{ 3074684ddb6SLionel Sambuc} 3084684ddb6SLionel Sambuc 3094684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 3104684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 3114684ddb6SLionel Sambucvoid 3124684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::swap(basic_ostream& __rhs) 3134684ddb6SLionel Sambuc{ 3144684ddb6SLionel Sambuc basic_ios<char_type, traits_type>::swap(__rhs); 3154684ddb6SLionel Sambuc} 3164684ddb6SLionel Sambuc 3174684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 3184684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 3194684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 3204684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::operator<<(basic_ostream& (*__pf)(basic_ostream&)) 3214684ddb6SLionel Sambuc{ 3224684ddb6SLionel Sambuc return __pf(*this); 3234684ddb6SLionel Sambuc} 3244684ddb6SLionel Sambuc 3254684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 3264684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 3274684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 3284684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::operator<<(basic_ios<char_type, traits_type>& 3294684ddb6SLionel Sambuc (*__pf)(basic_ios<char_type,traits_type>&)) 3304684ddb6SLionel Sambuc{ 3314684ddb6SLionel Sambuc __pf(*this); 3324684ddb6SLionel Sambuc return *this; 3334684ddb6SLionel Sambuc} 3344684ddb6SLionel Sambuc 3354684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 3364684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 3374684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 3384684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::operator<<(ios_base& (*__pf)(ios_base&)) 3394684ddb6SLionel Sambuc{ 3404684ddb6SLionel Sambuc __pf(*this); 3414684ddb6SLionel Sambuc return *this; 3424684ddb6SLionel Sambuc} 3434684ddb6SLionel Sambuc 3444684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 3454684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 3464684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_type>* __sb) 3474684ddb6SLionel Sambuc{ 3484684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 3494684ddb6SLionel Sambuc try 3504684ddb6SLionel Sambuc { 3514684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 3524684ddb6SLionel Sambuc sentry __s(*this); 3534684ddb6SLionel Sambuc if (__s) 3544684ddb6SLionel Sambuc { 3554684ddb6SLionel Sambuc if (__sb) 3564684ddb6SLionel Sambuc { 3574684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 3584684ddb6SLionel Sambuc try 3594684ddb6SLionel Sambuc { 3604684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 3614684ddb6SLionel Sambuc typedef istreambuf_iterator<_CharT, _Traits> _Ip; 3624684ddb6SLionel Sambuc typedef ostreambuf_iterator<_CharT, _Traits> _Op; 3634684ddb6SLionel Sambuc _Ip __i(__sb); 3644684ddb6SLionel Sambuc _Ip __eof; 3654684ddb6SLionel Sambuc _Op __o(*this); 3664684ddb6SLionel Sambuc size_t __c = 0; 3674684ddb6SLionel Sambuc for (; __i != __eof; ++__i, ++__o, ++__c) 3684684ddb6SLionel Sambuc { 3694684ddb6SLionel Sambuc *__o = *__i; 3704684ddb6SLionel Sambuc if (__o.failed()) 3714684ddb6SLionel Sambuc break; 3724684ddb6SLionel Sambuc } 3734684ddb6SLionel Sambuc if (__c == 0) 3744684ddb6SLionel Sambuc this->setstate(ios_base::failbit); 3754684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 3764684ddb6SLionel Sambuc } 3774684ddb6SLionel Sambuc catch (...) 3784684ddb6SLionel Sambuc { 3794684ddb6SLionel Sambuc this->__set_failbit_and_consider_rethrow(); 3804684ddb6SLionel Sambuc } 3814684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 3824684ddb6SLionel Sambuc } 3834684ddb6SLionel Sambuc else 3844684ddb6SLionel Sambuc this->setstate(ios_base::badbit); 3854684ddb6SLionel Sambuc } 3864684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 3874684ddb6SLionel Sambuc } 3884684ddb6SLionel Sambuc catch (...) 3894684ddb6SLionel Sambuc { 3904684ddb6SLionel Sambuc this->__set_badbit_and_consider_rethrow(); 3914684ddb6SLionel Sambuc } 3924684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 3934684ddb6SLionel Sambuc return *this; 3944684ddb6SLionel Sambuc} 3954684ddb6SLionel Sambuc 3964684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 3974684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 3984684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::operator<<(bool __n) 3994684ddb6SLionel Sambuc{ 4004684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 4014684ddb6SLionel Sambuc try 4024684ddb6SLionel Sambuc { 4034684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 4044684ddb6SLionel Sambuc sentry __s(*this); 4054684ddb6SLionel Sambuc if (__s) 4064684ddb6SLionel Sambuc { 4074684ddb6SLionel Sambuc typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; 4084684ddb6SLionel Sambuc const _Fp& __f = use_facet<_Fp>(this->getloc()); 4094684ddb6SLionel Sambuc if (__f.put(*this, *this, this->fill(), __n).failed()) 4104684ddb6SLionel Sambuc this->setstate(ios_base::badbit | ios_base::failbit); 4114684ddb6SLionel Sambuc } 4124684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 4134684ddb6SLionel Sambuc } 4144684ddb6SLionel Sambuc catch (...) 4154684ddb6SLionel Sambuc { 4164684ddb6SLionel Sambuc this->__set_badbit_and_consider_rethrow(); 4174684ddb6SLionel Sambuc } 4184684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 4194684ddb6SLionel Sambuc return *this; 4204684ddb6SLionel Sambuc} 4214684ddb6SLionel Sambuc 4224684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 4234684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 4244684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::operator<<(short __n) 4254684ddb6SLionel Sambuc{ 4264684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 4274684ddb6SLionel Sambuc try 4284684ddb6SLionel Sambuc { 4294684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 4304684ddb6SLionel Sambuc sentry __s(*this); 4314684ddb6SLionel Sambuc if (__s) 4324684ddb6SLionel Sambuc { 4334684ddb6SLionel Sambuc ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield; 4344684ddb6SLionel Sambuc typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; 4354684ddb6SLionel Sambuc const _Fp& __f = use_facet<_Fp>(this->getloc()); 4364684ddb6SLionel Sambuc if (__f.put(*this, *this, this->fill(), 4374684ddb6SLionel Sambuc __flags == ios_base::oct || __flags == ios_base::hex ? 4384684ddb6SLionel Sambuc static_cast<long>(static_cast<unsigned short>(__n)) : 4394684ddb6SLionel Sambuc static_cast<long>(__n)).failed()) 4404684ddb6SLionel Sambuc this->setstate(ios_base::badbit | ios_base::failbit); 4414684ddb6SLionel Sambuc } 4424684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 4434684ddb6SLionel Sambuc } 4444684ddb6SLionel Sambuc catch (...) 4454684ddb6SLionel Sambuc { 4464684ddb6SLionel Sambuc this->__set_badbit_and_consider_rethrow(); 4474684ddb6SLionel Sambuc } 4484684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 4494684ddb6SLionel Sambuc return *this; 4504684ddb6SLionel Sambuc} 4514684ddb6SLionel Sambuc 4524684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 4534684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 4544684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::operator<<(unsigned short __n) 4554684ddb6SLionel Sambuc{ 4564684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 4574684ddb6SLionel Sambuc try 4584684ddb6SLionel Sambuc { 4594684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 4604684ddb6SLionel Sambuc sentry __s(*this); 4614684ddb6SLionel Sambuc if (__s) 4624684ddb6SLionel Sambuc { 4634684ddb6SLionel Sambuc typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; 4644684ddb6SLionel Sambuc const _Fp& __f = use_facet<_Fp>(this->getloc()); 4654684ddb6SLionel Sambuc if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed()) 4664684ddb6SLionel Sambuc this->setstate(ios_base::badbit | ios_base::failbit); 4674684ddb6SLionel Sambuc } 4684684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 4694684ddb6SLionel Sambuc } 4704684ddb6SLionel Sambuc catch (...) 4714684ddb6SLionel Sambuc { 4724684ddb6SLionel Sambuc this->__set_badbit_and_consider_rethrow(); 4734684ddb6SLionel Sambuc } 4744684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 4754684ddb6SLionel Sambuc return *this; 4764684ddb6SLionel Sambuc} 4774684ddb6SLionel Sambuc 4784684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 4794684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 4804684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::operator<<(int __n) 4814684ddb6SLionel Sambuc{ 4824684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 4834684ddb6SLionel Sambuc try 4844684ddb6SLionel Sambuc { 4854684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 4864684ddb6SLionel Sambuc sentry __s(*this); 4874684ddb6SLionel Sambuc if (__s) 4884684ddb6SLionel Sambuc { 4894684ddb6SLionel Sambuc ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield; 4904684ddb6SLionel Sambuc typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; 4914684ddb6SLionel Sambuc const _Fp& __f = use_facet<_Fp>(this->getloc()); 4924684ddb6SLionel Sambuc if (__f.put(*this, *this, this->fill(), 4934684ddb6SLionel Sambuc __flags == ios_base::oct || __flags == ios_base::hex ? 4944684ddb6SLionel Sambuc static_cast<long>(static_cast<unsigned int>(__n)) : 4954684ddb6SLionel Sambuc static_cast<long>(__n)).failed()) 4964684ddb6SLionel Sambuc this->setstate(ios_base::badbit | ios_base::failbit); 4974684ddb6SLionel Sambuc } 4984684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 4994684ddb6SLionel Sambuc } 5004684ddb6SLionel Sambuc catch (...) 5014684ddb6SLionel Sambuc { 5024684ddb6SLionel Sambuc this->__set_badbit_and_consider_rethrow(); 5034684ddb6SLionel Sambuc } 5044684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 5054684ddb6SLionel Sambuc return *this; 5064684ddb6SLionel Sambuc} 5074684ddb6SLionel Sambuc 5084684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 5094684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 5104684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::operator<<(unsigned int __n) 5114684ddb6SLionel Sambuc{ 5124684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 5134684ddb6SLionel Sambuc try 5144684ddb6SLionel Sambuc { 5154684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 5164684ddb6SLionel Sambuc sentry __s(*this); 5174684ddb6SLionel Sambuc if (__s) 5184684ddb6SLionel Sambuc { 5194684ddb6SLionel Sambuc typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; 5204684ddb6SLionel Sambuc const _Fp& __f = use_facet<_Fp>(this->getloc()); 5214684ddb6SLionel Sambuc if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed()) 5224684ddb6SLionel Sambuc this->setstate(ios_base::badbit | ios_base::failbit); 5234684ddb6SLionel Sambuc } 5244684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 5254684ddb6SLionel Sambuc } 5264684ddb6SLionel Sambuc catch (...) 5274684ddb6SLionel Sambuc { 5284684ddb6SLionel Sambuc this->__set_badbit_and_consider_rethrow(); 5294684ddb6SLionel Sambuc } 5304684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 5314684ddb6SLionel Sambuc return *this; 5324684ddb6SLionel Sambuc} 5334684ddb6SLionel Sambuc 5344684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 5354684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 5364684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::operator<<(long __n) 5374684ddb6SLionel Sambuc{ 5384684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 5394684ddb6SLionel Sambuc try 5404684ddb6SLionel Sambuc { 5414684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 5424684ddb6SLionel Sambuc sentry __s(*this); 5434684ddb6SLionel Sambuc if (__s) 5444684ddb6SLionel Sambuc { 5454684ddb6SLionel Sambuc typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; 5464684ddb6SLionel Sambuc const _Fp& __f = use_facet<_Fp>(this->getloc()); 5474684ddb6SLionel Sambuc if (__f.put(*this, *this, this->fill(), __n).failed()) 5484684ddb6SLionel Sambuc this->setstate(ios_base::badbit | ios_base::failbit); 5494684ddb6SLionel Sambuc } 5504684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 5514684ddb6SLionel Sambuc } 5524684ddb6SLionel Sambuc catch (...) 5534684ddb6SLionel Sambuc { 5544684ddb6SLionel Sambuc this->__set_badbit_and_consider_rethrow(); 5554684ddb6SLionel Sambuc } 5564684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 5574684ddb6SLionel Sambuc return *this; 5584684ddb6SLionel Sambuc} 5594684ddb6SLionel Sambuc 5604684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 5614684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 5624684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::operator<<(unsigned long __n) 5634684ddb6SLionel Sambuc{ 5644684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 5654684ddb6SLionel Sambuc try 5664684ddb6SLionel Sambuc { 5674684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 5684684ddb6SLionel Sambuc sentry __s(*this); 5694684ddb6SLionel Sambuc if (__s) 5704684ddb6SLionel Sambuc { 5714684ddb6SLionel Sambuc typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; 5724684ddb6SLionel Sambuc const _Fp& __f = use_facet<_Fp>(this->getloc()); 5734684ddb6SLionel Sambuc if (__f.put(*this, *this, this->fill(), __n).failed()) 5744684ddb6SLionel Sambuc this->setstate(ios_base::badbit | ios_base::failbit); 5754684ddb6SLionel Sambuc } 5764684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 5774684ddb6SLionel Sambuc } 5784684ddb6SLionel Sambuc catch (...) 5794684ddb6SLionel Sambuc { 5804684ddb6SLionel Sambuc this->__set_badbit_and_consider_rethrow(); 5814684ddb6SLionel Sambuc } 5824684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 5834684ddb6SLionel Sambuc return *this; 5844684ddb6SLionel Sambuc} 5854684ddb6SLionel Sambuc 5864684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 5874684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 5884684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::operator<<(long long __n) 5894684ddb6SLionel Sambuc{ 5904684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 5914684ddb6SLionel Sambuc try 5924684ddb6SLionel Sambuc { 5934684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 5944684ddb6SLionel Sambuc sentry __s(*this); 5954684ddb6SLionel Sambuc if (__s) 5964684ddb6SLionel Sambuc { 5974684ddb6SLionel Sambuc typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; 5984684ddb6SLionel Sambuc const _Fp& __f = use_facet<_Fp>(this->getloc()); 5994684ddb6SLionel Sambuc if (__f.put(*this, *this, this->fill(), __n).failed()) 6004684ddb6SLionel Sambuc this->setstate(ios_base::badbit | ios_base::failbit); 6014684ddb6SLionel Sambuc } 6024684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 6034684ddb6SLionel Sambuc } 6044684ddb6SLionel Sambuc catch (...) 6054684ddb6SLionel Sambuc { 6064684ddb6SLionel Sambuc this->__set_badbit_and_consider_rethrow(); 6074684ddb6SLionel Sambuc } 6084684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 6094684ddb6SLionel Sambuc return *this; 6104684ddb6SLionel Sambuc} 6114684ddb6SLionel Sambuc 6124684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 6134684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 6144684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n) 6154684ddb6SLionel Sambuc{ 6164684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 6174684ddb6SLionel Sambuc try 6184684ddb6SLionel Sambuc { 6194684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 6204684ddb6SLionel Sambuc sentry __s(*this); 6214684ddb6SLionel Sambuc if (__s) 6224684ddb6SLionel Sambuc { 6234684ddb6SLionel Sambuc typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; 6244684ddb6SLionel Sambuc const _Fp& __f = use_facet<_Fp>(this->getloc()); 6254684ddb6SLionel Sambuc if (__f.put(*this, *this, this->fill(), __n).failed()) 6264684ddb6SLionel Sambuc this->setstate(ios_base::badbit | ios_base::failbit); 6274684ddb6SLionel Sambuc } 6284684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 6294684ddb6SLionel Sambuc } 6304684ddb6SLionel Sambuc catch (...) 6314684ddb6SLionel Sambuc { 6324684ddb6SLionel Sambuc this->__set_badbit_and_consider_rethrow(); 6334684ddb6SLionel Sambuc } 6344684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 6354684ddb6SLionel Sambuc return *this; 6364684ddb6SLionel Sambuc} 6374684ddb6SLionel Sambuc 6384684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 6394684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 6404684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::operator<<(float __n) 6414684ddb6SLionel Sambuc{ 6424684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 6434684ddb6SLionel Sambuc try 6444684ddb6SLionel Sambuc { 6454684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 6464684ddb6SLionel Sambuc sentry __s(*this); 6474684ddb6SLionel Sambuc if (__s) 6484684ddb6SLionel Sambuc { 6494684ddb6SLionel Sambuc typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; 6504684ddb6SLionel Sambuc const _Fp& __f = use_facet<_Fp>(this->getloc()); 6514684ddb6SLionel Sambuc if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed()) 6524684ddb6SLionel Sambuc this->setstate(ios_base::badbit | ios_base::failbit); 6534684ddb6SLionel Sambuc } 6544684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 6554684ddb6SLionel Sambuc } 6564684ddb6SLionel Sambuc catch (...) 6574684ddb6SLionel Sambuc { 6584684ddb6SLionel Sambuc this->__set_badbit_and_consider_rethrow(); 6594684ddb6SLionel Sambuc } 6604684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 6614684ddb6SLionel Sambuc return *this; 6624684ddb6SLionel Sambuc} 6634684ddb6SLionel Sambuc 6644684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 6654684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 6664684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::operator<<(double __n) 6674684ddb6SLionel Sambuc{ 6684684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 6694684ddb6SLionel Sambuc try 6704684ddb6SLionel Sambuc { 6714684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 6724684ddb6SLionel Sambuc sentry __s(*this); 6734684ddb6SLionel Sambuc if (__s) 6744684ddb6SLionel Sambuc { 6754684ddb6SLionel Sambuc typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; 6764684ddb6SLionel Sambuc const _Fp& __f = use_facet<_Fp>(this->getloc()); 6774684ddb6SLionel Sambuc if (__f.put(*this, *this, this->fill(), __n).failed()) 6784684ddb6SLionel Sambuc this->setstate(ios_base::badbit | ios_base::failbit); 6794684ddb6SLionel Sambuc } 6804684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 6814684ddb6SLionel Sambuc } 6824684ddb6SLionel Sambuc catch (...) 6834684ddb6SLionel Sambuc { 6844684ddb6SLionel Sambuc this->__set_badbit_and_consider_rethrow(); 6854684ddb6SLionel Sambuc } 6864684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 6874684ddb6SLionel Sambuc return *this; 6884684ddb6SLionel Sambuc} 6894684ddb6SLionel Sambuc 6904684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 6914684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 6924684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::operator<<(long double __n) 6934684ddb6SLionel Sambuc{ 6944684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 6954684ddb6SLionel Sambuc try 6964684ddb6SLionel Sambuc { 6974684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 6984684ddb6SLionel Sambuc sentry __s(*this); 6994684ddb6SLionel Sambuc if (__s) 7004684ddb6SLionel Sambuc { 7014684ddb6SLionel Sambuc typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; 7024684ddb6SLionel Sambuc const _Fp& __f = use_facet<_Fp>(this->getloc()); 7034684ddb6SLionel Sambuc if (__f.put(*this, *this, this->fill(), __n).failed()) 7044684ddb6SLionel Sambuc this->setstate(ios_base::badbit | ios_base::failbit); 7054684ddb6SLionel Sambuc } 7064684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 7074684ddb6SLionel Sambuc } 7084684ddb6SLionel Sambuc catch (...) 7094684ddb6SLionel Sambuc { 7104684ddb6SLionel Sambuc this->__set_badbit_and_consider_rethrow(); 7114684ddb6SLionel Sambuc } 7124684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 7134684ddb6SLionel Sambuc return *this; 7144684ddb6SLionel Sambuc} 7154684ddb6SLionel Sambuc 7164684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 7174684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 7184684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::operator<<(const void* __n) 7194684ddb6SLionel Sambuc{ 7204684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 7214684ddb6SLionel Sambuc try 7224684ddb6SLionel Sambuc { 7234684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 7244684ddb6SLionel Sambuc sentry __s(*this); 7254684ddb6SLionel Sambuc if (__s) 7264684ddb6SLionel Sambuc { 7274684ddb6SLionel Sambuc typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; 7284684ddb6SLionel Sambuc const _Fp& __f = use_facet<_Fp>(this->getloc()); 7294684ddb6SLionel Sambuc if (__f.put(*this, *this, this->fill(), __n).failed()) 7304684ddb6SLionel Sambuc this->setstate(ios_base::badbit | ios_base::failbit); 7314684ddb6SLionel Sambuc } 7324684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 7334684ddb6SLionel Sambuc } 7344684ddb6SLionel Sambuc catch (...) 7354684ddb6SLionel Sambuc { 7364684ddb6SLionel Sambuc this->__set_badbit_and_consider_rethrow(); 7374684ddb6SLionel Sambuc } 7384684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 7394684ddb6SLionel Sambuc return *this; 7404684ddb6SLionel Sambuc} 7414684ddb6SLionel Sambuc 7424684ddb6SLionel Sambuctemplate<class _CharT, class _Traits> 7434684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 744*0a6a1f1dSLionel Sambuc__put_character_sequence(basic_ostream<_CharT, _Traits>& __os, 745*0a6a1f1dSLionel Sambuc const _CharT* __str, size_t __len) 7464684ddb6SLionel Sambuc{ 7474684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 7484684ddb6SLionel Sambuc try 7494684ddb6SLionel Sambuc { 7504684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 7514684ddb6SLionel Sambuc typename basic_ostream<_CharT, _Traits>::sentry __s(__os); 7524684ddb6SLionel Sambuc if (__s) 7534684ddb6SLionel Sambuc { 7544684ddb6SLionel Sambuc typedef ostreambuf_iterator<_CharT, _Traits> _Ip; 7554684ddb6SLionel Sambuc if (__pad_and_output(_Ip(__os), 756*0a6a1f1dSLionel Sambuc __str, 7574684ddb6SLionel Sambuc (__os.flags() & ios_base::adjustfield) == ios_base::left ? 758*0a6a1f1dSLionel Sambuc __str + __len : 759*0a6a1f1dSLionel Sambuc __str, 760*0a6a1f1dSLionel Sambuc __str + __len, 7614684ddb6SLionel Sambuc __os, 7624684ddb6SLionel Sambuc __os.fill()).failed()) 7634684ddb6SLionel Sambuc __os.setstate(ios_base::badbit | ios_base::failbit); 7644684ddb6SLionel Sambuc } 7654684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 7664684ddb6SLionel Sambuc } 7674684ddb6SLionel Sambuc catch (...) 7684684ddb6SLionel Sambuc { 7694684ddb6SLionel Sambuc __os.__set_badbit_and_consider_rethrow(); 7704684ddb6SLionel Sambuc } 7714684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 7724684ddb6SLionel Sambuc return __os; 7734684ddb6SLionel Sambuc} 7744684ddb6SLionel Sambuc 775*0a6a1f1dSLionel Sambuc 776*0a6a1f1dSLionel Sambuctemplate<class _CharT, class _Traits> 777*0a6a1f1dSLionel Sambucbasic_ostream<_CharT, _Traits>& 778*0a6a1f1dSLionel Sambucoperator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c) 779*0a6a1f1dSLionel Sambuc{ 780*0a6a1f1dSLionel Sambuc return _VSTD::__put_character_sequence(__os, &__c, 1); 781*0a6a1f1dSLionel Sambuc} 782*0a6a1f1dSLionel Sambuc 7834684ddb6SLionel Sambuctemplate<class _CharT, class _Traits> 7844684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 7854684ddb6SLionel Sambucoperator<<(basic_ostream<_CharT, _Traits>& __os, char __cn) 7864684ddb6SLionel Sambuc{ 7874684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 7884684ddb6SLionel Sambuc try 7894684ddb6SLionel Sambuc { 7904684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 7914684ddb6SLionel Sambuc typename basic_ostream<_CharT, _Traits>::sentry __s(__os); 7924684ddb6SLionel Sambuc if (__s) 7934684ddb6SLionel Sambuc { 7944684ddb6SLionel Sambuc _CharT __c = __os.widen(__cn); 7954684ddb6SLionel Sambuc typedef ostreambuf_iterator<_CharT, _Traits> _Ip; 7964684ddb6SLionel Sambuc if (__pad_and_output(_Ip(__os), 7974684ddb6SLionel Sambuc &__c, 7984684ddb6SLionel Sambuc (__os.flags() & ios_base::adjustfield) == ios_base::left ? 7994684ddb6SLionel Sambuc &__c + 1 : 8004684ddb6SLionel Sambuc &__c, 8014684ddb6SLionel Sambuc &__c + 1, 8024684ddb6SLionel Sambuc __os, 8034684ddb6SLionel Sambuc __os.fill()).failed()) 8044684ddb6SLionel Sambuc __os.setstate(ios_base::badbit | ios_base::failbit); 8054684ddb6SLionel Sambuc } 8064684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 8074684ddb6SLionel Sambuc } 8084684ddb6SLionel Sambuc catch (...) 8094684ddb6SLionel Sambuc { 8104684ddb6SLionel Sambuc __os.__set_badbit_and_consider_rethrow(); 8114684ddb6SLionel Sambuc } 8124684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 8134684ddb6SLionel Sambuc return __os; 8144684ddb6SLionel Sambuc} 8154684ddb6SLionel Sambuc 8164684ddb6SLionel Sambuctemplate<class _Traits> 8174684ddb6SLionel Sambucbasic_ostream<char, _Traits>& 8184684ddb6SLionel Sambucoperator<<(basic_ostream<char, _Traits>& __os, char __c) 8194684ddb6SLionel Sambuc{ 820*0a6a1f1dSLionel Sambuc return _VSTD::__put_character_sequence(__os, &__c, 1); 8214684ddb6SLionel Sambuc} 8224684ddb6SLionel Sambuc 8234684ddb6SLionel Sambuctemplate<class _Traits> 8244684ddb6SLionel Sambucbasic_ostream<char, _Traits>& 8254684ddb6SLionel Sambucoperator<<(basic_ostream<char, _Traits>& __os, signed char __c) 8264684ddb6SLionel Sambuc{ 827*0a6a1f1dSLionel Sambuc return _VSTD::__put_character_sequence(__os, (char *) &__c, 1); 8284684ddb6SLionel Sambuc} 8294684ddb6SLionel Sambuc 8304684ddb6SLionel Sambuctemplate<class _Traits> 8314684ddb6SLionel Sambucbasic_ostream<char, _Traits>& 8324684ddb6SLionel Sambucoperator<<(basic_ostream<char, _Traits>& __os, unsigned char __c) 8334684ddb6SLionel Sambuc{ 834*0a6a1f1dSLionel Sambuc return _VSTD::__put_character_sequence(__os, (char *) &__c, 1); 8354684ddb6SLionel Sambuc} 8364684ddb6SLionel Sambuc 8374684ddb6SLionel Sambuctemplate<class _CharT, class _Traits> 8384684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 8394684ddb6SLionel Sambucoperator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str) 8404684ddb6SLionel Sambuc{ 841*0a6a1f1dSLionel Sambuc return _VSTD::__put_character_sequence(__os, __str, _Traits::length(__str)); 8424684ddb6SLionel Sambuc} 8434684ddb6SLionel Sambuc 8444684ddb6SLionel Sambuctemplate<class _CharT, class _Traits> 8454684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 8464684ddb6SLionel Sambucoperator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn) 8474684ddb6SLionel Sambuc{ 8484684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 8494684ddb6SLionel Sambuc try 8504684ddb6SLionel Sambuc { 8514684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 8524684ddb6SLionel Sambuc typename basic_ostream<_CharT, _Traits>::sentry __s(__os); 8534684ddb6SLionel Sambuc if (__s) 8544684ddb6SLionel Sambuc { 8554684ddb6SLionel Sambuc typedef ostreambuf_iterator<_CharT, _Traits> _Ip; 8564684ddb6SLionel Sambuc size_t __len = char_traits<char>::length(__strn); 8574684ddb6SLionel Sambuc const int __bs = 100; 8584684ddb6SLionel Sambuc _CharT __wbb[__bs]; 8594684ddb6SLionel Sambuc _CharT* __wb = __wbb; 8604684ddb6SLionel Sambuc unique_ptr<_CharT, void(*)(void*)> __h(0, free); 8614684ddb6SLionel Sambuc if (__len > __bs) 8624684ddb6SLionel Sambuc { 8634684ddb6SLionel Sambuc __wb = (_CharT*)malloc(__len*sizeof(_CharT)); 8644684ddb6SLionel Sambuc if (__wb == 0) 8654684ddb6SLionel Sambuc __throw_bad_alloc(); 8664684ddb6SLionel Sambuc __h.reset(__wb); 8674684ddb6SLionel Sambuc } 8684684ddb6SLionel Sambuc for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p) 8694684ddb6SLionel Sambuc *__p = __os.widen(*__strn); 8704684ddb6SLionel Sambuc if (__pad_and_output(_Ip(__os), 8714684ddb6SLionel Sambuc __wb, 8724684ddb6SLionel Sambuc (__os.flags() & ios_base::adjustfield) == ios_base::left ? 8734684ddb6SLionel Sambuc __wb + __len : 8744684ddb6SLionel Sambuc __wb, 8754684ddb6SLionel Sambuc __wb + __len, 8764684ddb6SLionel Sambuc __os, 8774684ddb6SLionel Sambuc __os.fill()).failed()) 8784684ddb6SLionel Sambuc __os.setstate(ios_base::badbit | ios_base::failbit); 8794684ddb6SLionel Sambuc } 8804684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 8814684ddb6SLionel Sambuc } 8824684ddb6SLionel Sambuc catch (...) 8834684ddb6SLionel Sambuc { 8844684ddb6SLionel Sambuc __os.__set_badbit_and_consider_rethrow(); 8854684ddb6SLionel Sambuc } 8864684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 8874684ddb6SLionel Sambuc return __os; 8884684ddb6SLionel Sambuc} 8894684ddb6SLionel Sambuc 8904684ddb6SLionel Sambuctemplate<class _Traits> 8914684ddb6SLionel Sambucbasic_ostream<char, _Traits>& 8924684ddb6SLionel Sambucoperator<<(basic_ostream<char, _Traits>& __os, const char* __str) 8934684ddb6SLionel Sambuc{ 894*0a6a1f1dSLionel Sambuc return _VSTD::__put_character_sequence(__os, __str, _Traits::length(__str)); 8954684ddb6SLionel Sambuc} 8964684ddb6SLionel Sambuc 8974684ddb6SLionel Sambuctemplate<class _Traits> 8984684ddb6SLionel Sambucbasic_ostream<char, _Traits>& 8994684ddb6SLionel Sambucoperator<<(basic_ostream<char, _Traits>& __os, const signed char* __str) 9004684ddb6SLionel Sambuc{ 901*0a6a1f1dSLionel Sambuc const char *__s = (const char *) __str; 902*0a6a1f1dSLionel Sambuc return _VSTD::__put_character_sequence(__os, __s, _Traits::length(__s)); 9034684ddb6SLionel Sambuc} 9044684ddb6SLionel Sambuc 9054684ddb6SLionel Sambuctemplate<class _Traits> 9064684ddb6SLionel Sambucbasic_ostream<char, _Traits>& 9074684ddb6SLionel Sambucoperator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str) 9084684ddb6SLionel Sambuc{ 909*0a6a1f1dSLionel Sambuc const char *__s = (const char *) __str; 910*0a6a1f1dSLionel Sambuc return _VSTD::__put_character_sequence(__os, __s, _Traits::length(__s)); 9114684ddb6SLionel Sambuc} 9124684ddb6SLionel Sambuc 9134684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 9144684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 9154684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::put(char_type __c) 9164684ddb6SLionel Sambuc{ 9174684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 9184684ddb6SLionel Sambuc try 9194684ddb6SLionel Sambuc { 9204684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 9214684ddb6SLionel Sambuc sentry __s(*this); 9224684ddb6SLionel Sambuc if (__s) 9234684ddb6SLionel Sambuc { 9244684ddb6SLionel Sambuc typedef ostreambuf_iterator<_CharT, _Traits> _Op; 9254684ddb6SLionel Sambuc _Op __o(*this); 9264684ddb6SLionel Sambuc *__o = __c; 9274684ddb6SLionel Sambuc if (__o.failed()) 9284684ddb6SLionel Sambuc this->setstate(ios_base::badbit); 9294684ddb6SLionel Sambuc } 9304684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 9314684ddb6SLionel Sambuc } 9324684ddb6SLionel Sambuc catch (...) 9334684ddb6SLionel Sambuc { 9344684ddb6SLionel Sambuc this->__set_badbit_and_consider_rethrow(); 9354684ddb6SLionel Sambuc } 9364684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 9374684ddb6SLionel Sambuc return *this; 9384684ddb6SLionel Sambuc} 9394684ddb6SLionel Sambuc 9404684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 9414684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 9424684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n) 9434684ddb6SLionel Sambuc{ 9444684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 9454684ddb6SLionel Sambuc try 9464684ddb6SLionel Sambuc { 9474684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 9484684ddb6SLionel Sambuc sentry __sen(*this); 9494684ddb6SLionel Sambuc if (__sen && __n) 9504684ddb6SLionel Sambuc { 9514684ddb6SLionel Sambuc if (this->rdbuf()->sputn(__s, __n) != __n) 9524684ddb6SLionel Sambuc this->setstate(ios_base::badbit); 9534684ddb6SLionel Sambuc } 9544684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 9554684ddb6SLionel Sambuc } 9564684ddb6SLionel Sambuc catch (...) 9574684ddb6SLionel Sambuc { 9584684ddb6SLionel Sambuc this->__set_badbit_and_consider_rethrow(); 9594684ddb6SLionel Sambuc } 9604684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 9614684ddb6SLionel Sambuc return *this; 9624684ddb6SLionel Sambuc} 9634684ddb6SLionel Sambuc 9644684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 9654684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 9664684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::flush() 9674684ddb6SLionel Sambuc{ 9684684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 9694684ddb6SLionel Sambuc try 9704684ddb6SLionel Sambuc { 9714684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 9724684ddb6SLionel Sambuc if (this->rdbuf()) 9734684ddb6SLionel Sambuc { 9744684ddb6SLionel Sambuc sentry __s(*this); 9754684ddb6SLionel Sambuc if (__s) 9764684ddb6SLionel Sambuc { 9774684ddb6SLionel Sambuc if (this->rdbuf()->pubsync() == -1) 9784684ddb6SLionel Sambuc this->setstate(ios_base::badbit); 9794684ddb6SLionel Sambuc } 9804684ddb6SLionel Sambuc } 9814684ddb6SLionel Sambuc#ifndef _LIBCPP_NO_EXCEPTIONS 9824684ddb6SLionel Sambuc } 9834684ddb6SLionel Sambuc catch (...) 9844684ddb6SLionel Sambuc { 9854684ddb6SLionel Sambuc this->__set_badbit_and_consider_rethrow(); 9864684ddb6SLionel Sambuc } 9874684ddb6SLionel Sambuc#endif // _LIBCPP_NO_EXCEPTIONS 9884684ddb6SLionel Sambuc return *this; 9894684ddb6SLionel Sambuc} 9904684ddb6SLionel Sambuc 9914684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 9924684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 9934684ddb6SLionel Sambuctypename basic_ostream<_CharT, _Traits>::pos_type 9944684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::tellp() 9954684ddb6SLionel Sambuc{ 9964684ddb6SLionel Sambuc if (this->fail()) 9974684ddb6SLionel Sambuc return pos_type(-1); 9984684ddb6SLionel Sambuc return this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out); 9994684ddb6SLionel Sambuc} 10004684ddb6SLionel Sambuc 10014684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 10024684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 10034684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 10044684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::seekp(pos_type __pos) 10054684ddb6SLionel Sambuc{ 10064684ddb6SLionel Sambuc sentry __s(*this); 1007*0a6a1f1dSLionel Sambuc if (!this->fail()) 10084684ddb6SLionel Sambuc { 10094684ddb6SLionel Sambuc if (this->rdbuf()->pubseekpos(__pos, ios_base::out) == pos_type(-1)) 10104684ddb6SLionel Sambuc this->setstate(ios_base::failbit); 10114684ddb6SLionel Sambuc } 10124684ddb6SLionel Sambuc return *this; 10134684ddb6SLionel Sambuc} 10144684ddb6SLionel Sambuc 10154684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 10164684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 10174684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 10184684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir) 10194684ddb6SLionel Sambuc{ 10204684ddb6SLionel Sambuc sentry __s(*this); 1021*0a6a1f1dSLionel Sambuc if (!this->fail()) 10224684ddb6SLionel Sambuc { 10234684ddb6SLionel Sambuc if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::out) == pos_type(-1)) 10244684ddb6SLionel Sambuc this->setstate(ios_base::failbit); 10254684ddb6SLionel Sambuc } 10264684ddb6SLionel Sambuc return *this; 10274684ddb6SLionel Sambuc} 10284684ddb6SLionel Sambuc 10294684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 10304684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 10314684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 10324684ddb6SLionel Sambucendl(basic_ostream<_CharT, _Traits>& __os) 10334684ddb6SLionel Sambuc{ 10344684ddb6SLionel Sambuc __os.put(__os.widen('\n')); 10354684ddb6SLionel Sambuc __os.flush(); 10364684ddb6SLionel Sambuc return __os; 10374684ddb6SLionel Sambuc} 10384684ddb6SLionel Sambuc 10394684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 10404684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 10414684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 10424684ddb6SLionel Sambucends(basic_ostream<_CharT, _Traits>& __os) 10434684ddb6SLionel Sambuc{ 10444684ddb6SLionel Sambuc __os.put(_CharT()); 10454684ddb6SLionel Sambuc return __os; 10464684ddb6SLionel Sambuc} 10474684ddb6SLionel Sambuc 10484684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 10494684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 10504684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 10514684ddb6SLionel Sambucflush(basic_ostream<_CharT, _Traits>& __os) 10524684ddb6SLionel Sambuc{ 10534684ddb6SLionel Sambuc __os.flush(); 10544684ddb6SLionel Sambuc return __os; 10554684ddb6SLionel Sambuc} 10564684ddb6SLionel Sambuc 10574684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 10584684ddb6SLionel Sambuc 10594684ddb6SLionel Sambuctemplate <class _Stream, class _Tp> 10604684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 10614684ddb6SLionel Sambuctypename enable_if 10624684ddb6SLionel Sambuc< 10634684ddb6SLionel Sambuc !is_lvalue_reference<_Stream>::value && 10644684ddb6SLionel Sambuc is_base_of<ios_base, _Stream>::value, 10654684ddb6SLionel Sambuc _Stream&& 10664684ddb6SLionel Sambuc>::type 10674684ddb6SLionel Sambucoperator<<(_Stream&& __os, const _Tp& __x) 10684684ddb6SLionel Sambuc{ 10694684ddb6SLionel Sambuc __os << __x; 10704684ddb6SLionel Sambuc return _VSTD::move(__os); 10714684ddb6SLionel Sambuc} 10724684ddb6SLionel Sambuc 10734684ddb6SLionel Sambuc#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 10744684ddb6SLionel Sambuc 10754684ddb6SLionel Sambuctemplate<class _CharT, class _Traits, class _Allocator> 10764684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 10774684ddb6SLionel Sambucoperator<<(basic_ostream<_CharT, _Traits>& __os, 10784684ddb6SLionel Sambuc const basic_string<_CharT, _Traits, _Allocator>& __str) 10794684ddb6SLionel Sambuc{ 1080*0a6a1f1dSLionel Sambuc return _VSTD::__put_character_sequence(__os, __str.data(), __str.size()); 10814684ddb6SLionel Sambuc} 10824684ddb6SLionel Sambuc 10834684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 10844684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 10854684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 10864684ddb6SLionel Sambucoperator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec) 10874684ddb6SLionel Sambuc{ 10884684ddb6SLionel Sambuc return __os << __ec.category().name() << ':' << __ec.value(); 10894684ddb6SLionel Sambuc} 10904684ddb6SLionel Sambuc 10914684ddb6SLionel Sambuctemplate<class _CharT, class _Traits, class _Yp> 10924684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 10934684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 10944684ddb6SLionel Sambucoperator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p) 10954684ddb6SLionel Sambuc{ 10964684ddb6SLionel Sambuc return __os << __p.get(); 10974684ddb6SLionel Sambuc} 10984684ddb6SLionel Sambuc 10994684ddb6SLionel Sambuctemplate <class _CharT, class _Traits, size_t _Size> 11004684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>& 11014684ddb6SLionel Sambucoperator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x) 11024684ddb6SLionel Sambuc{ 11034684ddb6SLionel Sambuc return __os << __x.template to_string<_CharT, _Traits> 11044684ddb6SLionel Sambuc (use_facet<ctype<_CharT> >(__os.getloc()).widen('0'), 11054684ddb6SLionel Sambuc use_facet<ctype<_CharT> >(__os.getloc()).widen('1')); 11064684ddb6SLionel Sambuc} 11074684ddb6SLionel Sambuc 11084684ddb6SLionel Sambuc_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ostream<char>) 11094684ddb6SLionel Sambuc_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ostream<wchar_t>) 11104684ddb6SLionel Sambuc 11114684ddb6SLionel Sambuc_LIBCPP_END_NAMESPACE_STD 11124684ddb6SLionel Sambuc 11134684ddb6SLionel Sambuc#endif // _LIBCPP_OSTREAM 1114