fix even more warnings and reduce some tests runtimes

tested under gcc and clang
This commit is contained in:
Johann Dreo 2020-04-28 17:41:50 +02:00
commit 9d3c848dfb
9 changed files with 29 additions and 26 deletions

View file

@ -38,11 +38,11 @@ public:
virtual void put(unsigned _oneIndice)=0;
virtual bool contains(unsigned _oneIndice)=0;
virtual bool contains(unsigned _oneIndice) const =0;
virtual unsigned size()=0;
virtual unsigned size() const =0;
virtual unsigned get(unsigned _index)=0;
virtual unsigned get(unsigned _index) const =0;
virtual POT & best()=0;

View file

@ -56,7 +56,7 @@ public:
* particle whose indice is _oneIndice")
* @param _oneIndice - The indice of the particle in its population.
*/
bool contains(unsigned _oneIndice)
bool contains(unsigned _oneIndice) const
{
for (unsigned i=0;i< indicesList.size();i++)
{
@ -77,7 +77,7 @@ public:
/**
* Return the size of the neighborhood.
*/
unsigned size()
unsigned size() const
{
return indicesList.size();
@ -87,7 +87,7 @@ public:
* Return the "_index-th" particle of the neighborhood.
* Throw an exception if its not contained in the neighborhood.
*/
unsigned get(unsigned _index)
unsigned get(unsigned _index) const
{
if (_index < size())
return indicesList[_index];

View file

@ -28,11 +28,12 @@
#ifndef eoRndGenerators_h
#define eoRndGenerators_h
#include <stdexcept>
#include <cassert>
#include "../eoExceptions.h"
#include "eoRNG.h"
#include "../eoFunctor.h"
#include <stdexcept>
/** @defgroup Random Random number generation
*
@ -80,7 +81,8 @@ template <class T = double> class eoUniformGenerator : public eoRndGenerator<T>
eoUniformGenerator(T _min, T _max, eoRng& _rng = rng) :
minim(_min), range(_max-_min), uniform(_rng)
{
if (_min>_max)
assert(_min < _max);
if (_min > _max)
throw eoException("Min is greater than Max in uniform_generator");
}

View file

@ -131,8 +131,8 @@ void eoState::load(std::istream& is)
if (is_section(str, name))
break;
removeComment(str, getCommentString());
fullstring += str + "\n";
removeComment(str, getCommentString());
fullstring += str + "\n";
}
std::istringstream the_stream(fullstring);
object->readFrom(the_stream);