ENH: add empty() member for Enum

This commit is contained in:
Mark Olesen
2019-12-11 13:18:01 +01:00
parent e247e06381
commit 622808c7d0
2 changed files with 12 additions and 2 deletions

View File

@ -101,8 +101,11 @@ public:
// Access
//- True if the enumeration list is empty.
inline bool empty() const noexcept;
//- The number of name/value pairs for the enumeration.
inline label size() const;
inline label size() const noexcept;
//- The list of enum names, in construction order. Same as toc()
inline const List<word>& names() const;

View File

@ -28,7 +28,14 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class EnumType>
inline Foam::label Foam::Enum<EnumType>::size() const
inline bool Foam::Enum<EnumType>::empty() const noexcept
{
return keys_.empty();
}
template<class EnumType>
inline Foam::label Foam::Enum<EnumType>::size() const noexcept
{
return keys_.size();
}