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// explicit num_put(size_t refs = 0); 15 16#include <locale> 17#include <cassert> 18 19typedef std::num_put<char, char*> F; 20 21class my_facet 22 : public F 23{ 24public: 25 static int count; 26 27 explicit my_facet(std::size_t refs = 0) 28 : F(refs) {++count;} 29 30 ~my_facet() {--count;} 31}; 32 33int my_facet::count = 0; 34 35int main() 36{ 37 { 38 std::locale l(std::locale::classic(), new my_facet); 39 assert(my_facet::count == 1); 40 } 41 assert(my_facet::count == 0); 42 { 43 my_facet f(1); 44 assert(my_facet::count == 1); 45 { 46 std::locale l(std::locale::classic(), &f); 47 assert(my_facet::count == 1); 48 } 49 assert(my_facet::count == 1); 50 } 51 assert(my_facet::count == 0); 52} 53