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 moneypunct<charT, International> 13 14 // string_type positive_sign() const; 15 16 // The C++ and C standards are silent. 17 // POSIX standard is being followed (as a guideline). 18 19 #include <locale> 20 #include <limits> 21 #include <cassert> 22 23 typedef std::moneypunct<char> F; 24 25 class Fnf 26 : public std::moneypunct<char, false> 27 { 28 public: 29 explicit Fnf(std::size_t refs = 0) 30 : std::moneypunct<char, false>(refs) {} 31 }; 32 33 class Fnt 34 : public std::moneypunct<char, true> 35 { 36 public: 37 explicit Fnt(std::size_t refs = 0) 38 : std::moneypunct<char, true>(refs) {} 39 }; 40 41 class Fwf 42 : public std::moneypunct<wchar_t, false> 43 { 44 public: 45 explicit Fwf(std::size_t refs = 0) 46 : std::moneypunct<wchar_t, false>(refs) {} 47 }; 48 49 class Fwt 50 : public std::moneypunct<wchar_t, true> 51 { 52 public: 53 explicit Fwt(std::size_t refs = 0) 54 : std::moneypunct<wchar_t, true>(refs) {} 55 }; 56 57 int main() 58 { 59 { 60 Fnf f(1); 61 assert(f.positive_sign() == std::string()); 62 } 63 { 64 Fnt f(1); 65 assert(f.positive_sign() == std::string()); 66 } 67 { 68 Fwf f(1); 69 assert(f.positive_sign() == std::wstring()); 70 } 71 { 72 Fwt f(1); 73 assert(f.positive_sign() == std::wstring()); 74 } 75 } 76