Added
Link Here
|
1 |
--- libxsd-frontend/types.hxx.orig 2022-08-19 06:30:48 UTC |
2 |
+++ libxsd-frontend/types.hxx |
3 |
@@ -13,38 +13,13 @@ namespace XSDFrontend |
4 |
{ |
5 |
using std::size_t; |
6 |
|
7 |
- namespace Bits |
8 |
- { |
9 |
- struct None {}; |
10 |
- |
11 |
- template <typename C> |
12 |
- struct NarrowerChar |
13 |
- { |
14 |
- typedef None Type; |
15 |
- }; |
16 |
- |
17 |
- template <> |
18 |
- struct NarrowerChar<wchar_t> |
19 |
- { |
20 |
- typedef char Type; |
21 |
- }; |
22 |
- } |
23 |
- |
24 |
struct LIBXSD_FRONTEND_SYMEXPORT NonRepresentable: std::exception |
25 |
{ |
26 |
virtual char const* |
27 |
what () const throw (); |
28 |
}; |
29 |
|
30 |
- template <typename C, typename NC = typename Bits::NarrowerChar<C>::Type> |
31 |
- class StringTemplate; |
32 |
- |
33 |
- template <> |
34 |
- class StringTemplate<Bits::None, Bits::None> |
35 |
- { |
36 |
- }; |
37 |
- |
38 |
- template <typename C, typename NC> |
39 |
+ template <typename C, typename NC = char> |
40 |
class StringTemplate : public std::basic_string<C> |
41 |
{ |
42 |
typedef std::basic_string<C> Base; |
43 |
@@ -114,16 +89,19 @@ namespace XSDFrontend |
44 |
|
45 |
// Conversion from the Narrower type. Experimental. |
46 |
// |
47 |
+ template<typename WC = C, typename = std::enable_if_t<std::is_same_v<WC, wchar_t>>> |
48 |
StringTemplate (NC const* s) |
49 |
{ |
50 |
from_narrow (s); |
51 |
} |
52 |
|
53 |
+ template<typename WC = C, typename = std::enable_if_t<std::is_same_v<WC, wchar_t>>> |
54 |
StringTemplate (StringTemplate<NC> const& other) |
55 |
{ |
56 |
from_narrow (other.c_str ()); |
57 |
} |
58 |
|
59 |
+ template<typename WC = C, typename = std::enable_if_t<std::is_same_v<WC, wchar_t>>> |
60 |
StringTemplate (NarrowerBase const& other) |
61 |
{ |
62 |
from_narrow (other.c_str ()); |