Some changes for using EO with libstdc++V3 and gcc-3.01

This commit is contained in:
jeggermo 2001-10-25 10:39:55 +00:00
commit 4584fda53d
3 changed files with 35 additions and 17 deletions

View file

@ -214,8 +214,15 @@ public:
// Now OK to erase some losers
for (unsigned i=0; i<oldSize - _newsize; i++)
{
EOT & eo = inverse_deterministic_tournament<EOT>(_newgen, t_size);
_newgen.erase(&eo);
//OLDCODE EOT & eo = inverse_deterministic_tournament<EOT>(_newgen, t_size);
//OLDCODE _newgen.erase(&eo);
// Jeroen Eggermont stdc++v3 patch
// in the new code from stdc++v3 an iterator from a container<T> is no longer an pointer to T
// Because eo already contained a fuction using eoPop<EOT>::iterator's we will use the following
_newgen.erase( inverse_stochastic_tournament(_newgen.begin(), _newgen.end(), t_size) );
}
}
private:
@ -259,8 +266,16 @@ public:
// Now OK to erase some losers
for (unsigned i=0; i<oldSize - _newsize; i++)
{
EOT & eo = inverse_stochastic_tournament<EOT>(_newgen, t_rate);
_newgen.erase(&eo);
//OLDCODE EOT & eo = inverse_stochastic_tournament<EOT>(_newgen, t_rate);
//OLDCODE _newgen.erase(&eo);
// Jeroen Eggermont stdc++v3 patch
// in the new code from stdc++v3 an iterator from a container<T> is no longer an pointer to T
// Because eo already contained a fuction using eoPop<EOT>::iterator's we will use the following
_newgen.erase( inverse_stochastic_tournament(_newgen.begin(), _newgen.end(), t_rate) );
}
}

View file

@ -32,7 +32,10 @@
#include <iostream>
#ifdef __GNUC__
typedef ios ios_base; // not currently defined in GCC
// check for stdlibc++v3 which does have ios_base
#ifndef _CPP_BITS_IOSBASE_H
typedef ios ios_base; // not currently defined in GCC
#endif
#endif
#ifdef _MSC_VER

View file

@ -309,14 +309,14 @@ void eoValueParam<std::vector<eoMinimizingFitness> >::setValue(std::string _valu
template <>
std::string eoValueParam<std::vector<void*> >::getValue(void) const
{
throw runtime_error("I cannot getValue for a vector<EOT*>");
return string("");
throw std::runtime_error("I cannot getValue for a vector<EOT*>");
return std::string("");
}
template <>
void eoValueParam<std::vector<void*> >::setValue(std::string)
{
throw runtime_error("I cannot setValue for a vector<EOT*>");
throw std::runtime_error("I cannot setValue for a vector<EOT*>");
return;
}
@ -353,7 +353,7 @@ private :
* See make_algo.h
*/
class eoParamParamType : public std::pair<string,std::vector<string> >
class eoParamParamType : public std::pair<std::string,std::vector<std::string> >
{
public:
eoParamParamType(std::string _value)
@ -361,7 +361,7 @@ public:
readFrom(_value);
}
ostream & printOn(ostream & _os) const
std::ostream & printOn(std::ostream & _os) const
{
_os << first;
unsigned narg = second.size();
@ -382,9 +382,9 @@ public:
return _os;
}
istream & readFrom(istream & _is)
std::istream & readFrom(std::istream & _is)
{
string value;
std::string value;
_is >> value;
readFrom(value);
return _is;
@ -400,16 +400,16 @@ public:
return;
}
// so here we do have arguments
string t = _value.substr(pos+1);// the arguments
std::string t = _value.substr(pos+1);// the arguments
_value.resize(pos);
first = _value; // done for the keyword (NOTE: may be empty string!)
// now all arguments
string delim(" (),");
std::string delim(" (),");
while ( (pos=t.find_first_not_of(delim)) < t.size())
{
size_t posEnd = t.find_first_of(delim, pos);
string u(t,pos);
std::string u(t,pos);
u.resize(posEnd-pos);
second.push_back(u);
t = t.substr(posEnd);
@ -418,7 +418,7 @@ public:
};
// at the moment, the following are defined in eoParser.cpp
ostream & operator<<(ostream & _os, const eoParamParamType & _rate);
istream & operator>>(istream & _is, eoParamParamType & _rate);
std::ostream & operator<<(std::ostream & _os, const eoParamParamType & _rate);
std::istream & operator>>(std::istream & _is, eoParamParamType & _rate);
#endif