From 94a13c6d534f45106098b7efa6d7e6d5609f5650 Mon Sep 17 00:00:00 2001 From: jeggermo Date: Mon, 4 Feb 2002 13:16:50 +0000 Subject: [PATCH] Fixed some compatibility issues with GCC 3.0.1 and the Intel C++ Compiler for Linux v5. --- eo/config.cache | 6 +++--- eo/src/eoParetoFitness.cpp | 2 +- eo/src/eoParetoFitness.h | 32 +++++++++++++++++--------------- eo/src/gp/eoParseTree.h | 7 +++++++ 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/eo/config.cache b/eo/config.cache index 541f62a3..8f137b2a 100644 --- a/eo/config.cache +++ b/eo/config.cache @@ -20,10 +20,10 @@ ac_cv_header_stdc=${ac_cv_header_stdc=yes} ac_cv_lib_eo_main=${ac_cv_lib_eo_main=no} ac_cv_lib_eoutils_main=${ac_cv_lib_eoutils_main=no} ac_cv_lib_m_main=${ac_cv_lib_m_main=yes} -ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'} -ac_cv_prog_CPP=${ac_cv_prog_CPP='cc -E'} +ac_cv_path_install=${ac_cv_path_install=$'/usr/bin/install -c'} +ac_cv_prog_CPP=${ac_cv_prog_CPP=$'cc -E'} ac_cv_prog_CXX=${ac_cv_prog_CXX=c++} -ac_cv_prog_LN_S=${ac_cv_prog_LN_S='ln -s'} +ac_cv_prog_LN_S=${ac_cv_prog_LN_S=$'ln -s'} ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB=ranlib} ac_cv_prog_cxx_cross=${ac_cv_prog_cxx_cross=no} ac_cv_prog_cxx_g=${ac_cv_prog_cxx_g=yes} diff --git a/eo/src/eoParetoFitness.cpp b/eo/src/eoParetoFitness.cpp index 908b2c9f..6de72db7 100644 --- a/eo/src/eoParetoFitness.cpp +++ b/eo/src/eoParetoFitness.cpp @@ -33,6 +33,6 @@ // need to allocate the static variables of class eoVariableParetoTraits unsigned eoVariableParetoTraits::nObj; -vector eoVariableParetoTraits::bObj; +std::vector eoVariableParetoTraits::bObj; diff --git a/eo/src/eoParetoFitness.h b/eo/src/eoParetoFitness.h index 3642a8d7..5e09be60 100644 --- a/eo/src/eoParetoFitness.h +++ b/eo/src/eoParetoFitness.h @@ -29,6 +29,8 @@ #include #include #include +#include + /** * eoFitnessTraits: a traits class to specify @@ -55,20 +57,20 @@ class eoVariableParetoTraits : public eoParetoFitnessTraits { public : /** setting the static stuff */ - static void setUp(unsigned _n, vector & _b) + static void setUp(unsigned _n, std::vector & _b) { // possible problems if ( nObj && (nObj != _n) ) // was already set to a different value { - cout << "WARNING\n"; - cout << "WARNING : you are changing the number of objectives\n"; - cout << "WARNING : Make sure all existing objects are destroyed\n"; - cout << "WARNING\n"; + std::cout << "WARNING\n"; + std::cout << "WARNING : you are changing the number of objectives\n"; + std::cout << "WARNING : Make sure all existing objects are destroyed\n"; + std::cout << "WARNING\n"; } nObj=_n; bObj=_b; if (nObj != bObj.size()) - throw runtime_error("Number of objectives and min/max size don't match in VariableParetoTraits::setup"); + throw std::runtime_error("Number of objectives and min/max size don't match in VariableParetoTraits::setup"); } /** the accessors */ @@ -76,7 +78,7 @@ public : { #ifndef NDEBUG if (!nObj) - throw runtime_error("Number of objectives not assigned in VariableParetoTraits"); + throw std::runtime_error("Number of objectives not assigned in VariableParetoTraits"); #endif return nObj; } @@ -84,17 +86,17 @@ public : { #ifndef NDEBUG if (_i >= bObj.size()) - throw runtime_error("Wrong index in VariableParetoTraits"); + throw std::runtime_error("Wrong index in VariableParetoTraits"); #endif return bObj[_i]; } private: static unsigned nObj; - static vector bObj; + static std::vector bObj; }; /** - eoParetoFitness class: vector of doubles with overloaded comparison operators. Comparison is done + eoParetoFitness class: std::vector of doubles with overloaded comparison operators. Comparison is done on pareto dominance. The template argument FitnessTraits defaults to eoParetoFitnessTraits, which can be replaces at will by any other class that implements the static functions defined therein. @@ -114,7 +116,7 @@ public : /** access to the traits characteristics (so you don't have to write * a lot of typedef's around */ - static void setUp(unsigned _n, vector & _b) {FitnessTraits::setUp(_n, _b);} + static void setUp(unsigned _n, std::vector & _b) {FitnessTraits::setUp(_n, _b);} static bool maximizing(unsigned _i) { return FitnessTraits::maximizing(_i);} /// Partial order based on Pareto-dominance @@ -124,8 +126,8 @@ public : bool dom = false; double tol = FitnessTraits::tol(); - const vector& performance = *this; - const vector& otherperformance = _other; + const std::vector& performance = *this; + const std::vector& otherperformance = _other; for (unsigned i = 0; i < FitnessTraits::nObjectives(); ++i) { @@ -152,8 +154,8 @@ public : bool operator<(const eoParetoFitness& _other) const { double tol = FitnessTraits::tol(); - const vector& performance = *this; - const vector& otherperformance = _other; + const std::vector& performance = *this; + const std::vector& otherperformance = _other; for (unsigned i = 0; i < FitnessTraits::nObjectives(); ++i) { bool maxim = FitnessTraits::maximizing(i); diff --git a/eo/src/gp/eoParseTree.h b/eo/src/gp/eoParseTree.h index 4aa82219..56199dc1 100644 --- a/eo/src/gp/eoParseTree.h +++ b/eo/src/gp/eoParseTree.h @@ -56,6 +56,13 @@ public : typedef parse_tree::subtree Subtree; + /* For Compatibility with the intel C++ compiler for Linux 5.x */ + typedef Node reference; + typedef const reference const_reference; + + + + /** * Default Constructor */