ENH: support cref() and shallow copies (refPtr and tmp)

- enables building HashTables with shadowed variables

- support good() and valid() as synonyms in memory classes
This commit is contained in:
Mark Olesen
2021-11-16 15:17:12 +01:00
parent 96735dce20
commit 92d52243af
8 changed files with 147 additions and 31 deletions

View File

@ -32,18 +32,26 @@ struct myScalarField : public scalarField
template<class T>
void printInfo(const tmp<T>& item, const bool verbose = false)
{
Info<< "tmp valid:" << Switch::name(item.valid())
Info<< "tmp good:" << Switch::name(item.good())
<< " pointer:" << Switch::name(item.is_pointer())
<< " addr: " << name(item.get())
<< " addr: " << Foam::name(item.get())
<< " movable:" << Switch(item.movable());
if (item.valid())
if (item)
{
Info<< " refCount:" << item->count();
}
Info<< nl;
if (verbose && item.valid())
Info<< " move-constructible:"
<< std::is_move_constructible<tmp<T>>::value
<< " move-assignable:"
<< std::is_move_assignable<tmp<T>>::value
<< " nothrow:"
<< std::is_nothrow_move_assignable<tmp<T>>::value
<< " trivially:"
<< std::is_trivially_move_assignable<tmp<T>>::value
<< nl;
if (verbose && item)
{
Info<< "content: " << item() << nl;
}