Changeset 1130 for cpp/frams


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
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/_demos/evol_test.cpp

    r1031 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
     
    195195        for (int i = 0; i < nr_evals; i++)
    196196        {
    197                 int selected_positive = tournament(population, max(2, int(sqrt(population.size()) / 2))); //moderate positive selection pressure
     197                int selected_positive = tournament(population, std::max(2, int(sqrt(population.size()) / 2))); //moderate positive selection pressure
    198198                int selected_negative = rndUint(population.size()); //random negative selection
    199199
     
    214214                else
    215215                {
    216                         int selected_positive2 = tournament(population, max(2, int(sqrt(population.size()) / 2)));
     216                        int selected_positive2 = tournament(population, std::max(2, int(sqrt(population.size()) / 2)));
    217217                        Geno xover = genman.crossOver(population[selected_positive].geno, population[selected_positive2].geno);
    218218                        if (xover.getGenes() == "")
  • cpp/frams/_demos/printconvmap.cpp

    r973 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    8888        :model(m)
    8989{
    90         joint_offset = max(10, (int(9 + model.getPartCount()) / 10) * 10);
    91         neuron_offset = joint_offset + max(10, (int(9 + model.getJointCount()) / 10) * 10);
    92         max_element = neuron_offset + max(10, (int(9 + model.getNeuroCount()) / 10) * 10);
     90        joint_offset = std::max(10, (int(9 + model.getPartCount()) / 10) * 10);
     91        neuron_offset = joint_offset + std::max(10, (int(9 + model.getJointCount()) / 10) * 10);
     92        max_element = neuron_offset + std::max(10, (int(9 + model.getNeuroCount()) / 10) * 10);
    9393        for (int i = 0; i < model.getPartCount(); i++)
    9494                map.add(Model::partToMap(i), Model::partToMap(i), i, i);
  • cpp/frams/canvas/neurodiagram.cpp

    r973 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    1313#include <frams/simul/simul.h>
    1414#include "common/nonstd_time.h"
     15#include <algorithm>
    1516
    1617#define FIELDSTRUCT NeuroDiagram
     
    231232        NeuroProbe *probe = new NeuroProbe(getNS(i));
    232233        Pixel s = getSize();
    233         s.x = s.y = max(probe->getSize().x, min(s.x / 3, s.y / 3));
     234        s.x = s.y = std::max(probe->getSize().x, std::min(s.x / 3, s.y / 3));
    234235        probes += (void*)probe;
    235236        add(probe);
     
    503504                                int *dr = drawing;
    504505                                int w = size.x - 2, h = size.y - clienttop - clientbottom;
    505                                 int scale = min(w, h);
     506                                int scale = std::min(w, h);
    506507                                int x0 = clienttop + leftborder + ((w > h) ? (w - h) / 2 : 0);
    507508                                int y0 = clientleft + topborder + ((h > w) ? (h - w) / 2 : 0);
  • cpp/frams/canvas/nn_smart_layout.cpp

    r492 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
    55#include "nn_layout.h"
    66#include <vector>
    7 #include "common/nonstd_stl.h"
     7#include <algorithm>
    88#ifdef __BORLANDC__
    99 #include <alloc.h> //borland needs for alloc/free
     
    131131           */
    132132        int x1, y1, x2, y2; // union rectangle
    133         x1 = max(0, b2->minx - b->minx + dx);
    134         x2 = min(b->maxx - b->minx, -b->minx + dx + b2->maxx);
     133        x1 = std::max(0, b2->minx - b->minx + dx);
     134        x2 = std::min(b->maxx - b->minx, -b->minx + dx + b2->maxx);
    135135        if (x1 > x2) return 1;
    136         y1 = max(0, b2->miny - b->miny + dy);
    137         y2 = min(b->maxy - b->miny, -b->miny + dy + b2->maxy);
     136        y1 = std::max(0, b2->miny - b->miny + dy);
     137        y2 = std::min(b->maxy - b->miny, -b->miny + dy + b2->maxy);
    138138        if (y1 > y2) return 1;
    139139        int x, y;
     
    162162                b->dodajelement(e, einfo[e].x + dx, einfo[e].y + dy);
    163163        }
    164         b->minx = min(b->minx, dx + b2->minx);
    165         b->miny = min(b->miny, dy + b2->miny);
    166         b->maxx = max(b->maxx, dx + b2->maxx);
    167         b->maxy = max(b->maxy, dy + b2->maxy);
     164        b->minx = std::min(b->minx, dx + b2->minx);
     165        b->miny = std::min(b->miny, dy + b2->miny);
     166        b->maxx = std::max(b->maxx, dx + b2->maxx);
     167        b->maxy = std::max(b->maxy, dy + b2->maxy);
    168168
    169169        DB(
  • cpp/frams/genetics/f1/f1_conv.cpp

    r1039 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2018  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
    55#include "f1_conv.h"
    6 #include <common/nonstd_stl.h>
    76#include <common/log.h>
    87#include <frams/util/multirange.h>
     
    1110#include <ctype.h>
    1211#include <assert.h>
     12#include <algorithm>
    1313
    1414//#define v1f1COMPATIBLE //as in ancient Framsticks 1.x
     
    273273int Builder::growJoint(int part1, int part2, Pt3D &angle, GeneProps &c, const char *g)
    274274{
    275         double len = min(2.0, c.length);
     275        double len = std::min(2.0, c.length);
    276276        sprintf(tmp, "p1=%d,p2=%d,dx=%lg,rx=%lg,ry=%lg,rz=%lg,stam=%lg,vr=%g,vg=%g,vb=%g",
    277277                part1, part2, len, angle.x, angle.y, angle.z, c.stamina, c.cred, c.cgreen, c.cblue);
  • cpp/frams/genetics/f9/f9_conv.cpp

    r1108 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    66#include <frams/model/model.h>
    77#include <string.h>
    8 #include <common/nonstd_stl.h> //ARRAY_LENGTH
    98
    109#define APPLY_DETERMINISTIC_BODY_NOISE //this genetic representation easily produces perfectly vertical sticks that would stay upright forever in simulation. In most cases such infinite perfection is not desired, so we make the construct less perfect by perturbing its coordinates.
     
    129128        static int g[] = { 0, 1, 1, 1, 0, 0 };
    130129        static int b[] = { 0, 0, 0, 1, 1, 1 };
    131         int maxind = ARRAY_LENGTH(r) - 1;
     130        int maxind = int(std::size(r)) - 1;
    132131
    133132        int joints_count = m.getJointCount();
  • cpp/frams/genetics/fB/fB_conv.cpp

    r973 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    77#include <frams/param/paramobj.h>
    88#include <vector>
     9#include <algorithm>
    910#include <frams/util/multimap.h>
    1011#include "fB_general.h"
     
    250251                                double mn, mx, def;
    251252                                par.getMinMaxDouble(propindex, mn, mx, def);
    252                                 par.setDouble(propindex, min(mx, max(mn, (mx - mn) * val + mn)));
     253                                par.setDouble(propindex, std::min(mx, std::max(mn, (mx - mn) * val + mn)));
    253254                        }
    254255                        propindex++;
  • cpp/frams/genetics/fB/fB_oper.cpp

    r999 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
    55#include <frams/util/sstring.h>
    66#include <vector>
     7#include <algorithm>
    78#include <frams/param/param.h>
    89#include "fB_conv.h"
     
    461462        {
    462463                // get maximal count of genes from both parents
    463                 int maxgenecount = max(fB_GenoHelpers::geneCountNoNested(parent1),
     464                int maxgenecount = std::max(fB_GenoHelpers::geneCountNoNested(parent1),
    464465                        fB_GenoHelpers::geneCountNoNested(parent2));
    465466
  • cpp/frams/genetics/fF/fF_conv.cpp

    r994 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
    55#include "fF_conv.h"
    66#include "fF_genotype.h"
    7 #include <common/nonstd_stl.h>
    87#include <common/Convert.h>
    98
  • cpp/frams/genetics/fF/fF_oper.cpp

    r974 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    4949        par.load(gene);
    5050        static const int propsToMutate[] = fF_PROPS_TO_MUTATE;
    51         int which = rndUint(ARRAY_LENGTH(propsToMutate));
     51        int which = rndUint(std::size(propsToMutate));
    5252        bool mutated_ok = GenoOperators::mutatePropertyNaive(par.param, propsToMutate[which]);
    5353        if (mutated_ok)
  • 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();
  • cpp/frams/genetics/fn/fn_conv.h

    r779 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2018  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    77
    88#include <frams/genetics/genoconv.h>
     9#include <common/nonstd_stl.h>
    910
    1011// The fn->f0 converter
  • cpp/frams/genetics/geneprops.cpp

    r1039 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2018  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
    55#include "geneprops.h"
     6#include <algorithm>
    67
    78GeneProps GeneProps::standard_values;
     
    5455#ifdef v1f1COMPATIBLE
    5556        case 'L': length += (3.0 - length)*0.3;
    56                 length = min(length, Model::getMaxJoint().d.x); break;
     57                length = std::min(length, Model::getMaxJoint().d.x); break;
    5758#else
    5859        case 'L': length += (2.0 - length)*0.3; //2.0 is currently Model::getMaxJoint().d.x so min() does not limit the range
    59                 length = min(length, Model::getMaxJoint().d.x); break;
     60                length = std::min(length, Model::getMaxJoint().d.x); break;
    6061#endif
    6162        case 'l': length += (0.33 - length)*0.3;
    62                 length = max(length, Model::getMinJoint().d.x); break;
     63                length = std::max(length, Model::getMinJoint().d.x); break;
    6364
    6465        case 'W': weight += (2.0 - weight)*0.3;  break;
  • cpp/frams/model/autoname.cpp

    r973 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
    55#include "autoname.h"
    6 #include "common/nonstd_stl.h"
     6#include <algorithm>
    77#include <ctype.h>
    88
     
    100100        if (model.getPartCount() > 0)
    101101        {
    102                 cialo = min((int)(sqrt(double(model.getPartCount()) - 1) * NAME_BODYLEN), NAME_MAXLENBODY - 1);
     102                cialo = std::min((int)(sqrt(double(model.getPartCount()) - 1) * NAME_BODYLEN), NAME_MAXLENBODY - 1);
    103103                poz = 0;
    104104                for (i = 0; i <= cialo; i++) // budowanie "opisu" ciala
     
    106106                        nextpoz = ((model.getPartCount()) * (i + 1)) / (cialo + 1) - 1;
    107107                        w = 1.0;
    108                         for (; poz <= nextpoz; poz++) w = max(w, model.getPart(poz)->mass);
    109                         tmpc[i] = Sp[min(int((w - 1.0) * NAME_BODYMASS), int(sizeof(Sp)) - 2)];
     108                        for (; poz <= nextpoz; poz++) w = std::max(w, model.getPart(poz)->mass);
     109                        tmpc[i] = Sp[std::min(int((w - 1.0) * NAME_BODYMASS), int(sizeof(Sp)) - 2)];
    110110                }
    111111                tmpc[i] = 0;
     
    117117        if (model.getNeuroCount() > 0)
    118118        {
    119                 mozg = min((int)(sqrt((double)model.getNeuroCount()) * NAME_BRAINLEN), NAME_MAXLENBRAIN - 1);
     119                mozg = std::min((int)(sqrt((double)model.getNeuroCount()) * NAME_BRAINLEN), NAME_MAXLENBRAIN - 1);
    120120                poz = 0;
    121121                for (i = 0; i <= mozg; i++) // budowanie "opisu" mozgu
     
    123123                        nextpoz = (model.getNeuroCount() * (i + 1)) / (mozg + 1) - 1;
    124124                        wint = 0;
    125                         for (; poz <= nextpoz; poz++) wint = max(wint, model.getNeuro(poz)->getInputCount());
    126                         tmpm[i] = Sam[min(int(wint * NAME_BRAININP), int(sizeof(Sam)) - 2)];
     125                        for (; poz <= nextpoz; poz++) wint = std::max(wint, model.getNeuro(poz)->getInputCount());
     126                        tmpm[i] = Sam[std::min(int(wint * NAME_BRAININP), int(sizeof(Sam)) - 2)];
    127127                }
    128128                tmpm[i] = 0;
  • cpp/frams/model/model.h

    r1118 r1130  
    1313#include <frams/util/advlist.h>
    1414#include <frams/util/usertags.h>
     15#include <common/nonstd_stl.h>
    1516
    1617extern ParamEntry f0_model_paramtab[];
  • cpp/frams/model/similarity/EMD/emd.c

    r1064 r1130  
    1919#include <stdlib.h>
    2020#include <math.h>
     21#include <algorithm>
    2122
    2223#include "emd.h"
     
    100101{
    101102  int itr;
    102   int max_n = max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
     103  int max_n = std::max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
    103104  double totalCost;
    104105  float w;
     
    211212{
    212213  int i, j;
    213   int max_n = max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
     214  int max_n = std::max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
    214215  double sSum, dSum, diff;
    215216  feature_t *P1, *P2;
     
    474475{
    475476    int i, j, k;
    476     int max_n = max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
     477    int max_n = std::max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
    477478    double xMin;
    478479    int steps;
     
    555556{
    556557  int i, steps;
    557   int max_n = max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
     558  int max_n = std::max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
    558559  node2_t **CurX, *NewX;
    559560  char *IsUsed=new char[2*max_n];
     
    652653{
    653654  int i, j, found, minI, minJ;
    654   int max_n = max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
     655  int max_n = std::max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.
    655656  double deltaMin, oldVal, diff;
    656657  double** Delta = new double*[_n1];
  • cpp/frams/model/similarity/measure-distribution.cpp

    r1125 r1130  
    7979        //int size = sampled.getPartCount();
    8080        //if (size < (int) sqrt((double) std::numeric_limits<int>::max())) //prevent exceeding int limits
    81         //      samples_taken = min(samples_num, size*size);
     81        //      samples_taken = std::min(samples_num, size*size);
    8282
    8383        rndgen.seed(55); //For determinism. Otherwise the descriptors (that choose samples pseudo-randomly) for the same Model can yield different values and so the dissimilarity between the object and its copy will not be 0.
  • cpp/frams/neuro/impl/neuroimpl-channels.cpp

    r907 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
    55#include "neuroimpl-channels.h"
    6 #include <common/nonstd_stl.h>
     6#include <algorithm>
    77
    88void NI_Channelize::go()
     
    1818        if (c < 2) { setState(getWeightedInputState(1)); return; }
    1919        double s = getWeightedInputState(0);
    20         s = (max(-1.0, min(1.0, s)) + 1.0) / 2.0; // 0..1
     20        s = (std::max(-1.0, std::min(1.0, s)) + 1.0) / 2.0; // 0..1
    2121        int i1;
    22         i1 = (int)(s * (c - 1)); i1 = max(0, min(i1, c - 2));
     22        i1 = (int)(s * (c - 1)); i1 = std::max(0, std::min(i1, c - 2));
    2323        double sw = 1.0 / (c - 1);
    2424        double s1 = sw * i1;
  • cpp/frams/neuro/impl/neuroimpl-fuzzy-f0.cpp

    r973 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    77
    88#include "neuroimpl-fuzzy-f0.h"
    9 #include <common/nonstd_stl.h> //min,max
     9#include <algorithm>
    1010
    1111//this part concerns fuzzy sets transformation
     
    132132                                return -1;
    133133                        if ((k >= inNr) && ((k % 2) == 0))
    134                                 maxOutputNr = max(maxOutputNr, rules[j][k]);
     134                                maxOutputNr = std::max(maxOutputNr, rules[j][k]);
    135135                }
    136136        }
  • cpp/frams/neuro/impl/neuroimpl-fuzzy.cpp

    r973 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
    55#include "neuroimpl-fuzzy.h"
    66#include "neuroimpl-fuzzy-f0.h"
    7 #include <common/nonstd_stl.h> //min,max
    87
    98int NI_FuzzyNeuro::countOuts(const Model *m, const Neuro *fuzzy)
     
    109108                        nrFuzzySet = rules[i][j * 2 + 1]; // j*2 moves pointer through each output, +1 moves to nr of fuzzy set
    110109                        inputNr = rules[i][j * 2]; // as above but gives input number
    111                         minimumCut = min(minimumCut, TrapeziumFuzz(nrFuzzySet, getWeightedInputState(inputNr))); // value of membership function for this input and given fuzzy set
     110                        minimumCut = std::min(minimumCut, TrapeziumFuzz(nrFuzzySet, getWeightedInputState(inputNr))); // value of membership function for this input and given fuzzy set
    112111                }
    113112                if ((minimumCut > 1) || (minimumCut < 0))
  • cpp/frams/param/mutableparam.cpp

    r973 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    2222};
    2323#undef FIELDSTRUCT
    24 const int MutableParam::staticprops = ARRAY_LENGTH(pe_tab);
     24const int MutableParam::staticprops = std::size(pe_tab);
    2525
    2626MutableParam::MutableParam(const char*n, const char*g, int gr0)
  • cpp/frams/param/paramobj.cpp

    r1051 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
    55#include <frams/param/paramobj.h>
    66#include <frams/util/extvalue.h>
    7 #include <common/nonstd_stl.h>
     7#include <algorithm>
    88       
    99static const char* maybedup(bool dup, const char* src)
     
    232232        const ExtValue *s = &src.fields[0];
    233233        ExtValue *d = &fields[0];
    234         int n = min(numfields, src.numfields);
     234        int n = std::min(numfields, src.numfields);
    235235        for (int i = 0; i < n; i++, d++, s++)
    236236                *d = *s;
  • cpp/frams/util/extvalue.h

    r851 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    88#include "sstring.h"
    99#include <frams/param/param.h>
    10 #include <common/nonstd_stl.h>
    1110#include <common/threads.h>
     11#include <vector>
    1212
    1313#define EXTVALUEUNION
  • cpp/frams/util/multirange.cpp

    r733 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
    55#include "multirange.h"
    6 #include <common/nonstd_stl.h>
     6#include <algorithm>
    77
    88#include <stdio.h>
     
    230230                break;
    231231        case SAME + JOINBEGIN: // extend 1 range
    232                 setEnd(r1, max(getEnd(r2), end));
     232                setEnd(r1, std::max(getEnd(r2), end));
    233233                break;
    234234        case SAME + JOINEND: // extend 1 range
     
    244244                break;
    245245        case JOINBEGIN: // extend r1
    246                 setEnd(r1, max(end, getEnd(r2)));
     246                setEnd(r1, std::max(end, getEnd(r2)));
    247247                removeRanges(r1 + 1, r2);
    248248                break;
     
    253253        case 0: // extend r2
    254254                setBegin(r2, begin);
    255                 setEnd(r2, max(end, getEnd(r2)));
     255                setEnd(r2, std::max(end, getEnd(r2)));
    256256                removeRanges(r1 + 1, r2 - 1);
    257257                break;
  • cpp/frams/util/sstring-simple.cpp

    r1040 r1130  
    11#include "sstring.h"
    2 #include <common/nonstd_stl.h>
    32#include "extvalue.h"
    43#include <assert.h>
  • cpp/frams/util/sstring.cpp

    r1040 r1130  
    2020// - mutex required to be thread safe
    2121
    22 #include <common/nonstd_stl.h>
    2322#include "extvalue.h"
    2423#include <assert.h>
  • cpp/frams/vm/classes/collectionobj.cpp

    r1076 r1130  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    66#include <common/nonstd_math.h> //sqrt in borland
    77#include <frams/util/validitychecks.h>
    8 #include <common/nonstd_stl.h>
     8#include <algorithm>
    99#include <frams/util/sstringutils.h>
    1010#ifndef NO_VMACHINE
     
    228228                s += d * d;
    229229        }
    230         ret->setDouble(sqrt(s / max(1, data.size() - 1)));
     230        ret->setDouble(sqrt(s / std::max(1, data.size() - 1)));
    231231}
    232232
Note: See TracChangeset for help on using the changeset viewer.