1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <locale>
11 
12 // class num_put<charT, OutputIterator>
13 
14 // iter_type put(iter_type s, ios_base& iob, char_type fill, void* v) const;
15 
16 #include <locale>
17 #include <ios>
18 #include <cassert>
19 #include <streambuf>
20 #include "test_iterators.h"
21 
22 typedef std::num_put<char, output_iterator<char*> > F;
23 
24 class my_facet
25     : public F
26 {
27 public:
my_facet(std::size_t refs=0)28     explicit my_facet(std::size_t refs = 0)
29         : F(refs) {}
30 };
31 
main()32 int main()
33 {
34     const my_facet f(1);
35     {
36         std::ios ios(0);
37         void* v = 0;
38         char str[50];
39         output_iterator<char*> iter = f.put(output_iterator<char*>(str), ios, '*', v);
40         std::string ex(str, iter.base());
41         assert(ex == "0x0" || ex == "(nil)");
42     }
43 }
44