G
Gary Wessle
Hi
I am trying to pass a iterator to a function, this is the iterator and
what it does
typedef vector<string>::const_iterator vs_itr;
for(vs_itr i=vect.begin(); i!=vect.end(); ++i){
x = fix_it(*i, 2.0);
..
// fix_it(string* 1.235, 2.0) returns double 1.24
double fix_it(vector<string>::const_iterator s, double n){
double y = strtod(s->c_str(),0);
return floor( y*pow(10,n) + 0.5 ) / pow(10,n);
}
I am getting an error relating to the type problem
****************************************************************
no matching function for call to
gen_data.h:27: note: candidates are:
double gen_data::fix_it(__gnu_cxx::__normal_iterator<const
std::char_traits<char>, std::allocator<char> > > > >, double)
****************************************************************
I tried to fix it by redefining the first argument of the function so
that it is a const vector<string>::const_iterator but that did not fix
it.
I am trying to pass a iterator to a function, this is the iterator and
what it does
typedef vector<string>::const_iterator vs_itr;
for(vs_itr i=vect.begin(); i!=vect.end(); ++i){
x = fix_it(*i, 2.0);
..
// fix_it(string* 1.235, 2.0) returns double 1.24
double fix_it(vector<string>::const_iterator s, double n){
double y = strtod(s->c_str(),0);
return floor( y*pow(10,n) + 0.5 ) / pow(10,n);
}
I am getting an error relating to the type problem
****************************************************************
no matching function for call to
&, double&)'
gen_data.h:27: note: candidates are:
double gen_data::fix_it(__gnu_cxx::__normal_iterator<const
std::allocator<char> >, std::allocator<std::basic_string<char,*, std::vector<std::basic_string<char, std::char_traits<char>,
std::char_traits<char>, std::allocator<char> > > > >, double)
****************************************************************
I tried to fix it by redefining the first argument of the function so
that it is a const vector<string>::const_iterator but that did not fix
it.