added some typename statements to make it compile without warnings under gcc3.2

This commit is contained in:
okoenig 2002-11-03 13:07:43 +00:00
commit c175b152bc
10 changed files with 20 additions and 20 deletions

View file

@ -59,7 +59,7 @@ class eoDetSelect : public eoSelect<EOT>
unsigned remain = target % pSize;
unsigned entireCopy = target / pSize;
eoPop<EOT>::iterator it = _dest.begin();
typename eoPop<EOT>::iterator it = _dest.begin();
if (target >= pSize)
{

View file

@ -130,7 +130,7 @@ typedef typename EOT::AtomType AtomType;
virtual void operator()(EOT& _chrom)
{
_chrom.resize(offset + rng.random(extent));
vector<AtomType>::iterator it;
typename vector<AtomType>::iterator it;
for (it=_chrom.begin(); it<_chrom.end(); it++)
init(*it);
_chrom.invalidate();

View file

@ -145,7 +145,7 @@ class eoProportionalOp : public eoOpContainer<EOT>
{
(*ops[i])(_pop);
}
catch(eoPopulator<EOT>::OutOfIndividuals&)
catch( typename eoPopulator<EOT>::OutOfIndividuals&)
{}
}
virtual string className() const {return "ProportionalOp";}

View file

@ -160,7 +160,7 @@ class eoPop: public vector<EOT>, public eoObject, public eoPersistent
}
/** returns an iterator to the best individual DOES NOT MOVE ANYBODY */
eoPop<EOT>::iterator it_best_element()
typename eoPop<EOT>::iterator it_best_element()
{
typename eoPop<EOT>::iterator it = max_element(begin(), end());
return it;
@ -181,7 +181,7 @@ class eoPop: public vector<EOT>, public eoObject, public eoPersistent
}
/** returns an iterator to the worse individual DOES NOT MOVE ANYBODY */
eoPop<EOT>::iterator it_worse_element()
typename eoPop<EOT>::iterator it_worse_element()
{
typename eoPop<EOT>::iterator it = min_element(begin(), end());
return it;
@ -191,7 +191,7 @@ class eoPop: public vector<EOT>, public eoObject, public eoPersistent
slightly faster algorithm than sort to find all individuals that are better
than the nth individual. INDIVIDUALS ARE MOVED AROUND in the pop.
*/
eoPop<EOT>::iterator nth_element(int nth)
typename eoPop<EOT>::iterator nth_element(int nth)
{
typename eoPop<EOT>::iterator it = begin() + nth;
std::nth_element(begin(), it, end(), greater<EOT>());
@ -207,7 +207,7 @@ class eoPop: public vector<EOT>, public eoObject, public eoPersistent
vector<Fitness> fitness(size());
std::transform(begin(), end(), fitness.begin(), GetFitness());
vector<Fitness>::iterator it = fitness.begin() + which;
typename vector<Fitness>::iterator it = fitness.begin() + which;
std::nth_element(fitness.begin(), it, fitness.end(), greater<Fitness>());
return *it;
}
@ -221,7 +221,7 @@ class eoPop: public vector<EOT>, public eoObject, public eoPersistent
result.resize(size());
std::transform(begin(), end(), result.begin(), Ref());
vector<const EOT*>::iterator it = result.begin() + which;
typename vector<const EOT*>::iterator it = result.begin() + which;
std::nth_element(result.begin(), it, result.end(), Cmp());
}

View file

@ -122,7 +122,7 @@ public :
protected :
eoPop<EOT>& dest;
eoPop<EOT>::iterator current;
typename eoPop<EOT>::iterator current;
const eoPop<EOT>& src;
private :

View file

