[libcxx-commits] [libcxx] [libc++] Implement p0753r2 Manipulators for C++ Synchronized Buffered Ostream (PR #97955)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jul 12 09:05:12 PDT 2024
================
@@ -0,0 +1,45 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17
+// UNSUPPORTED: no-localization
+// UNSUPPORTED: libcpp-has-no-experimental-syncstream
+
+// template<class charT, class traits>
+// basic_ostream<charT, traits>& emit_on_flush(basic_ostream<charT, traits>& os);
+
+#include <cassert>
+#include <ostream>
+#include <sstream>
+#include <syncstream>
+
+template <class CharT>
+void test_emit_on_flush() {
+ {
+ // non sync stream: nothing happens
+ std::basic_ostringstream<CharT> os;
+ std::emit_on_flush(os);
+ }
+ {
+ std::basic_stringbuf<CharT> buf;
+ std::basic_osyncstream<CharT> ss(&buf);
+ std::emit_on_flush(ss);
----------------
ldionne wrote:
We need to test the return type and the return value of all these functions. The return value should satisfy `&result == &ss`.
https://github.com/llvm/llvm-project/pull/97955
More information about the libcxx-commits
mailing list