# HG changeset patch # User John W. Eaton # Date 1267474203 18000 # Node ID 1aa8b9b8f9210952bb29831a26cce3b71a86ba8f # Parent 60acc47c203fe59bad62bfda22f11a91e3dee590 str2double.cc: style fix diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-03-01 John W. Eaton + + * (str2double1): Pass argument as const reference and make + explicit copy instead of passing by value. + 2010-03-01 John W. Eaton * DLD-FUNCTIONS/str2double.cc (set_component): Use autoconf diff --git a/src/DLD-FUNCTIONS/str2double.cc b/src/DLD-FUNCTIONS/str2double.cc --- a/src/DLD-FUNCTIONS/str2double.cc +++ b/src/DLD-FUNCTIONS/str2double.cc @@ -158,10 +158,14 @@ } static Complex -str2double1 (std::string str) +str2double1 (const std::string& str_arg) { Complex val (0.0, 0.0); + + std::string str = str_arg; + std::string::iterator se = str.end (); + // Remove commas (thousand separators) and spaces. se = std::remove (str.begin (), se, ','); se = std::remove (str.begin (), se, ' ');