diff --git a/stl/inc/xlocmon b/stl/inc/xlocmon index 3c7d924644..0b584c2197 100644 --- a/stl/inc/xlocmon +++ b/stl/inc/xlocmon @@ -106,29 +106,6 @@ protected: _Tidy(); } - template - void _Getvals(_Elem2, const lconv* _Ptr) { // get values - _Currencysign = _Maklocstr( - _International ? _Ptr->int_curr_symbol : _Ptr->currency_symbol, static_cast<_Elem2*>(nullptr), _Cvt); - _Plussign = _Maklocstr(4 < static_cast(_Ptr->p_sign_posn) ? "" : _Ptr->positive_sign, - static_cast<_Elem2*>(nullptr), _Cvt); - _Minussign = _Maklocstr(4 < static_cast(_Ptr->n_sign_posn) ? "-" : _Ptr->negative_sign, - static_cast<_Elem2*>(nullptr), _Cvt); - _Decimalpoint = _Maklocchr(_Ptr->mon_decimal_point[0], static_cast<_Elem2*>(nullptr), _Cvt); - _Kseparator = _Maklocchr(_Ptr->mon_thousands_sep[0], static_cast<_Elem2*>(nullptr), _Cvt); - } - - void _Getvals(wchar_t, const lconv* _Ptr) { // get values - _Currencysign = reinterpret_cast( - _Maklocwcs(_International ? _Ptr->_W_int_curr_symbol : _Ptr->_W_currency_symbol)); - _Plussign = reinterpret_cast( - _Maklocwcs(4 < static_cast(_Ptr->p_sign_posn) ? L"" : _Ptr->_W_positive_sign)); - _Minussign = reinterpret_cast( - _Maklocwcs(4 < static_cast(_Ptr->n_sign_posn) ? L"-" : _Ptr->_W_negative_sign)); - _Decimalpoint = static_cast<_Elem>(_Ptr->_W_mon_decimal_point[0]); - _Kseparator = static_cast<_Elem>(_Ptr->_W_mon_thousands_sep[0]); - } - void _Init(const _Locinfo& _Lobj, bool _Isdef = false) { // initialize from _Lobj _Cvt = _Lobj._Getcvt(); const lconv* _Ptr = _Lobj._Getlconv(); @@ -140,7 +117,23 @@ protected: _Tidy_guard<_Mpunct> _Guard{this}; _Grouping = _Maklocstr(_Ptr->mon_grouping, static_cast(nullptr), _Cvt); - _Getvals(_Elem{}, _Ptr); + if constexpr (is_same_v<_Elem, wchar_t>) { + _Currencysign = _Maklocwcs(_International ? _Ptr->_W_int_curr_symbol : _Ptr->_W_currency_symbol); + _Plussign = _Maklocwcs(4 < static_cast(_Ptr->p_sign_posn) ? L"" : _Ptr->_W_positive_sign); + _Minussign = _Maklocwcs(4 < static_cast(_Ptr->n_sign_posn) ? L"-" : _Ptr->_W_negative_sign); + _Decimalpoint = _Ptr->_W_mon_decimal_point[0]; + _Kseparator = _Ptr->_W_mon_thousands_sep[0]; + } else { + _Currencysign = _Maklocstr( + _International ? _Ptr->int_curr_symbol : _Ptr->currency_symbol, static_cast<_Elem*>(nullptr), _Cvt); + _Plussign = _Maklocstr(4 < static_cast(_Ptr->p_sign_posn) ? "" : _Ptr->positive_sign, + static_cast<_Elem*>(nullptr), _Cvt); + _Minussign = _Maklocstr(4 < static_cast(_Ptr->n_sign_posn) ? "-" : _Ptr->negative_sign, + static_cast<_Elem*>(nullptr), _Cvt); + _Decimalpoint = _Maklocchr(_Ptr->mon_decimal_point[0], static_cast<_Elem*>(nullptr), _Cvt); + _Kseparator = _Maklocchr(_Ptr->mon_thousands_sep[0], static_cast<_Elem*>(nullptr), _Cvt); + } + _Guard._Target = nullptr; _Fracdigits = _International ? _Ptr->int_frac_digits : _Ptr->frac_digits; diff --git a/stl/inc/xlocnum b/stl/inc/xlocnum index b9085095e0..43b8532518 100644 --- a/stl/inc/xlocnum +++ b/stl/inc/xlocnum @@ -149,17 +149,6 @@ protected: _END_LOCINFO() } - template - void _Getvals(_Elem2, const lconv* _Ptr, _Locinfo::_Cvtvec _Cvt) { // get values - _Dp = _Maklocchr(_Ptr->decimal_point[0], static_cast<_Elem2*>(nullptr), _Cvt); - _Kseparator = _Maklocchr(_Ptr->thousands_sep[0], static_cast<_Elem2*>(nullptr), _Cvt); - } - - void _Getvals(wchar_t, const lconv* _Ptr, _Locinfo::_Cvtvec) { // get values - _Dp = static_cast<_Elem>(_Ptr->_W_decimal_point[0]); - _Kseparator = static_cast<_Elem>(_Ptr->_W_thousands_sep[0]); - } - void _Init(const _Locinfo& _Lobj, bool _Isdef = false) { // initialize from _Lobj const lconv* _Ptr = _Lobj._Getlconv(); _Locinfo::_Cvtvec _Cvt = _Lobj._Getcvt(); // conversion information @@ -169,17 +158,22 @@ protected: _Truename = nullptr; _Tidy_guard _Guard{this}; - _Grouping = _Maklocstr(_Isdef ? "" : _Ptr->grouping, static_cast(nullptr), _Lobj._Getcvt()); + _Grouping = _Maklocstr(_Isdef ? "" : _Ptr->grouping, static_cast(nullptr), _Cvt); _Falsename = _Maklocstr(_Lobj._Getfalse(), static_cast<_Elem*>(nullptr), _Cvt); _Truename = _Maklocstr(_Lobj._Gettrue(), static_cast<_Elem*>(nullptr), _Cvt); _Guard._Target = nullptr; if (_Isdef) { // apply defaults for required facets - // _Grouping = _Maklocstr("", static_cast(nullptr), _Cvt); _Dp = _Maklocchr('.', static_cast<_Elem*>(nullptr), _Cvt); _Kseparator = _Maklocchr(',', static_cast<_Elem*>(nullptr), _Cvt); } else { - _Getvals(_Elem{}, _Ptr, _Cvt); + if constexpr (is_same_v<_Elem, wchar_t>) { + _Dp = _Ptr->_W_decimal_point[0]; + _Kseparator = _Ptr->_W_thousands_sep[0]; + } else { + _Dp = _Maklocchr(_Ptr->decimal_point[0], static_cast<_Elem*>(nullptr), _Cvt); + _Kseparator = _Maklocchr(_Ptr->thousands_sep[0], static_cast<_Elem*>(nullptr), _Cvt); + } } } diff --git a/stl/inc/xloctime b/stl/inc/xloctime index 1952685ddd..b48e1b1d25 100644 --- a/stl/inc/xloctime +++ b/stl/inc/xloctime @@ -238,7 +238,7 @@ protected: void __CLR_OR_THIS_CALL _Getvals(_Elem2, const _Locinfo& _Lobj) { // get values _Cvt = _Lobj._Getcvt(); - if (is_same_v<_Elem2, wchar_t>) { + if constexpr (is_same_v<_Elem2, wchar_t>) { _Days = reinterpret_cast(_Maklocwcs(reinterpret_cast(_Lobj._W_Getdays()))); _Months = reinterpret_cast(_Maklocwcs(reinterpret_cast(_Lobj._W_Getmonths())));