SQUASH: 970449: use more convenient type trait checks

This commit is contained in:
Kutalmis Bercin 2025-03-13 11:58:10 +00:00 committed by Kutalmış Berçin
parent 7765382f13
commit 864c297104

View File

@ -277,13 +277,16 @@ bool Foam::functionObjects::fieldStatistics::write()
( (
[&file](const auto& v) [&file](const auto& v)
{ {
if constexpr (std::is_same_v<std::decay_t<decltype(v)>, scalar>) if constexpr
(
is_vectorspace_v<std::decay_t<decltype(v)>>
)
{ {
file<< token::TAB << v; for (const auto& val : v) file<< token::TAB << val;
} }
else else
{ {
for (const auto& val : v) file<< token::TAB << val; file<< token::TAB << v;
} }
}, },
value value
@ -311,16 +314,19 @@ bool Foam::functionObjects::fieldStatistics::write()
( (
[name](const auto& v) [name](const auto& v)
{ {
if constexpr (std::is_same_v<std::decay_t<decltype(v)>, scalar>) if constexpr
{ (
Info<< ' ' << name << tab << v << nl; is_vectorspace_v<std::decay_t<decltype(v)>>
} )
else
{ {
Info<< ' ' << name << tab; Info<< ' ' << name << tab;
for (const auto& val : v) Info<< val << tab; for (const auto& val : v) Info<< val << tab;
Info<< nl; Info<< nl;
} }
else
{
Info<< tab << name << tab << v << nl;
}
}, },
value value
); );