fix new warnings and escape apply namespace

- `std::apply` is part of C++17 and the compiler wants to use it because
of ADL. Thus it is now necessary to escape it as `::apply`.
- remove some `using namespace std` remaining in the sources.
- fix simple warnings.
This commit is contained in:
Johann Dreo 2020-04-28 15:56:14 +02:00
commit 24bc8edd6f
25 changed files with 125 additions and 125 deletions

View file

@ -38,7 +38,7 @@ double binary_value(const Indi & _indi)
}
// GENERAL
//-----------------------------------------------------------------------------
void main_function(int argc, char **argv)
void main_function(int /*argc*/, char **/*argv*/)
{
// PARAMETRES
// all parameters are hard-coded!

View file

@ -38,7 +38,7 @@ double real_value(const Indi & _indi)
}
// GENERAL
//-----------------------------------------------------------------------------
void main_function(int argc, char **argv)
void main_function(int /*argc*/, char **/*argv*/)
{
// PARAMETRES
// all parameters are hard-coded!

View file

@ -39,7 +39,7 @@ double binary_value(const Indi & _indi)
//-----------------------------------------------------------------------------
void main_function(int argc, char **argv)
void main_function(int /*argc*/, char **/*argv*/)
{
const unsigned int SEED = 42; // seed for random number generator
const unsigned int VEC_SIZE = 8; // Number of bits in genotypes

View file

@ -36,7 +36,7 @@ using namespace std;
// GENERAL
//-----------------------------------------------------------------------------
void main_function(int argc, char **argv)
void main_function(int /*argc*/, char **/*argv*/)
{
// PARAMETRES
const unsigned int SEED = 42; // seed for random number generator

View file

@ -36,7 +36,7 @@ typedef eoBit<double> Indi; // A bitstring with fitness double
using namespace std;
void main_function(int argc, char **argv)
void main_function(int /*argc*/, char **/*argv*/)
{
// PARAMETRES
const unsigned int SEED = 42; // seed for random number generator

View file

@ -44,7 +44,7 @@ public:
* modifies the parent
* @param _genotype The parent genotype (will be modified)
*/
bool operator()(GenotypeT & _genotype)
bool operator()(GenotypeT & /*_genotype*/)
{
bool isModified(true);
// START code for mutation of the _genotype object

View file

@ -46,7 +46,7 @@ public:
* @param _genotype1 The first parent
* @param _genotype2 The second parent
*/
bool operator()(GenotypeT& _genotype1, GenotypeT & _genotype2)
bool operator()(GenotypeT& /*_genotype1*/, GenotypeT & /*_genotype2*/)
{
bool oneAtLeastIsModified(true);
// START code for crossover of _genotype1 and _genotype2 objects

View file

@ -73,7 +73,7 @@
*/
template <class EOT>
eoGenOp<EOT> & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit<EOT>& _init)
eoGenOp<EOT> & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit<EOT>& /*_init*/)
{
// this is a temporary version, while Maarten codes the full tree-structured
// general operator input

View file

@ -12,7 +12,7 @@
#include <eo>
// Use functions from namespace std
using namespace std;
// using namespace std; // Do not do this, this shadows EO's `apply` function.
//-----------------------------------------------------------------------------
typedef eoMinimizingFitness FitT;
@ -33,7 +33,7 @@ FitT real_value (const Particle & _particle)
void main_function(int argc, char **argv)
void main_function(int /*argc*/, char **/*argv*/)
{
// PARAMETRES
// all parameters are hard-coded!
@ -114,9 +114,9 @@ void main_function(int argc, char **argv)
pop.sort();
// Print (sorted) the initial population (raw printout)
cout << "INITIAL POPULATION:" << endl;
std::cout << "INITIAL POPULATION:" << std::endl;
for (unsigned i = 0; i < pop.size(); ++i)
cout << "\t best fit=" << pop[i] << endl;
std::cout << "\t best fit=" << pop[i] << std::endl;
///////////////
@ -158,9 +158,9 @@ void main_function(int argc, char **argv)
// OUTPUT
// Print (sorted) intial population
pop.sort();
cout << "FINAL POPULATION:" << endl;
std::clog << "FINAL POPULATION:" << std::endl;
for (unsigned i = 0; i < pop.size(); ++i)
cout << "\t best fit=" << pop[i] << endl;
std::clog << "\t best fit=" << pop[i] << std::endl;
}
@ -173,9 +173,9 @@ int main(int argc, char **argv)
{
main_function(argc, argv);
}
catch(exception& e)
catch(std::exception& e)
{
cout << "Exception: " << e.what() << '\n';
std::cerr << "Exception: " << e.what() << '\n';
}
return 1;