diff --git a/applications/test/SLList/Test-SLList.C b/applications/test/SLList/Test-SLList.C index d46fbf6e8e..2a6ef7a245 100644 --- a/applications/test/SLList/Test-SLList.C +++ b/applications/test/SLList/Test-SLList.C @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) Info<< nl << "And again using STL iterator: " << nl << endl; - for (auto const& val : myList) + for (const auto& val : myList) { Info<< "element:" << val << endl; } @@ -72,7 +72,7 @@ int main(int argc, char *argv[]) myList.remove(iter); } - for (auto const& val : const_myList) + for (const auto& val : const_myList) { Info<< "element:" << val << endl; } diff --git a/applications/test/edges/Test-edges.C b/applications/test/edges/Test-edges.C index eda9ae0dd9..51da417de3 100644 --- a/applications/test/edges/Test-edges.C +++ b/applications/test/edges/Test-edges.C @@ -67,6 +67,17 @@ int main(int argc, char *argv[]) Info<< e3 << " connects " << e2 << " => " << e2.connects(e3) << endl; + labelPair labels(e3); + + Info<< "as labelPair: " << labels << endl; + + edge e5; + // Good: this fails (explicit constructor): printInfo(labels); + // Good: this also fails (no assignment operator): e5 = labels; + + // OK: explicit + edge e6(labels); + Info<< nl << "hash-like functionality" << nl; // doesn't work e4 = -1; diff --git a/src/OpenFOAM/meshes/meshShapes/edge/edge.H b/src/OpenFOAM/meshes/meshShapes/edge/edge.H index f373186a54..52bf97cb7c 100644 --- a/src/OpenFOAM/meshes/meshShapes/edge/edge.H +++ b/src/OpenFOAM/meshes/meshShapes/edge/edge.H @@ -45,6 +45,7 @@ SourceFiles #define edge_H #include "FixedList.H" +#include "labelPair.H" #include "pointField.H" #include "linePointRef.H" @@ -65,7 +66,7 @@ class edge //- Insert values, using begin/end iterators. template - inline int insertMultiple + inline label insertMultiple ( const InputIter begIter, const InputIter endIter @@ -73,7 +74,7 @@ class edge //- Remove values, using begin/end iterators. template - inline int eraseMultiple + inline label eraseMultiple ( const InputIter begIter, const InputIter endIter @@ -98,6 +99,9 @@ public: //- Construct, optionally sorted with start less-than end inline edge(const label from, const label to, const bool doSort); + //- Construct from two labels + inline edge(const labelPair& pair); + //- Construct from FixedList inline edge(const FixedList& lst); @@ -165,7 +169,7 @@ public: //- 'Collapse' edge by marking duplicate point labels as '-1', // the lower vertex is retained. // Return the effective size after collapsing. - inline int collapse(); + inline label collapse(); //- Flip the edge in-place. // No special handling of negative point labels. @@ -180,7 +184,7 @@ public: //- Return the number of unique, valid (non -1) point labels. // Similar to a HashTable::size(). - inline int count() const; + inline label count() const; //- Return true if edge has no valid point labels. inline bool empty() const; @@ -194,41 +198,41 @@ public: inline bool insert(const label index); //- Fill open slots with the indices if they did not previously exist. - // Returns true on success. Negative labels never inserts. + // Returns true on success. Negative labels never insert. // Return the number of slots filled. // Similar to a HashTable::insert(). - inline int insert(const UList