put_pointer.pass.cpp revision b64f8b07c104c6cc986570ac8ee0ed16a9f23976
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 "iterators.h" 21 22typedef std::num_put<char, output_iterator<char*> > F; 23 24class my_facet 25 : public F 26{ 27public: 28 explicit my_facet(std::size_t refs = 0) 29 : F(refs) {} 30}; 31 32int 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"); 42 } 43} 44