summaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/libcxx/include/__ostream/basic_ostream.h
diff options
context:
space:
mode:
authormikhnenko <[email protected]>2025-02-25 10:55:30 +0300
committermikhnenko <[email protected]>2025-02-25 11:10:50 +0300
commitba3f1646a3a22daceac94dd0cd330152b1d5b5b5 (patch)
tree16da0d516f0c768c219e6f0fc7351676e390873f /contrib/libs/cxxsupp/libcxx/include/__ostream/basic_ostream.h
parentdda9be9e1fde150b4473d9d10ec1a0d3829f7482 (diff)
Update libcxx to 8 July 2024
{% cut "Change log" %} ``` [libc++] Add a test case for std::bit_cast with std::complex (#97751) [libc++] Update status after the St. Louis meeting. (#97951) [libc++] Guard transitive include of `<locale>` with availability macro (#97869) [libc++] Restore `__synth_three_way` lambda (#90398) [libc++][TZDB] Makes implementation experimental. (#95657) [libc++] Remove dead code from the locale base API and support code (#89070) [libc++] Assume newer LLVM versions for not-yet-released macOS versions [libc++] Remove annotations for GCC 13 and update the documentation (#97744) [libc++][test] Updates sized deallocation tests. (#97833) [libc++] Adds a missing include. [libc++] Use __is_array if the builtin is fixed (#93037) [libc++] Use _Complex for multiplication and division of complex floating point types (#83575) [libc++] Adds a new feature-test macro generator class. (#90889) [libc++][chrono] Fixes leap seconds. (#90070) [libc++] Upgrade to GCC 14 (#97205) [libc++] Fix the signatures of `std::rethrow_if_nested` (#91365) [libc++] Use GCC compilers from compiler explorer (#97219) Add a regression test for recent regression in pair. (#97355) [libcxx][Docs] Correct link syntax in hardening docs [libc++] Don't use a ppa for GCC [libc++] Upgrade to GCC 14 in the CI (#95212) [libc++abi] Fix test failures with GCC 14 (#95759) [libc++] Clean up and update deployment target features (#96312) [libc++] Fix how we pass /MANIFEST flag on Windows without clang-cl (#96967) [libc++] Classify iota_view precondition (#96662) [libc++] restrict the expected conversion constructor not compete against copy constructor (#96101) "[libc++] Try again LWG3233 Broken requirements for shared_ptr converting constructors" (#96103) [libc++] LWG3382: NTTP for `pair` and `array` (#85811) [libc++] Get the GCC build mostly clean of warnings (#96604) [libc++] P3029R1: Better `mdspan`'s CTAD - `std::extents` (#89015) [libc++] Move allocator assertion into allocator_traits (#94750) [libc++] change the visibility of libc++ header to public in libcxx module (#91240) [libc++] Use _If for conditional_t (#96193) [libc++] Remove the allocator<const T> extension (#96319) [libc++] Fix incorrect overflow checking in std::lcm (#96310) [libc++] Use __is_nothrow_destructible (#95766) [libc++] Remove Windows-specific configuration from libcxx/test/CMakeLists.txt (#96330) [libc++] Build with -fsized-deallocation (#96217) [libc++] <experimental/simd> Add swap functions of simd reference (#86478) [libc++] Fix deployment target Lit features (#94791) [libc++] Workaround clang bug in __has_unique_object_representations (#95314) [libc++] Remove <ostream> include from <chrono> (#96035) [libc++] Fix triviality of std::pair for trivially copyable types without an assignment operator (#95444) [libc++] Install Python packaging to resolve LLDB data formatter issues (#95971) [libc++] Properly define _LIBCPP_HAS_NO_UNICODE in __config_site (#95138) [libc++] Refactor<__type_traits/is_swappable.h> (#86822) [libc++] Enable modernize-use-equals-delete (#93293) [libc++] Test suite adjustments on macOS (#95835) [libc++] Guard transitive include of `<locale>` with availability macro (#95686) [libc++] Mark more types as trivially relocatable (#89724) [libcxx] [ci] Simplify the mingw x86_64 configs (#95609) [libc++][TZDB] Disables a failing test. (#95659) [libc++] Add default copy ctor to "__chrono/exception.h" (#95338) [libcxx][test][AIX] address more platform differences in locale tests (#94826) [libc++] Remove unnecessary #ifdef guards around PSTL implementation details (#95268) [libc++] Mark local_time test as a long test (#95170) Update actions-runner version for libc++ builder images [libc++] Move the implementation of CPU-based basis operations to namespace __pstl (#95267) [libc++][modules] Mark as implemented. (#90091) [libc++] Adds __cpp_lib_three_way_comparison FTM. (#91515) [libc++] Overhaul the PSTL dispatching mechanism (#88131) [libcxx] Correct and clean-up filesystem operations error_code paths (#88341) [libc++][z/OS] Disable portion of formatter.char.funsigned-char.pass.cpp for no unicode (#94044) [libc++] Mark a few functions in the dylib as noexcept (#94098) [libc++] Fix UB in filesystem::__copy for non-existent destination. (#87615) [libc++] Simplify the definition of string::operator== (#95000) [libc++] Update with LWG issue number for shared-ptr constructor [libc++] Tweak how we check constraints on shared_ptr(nullptr_t) (#94996) [HWASan] make get_info.local_time.pass.cpp UNSUPPORTED [libc++] Fix endianness for algorithm mismatch (#93082) [HWASan] skip libcxx test that times out with hwasan [libc++][TZDB] Implements zoned_traits. (#91059) [libc++][test] Avoid `-Wunused-variable` warnings in mutex tests (#94907) [libc++] Fix invalid escape sequences in Python comments (#94032) [libc++][TZDB] Implements time_zone::to_local. (#91003) [libc++][TZDB] Implements time_zone::to_sys. (#90901) [libc++][TZDB] Implements time_zone::to_sys. (#90394) [libc++][TZDB] Implements time_zone get_info(local_time). (#89537) [libc++] Undeprecate shared_ptr atomic access APIs (#92920) [libc++][regex] Correctly adjust match prefix for zero-length matches. (#94550) [libc++][test][AIX] Only XFAIL atomic tests for before clang 19 (#94646) [libc++] Fix naming of value template parameters (#76888) [libc++][hardening] Finish documenting hardening. (#92021) Fix detection of __datasizeof with Clang. (#94174) [libc++] Fix SyntaxWarning messages from python 3.12 (#93637) [libc++] [test] Consistently use `REQUIRES: has-unix-headers` (#94122) [libc++] Add missing noexcept to span constructor (#94381) Remove act from builder image. It never turned out to be useful [libc++] Adjust XFAIL for quick_exit (#94274) [libc++] Properly detect whether C++20 modules are supported by the compiler (#94275) [libc++] Handle 0 size case for testing support operator new (#93834) [libc++] Fix regression about parsing leading decimal points (#93989) [libc++][test] Mark `optional` test functions as `TEST_CONSTEXPR_CXX20` (#94172) [clang][Modules] Remove unnecessary includes of `Module.h` (#93417) [libc++] Don't give functions C linkage (#94102) [libc++] [test] Cleanup compile-only tests (#94121) [libc++] [test] Fix `__has_include` usage, expand condvarany and spaceship coverage (#94120) [libc++] Fix `std::atomic::wait` ulock wait UL_COMPARE_AND_WAIT64 (#92783) Fix order of include flags for the target & regular include paths. (#93547) [libc++] Fix failures with GCC 14 (#92663) [libc++] Remove the inline namespace for std::filesystem in ABIv2 (#92971) [runtimes] Correctly apply libdir subdir for multilib (#93354) [clang] Preserve Qualifiers and type sugar in TemplateNames (#93433) [libc++][test] Close LWG3018 and add tests (#93047) [runtimes][CMake] Simplify the propagation of test dependencies (#93558) [runtimes] Reintroduce a way to select the compiler used for the test suite (#93542) [libc++] Make the __availability header a sub-header of __config (#93083) [libc++][test] Close LWG3238 and add tests (#93043) [libc++] LWG3223 Broken requirements for shared_ptr converting constructors (#93071) [libc++][test] Close LWG3382 and add tests (#93039) [libc++] [test] Fix portability issues for MSVC (#93259) [libc++] [test] Fix MSVC warnings (#93257) [libc++] Mark P2845R8 `__cpp_lib_format_path` and P2587R3 `__cpp_lib_to_string` as C++26 (#93255) [libc++] Split up ABI and platform configuration to their own headers (#90863) [libc++][pstl] Merge all frontend functions for the PSTL (#89219) [libcxx][test][AIX] Fix the thousands_sep expectation for fr_FR locales (#92312) [libcxx] [test] Use `shlex.quote()` to fix Python 3.13 compatibility (#93376) [libc++] Remove libcxx/include/libcxx.imp Revise IDE folder structure (#89755) [libc++][test] Close LWG3045 (#93053) [libc++] Remove a few unused includes of trivially_copyable.h (#93200) [test][libcxx] Update deallocation after #90373 (#93145) [libc++] Refactor tests for std::condition_variable (#91530) Removed redundant template in '__delete_node()' member function of '__forward_list_base' and '__list_imp' classes. (#84323) [libc++][pstl] Improve exception handling (#88998) [WebAssembly] Upstream misc. EH changes (#92990) [libc++] <experimental/simd> Add copy functions for class simd/simd_mask (#78935) [libc++][vector] Inline remaining constructors filling vector with the same value (#82068) Reland "[clang] Enable sized deallocation by default in C++14 onwards" (#90373) [libc++] Implement C++20 atomic_ref (#76647) [libc++] Refactor flaky tests for std::shared_lock (#91779) [libcxx] [test] Detect mingw-w64 headers compatible with C++ module builds (#92893) [libc++] LWG2381: Inconsistency in parsing floating point numbers (#77948) [libcxx] removes unnecessary traits from `has_unique_object_representations` (#69241) [libc++][z/OS] Switch to use TEST_HAS_NO_INT128 as per comment in PR 92261 (#92434) [libcxx] Add cast to avoid pointer casting warning on Windows (#92738) [libcxx] locale.cpp: Move build_name helper into unnamed namespace (#92461) [libcxx][libcxxabi] Fix build for OpenBSD (#92186) [libc++] LWG3672: `common_iterator::operator->()` should return by value (#87899) [libc++][z/OS] Correct a definition of __native_vector_size (#91995) [libc++][z/OS] Fixup two linear_congruential_engine tests (#92261) [libc++][test] `__cpp_lib_within_lifetime` -> `__cpp_lib_is_within_lifetime` (#91896) Fix typo "indicies" (#92232) [libcxx][test] Fix numpunct grouping tests on AIX (#91781) [libcxx] [test] Fix the locale ctype widen tests on AIX (#91744) [libc++] Vectorize std::mismatch with trivially equality comparable types (#87716) [libc++] Make `constexpr std::variant`. Implement P2231R1 (#83335) [libc++][doc] Updates Spaceship status page. [libc++][ASan] Fix std::basic_string trait type (#91590) [libc++][test] Fixes constexpr char_traits. (#90981) [libc++][functional] P2944R3 (partial): Comparisons for `reference_wrapper` (`reference_wrapper` operators only) (#88384) [libc++][CI] Reenables clang-tidy. (#90077) [libc++] Implement std::gcd using the binary version (#77747) [ASan][libc++] Turn on ASan annotations for short strings (#79536) [AIX][libc++] Enable clang_modules_include.gen.py tests (#90971) [libc++] Rename _LIBCPP_INTRODUCED_foo_MARKUP to _LIBCPP_INTRODUCED_foo_ATTRIBUTE (#91269) [libc++] Fix P1206R7 feature test macros (#90914) [libc++] Adjust some of the [rand.dist] critical values that are too strict (#88669) [libc++][modules] Uses _LIBCPP_USING_IF_EXISTS. (#90409) Bump actions runner image used for libc++'s builders. [libcxx] Align `__recommend() + 1` by __endian_factor (#90292) [libc++] Granularize <ostream> (#85537) [libc++] Remove a few __has_foo defines in __config (#90511) [libc++] Remove _LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS (#90512) [libcxx][ci] In picolib build, ask clang for the normalised triple (#90722) [libc++][ranges] Implement LWG4053 and LWG4054 (#88612) [libc++] Some tests are missing include for `numeric_limits` (#90345) [libc++] Mark scoped_lock and unique_lock constructors as [[nodiscard]] (#89397) [libc++] Improve libc++ tests when using optimizations (#88897) [libc++][modules] Enable installation by default. (#90094) [libc++][format] Improves escaping performance. (#88533) [libcxx] Remove empty ~__no_destroy (#89882) [libc++][ranges] Exports operator|. (#90071) [C++17] Support __GCC_[CON|DE]STRUCTIVE_SIZE (#89446) [libc++][ranges] LWG3984: ranges::to's recursion branch may be ill-formed (#87964) [clang] Enable sized deallocation by default in C++14 onwards (#83774) [libc++][format] Improves escaping. (#88283) [libc++] Implement LWG4023 (#87513) [libc++] Reformulate availability in terms of LLVM releases (#87563) [libc++] Reorganize the std::variant macros (#89419) [libc++][format] Adds an escaped output benchmark. (#88020) [libc++] Makes saturation functions privately available. (#89503) [libcxx] [modules] Add _LIBCPP_USING_IF_EXISTS on aligned_alloc (#89827) [libc++][TZDB] Fixes reverse time lookups. (#89502) [libc++][doc] Updates module build instructions. (#89413) [libc++][chrono] Fixes format output of negative values. (#89408) [libc++][ranges] export `std::ranges::range_adaptor_closure` (#89793) [libc++][ranges] P2387R3: Pipe support for user-defined range adaptors (#89148) [libc++] Add some private headers to libcxx.imp (#89568) [libc++] Remove _LIBCPP_DISABLE_NODISCARD_EXTENSIONS and refactor the tests (#87094) [libc++] Remove stray CMake install step for modulemap file (#89394) [libc++] Don't commit libcxx.imp (#89391) [libc++] Removes a Clang 16 Windows workaround. (#88560) [libc++][TZDB] Renames incomplete. (#89250) [libc++] Optimize char_traits a bit (#72799) [libc++] Fix usage of 'exclude_from_explicit_instantiation' attribute on local class members (#89377) linear_congruential_engine: add using more precision to prevent overflow (#81583) CompilerRT: Normalize COMPILER_RT_DEFAULT_TARGET_TRIPLE (#89234) [libc++][TZDB] Adds local_info formatter. (#86256) [libc++][pstl] Move the CPU algorithm implementations to __pstl (#89109) [libc++][TZDB] Adds sys_info formatter. (#85896) [libc++][pstl] Promote CPU backends to top-level backends (#88968) [libc++][chrono] Improves date formatting. (#86127) [libc++] Add missing iterator requirement checks in the PSTL (#88127) [libc++][TZDB] Improves time zone format specifiers. (#85797) [libc++][chrono] Disables a test. [libc++][doc] Documents -DLIBCXX_INSTALL_MODULES=ON. (#88547) [libc++][test] Removes Clang 16 validation. (#88558) [libc++] Removes deprecated _LIBCPP_ENABLE_<VERSION>_REMOVED_FEATURES macros (#88548) [libc++][modules] Removes some validation quirks. (#88031) [libc++] Deprecate the C++20 synchronization library before C++20 (#86410) [libc++] Use availability to rely on key functions for bad_expected_access and bad_function_call (#87390) [libc++] Rename __cpu_traits functions (#88741) [libc++][CI] Tests LLDB libc++ data formatters. (#88312) [libc++] Add a utility to check whether a range is valid (#87665) [libc++][PSTL] Introduce cpu traits (#88134) [libc++][RFC] Only include what is required by-version in the umbrella headers (#83740) [libc++] Deprecated `shared_ptr` Atomic Access APIs as per P0718R2 & Implemented P2869R3: Remove Deprecated `shared_ptr` Atomic Access APIs from C++26 (#87111) [libc++][TZDB] Removes test_indian_kerguelen test. [libc++][TZDZ] Validates the database version. [libc++] Undeprecate POSIX STREAM macros. (#88296) [libc++] Marks a variable const. (#88562) [libc++][CMake] Removes LIBCXX_ENABLE_CLANG_TIDY. (#85794) [tzdb] Replace shared_mutex with mutex. (#87929) [libc++] P3029R1: Better `mdspan`'s CTAD (#87873) [libc++][ranges] LWG3736: move_iterator missing disable_sized_sentinel_for specialization (#85611) [libc++] LWG3643: Missing `constexpr` in `std::counted_iterator` (#87901) [libcxx] applies changes regarding post-commit feedback to #75259 (#76534) [libc++] Fix -Wgnu-include-next in stddef.h (#88214) [libcxx] Use generic builtins for popcount, clz and ctz (#86563) [libc++] Adds a global private constructor tag. (#87920) [libc++] Removes Clang-16 support. (#87810) [lib++][CI] Changes bootstrap build type. (#88175) [libc++][CI] Updates Docker LLDB dependencies. (#88174) [libc++][chrono] Adds the sys_info class. (#85619) [libc++][format] Switches to Unicode 15.1. (#86543) [libc++] Avoids using ENODATA. (#86165) [libc++][TZDB] Fixes relative path resolving. (#87882) [libc++][format] adds a basic fuzzer test. (#87883) [libc++] Add test coverage for our implementation of LWG4031 (#87508) [libc++] Implement `bind_back` (#81055) [libc++][format] Fixed `println.blank_line.sh.cpp` test on llvm-clang-win-x-* configurations (#88011) [libc++][doc] Updates format status page. [libc++][format] P3142R0: Printing Blank Lines with `println` (#87277) [libc++] Optimize ranges::minmax (#87335) [libc++] Implement LWG3430 disallow implicit conversion of the source arguments to `std::filesystem::path` when constructing `std::basic_*fstream` (#85079) [libc++] P2872R3: Remove ``wstring_convert`` From C++26 (#87100) Fix issue with never-constexpr __construct_at in C++ < 20. (#87403) [libcxx] coerce formatter precision to int (#87738) [libc++][CI] Updates to Clang 19. (#85301) [libc++][chrono] Completes the tzdb class. (#82157) [libc++][oss-fuzz] Updates C++ version used. (#87531) [libc++] P2867R1: Remove Deprecated `strstream`s From C++26 (#87107) [libc++] Fix copy/pasta error in atomic tests for `atomic_compare_exchange_{weak,strong}` (#87135) [libc++] Mark some recent LWG issues and papers as done (#87502) [libc++][chrono] Loads leap-seconds.list in tzdb. (#82113) [libc++] Disables -Wweak-vtables diagnostics. (#85577) [libc++] Update status page after the Tokyo meeting (#87395) [libc++] Upstream ptrauth support in libc++ and libc++abi (#84573) [libc++] Fix tests on musl (#85085) (#86934) [libc++] Add a static_assert for a Mandates in seed_seq (#86992) [libc++][ranges] Avoid using `distance` in `ranges::contains_subrange` (#87155) [libc++] `std::ranges::advance`: avoid unneeded bounds checks when advancing iterator (#84126) ``` {% endcut %} commit_hash:45feb9db5b173f12bf29de2a3ee73006d4371a4e
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/__ostream/basic_ostream.h')
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__ostream/basic_ostream.h860
1 files changed, 860 insertions, 0 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/__ostream/basic_ostream.h b/contrib/libs/cxxsupp/libcxx/include/__ostream/basic_ostream.h
new file mode 100644
index 00000000000..4f7e9cfe1cf
--- /dev/null
+++ b/contrib/libs/cxxsupp/libcxx/include/__ostream/basic_ostream.h
@@ -0,0 +1,860 @@
+//===---------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===---------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___OSTREAM_BASIC_OSTREAM_H
+#define _LIBCPP___OSTREAM_BASIC_OSTREAM_H
+
+#include <__config>
+#include <__exception/operations.h>
+#include <__memory/shared_ptr.h>
+#include <__memory/unique_ptr.h>
+#include <__system_error/error_code.h>
+#include <__type_traits/conjunction.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_base_of.h>
+#include <__type_traits/void_t.h>
+#include <__utility/declval.h>
+#include <bitset>
+#include <cstddef>
+#include <ios>
+#include <locale>
+#include <new> // for __throw_bad_alloc
+#include <streambuf>
+#include <string_view>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _CharT, class _Traits>
+class _LIBCPP_TEMPLATE_VIS basic_ostream : virtual public basic_ios<_CharT, _Traits> {
+public:
+ // types (inherited from basic_ios (27.5.4)):
+ typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef typename traits_type::int_type int_type;
+ typedef typename traits_type::pos_type pos_type;
+ typedef typename traits_type::off_type off_type;
+
+ // 27.7.2.2 Constructor/destructor:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 explicit basic_ostream(basic_streambuf<char_type, traits_type>* __sb) {
+ this->init(__sb);
+ }
+ ~basic_ostream() override;
+
+ basic_ostream(const basic_ostream& __rhs) = delete;
+ basic_ostream& operator=(const basic_ostream& __rhs) = delete;
+
+protected:
+ inline _LIBCPP_HIDE_FROM_ABI basic_ostream(basic_ostream&& __rhs);
+
+ // 27.7.2.3 Assign/swap
+ inline _LIBCPP_HIDE_FROM_ABI basic_ostream& operator=(basic_ostream&& __rhs);
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 void swap(basic_ostream& __rhs) {
+ basic_ios<char_type, traits_type>::swap(__rhs);
+ }
+
+public:
+ // 27.7.2.4 Prefix/suffix:
+ class _LIBCPP_TEMPLATE_VIS sentry;
+
+ // 27.7.2.6 Formatted output:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&)) {
+ return __pf(*this);
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_ostream&
+ operator<<(basic_ios<char_type, traits_type>& (*__pf)(basic_ios<char_type, traits_type>&)) {
+ __pf(*this);
+ return *this;
+ }
+
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 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);
+ basic_ostream& operator<<(int __n);
+ basic_ostream& operator<<(unsigned int __n);
+ basic_ostream& operator<<(long __n);
+ basic_ostream& operator<<(unsigned long __n);
+ basic_ostream& operator<<(long long __n);
+ basic_ostream& operator<<(unsigned long long __n);
+ basic_ostream& operator<<(float __f);
+ basic_ostream& operator<<(double __f);
+ basic_ostream& operator<<(long double __f);
+ basic_ostream& operator<<(const void* __p);
+
+#if _LIBCPP_STD_VER >= 23
+ _LIBCPP_HIDE_FROM_ABI basic_ostream& operator<<(const volatile void* __p) {
+ return operator<<(const_cast<const void*>(__p));
+ }
+#endif
+
+ basic_ostream& operator<<(basic_streambuf<char_type, traits_type>* __sb);
+
+#if _LIBCPP_STD_VER >= 17
+ // LWG 2221 - nullptr. This is not backported to older standards modes.
+ // See https://reviews.llvm.org/D127033 for more info on the rationale.
+ _LIBCPP_HIDE_FROM_ABI basic_ostream& operator<<(nullptr_t) { return *this << "nullptr"; }
+#endif
+
+ // 27.7.2.7 Unformatted output:
+ basic_ostream& put(char_type __c);
+ basic_ostream& write(const char_type* __s, streamsize __n);
+ basic_ostream& flush();
+
+ // 27.7.2.5 seeks:
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 pos_type tellp();
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_ostream& seekp(pos_type __pos);
+ inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1 basic_ostream& seekp(off_type __off, ios_base::seekdir __dir);
+
+protected:
+ _LIBCPP_HIDE_FROM_ABI basic_ostream() {} // extension, intentially does not initialize
+};
+
+template <class _CharT, class _Traits>
+class _LIBCPP_TEMPLATE_VIS basic_ostream<_CharT, _Traits>::sentry {
+ bool __ok_;
+ basic_ostream<_CharT, _Traits>& __os_;
+
+public:
+ explicit sentry(basic_ostream<_CharT, _Traits>& __os);
+ ~sentry();
+ sentry(const sentry&) = delete;
+ sentry& operator=(const sentry&) = delete;
+
+ _LIBCPP_HIDE_FROM_ABI explicit operator bool() const { return __ok_; }
+};
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>::sentry::sentry(basic_ostream<_CharT, _Traits>& __os) : __ok_(false), __os_(__os) {
+ if (__os.good()) {
+ if (__os.tie())
+ __os.tie()->flush();
+ __ok_ = true;
+ }
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>::sentry::~sentry() {
+ if (__os_.rdbuf() && __os_.good() && (__os_.flags() & ios_base::unitbuf) && !uncaught_exception()) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ if (__os_.rdbuf()->pubsync() == -1)
+ __os_.setstate(ios_base::badbit);
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ }
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>::basic_ostream(basic_ostream&& __rhs) {
+ this->move(__rhs);
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator=(basic_ostream&& __rhs) {
+ swap(__rhs);
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>::~basic_ostream() {}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>&
+basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_type>* __sb) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ sentry __s(*this);
+ if (__s) {
+ if (__sb) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ typedef istreambuf_iterator<_CharT, _Traits> _Ip;
+ typedef ostreambuf_iterator<_CharT, _Traits> _Op;
+ _Ip __i(__sb);
+ _Ip __eof;
+ _Op __o(*this);
+ size_t __c = 0;
+ for (; __i != __eof; ++__i, ++__o, ++__c) {
+ *__o = *__i;
+ if (__o.failed())
+ break;
+ }
+ if (__c == 0)
+ this->setstate(ios_base::failbit);
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_failbit_and_consider_rethrow();
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ } else
+ this->setstate(ios_base::badbit);
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(bool __n) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(short __n) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ sentry __s(*this);
+ if (__s) {
+ ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this,
+ *this,
+ this->fill(),
+ __flags == ios_base::oct || __flags == ios_base::hex
+ ? static_cast<long>(static_cast<unsigned short>(__n))
+ : static_cast<long>(__n))
+ .failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(int __n) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ sentry __s(*this);
+ if (__s) {
+ ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this,
+ *this,
+ this->fill(),
+ __flags == ios_base::oct || __flags == ios_base::hex
+ ? static_cast<long>(static_cast<unsigned int>(__n))
+ : static_cast<long>(__n))
+ .failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long __n) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long long __n) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(float __n) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(double __n) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long double __n) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(const void* __n) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ sentry __s(*this);
+ if (__s) {
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = std::use_facet<_Fp>(this->getloc());
+ if (__f.put(*this, *this, this->fill(), __n).failed())
+ this->setstate(ios_base::badbit | ios_base::failbit);
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+__put_character_sequence(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str, size_t __len) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
+ if (__s) {
+ typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
+ if (std::__pad_and_output(
+ _Ip(__os),
+ __str,
+ (__os.flags() & ios_base::adjustfield) == ios_base::left ? __str + __len : __str,
+ __str + __len,
+ __os,
+ __os.fill())
+ .failed())
+ __os.setstate(ios_base::badbit | ios_base::failbit);
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __os.__set_badbit_and_consider_rethrow();
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ return __os;
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c) {
+ return std::__put_character_sequence(__os, &__c, 1);
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
+ if (__s) {
+ _CharT __c = __os.widen(__cn);
+ typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
+ if (std::__pad_and_output(
+ _Ip(__os),
+ &__c,
+ (__os.flags() & ios_base::adjustfield) == ios_base::left ? &__c + 1 : &__c,
+ &__c + 1,
+ __os,
+ __os.fill())
+ .failed())
+ __os.setstate(ios_base::badbit | ios_base::failbit);
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __os.__set_badbit_and_consider_rethrow();
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ return __os;
+}
+
+template <class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __os, char __c) {
+ return std::__put_character_sequence(__os, &__c, 1);
+}
+
+template <class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __os, signed char __c) {
+ return std::__put_character_sequence(__os, (char*)&__c, 1);
+}
+
+template <class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c) {
+ return std::__put_character_sequence(__os, (char*)&__c, 1);
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str) {
+ return std::__put_character_sequence(__os, __str, _Traits::length(__str));
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
+ if (__s) {
+ typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
+ size_t __len = char_traits<char>::length(__strn);
+ const int __bs = 100;
+ _CharT __wbb[__bs];
+ _CharT* __wb = __wbb;
+ unique_ptr<_CharT, void (*)(void*)> __h(0, free);
+ if (__len > __bs) {
+ __wb = (_CharT*)malloc(__len * sizeof(_CharT));
+ if (__wb == 0)
+ __throw_bad_alloc();
+ __h.reset(__wb);
+ }
+ for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p)
+ *__p = __os.widen(*__strn);
+ if (std::__pad_and_output(
+ _Ip(__os),
+ __wb,
+ (__os.flags() & ios_base::adjustfield) == ios_base::left ? __wb + __len : __wb,
+ __wb + __len,
+ __os,
+ __os.fill())
+ .failed())
+ __os.setstate(ios_base::badbit | ios_base::failbit);
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ __os.__set_badbit_and_consider_rethrow();
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ return __os;
+}
+
+template <class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>& __os, const char* __str) {
+ return std::__put_character_sequence(__os, __str, _Traits::length(__str));
+}
+
+template <class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>&
+operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str) {
+ const char* __s = (const char*)__str;
+ return std::__put_character_sequence(__os, __s, _Traits::length(__s));
+}
+
+template <class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<char, _Traits>&
+operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str) {
+ const char* __s = (const char*)__str;
+ return std::__put_character_sequence(__os, __s, _Traits::length(__s));
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::put(char_type __c) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ sentry __s(*this);
+ if (__s) {
+ typedef ostreambuf_iterator<_CharT, _Traits> _Op;
+ _Op __o(*this);
+ *__o = __c;
+ if (__o.failed())
+ this->setstate(ios_base::badbit);
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n) {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ sentry __sen(*this);
+ if (__sen && __n) {
+ if (this->rdbuf()->sputn(__s, __n) != __n)
+ this->setstate(ios_base::badbit);
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::flush() {
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ try {
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ if (this->rdbuf()) {
+ sentry __s(*this);
+ if (__s) {
+ if (this->rdbuf()->pubsync() == -1)
+ this->setstate(ios_base::badbit);
+ }
+ }
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+ } catch (...) {
+ this->__set_badbit_and_consider_rethrow();
+ }
+#endif // _LIBCPP_HAS_NO_EXCEPTIONS
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+typename basic_ostream<_CharT, _Traits>::pos_type basic_ostream<_CharT, _Traits>::tellp() {
+ if (this->fail())
+ return pos_type(-1);
+ return this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out);
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::seekp(pos_type __pos) {
+ sentry __s(*this);
+ if (!this->fail()) {
+ if (this->rdbuf()->pubseekpos(__pos, ios_base::out) == pos_type(-1))
+ this->setstate(ios_base::failbit);
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir) {
+ sentry __s(*this);
+ if (!this->fail()) {
+ if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::out) == pos_type(-1))
+ this->setstate(ios_base::failbit);
+ }
+ return *this;
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI inline basic_ostream<_CharT, _Traits>& endl(basic_ostream<_CharT, _Traits>& __os) {
+ __os.put(__os.widen('\n'));
+ __os.flush();
+ return __os;
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI inline basic_ostream<_CharT, _Traits>& ends(basic_ostream<_CharT, _Traits>& __os) {
+ __os.put(_CharT());
+ return __os;
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI inline basic_ostream<_CharT, _Traits>& flush(basic_ostream<_CharT, _Traits>& __os) {
+ __os.flush();
+ return __os;
+}
+
+template <class _Stream, class _Tp, class = void>
+struct __is_ostreamable : false_type {};
+
+template <class _Stream, class _Tp>
+struct __is_ostreamable<_Stream, _Tp, decltype(std::declval<_Stream>() << std::declval<_Tp>(), void())> : true_type {};
+
+template <class _Stream,
+ class _Tp,
+ __enable_if_t<_And<is_base_of<ios_base, _Stream>, __is_ostreamable<_Stream&, const _Tp&> >::value, int> = 0>
+_LIBCPP_HIDE_FROM_ABI _Stream&& operator<<(_Stream&& __os, const _Tp& __x) {
+ __os << __x;
+ return std::move(__os);
+}
+
+template <class _CharT, class _Traits, class _Allocator>
+basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const basic_string<_CharT, _Traits, _Allocator>& __str) {
+ return std::__put_character_sequence(__os, __str.data(), __str.size());
+}
+
+template <class _CharT, class _Traits>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, basic_string_view<_CharT, _Traits> __sv) {
+ return std::__put_character_sequence(__os, __sv.data(), __sv.size());
+}
+
+template <class _CharT, class _Traits>
+inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec) {
+ return __os << __ec.category().name() << ':' << __ec.value();
+}
+
+template <class _CharT, class _Traits, class _Yp>
+inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p) {
+ return __os << __p.get();
+}
+
+template <
+ class _CharT,
+ class _Traits,
+ class _Yp,
+ class _Dp,
+ __enable_if_t<is_same<void,
+ __void_t<decltype((std::declval<basic_ostream<_CharT, _Traits>&>()
+ << std::declval<typename unique_ptr<_Yp, _Dp>::pointer>()))> >::value,
+ int> = 0>
+inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, unique_ptr<_Yp, _Dp> const& __p) {
+ return __os << __p.get();
+}
+
+template <class _CharT, class _Traits, size_t _Size>
+_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
+operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x) {
+ return __os << __x.template to_string<_CharT, _Traits>(std::use_facet<ctype<_CharT> >(__os.getloc()).widen('0'),
+ std::use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
+}
+
+#if 0 && _LIBCPP_STD_VER >= 20
+
+# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+template <class _Traits>
+basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, wchar_t) = delete;
+
+template <class _Traits>
+basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const wchar_t*) = delete;
+
+template <class _Traits>
+basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, char16_t) = delete;
+
+template <class _Traits>
+basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, char32_t) = delete;
+
+template <class _Traits>
+basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, const char16_t*) = delete;
+
+template <class _Traits>
+basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, const char32_t*) = delete;
+
+# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+
+# ifndef _LIBCPP_HAS_NO_CHAR8_T
+template <class _Traits>
+basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, char8_t) = delete;
+
+template <class _Traits>
+basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, char8_t) = delete;
+
+template <class _Traits>
+basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const char8_t*) = delete;
+
+template <class _Traits>
+basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, const char8_t*) = delete;
+# endif
+
+template <class _Traits>
+basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, char16_t) = delete;
+
+template <class _Traits>
+basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, char32_t) = delete;
+
+template <class _Traits>
+basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const char16_t*) = delete;
+
+template <class _Traits>
+basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const char32_t*) = delete;
+
+#endif // _LIBCPP_STD_VER >= 20
+
+extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<char>;
+#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<wchar_t>;
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
+
+#endif // _LIBCPP___OSTREAM_BASIC_OSTREAM_H