ENH: add swallow assignment to nullObject

- similar to the behaviour of std::ignore and consistent with the
  no input / no output nature of nullObject. Similarly accept a
  const reference for its Istream operator.

- make most nullObject methods constexpr
This commit is contained in:
Mark Olesen
2020-05-29 12:49:48 +02:00
parent e3367dbdc1
commit 1d2391e0b4
2 changed files with 28 additions and 13 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2014 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -47,9 +47,8 @@ class SimpleClass
{
public:
//- Null constructor
SimpleClass()
{}
//- Default construct
SimpleClass() {}
};
@ -149,6 +148,12 @@ int main()
printInfo(pointField::null());
}
// Test swallow assigment (like std::ignore)
// Looks pretty ugly though!
NullObject::nullObject = "hello world";
NullObject::nullObject = labelList({1, 2, 3});
Info<< nl;
return 0;