35 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS -D_LIBCPP_ENABLE_CXX26_REMOVED_STRSTREAM10 11// <strstream>12 13// class ostrstream14 15// ostrstream();16 17#include <strstream>18#include <cassert>19#include <string>20 21#include "test_macros.h"22 23int main(int, char**)24{25 std::ostrstream out;26 int i = 123;27 double d = 4.5;28 std::string s("dog");29 out << i << ' ' << d << ' ' << s << std::ends;30 assert(out.str() == std::string("123 4.5 dog"));31 out.freeze(false);32 33 return 0;34}35