• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <strstream>
10 
11 // class ostrstream
12 
13 // ostrstream();
14 
15 #include <strstream>
16 #include <cassert>
17 #include <string>
18 
19 #include "test_macros.h"
20 
main(int,char **)21 int main(int, char**)
22 {
23     std::ostrstream out;
24     int i = 123;
25     double d = 4.5;
26     std::string s("dog");
27     out << i << ' ' << d << ' ' << s << std::ends;
28     assert(out.str() == std::string("123 4.5 dog"));
29     out.freeze(false);
30 
31   return 0;
32 }
33