ENH: noexcept size_bytes() method for lists

- for use when the is_contiguous check has already been done outside
  the loop. Naming as per std::span.

STYLE: use data/cdata instead of begin

ENH: replace random_shuffle with shuffle, fix OSX int64 ambiguity
This commit is contained in:
Mark Olesen
2021-02-26 18:10:42 +01:00
parent 51cd7ceecb
commit fa645c2dac
40 changed files with 188 additions and 132 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -34,6 +34,7 @@ Description
#include "vector.H"
#include "IOstreams.H"
#include <algorithm>
#include <random>
using namespace Foam;
@ -115,9 +116,8 @@ void testData(const VecSpace& vs)
int main(int argc, char *argv[])
{
Info<<"normalised: " << vector(1,2,3).normalise() << nl;
Info<<"normalised: " << vector(VSMALL,VSMALL,VSMALL).normalise() << nl;
Info<<"normalised: " <<
vector(ROOTVSMALL,ROOTVSMALL,ROOTVSMALL).normalise() << nl;
Info<<"normalised: " << vector::uniform(VSMALL).normalise() << nl;
Info<<"normalised: " << vector::uniform(ROOTVSMALL).normalise() << nl;
{
vector vec1(0.5, 0.5, 0.5);
@ -134,7 +134,7 @@ int main(int argc, char *argv[])
std::sort(vec2.begin(), vec2.end());
Info<< "sorted: " << vec2 << nl;
std::random_shuffle(vec2.begin(), vec2.end());
std::shuffle(vec2.begin(), vec2.end(), std::default_random_engine());
Info<< "shuffled: " << vec2 << nl;
}