mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
ENH: add Xfer rvalue(), valid() methods
- rvalue() is a (transitional) means of converting Xfer content to a reference for move construct, move assign semantics. - valid() method for consistency with autoPtr and tmp classes
This commit is contained in:
@ -39,6 +39,16 @@ Description
|
||||
using namespace Foam;
|
||||
|
||||
|
||||
template<class Type>
|
||||
void printInfo(const Xfer<Type>& xf)
|
||||
{
|
||||
Info<<" address:" << long(xf.get()) << nl
|
||||
<<" isNull = " << isNull(xf) << nl
|
||||
<<" notNull = " << notNull(xf) << nl
|
||||
<<" valid() = " << xf.valid() << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
@ -55,6 +65,18 @@ int main(int argc, char *argv[])
|
||||
lstA[i] = 5 - i;
|
||||
}
|
||||
|
||||
// Information about null-object
|
||||
|
||||
Info<<"nullObject:" << nl;
|
||||
printInfo(Xfer<labelList>::null());
|
||||
{
|
||||
// This probably needs more work...
|
||||
Xfer<labelList> xf = Xfer<labelList>::null();
|
||||
|
||||
Info<<"copy of nullObject:" << nl;
|
||||
printInfo(xf);
|
||||
}
|
||||
|
||||
Info<< "lstA: " << lstA << nl
|
||||
<< "lstC: " << lstC << nl;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user