mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
ENH: upgrade to use some C++17 constructs
- 'if constexpr (...)' * instead of std::enable_if * terminate template recursion * compile-time elimination of code - use C++14 '_t', '_v' versions, eg, std::is_integral_v<T> instead of std::is_integral<T>::value - std::begin, std::end, std::void_t instead of prev stdFoam versions - provide is_contiguous_v<..> as short form of is_contiguous<..>::value with the additional benefit of removing any cv qualifiers. ENH: include is_rotational_vectorspace trait - tests for vector-space and nComponents > 1 (ie, not sphericalTensor) ENH: improve robustness of pTraits_.. tests by removing cv qualifiers
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2025 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -72,13 +72,14 @@ void printInfo(const char* const name = nullptr)
|
||||
Info<< name;
|
||||
}
|
||||
|
||||
Info<< " contiguous=" << Switch(is_contiguous<T>::value);
|
||||
Info<< " contiguous=" << Switch(is_contiguous<T>::value)
|
||||
<< " / " << Switch(is_contiguous_v<T>);
|
||||
|
||||
if (is_contiguous_label<T>::value)
|
||||
if constexpr (is_contiguous_label<T>::value)
|
||||
{
|
||||
Info<< " label";
|
||||
}
|
||||
if (is_contiguous_scalar<T>::value)
|
||||
if constexpr (is_contiguous_scalar<T>::value)
|
||||
{
|
||||
Info<< " scalar";
|
||||
}
|
||||
@ -96,10 +97,11 @@ int main(int argc, char *argv[])
|
||||
argList::noParallel();
|
||||
argList::noFunctionObjects();
|
||||
|
||||
printInfo<label>();
|
||||
printInfo<label>();
|
||||
printInfo<double>();
|
||||
printInfo<FixedList<double, 4>>();
|
||||
printInfo<Pair<long>>();
|
||||
printInfo<const Pair<long>>();
|
||||
|
||||
printInfo<FixedList<word, 2>>();
|
||||
printInfo<Pair<word>>();
|
||||
|
||||
Reference in New Issue
Block a user