File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,15 @@ class URLHost {
92
92
Value value_;
93
93
HostType type_ = HostType::H_FAILED;
94
94
95
+ inline void Reset () {
96
+ using string = std::string;
97
+ switch (type_) {
98
+ case HostType::H_DOMAIN: value_.domain .~string (); break ;
99
+ case HostType::H_OPAQUE: value_.opaque .~string (); break ;
100
+ default : break ;
101
+ }
102
+ }
103
+
95
104
// Setting the string members of the union with = is brittle because
96
105
// it relies on them being initialized to a state that requires no
97
106
// destruction of old data.
@@ -112,12 +121,7 @@ class URLHost {
112
121
};
113
122
114
123
URLHost::~URLHost () {
115
- using string = std::string;
116
- switch (type_) {
117
- case HostType::H_DOMAIN: value_.domain .~string (); break ;
118
- case HostType::H_OPAQUE: value_.opaque .~string (); break ;
119
- default : break ;
120
- }
124
+ Reset ();
121
125
}
122
126
123
127
#define ARGS (XX ) \
You can’t perform that action at this time.
0 commit comments