Hi, I have a problem compiling the following code with g++.
It works fine with Sun CC5.3

double tab[] = {0.6, 1.0, 3.0, 10.0, 20.0, 50., 1000.};
std::vector<double> const myvec(tab, tab+sizeof(tab)/sizeof(double));
/* ... */
for (std::vector<double>::const_iterator it = myvec.begin(); it!=myvec.end(); ++it) {
    std::vector<double>::difference_type i = 0;
    std::distance(myvec.begin(), it, i);
    /* .. */
}

The compilation error message reads :

error: no matching function for call to `distance(__gnu_cxx::__normal_iterator<const double*, std::vector<double, std::allocator<double> > >, __gnu_cxx::__normal_iterator<const double*, std::vector<double, std::allocator<double> > >&, ptrdiff_t&)'

Thanks for any help.
Artus

P.S. : I cannot use the version of std::distance with a return value, as
it does not work under Sun CC5.3
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to