diff options
Diffstat (limited to 'contrib/libc++/include/ostream')
| -rw-r--r-- | contrib/libc++/include/ostream | 95 |
1 files changed, 36 insertions, 59 deletions
diff --git a/contrib/libc++/include/ostream b/contrib/libc++/include/ostream index f55fd40856ec..be35f2e16e70 100644 --- a/contrib/libc++/include/ostream +++ b/contrib/libc++/include/ostream @@ -148,7 +148,7 @@ template <class charT, class traits, class T> _LIBCPP_BEGIN_NAMESPACE_STD template <class _CharT, class _Traits> -class _LIBCPP_TYPE_VIS_ONLY basic_ostream +class _LIBCPP_TEMPLATE_VIS basic_ostream : virtual public basic_ios<_CharT, _Traits> { public: @@ -160,20 +160,24 @@ public: typedef typename traits_type::off_type off_type; // 27.7.2.2 Constructor/destructor: - explicit basic_ostream(basic_streambuf<char_type, traits_type>* __sb); + inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY + explicit basic_ostream(basic_streambuf<char_type, traits_type>* __sb) + { this->init(__sb); } virtual ~basic_ostream(); protected: #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY + inline _LIBCPP_INLINE_VISIBILITY basic_ostream(basic_ostream&& __rhs); #endif // 27.7.2.3 Assign/swap #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES - _LIBCPP_INLINE_VISIBILITY + inline _LIBCPP_INLINE_VISIBILITY basic_ostream& operator=(basic_ostream&& __rhs); #endif - void swap(basic_ostream& __rhs); + inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY + void swap(basic_ostream& __rhs) + { basic_ios<char_type, traits_type>::swap(__rhs); } #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS basic_ostream (const basic_ostream& __rhs) = delete; @@ -185,13 +189,22 @@ protected: public: // 27.7.2.4 Prefix/suffix: - class _LIBCPP_TYPE_VIS_ONLY sentry; + class _LIBCPP_TEMPLATE_VIS sentry; // 27.7.2.6 Formatted output: - basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&)); + inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY + basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&)) + { return __pf(*this); } + + inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY basic_ostream& operator<<(basic_ios<char_type, traits_type>& - (*__pf)(basic_ios<char_type,traits_type>&)); - basic_ostream& operator<<(ios_base& (*__pf)(ios_base&)); + (*__pf)(basic_ios<char_type,traits_type>&)) + { __pf(*this); return *this; } + + inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY + basic_ostream& operator<<(ios_base& (*__pf)(ios_base&)) + { __pf(*this); return *this; } + basic_ostream& operator<<(bool __n); basic_ostream& operator<<(short __n); basic_ostream& operator<<(unsigned short __n); @@ -213,8 +226,11 @@ public: basic_ostream& flush(); // 27.7.2.5 seeks: + inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY pos_type tellp(); + inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY basic_ostream& seekp(pos_type __pos); + inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY basic_ostream& seekp(off_type __off, ios_base::seekdir __dir); protected: @@ -223,7 +239,7 @@ protected: }; template <class _CharT, class _Traits> -class _LIBCPP_TYPE_VIS_ONLY basic_ostream<_CharT, _Traits>::sentry +class _LIBCPP_TEMPLATE_VIS basic_ostream<_CharT, _Traits>::sentry { bool __ok_; basic_ostream<_CharT, _Traits>& __os_; @@ -274,24 +290,15 @@ basic_ostream<_CharT, _Traits>::sentry::~sentry() } } -template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY -basic_ostream<_CharT, _Traits>::basic_ostream(basic_streambuf<char_type, traits_type>* __sb) -{ - this->init(__sb); -} - #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY basic_ostream<_CharT, _Traits>::basic_ostream(basic_ostream&& __rhs) { this->move(__rhs); } template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator=(basic_ostream&& __rhs) { @@ -307,41 +314,6 @@ basic_ostream<_CharT, _Traits>::~basic_ostream() } template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY -void -basic_ostream<_CharT, _Traits>::swap(basic_ostream& __rhs) -{ - basic_ios<char_type, traits_type>::swap(__rhs); -} - -template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY -basic_ostream<_CharT, _Traits>& -basic_ostream<_CharT, _Traits>::operator<<(basic_ostream& (*__pf)(basic_ostream&)) -{ - return __pf(*this); -} - -template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY -basic_ostream<_CharT, _Traits>& -basic_ostream<_CharT, _Traits>::operator<<(basic_ios<char_type, traits_type>& - (*__pf)(basic_ios<char_type,traits_type>&)) -{ - __pf(*this); - return *this; -} - -template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY -basic_ostream<_CharT, _Traits>& -basic_ostream<_CharT, _Traits>::operator<<(ios_base& (*__pf)(ios_base&)) -{ - __pf(*this); - return *this; -} - -template <class _CharT, class _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_type>* __sb) { @@ -989,7 +961,6 @@ basic_ostream<_CharT, _Traits>::flush() } template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY typename basic_ostream<_CharT, _Traits>::pos_type basic_ostream<_CharT, _Traits>::tellp() { @@ -999,7 +970,6 @@ basic_ostream<_CharT, _Traits>::tellp() } template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::seekp(pos_type __pos) { @@ -1013,7 +983,6 @@ basic_ostream<_CharT, _Traits>::seekp(pos_type __pos) } template <class _CharT, class _Traits> -inline _LIBCPP_INLINE_VISIBILITY basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir) { @@ -1080,6 +1049,14 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, return _VSTD::__put_character_sequence(__os, __str.data(), __str.size()); } +template<class _CharT, class _Traits> +basic_ostream<_CharT, _Traits>& +operator<<(basic_ostream<_CharT, _Traits>& __os, + const basic_string_view<_CharT, _Traits> __sv) +{ + return _VSTD::__put_character_sequence(__os, __sv.data(), __sv.size()); +} + template <class _CharT, class _Traits> inline _LIBCPP_INLINE_VISIBILITY basic_ostream<_CharT, _Traits>& @@ -1105,8 +1082,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x) use_facet<ctype<_CharT> >(__os.getloc()).widen('1')); } -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ostream<char>) -_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ostream<wchar_t>) +_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<char>) +_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<wchar_t>) _LIBCPP_END_NAMESPACE_STD |
