ENH: add no-op methods to Nullobject

- empty(), size(), toc(), sortedToc()
This commit is contained in:
Mark Olesen
2019-07-15 19:25:22 +02:00
committed by Andrew Heather
parent fb09f56aba
commit 0ccc005fe6

View File

@ -48,10 +48,9 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declarations // Forward Declarations
class Istream; class Istream;
class Ostream; class Ostream;
class NullObject; class NullObject;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
@ -111,6 +110,30 @@ public:
{ {
return data_[0].val; return data_[0].val;
} }
//- No elements
inline constexpr bool empty() const
{
return true;
}
//- Zero elements
inline constexpr label size() const
{
return 0;
}
//- No-op method (for HashTable replacement)
inline const NullObject& toc() const
{
return *this;
}
//- No-op method (for HashTable replacement)
inline const NullObject& sortedToc() const
{
return *this;
}
}; };