Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 4 | // |
Howard Hinnant | b64f8b0 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | // <strstream> |
| 11 | |
| 12 | // class ostrstream |
| 13 | |
| 14 | // ostrstream(); |
| 15 | |
| 16 | #include <strstream> |
| 17 | #include <cassert> |
| 18 | |
| 19 | int main() |
| 20 | { |
| 21 | std::ostrstream out; |
| 22 | int i = 123; |
| 23 | double d = 4.5; |
| 24 | std::string s("dog"); |
Howard Hinnant | caee2b0 | 2012-06-01 20:02:59 +0000 | [diff] [blame] | 25 | out << i << ' ' << d << ' ' << s << std::ends; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 26 | assert(out.str() == std::string("123 4.5 dog")); |
Eric Fiselier | 50ada3a | 2014-11-14 19:10:43 +0000 | [diff] [blame] | 27 | out.freeze(false); |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 28 | } |