@ -48,7 +48,7 @@ public:
/* helper function: finds index in _pop of _eo, an EOT * */
int lookfor(const EOT *_eo, const eoPop<EOT>& _pop)
{
eoPop<EOT>::const_iterator it;
typename eoPop<EOT>::const_iterator it;
for (it=_pop.begin(); it<_pop.end(); it++)
{
if (_eo == &(*it))

View file

@ -98,7 +98,7 @@ typedef typename EOT::Fitness Fitness;
/// helper struct for comparing on pairs
// compares the scores
// uses the fitness if scores are equals ????
typedef pair<float, eoPop<EOT>::iterator> EPpair;
typedef pair<float, typename eoPop<EOT>::iterator> EPpair;
struct Cmp {
bool operator()(const EPpair a, const EPpair b) const
{
@ -175,7 +175,7 @@ class eoLinearTruncate : public eoReduce<EOT>
throw std::logic_error("eoLinearTruncate: Cannot truncate to a larger size!\n");
for (unsigned i=0; i<oldSize - _newsize; i++)
{
eoPop<EOT>::iterator it = _newgen.it_worse_element();
typename eoPop<EOT>::iterator it = _newgen.it_worse_element();
_newgen.erase(it);
}
}

View file

@ -95,7 +95,7 @@ template <class EOT, class WorthT = double>
class eoDetTournamentWorthSelect : public eoSelectFromWorth<EOT, WorthT>
{
public:
typedef vector<WorthT>::iterator worthIterator;
typedef typename vector<WorthT>::iterator worthIterator;
/* Default ctor from an eoPerf2Worth object + tournament size
*/
@ -134,7 +134,7 @@ template <class EOT, class WorthT = double>
class eoStochTournamentWorthSelect : public eoSelectFromWorth<EOT, WorthT>
{
public:
typedef vector<WorthT>::iterator worthIterator;
typedef typename vector<WorthT>::iterator worthIterator;
/* Default ctor from an eoPerf2Worth object + tournament rate
*/
@ -172,7 +172,7 @@ template <class EOT, class WorthT = double>
class eoRouletteWorthSelect : public eoSelectFromWorth<EOT, WorthT>
{
public:
typedef vector<WorthT>::iterator worthIterator;
typedef typename vector<WorthT>::iterator worthIterator;
/* Default ctor from an eoPerf2Worth object
*/

View file

@ -225,7 +225,7 @@ private :
for (unsigned o = 0; o < value().size(); ++o)
{
vector<const EOT*>::iterator nth = tmp_pop.begin() + which;
typename vector<const EOT*>::iterator nth = tmp_pop.begin() + which;
std::nth_element(tmp_pop.begin(), nth, tmp_pop.end(), CmpFitness(o, traits::maximizing(o)));
value()[o] = (*nth)->fitness()[o];
}
@ -310,7 +310,7 @@ private :
for (unsigned o = 0; o < traits::nObjectives(); ++o)
{
eoPop<EOT>::const_iterator it = max_element(_pop.begin(), _pop.end(), CmpFitness(o, traits::maximizing(o)));
typename eoPop<EOT>::const_iterator it = max_element(_pop.begin(), _pop.end(), CmpFitness(o, traits::maximizing(o)));
value()[o] = it->fitness()[o];
}
}

View file

@ -98,7 +98,7 @@ double sum_fitness(const eoPop<EOT>& _pop)
template <class EOT>
double sum_fitness(const eoPop<EOT>& _pop, std::pair<double, double>& _minmax)
{
eoPop<EOT>::const_iterator it = _pop.begin();
typename eoPop<EOT>::const_iterator it = _pop.begin();
_minmax.first = it->fitness();
_minmax.second = it++->fitness();
@ -156,7 +156,7 @@ const EOT& roulette_wheel(const eoPop<EOT>& _pop, double total, eoRng& _gen = rn
if (roulette == 0.0) // covers the case where total==0.0
return _pop[_gen.random(_pop.size())]; // uniform choice
eoPop<EOT>::const_iterator i = _pop.begin();
typename eoPop<EOT>::const_iterator i = _pop.begin();
while (roulette > 0.0)
{
@ -174,7 +174,7 @@ EOT& roulette_wheel(eoPop<EOT>& _pop, double total, eoRng& _gen = rng)
if (roulette == 0.0) // covers the case where total==0.0
return _pop[_gen.random(_pop.size())]; // uniform choice
eoPop<EOT>::iterator i = _pop.begin();
typename eoPop<EOT>::iterator i = _pop.begin();
while (roulette > 0.0)
{