mirror of
https://github.com/boostorg/spirit.git
synced 2026-01-19 04:42:11 +00:00
ts_real_policies: Parse directly into output parameter
There is no need to initialize accumulator with zero value before the first call to `parse`, and to use a temporary.
This commit is contained in:
@@ -157,7 +157,7 @@ struct ts_real_policies : boost::spirit::qi::ureal_policies<T>
|
||||
// Thousands separated numbers
|
||||
template <typename Iterator, typename Accumulator>
|
||||
static bool
|
||||
parse_n(Iterator& first, Iterator const& last, Accumulator& attr)
|
||||
parse_n(Iterator& first, Iterator const& last, Accumulator& result)
|
||||
{
|
||||
using boost::spirit::qi::uint_parser;
|
||||
namespace qi = boost::spirit::qi;
|
||||
@@ -165,7 +165,6 @@ struct ts_real_policies : boost::spirit::qi::ureal_policies<T>
|
||||
uint_parser<unsigned, 10, 1, 3> uint3;
|
||||
uint_parser<unsigned, 10, 3, 3> uint3_3;
|
||||
|
||||
Accumulator result = 0;
|
||||
if (parse(first, last, uint3, result))
|
||||
{
|
||||
Accumulator n;
|
||||
@@ -177,7 +176,6 @@ struct ts_real_policies : boost::spirit::qi::ureal_policies<T>
|
||||
first = iter;
|
||||
}
|
||||
|
||||
attr = result;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user