Skip to content

Commit d06d5f6

Browse files
Move the errs
1 parent dacad20 commit d06d5f6

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

include/rfl/parsing/ViewReader.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ class ViewReader {
7777
std::stringstream stream;
7878
stream << "Failed to parse field '" << name
7979
<< "': " << res.error().what();
80-
_errors->emplace_back(Error(stream.str()));
80+
auto err = Error{stream.str()};
81+
_errors->emplace_back(std::move(err));
8182
return;
8283
}
8384
if constexpr (std::is_pointer_v<OriginalType>) {
@@ -109,7 +110,8 @@ class ViewReader {
109110
std::stringstream stream;
110111
stream << "Failed to parse field '" << _current_name
111112
<< "': " << res.error().what();
112-
_errors->emplace_back(Error(stream.str()));
113+
auto err = Error{stream.str()};
114+
_errors->emplace_back(std::move(err));
113115
return;
114116
}
115117
extra_fields->emplace(std::string(_current_name), std::move(*res));
@@ -144,7 +146,8 @@ class ViewReader {
144146
if (!already_assigned) {
145147
std::stringstream stream;
146148
stream << "Value named '" << _current_name_or_index << "' not used.";
147-
_errors->emplace_back(Error(stream.str()));
149+
auto err = Error{stream.str()};
150+
_errors->emplace_back(std::move(err));
148151
}
149152
}
150153
}

0 commit comments

Comments
 (0)