diff --git a/src/OpenFOAM/primitives/predicates/predicates.H b/src/OpenFOAM/primitives/predicates/predicates.H index a44b4eec7e..04ddd6a64b 100644 --- a/src/OpenFOAM/primitives/predicates/predicates.H +++ b/src/OpenFOAM/primitives/predicates/predicates.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ Namespace Foam::predicates Description - Various constant predicate types. + Constant predicate types. SourceFiles predicates.H @@ -36,6 +36,7 @@ SourceFiles #define predicates_H #include +#include // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -50,42 +51,29 @@ namespace predicates \*---------------------------------------------------------------------------*/ //- Unary and binary predicates that always return true, useful for templating. -struct always +struct always : std::true_type { - typedef always value_type; - - //- Null constructible - inline always() - {} - - //- Evaluated as a bool - // \return true - inline operator bool() const - { - return true; - } - //- Unary predicate // \return true template - inline bool operator()(const T&) const + constexpr bool operator()(const T&) const noexcept { - return true; + return value; } //- Binary predicate // \return true template - inline bool operator()(const T1&, const T2&) const + constexpr bool operator()(const T1&, const T2&) const noexcept { - return true; + return value; } //- String match // \return true - inline bool match(const std::string&, bool literal=false) const + constexpr bool match(const std::string&, bool literal=false) const noexcept { - return true; + return value; } }; @@ -95,42 +83,29 @@ struct always \*---------------------------------------------------------------------------*/ //- Unary and binary predicates that never return true, useful for templating. -struct never +struct never : std::false_type { - typedef never value_type; - - //- Null constructible - inline never() - {} - - //- Evaluated as a bool - // \return false - inline operator bool() const - { - return false; - } - //- Unary predicate // \return false template - inline bool operator()(const T&) const + constexpr bool operator()(const T&) const noexcept { - return false; + return value; } //- Binary predicate // \return false template - inline bool operator()(const T1&, const T2&) const + constexpr bool operator()(const T1&, const T2&) const noexcept { - return false; + return value; } //- String match // \return false - inline bool match(const std::string&, bool literal=false) const + constexpr bool match(const std::string&, bool literal=false) const noexcept { - return false; + return value; } }; diff --git a/src/finiteVolume/volMesh/volMesh.H b/src/finiteVolume/volMesh/volMesh.H index d132df1070..d5e6fb7377 100644 --- a/src/finiteVolume/volMesh/volMesh.H +++ b/src/finiteVolume/volMesh/volMesh.H @@ -27,12 +27,6 @@ Class Description Mesh data needed to do the Finite Volume discretisation. -Class - Foam::isVolMesh - -Description - Supports static assertion that a template argument is of type volMesh. - \*---------------------------------------------------------------------------*/ #ifndef volMesh_H @@ -56,7 +50,6 @@ class volMesh : public GeoMesh { - public: // Constructors @@ -70,18 +63,18 @@ public: // Member Functions - //- Return size - label size() const - { - return size(mesh_); - } - //- Return size static label size(const Mesh& mesh) { return mesh.nCells(); } + //- Return size + label size() const + { + return size(mesh_); + } + //- Return cell centres const volVectorField& C() { @@ -94,18 +87,10 @@ public: Class isVolMesh Declaration \*---------------------------------------------------------------------------*/ -template -class isVolMesh -: - public std::false_type -{}; +//- Template argument for type volMesh. +template struct isVolMesh : std::false_type {}; - -template<> -class isVolMesh -: - public std::true_type -{}; +template<> struct isVolMesh : std::true_type {}; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //