bug-gmp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Declarations in a for loop


From: Fred Labrosse
Subject: Declarations in a for loop
Date: Wed, 18 May 2005 16:56:50 +0100

All,

The following doesn't compile (with different messages depending on the
order in which I declare things:

#include <vector>

main()
{
   std::vector<double> doubles;
   double aDouble;

   for (int index = 0,
           std::vector<double>::iterator doublesIter = doubles.begin();
        doublesIter != doubles.end();
        ++doublesIter, ++index)
   {
      if (aDouble == *doublesIter)
         return(index);
   }
}

However, if I declare index and doublesIter before the for, then all
works fine.  Is that a bug?

Fred




reply via email to

[Prev in Thread] Current Thread [Next in Thread]