1bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//===----------------------------------------------------------------------===//
2bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//
3f5256e16dfc425c1d466f6308d4026d529ce9e0bHoward Hinnant//                     The LLVM Compiler Infrastructure
4bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//
5b64f8b07c104c6cc986570ac8ee0ed16a9f23976Howard Hinnant// This file is dual licensed under the MIT and the University of Illinois Open
6b64f8b07c104c6cc986570ac8ee0ed16a9f23976Howard Hinnant// Source Licenses. See LICENSE.TXT for details.
7bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//
8bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//===----------------------------------------------------------------------===//
9bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
10bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// <strstream>
11bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
12bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// class ostrstream
13bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
14bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// void freeze(bool freezefl = true);
15bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
16bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#include <strstream>
17bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#include <cassert>
18bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
19bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnantint main()
20bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant{
21bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    {
22bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant        std::ostrstream out;
23bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant        out.freeze();
24bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant        assert(!out.fail());
25bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant        out << 'a';
26bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant        assert(out.fail());
27bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant        out.clear();
28bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant        out.freeze(false);
29bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant        out << 'a';
30bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant        out << char(0);
31bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant        assert(out.str() == std::string("a"));
327112dae6acac544a0271a85d95342c583441e2d1Dan Albert        out.freeze(false);
33bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    }
34bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant}
35