From df56ae514560e1fbb9bec997e48d9481d7aa4467 Mon Sep 17 00:00:00 2001 From: mac Date: Tue, 13 Jun 2000 09:48:24 +0000 Subject: [PATCH] Fixed typedef Type error --- eo/src/eoFixedLength.h | 4 ++- eo/src/eoVariableLength.h | 61 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 eo/src/eoVariableLength.h diff --git a/eo/src/eoFixedLength.h b/eo/src/eoFixedLength.h index d2affe70..853059ca 100644 --- a/eo/src/eoFixedLength.h +++ b/eo/src/eoFixedLength.h @@ -27,6 +27,8 @@ #ifndef _eoFixedLength_h #define _eoFixedLength_h +#include + /** \ingroup EvolutionStrategies @@ -39,7 +41,7 @@ class eoFixedLength : public EO, public std::vector { public : - typedef double Type; + typedef typename GeneType Type; /// to avoid conflicts between EO::operator< and vector::operator< bool operator<(const eoFixedLength& _eo) const diff --git a/eo/src/eoVariableLength.h b/eo/src/eoVariableLength.h new file mode 100644 index 00000000..43b25f40 --- /dev/null +++ b/eo/src/eoVariableLength.h @@ -0,0 +1,61 @@ +// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- + +//----------------------------------------------------------------------------- +// eoEsBase.h +// (c) GeNeura Team, 2000 - EEAAX 1999 - Maarten Keijzer 2000 +/* + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: todos@geneura.ugr.es, http://geneura.ugr.es + Marc.Schoenauer@polytechnique.fr + mak@dhi.dk + */ +//----------------------------------------------------------------------------- + +#ifndef _eoVariableLength_h +#define _eoVariableLength_h + +#include + +/** +\ingroup EvolutionStrategies + + Base class for variable length chromosomes, just derives from EO and list and + redirects the smaller than operator to EO (fitness based comparison) +*/ + +template +class eoVariableLength : public EO, public std::list +{ + public : + + typedef typename GeneType Type; + + /// to avoid conflicts between EO::operator< and vector::operator< + bool operator<(const eoVariableLength& _eo) const + { + return EO::operator<(_eo); + } + +}; + +/// to avoid conflicts between EO::operator< and vector::operator< +template +bool operator<(const eoVariableLength& _eo1, const eoVariableLength& _eo2) +{ + return _eo1.operator<(_eo2); +} + +#endif