Changeset 1130 for cpp/frams/genetics/fS


Ignore:
Timestamp:
04/16/21 15:55:34 (4 years ago)
Author:
Maciej Komosinski
Message:

Used std::min(), std::max() explicitly to avoid compiler confusion. Used std::size() explicitly instead of the equivalent macro

Location:
cpp/frams/genetics/fS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/fS/fS_general.cpp

    r1108 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 2019-2020  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 2019-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    1313#include "common/nonstd_math.h"
    1414#include <frams/model/geometry/part_distance_estimator.h>
     15#include <algorithm>
    1516
    1617int fS_Genotype::precision = 4;
  • cpp/frams/genetics/fS/fS_oper.cpp

    r1056 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 2019-2020  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 2019-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    77#include "fS_oper.h"
    88#include "frams/util/rndutil.h"
     9#include <algorithm>
    910
    1011#define FIELDSTRUCT GenoOper_fS
     
    362363                        {
    363364                                // Remove the selected child
    364                                 swap(randomNode->children[selectedIndex], randomNode->children[childCount - 1]);
     365                                std::swap(randomNode->children[selectedIndex], randomNode->children[childCount - 1]);
    365366                                randomNode->children.pop_back();
    366367                                randomNode->children.shrink_to_fit();
     
    586587                        fS_Neuron *it = randomNode->neurons[rndUint(size)];
    587588                        geno.rearrangeNeuronConnections(it, SHIFT::LEFT);        // Important to rearrange the neurons before deleting
    588                         swap(it, randomNode->neurons.back());
     589                        std::swap(it, randomNode->neurons.back());
    589590                        randomNode->neurons.pop_back();
    590591                        randomNode->neurons.shrink_to_fit();
Note: See TracChangeset for help on using the changeset viewer.