Small modifications here and there to be MSVC++ compatible

Mainly, time.h -> ctime
        definition of loop index out of loops when multiply used
        no typename in declaration using template typename
This commit is contained in:
evomarc 2001-11-10 09:02:17 +00:00
commit d7c3d973c7
14 changed files with 56 additions and 27 deletions

View file

@ -239,16 +239,16 @@ template <>
void eoValueParam<std::vector<std::vector<double> > >::setValue(std::string _value)
{
std::istrstream is(_value.c_str());
unsigned sz;
unsigned i,j,sz;
is >> sz;
repValue.resize(sz);
for (unsigned i = 0; i < repValue.size(); ++i)
for (i = 0; i < repValue.size(); ++i)
{
unsigned sz2;
is >> sz2;
repValue[i].resize(sz2);
for (unsigned j = 0; j < sz2; ++j)
for (j = 0; j < sz2; ++j)
{
is >> repValue[i][j];
}

View file

@ -82,8 +82,12 @@ public :
Average fitness of a population, fitness can be a double, eoMinimizingFitness, eoMaximizingFitness or eoParetoFitness.
In the case of pareto optimization it will calculate the average of each objective.
*/
template <class EOT>
class eoAverageStat : public eoStat<EOT, typename EOT::Fitness>
#ifdef _MSC_VER
template <class EOT> class eoAverageStat : public eoStat<EOT, EOT::Fitness>
#else
template <class EOT> class eoAverageStat : public eoStat<EOT, typename EOT::Fitness>
#endif
{
public :
typedef typename EOT::Fitness fitness_type;
@ -99,7 +103,11 @@ public :
virtual void operator()(const eoPop<EOT>& _pop)
{
#ifdef _MSC_VER
doit(_pop, EOT::Fitness()); // specializations for scalar and vector
#else
doit(_pop, typename EOT::Fitness()); // specializations for scalar and vector
#endif
}
private :
@ -248,17 +256,22 @@ public :
/**
Best fitness in the population
*/
#ifdef _MSC_VER
template <class EOT>
class eoBestFitnessStat : public eoStat<EOT, EOT::Fitness>
#else
template <class EOT>
class eoBestFitnessStat : public eoStat<EOT, typename EOT::Fitness>
#endif
{
public :
typedef typename EOT::Fitness Fitness;
eoBestFitnessStat(std::string _description = "Best ") : eoStat<EOT, typename EOT::Fitness>(typename EOT::Fitness(), _description) {}
eoBestFitnessStat(std::string _description = "Best ") : eoStat<EOT, Fitness>(Fitness(), _description) {}
void operator()(const eoPop<EOT>& _pop)
{
doit(_pop, typename EOT::Fitness());
doit(_pop, Fitness());
}
private :