Skip to content

Commit e19e1d9

Browse files
committed
Avoid a copy of std::locale
1 parent f14618a commit e19e1d9

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/boost/locale/win32/numeric.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,27 +130,25 @@ namespace boost { namespace locale { namespace impl_win {
130130
template<typename CharType>
131131
std::locale create_formatting_impl(const std::locale& in, const winlocale& lc)
132132
{
133+
std::locale tmp(in, new num_format<CharType>(lc));
133134
if(lc.is_c()) {
134-
std::locale tmp(in, new numpunct<CharType>());
135+
tmp = std::locale(tmp, new numpunct<CharType>());
135136
tmp = std::locale(tmp, new std::time_put_byname<CharType>("C"));
136-
tmp = std::locale(tmp, new num_format<CharType>(lc));
137-
return tmp;
138137
} else {
139-
std::locale tmp(in, new num_punct_win<CharType>(lc));
138+
tmp = std::locale(tmp, new num_punct_win<CharType>(lc));
140139
tmp = std::locale(tmp, new time_put_win<CharType>(lc));
141-
tmp = std::locale(tmp, new num_format<CharType>(lc));
142-
return tmp;
143140
}
141+
return tmp;
144142
}
145143

146144
template<typename CharType>
147-
std::locale create_parsing_impl(std::locale tmp, const winlocale& lc)
145+
std::locale create_parsing_impl(const std::locale& in, const winlocale& lc)
148146
{
147+
std::locale tmp(in, new util::base_num_parse<CharType>());
149148
if(lc.is_c())
150149
tmp = std::locale(tmp, new numpunct<CharType>());
151150
else
152151
tmp = std::locale(tmp, new num_punct_win<CharType>(lc));
153-
tmp = std::locale(tmp, new util::base_num_parse<CharType>());
154152
return tmp;
155153
}
156154

0 commit comments

Comments
 (0)