diff --git a/applications/test/vector/Test-vector.C b/applications/test/vector/Test-vector.C
index 497dea43d10d1eb4a8fb068f2bafda15464d9d29..fc3e430882598ce8510cc7fc1d7030279f2ef3ae 100644
--- a/applications/test/vector/Test-vector.C
+++ b/applications/test/vector/Test-vector.C
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2018 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2018-2019 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
 License
@@ -31,6 +31,7 @@ Description
 
 #include "vector.H"
 #include "IOstreams.H"
+#include <algorithm>
 
 using namespace Foam;
 
@@ -74,6 +75,18 @@ void doTest(vector& vec1, vector& vec2)
 }
 
 
+template<class VecSpace>
+void testIterator(const VecSpace& vs)
+{
+    Info<< "size: " << vs.size() << " for:";
+    for (const auto& val : vs)
+    {
+        Info<< " " << val;
+    }
+    Info<< nl;
+}
+
+
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 //  Main program:
 
@@ -89,8 +102,21 @@ int main(int argc, char *argv[])
         vector vec2(0.5, 0.51, -0.5);
 
         doTest(vec1, vec2);
+
+        testIterator(vec1);
+        testIterator(vec2);
+
+        // Use STL algorithm(s)
+
+        std::sort(vec2.begin(), vec2.end());
+        Info<< "sorted: " << vec2 << nl;
+
+        std::random_shuffle(vec2.begin(), vec2.end());
+        Info<< "shuffled: " << vec2 << nl;
     }
 
+    Info<< "\nEnd\n" << nl;
+
     return 0;
 }
 
diff --git a/src/OpenFOAM/primitives/Barycentric/BarycentricTensor.H b/src/OpenFOAM/primitives/Barycentric/BarycentricTensor.H
index 83d5ac064ad106588e22996d370c673528e02de2..e603dc5304aee3fc4b31d2d2aba972eb03fff381 100644
--- a/src/OpenFOAM/primitives/Barycentric/BarycentricTensor.H
+++ b/src/OpenFOAM/primitives/Barycentric/BarycentricTensor.H
@@ -67,7 +67,7 @@ public:
     // Member constants
 
         //- Rank of BarycentricTensor is 2
-        static const direction rank = 2;
+        static constexpr direction rank = 2;
 
 
     //- Component labeling enumeration
diff --git a/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H b/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H
index d2a70e1d8ecb61e68c5f082e3dace125fec9dd19..8c21243b5d5b22ba8ee5ab60ca89ed889de7726d 100644
--- a/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H
+++ b/src/OpenFOAM/primitives/DiagTensor/DiagTensor.H
@@ -67,7 +67,7 @@ public:
     // Member constants
 
         //- Rank of DiagTensor is 2
-        static const direction rank = 2;
+        static constexpr direction rank = 2;
 
 
     //- Component labeling enumeration
diff --git a/src/OpenFOAM/primitives/MatrixSpace/MatrixSpace.H b/src/OpenFOAM/primitives/MatrixSpace/MatrixSpace.H
index 8c45d5669cf746dae9e0c1af08028c2893b86045..f83297a0567b5cfc276c2fa1fd4a49ec6a2bf02a 100644
--- a/src/OpenFOAM/primitives/MatrixSpace/MatrixSpace.H
+++ b/src/OpenFOAM/primitives/MatrixSpace/MatrixSpace.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           |
+    \\  /    A nd           | Copyright (C) 2019 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
                             | Copyright (C) 2016 OpenFOAM Foundation
@@ -68,20 +68,20 @@ public:
 
     // Member constants
 
-        static const direction mRows = Mrows;
-        static const direction nCols = Ncols;
+        static constexpr direction mRows = Mrows;
+        static constexpr direction nCols = Ncols;
 
 
     // Static member functions
 
         //- Return the number of rows
-        static direction m()
+        static direction m() noexcept
         {
             return Mrows;
         }
 
         //- Return the number of columns
-        static direction n()
+        static direction n() noexcept
         {
             return Ncols;
         }
diff --git a/src/OpenFOAM/primitives/MatrixSpace/MatrixSpaceI.H b/src/OpenFOAM/primitives/MatrixSpace/MatrixSpaceI.H
index d6ff7d796c9f14435aa1c2c0ee5ce51abae3f9bc..5e696035ae97d5d2a8612b6e11947ba5c94391c3 100644
--- a/src/OpenFOAM/primitives/MatrixSpace/MatrixSpaceI.H
+++ b/src/OpenFOAM/primitives/MatrixSpace/MatrixSpaceI.H
@@ -345,7 +345,7 @@ inline const Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::operator()
 ) const
 {
     #ifdef FULLDEBUG
-    if (i > Mrows-1 || j > Ncols-1)
+    if (i >= Mrows || j >= Ncols)
     {
         FatalErrorInFunction
             << "indices out of range"
@@ -365,7 +365,7 @@ inline Cmpt& Foam::MatrixSpace<Form, Cmpt, Mrows, Ncols>::operator()
 )
 {
     #ifdef FULLDEBUG
-    if (i > Mrows-1 || j > Ncols-1)
+    if (i >= Mrows || j >= Ncols)
     {
         FatalErrorInFunction
             << "indices out of range"
diff --git a/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H b/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H
index c7f1e7156e7323766ec68f72a7c44963fc8f5114..9712d535bb33a1c9fd9a10131a976950dbce1004 100644
--- a/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H
+++ b/src/OpenFOAM/primitives/SphericalTensor/SphericalTensor.H
@@ -65,7 +65,7 @@ public:
     // Member constants
 
         //- Rank of SphericalTensor is 2
-        static const direction rank = 2;
+        static constexpr direction rank = 2;
 
 
     // Static data members
diff --git a/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2D.H b/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2D.H
index d4585aa8f29f3110fd56d7999649aa83ec7c9496..81f37371d095443b36f71558d01ca66d8ede31df 100644
--- a/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2D.H
+++ b/src/OpenFOAM/primitives/SphericalTensor2D/SphericalTensor2D.H
@@ -61,7 +61,7 @@ public:
     // Member constants
 
         //- Rank of SphericalTensor2D is 2
-        static const direction rank = 2;
+        static constexpr direction rank = 2;
 
 
     // Static data members
diff --git a/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H b/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H
index 04ebd04a4b59f748aba163a1e8469b733457f14b..073951234724bfd5086edfc1be102fbea36e37d1 100644
--- a/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H
+++ b/src/OpenFOAM/primitives/SymmTensor/SymmTensor.H
@@ -67,7 +67,7 @@ public:
     // Member constants
 
         //- Rank of SymmTensor is 2
-        static const direction rank = 2;
+        static constexpr direction rank = 2;
 
 
     // Static data members
diff --git a/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2D.H b/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2D.H
index 7b026dc82f577eb12e2b632d3e0b741987221c4b..c961f6203a569b46545df76009ab125fef6f4b59 100644
--- a/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2D.H
+++ b/src/OpenFOAM/primitives/SymmTensor2D/SymmTensor2D.H
@@ -67,7 +67,7 @@ public:
     // Member constants
 
         //- Rank of SymmTensor2D is 2
-        static const direction rank = 2;
+        static constexpr direction rank = 2;
 
 
     // Static data members
diff --git a/src/OpenFOAM/primitives/Tensor/Tensor.H b/src/OpenFOAM/primitives/Tensor/Tensor.H
index c16500ba6df34fa48e33e3dd18b6cd6dd8e43fac..286eac6711d573a53fe92fb4f35a63e0e46dfc6b 100644
--- a/src/OpenFOAM/primitives/Tensor/Tensor.H
+++ b/src/OpenFOAM/primitives/Tensor/Tensor.H
@@ -53,8 +53,9 @@ See also
 namespace Foam
 {
 
-template<class Cmpt>
-class SymmTensor;
+// Forward Declarations
+template<class Cmpt> class SymmTensor;
+
 
 /*---------------------------------------------------------------------------*\
                            Class Tensor Declaration
@@ -75,7 +76,7 @@ public:
     // Member constants
 
         //- Rank of Tensor is 2
-        static const direction rank = 2;
+        static constexpr direction rank = 2;
 
 
     // Static data members
diff --git a/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H b/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H
index ac97d06d5f53219faa1e7852df79d059057523f0..21b1de4fc99da9dac0fadbb99955ac95ca02c16a 100644
--- a/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H
+++ b/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H
@@ -70,7 +70,7 @@ public:
     // Member constants
 
         //- Rank of Tensor2D is 2
-        static const direction rank = 2;
+        static constexpr direction rank = 2;
 
 
     // Static data members
diff --git a/src/OpenFOAM/primitives/Vector/Vector.H b/src/OpenFOAM/primitives/Vector/Vector.H
index 25073b8fae3c88522024a87d60f2ca57299d766a..a43c09a87ffaf5270979f7339a1f030241eb22f0 100644
--- a/src/OpenFOAM/primitives/Vector/Vector.H
+++ b/src/OpenFOAM/primitives/Vector/Vector.H
@@ -72,7 +72,7 @@ public:
     // Member constants
 
         //- Rank of Vector is 1
-        static const direction rank = 1;
+        static constexpr direction rank = 1;
 
 
     //- Component labeling enumeration
diff --git a/src/OpenFOAM/primitives/Vector2D/Vector2D.H b/src/OpenFOAM/primitives/Vector2D/Vector2D.H
index 26e84aed0ecc9c63ad9170a872849f00a9e5c23b..7f87a632d868baa7bc4bc1cda621aefeaa44153c 100644
--- a/src/OpenFOAM/primitives/Vector2D/Vector2D.H
+++ b/src/OpenFOAM/primitives/Vector2D/Vector2D.H
@@ -65,7 +65,7 @@ public:
     // Member constants
 
         //- Rank of Vector2D is 1
-        static const direction rank = 1;
+        static constexpr direction rank = 1;
 
 
     //- Component labeling enumeration
diff --git a/src/OpenFOAM/primitives/VectorSpace/VectorSpace.C b/src/OpenFOAM/primitives/VectorSpace/VectorSpace.C
index 82123de4e26dca9a8b5b01dccce721b226a37258..bb66e6e9081d6520c666b4d8edbbfccc54dc5662 100644
--- a/src/OpenFOAM/primitives/VectorSpace/VectorSpace.C
+++ b/src/OpenFOAM/primitives/VectorSpace/VectorSpace.C
@@ -38,18 +38,15 @@ Foam::VectorSpace<Form, Cmpt, Ncmpts>::VectorSpace
     Istream& is
 )
 {
-    // Read beginning of VectorSpace<Cmpt>
-    is.readBegin("VectorSpace<Form, Cmpt, Ncmpts>");
+    is.readBegin("VectorSpace");
 
     for (direction i=0; i<Ncmpts; i++)
     {
         is >> v_[i];
     }
 
-    // Read end of VectorSpace<Cmpt>
-    is.readEnd("VectorSpace<Form, Cmpt, Ncmpts>");
+    is.readEnd("VectorSpace");
 
-    // Check state of Istream
     is.check(FUNCTION_NAME);
 }
 
@@ -64,7 +61,7 @@ Foam::word Foam::name
 
     buf << '(' << vs.v_[0];
 
-    for (direction i=1; i<Ncmpts; i++)
+    for (direction i=1; i<Ncmpts; ++i)
     {
         buf << ',' << vs.v_[i];
     }
@@ -84,18 +81,15 @@ Foam::Istream& Foam::operator>>
     VectorSpace<Form, Cmpt, Ncmpts>& vs
 )
 {
-    // Read beginning of VectorSpace<Cmpt, Ncmpts>
-    is.readBegin("VectorSpace<Form, Cmpt, Ncmpts>");
+    is.readBegin("VectorSpace");
 
     for (direction i=0; i<Ncmpts; i++)
     {
         is >> vs.v_[i];
     }
 
-    // Read end of VectorSpace<Cmpt, Ncmpts>
-    is.readEnd("VectorSpace<Form, Cmpt, Ncmpts>");
+    is.readEnd("VectorSpace");
 
-    // Check state of Istream
     is.check(FUNCTION_NAME);
 
     return is;
@@ -111,7 +105,7 @@ Foam::Ostream& Foam::operator<<
 {
     os << token::BEGIN_LIST << vs.v_[0];
 
-    for (direction i=1; i<Ncmpts; i++)
+    for (direction i=1; i<Ncmpts; ++i)
     {
         os << token::SPACE << vs.v_[i];
     }
diff --git a/src/OpenFOAM/primitives/VectorSpace/VectorSpace.H b/src/OpenFOAM/primitives/VectorSpace/VectorSpace.H
index 54e46431971119e38af440b07cb53492f6077e3e..91065e6823a5a26d5489d694cafbd3eb4bb386c1 100644
--- a/src/OpenFOAM/primitives/VectorSpace/VectorSpace.H
+++ b/src/OpenFOAM/primitives/VectorSpace/VectorSpace.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2004-2010 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2004-2010, 2019 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
                             | Copyright (C) 2011-2016 OpenFOAM Foundation
@@ -89,23 +89,23 @@ public:
     typedef Cmpt cmptType;
 
 
-    // Static constants
+    // Static Constants
 
         //- Dimensionality of space
-        static const direction dim = 3;
+        static constexpr direction dim = 3;
 
         //- Number of components in this vector space
-        static const direction nComponents = Ncmpts;
+        static constexpr direction nComponents = Ncmpts;
 
 
         // VectorSpace currently defaults to a column-vector
         // This will be removed when column-vector is introduced
         // as a specialization
-        static const direction mRows = Ncmpts;
-        static const direction nCols = 1;
+        static constexpr direction mRows = Ncmpts;
+        static constexpr direction nCols = 1;
 
 
-    // Static data members
+    // Static Data Members
 
         static const char* const typeName;
         static const char* const componentNames[];
@@ -120,11 +120,7 @@ public:
     // Sub-Block Classes
 
         //- Const sub-block type
-        template
-        <
-            class SubVector,
-            direction BStart
-        >
+        template<class SubVector, direction BStart>
         class ConstBlock
         {
             const vsType& vs_;
@@ -158,12 +154,12 @@ public:
         inline VectorSpace(const Foam::zero);
 
         //- Construct from Istream
-        VectorSpace(Istream&);
+        VectorSpace(Istream& is);
 
-        //- Construct as copy
-        inline VectorSpace(const VectorSpace<Form, Cmpt, Ncmpts>&);
+        //- Copy construct
+        inline VectorSpace(const VectorSpace<Form, Cmpt, Ncmpts>& vs);
 
-        //- Construct as copy of a VectorSpace with the same size
+        //- Copy construct of a VectorSpace with the same size
         template<class Form2, class Cmpt2>
         inline explicit VectorSpace(const VectorSpace<Form2, Cmpt2, Ncmpts>&);
 
@@ -171,7 +167,7 @@ public:
     // Member Functions
 
         //- Return the number of elements in the VectorSpace = Ncmpts.
-        inline static direction size();
+        inline static constexpr direction size();
 
         inline const Cmpt& component(const direction) const;
         inline Cmpt& component(const direction);
@@ -200,6 +196,39 @@ public:
         inline void operator/=(const scalar);
 
 
+    // Iterators
+
+        //- Random access iterator for traversing VectorSpace
+        typedef Cmpt* iterator;
+
+        //- Random access iterator for traversing VectorSpace
+        typedef const Cmpt* const_iterator;
+
+
+    // Random access iterator (non-const)
+
+        //- Return an iterator to begin of VectorSpace
+        inline iterator begin();
+
+        //- Return an iterator to end of UListVectorSpace
+        inline iterator end();
+
+
+    // Random access iterator (const)
+
+        //- Return const_iterator to begin of VectorSpace
+        inline const_iterator cbegin() const;
+
+        //- Return const_iterator to end of VectorSpace
+        inline const_iterator cend() const;
+
+        //- Return const_iterator to begin of VectorSpace
+        inline const_iterator begin() const;
+
+        //- Return const_iterator to end of VectorSpace
+        inline const_iterator end() const;
+
+
     // IOstream Operators
 
         friend Istream& operator>> <Form, Cmpt, Ncmpts>
diff --git a/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H b/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H
index da891c64f0ae34d2f09182da915da893850a5fbe..2b80e0710f152084f6b7a10157c3efb434b72e97 100644
--- a/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H
+++ b/src/OpenFOAM/primitives/VectorSpace/VectorSpaceI.H
@@ -2,7 +2,7 @@
   =========                 |
   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
    \\    /   O peration     |
-    \\  /    A nd           | Copyright (C) 2004-2010 OpenCFD Ltd.
+    \\  /    A nd           | Copyright (C) 2004-2010, 2019 OpenCFD Ltd.
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
                             | Copyright (C) 2011-2016 OpenFOAM Foundation
@@ -31,27 +31,23 @@ License
 #include "ops.H"
 #include <type_traits>
 
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
 
 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
 
-template<class Form, class Cmpt, direction Ncmpts>
-inline VectorSpace<Form, Cmpt, Ncmpts>::VectorSpace()
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline Foam::VectorSpace<Form, Cmpt, Ncmpts>::VectorSpace()
 {}
 
 
-template<class Form, class Cmpt, direction Ncmpts>
-inline VectorSpace<Form, Cmpt, Ncmpts>::VectorSpace(const Foam::zero)
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline Foam::VectorSpace<Form, Cmpt, Ncmpts>::VectorSpace(const Foam::zero)
 {
     VectorSpaceOps<Ncmpts,0>::eqOpS(*this, Zero, eqOp<Cmpt>());
 }
 
 
-template<class Form, class Cmpt, direction Ncmpts>
-inline VectorSpace<Form, Cmpt, Ncmpts>::VectorSpace
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline Foam::VectorSpace<Form, Cmpt, Ncmpts>::VectorSpace
 (
     const VectorSpace<Form, Cmpt, Ncmpts>& vs
 )
@@ -60,9 +56,9 @@ inline VectorSpace<Form, Cmpt, Ncmpts>::VectorSpace
 }
 
 
-template<class Form, class Cmpt, direction Ncmpts>
+template<class Form, class Cmpt, Foam::direction Ncmpts>
 template<class Form2, class Cmpt2>
-inline VectorSpace<Form, Cmpt, Ncmpts>::VectorSpace
+inline Foam::VectorSpace<Form, Cmpt, Ncmpts>::VectorSpace
 (
     const VectorSpace<Form2, Cmpt2, Ncmpts>& vs
 )
@@ -71,10 +67,10 @@ inline VectorSpace<Form, Cmpt, Ncmpts>::VectorSpace
 }
 
 
-template<class Form, class Cmpt, direction Ncmpts>
-template<class SubVector, direction BStart>
-inline
-VectorSpace<Form, Cmpt, Ncmpts>::ConstBlock<SubVector, BStart>::ConstBlock
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+template<class SubVector, Foam::direction BStart>
+inline Foam::VectorSpace<Form, Cmpt, Ncmpts>::ConstBlock<SubVector, BStart>
+    ::ConstBlock
 (
     const vsType& vs
 )
@@ -91,15 +87,15 @@ VectorSpace<Form, Cmpt, Ncmpts>::ConstBlock<SubVector, BStart>::ConstBlock
 
 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
 
-template<class Form, class Cmpt, direction Ncmpts>
-inline direction VectorSpace<Form, Cmpt, Ncmpts>::size()
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline constexpr Foam::direction Foam::VectorSpace<Form, Cmpt, Ncmpts>::size()
 {
     return Ncmpts;
 }
 
 
-template<class Form, class Cmpt, direction Ncmpts>
-inline const Cmpt& VectorSpace<Form, Cmpt, Ncmpts>::component
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline const Cmpt& Foam::VectorSpace<Form, Cmpt, Ncmpts>::component
 (
     const direction d
 ) const
@@ -117,8 +113,8 @@ inline const Cmpt& VectorSpace<Form, Cmpt, Ncmpts>::component
 }
 
 
-template<class Form, class Cmpt, direction Ncmpts>
-inline Cmpt& VectorSpace<Form, Cmpt, Ncmpts>::component
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline Cmpt& Foam::VectorSpace<Form, Cmpt, Ncmpts>::component
 (
     const direction d
 )
@@ -136,8 +132,8 @@ inline Cmpt& VectorSpace<Form, Cmpt, Ncmpts>::component
 }
 
 
-template<class Form, class Cmpt, direction Ncmpts>
-inline void VectorSpace<Form, Cmpt, Ncmpts>::component
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline void Foam::VectorSpace<Form, Cmpt, Ncmpts>::component
 (
     Cmpt& c,
     const direction d
@@ -156,8 +152,8 @@ inline void VectorSpace<Form, Cmpt, Ncmpts>::component
 }
 
 
-template<class Form, class Cmpt, direction Ncmpts>
-inline void VectorSpace<Form, Cmpt, Ncmpts>::replace
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline void Foam::VectorSpace<Form, Cmpt, Ncmpts>::replace
 (
     const direction d,
     const Cmpt& c
@@ -176,8 +172,8 @@ inline void VectorSpace<Form, Cmpt, Ncmpts>::replace
 }
 
 
-template<class Form, class Cmpt, direction Ncmpts>
-inline Form VectorSpace<Form, Cmpt, Ncmpts>::uniform(const Cmpt& s)
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline Form Foam::VectorSpace<Form, Cmpt, Ncmpts>::uniform(const Cmpt& s)
 {
     Form v;
     VectorSpaceOps<Ncmpts,0>::eqOpS(v, s, eqOp<Cmpt>());
@@ -185,20 +181,64 @@ inline Form VectorSpace<Form, Cmpt, Ncmpts>::uniform(const Cmpt& s)
 }
 
 
-template<class Form, class Cmpt, direction Ncmpts>
-template<class SubVector, direction BStart>
-inline const typename VectorSpace<Form, Cmpt, Ncmpts>::template
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+template<class SubVector, Foam::direction BStart>
+inline const typename Foam::VectorSpace<Form, Cmpt, Ncmpts>::template
     ConstBlock<SubVector, BStart>
-VectorSpace<Form, Cmpt, Ncmpts>::block() const
+Foam::VectorSpace<Form, Cmpt, Ncmpts>::block() const
 {
     return *this;
 }
 
 
+// * * * * * * * * * * * * * * * * Iterator  * * * * * * * * * * * * * * * * //
+
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline Cmpt* Foam::VectorSpace<Form, Cmpt, Ncmpts>::begin()
+{
+    return v_;
+}
+
+
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline Cmpt* Foam::VectorSpace<Form, Cmpt, Ncmpts>::end()
+{
+    return (v_ + Ncmpts);
+}
+
+
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline const Cmpt* Foam::VectorSpace<Form, Cmpt, Ncmpts>::cbegin() const
+{
+    return v_;
+}
+
+
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline const Cmpt* Foam::VectorSpace<Form, Cmpt, Ncmpts>::cend() const
+{
+    return (v_ + Ncmpts);
+}
+
+
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline const Cmpt* Foam::VectorSpace<Form, Cmpt, Ncmpts>::begin() const
+{
+    return v_;
+}
+
+
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline const Cmpt* Foam::VectorSpace<Form, Cmpt, Ncmpts>::end() const
+{
+    return (v_ + Ncmpts);
+}
+
+
 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
 
-template<class Form, class Cmpt, direction Ncmpts>
-inline const Cmpt& VectorSpace<Form, Cmpt, Ncmpts>::operator[]
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline const Cmpt& Foam::VectorSpace<Form, Cmpt, Ncmpts>::operator[]
 (
     const direction d
 ) const
@@ -216,8 +256,8 @@ inline const Cmpt& VectorSpace<Form, Cmpt, Ncmpts>::operator[]
 }
 
 
-template<class Form, class Cmpt, direction Ncmpts>
-inline Cmpt& VectorSpace<Form, Cmpt, Ncmpts>::operator[]
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline Cmpt& Foam::VectorSpace<Form, Cmpt, Ncmpts>::operator[]
 (
     const direction d
 )
@@ -235,10 +275,10 @@ inline Cmpt& VectorSpace<Form, Cmpt, Ncmpts>::operator[]
 }
 
 
-template<class Form, class Cmpt, direction Ncmpts>
-template<class SubVector, direction BStart>
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+template<class SubVector, Foam::direction BStart>
 inline const Cmpt&
-VectorSpace<Form, Cmpt, Ncmpts>::
+Foam::VectorSpace<Form, Cmpt, Ncmpts>::
 ConstBlock<SubVector, BStart>::operator[]
 (
     const direction d
@@ -257,10 +297,10 @@ ConstBlock<SubVector, BStart>::operator[]
 }
 
 
-template<class Form, class Cmpt, direction Ncmpts>
-template<class SubVector, direction BStart>
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+template<class SubVector, Foam::direction BStart>
 inline const Cmpt&
-VectorSpace<Form, Cmpt, Ncmpts>::
+Foam::VectorSpace<Form, Cmpt, Ncmpts>::
 ConstBlock<SubVector, BStart>::operator()
 (
     const direction i,
@@ -275,7 +315,7 @@ ConstBlock<SubVector, BStart>::operator()
             << abort(FatalError);
     }
 
-    if (j != 0)
+    if (j)
     {
         FatalErrorInFunction
             << "index " << j << " != 0"
@@ -287,8 +327,8 @@ ConstBlock<SubVector, BStart>::operator()
 }
 
 
-template<class Form, class Cmpt, direction Ncmpts>
-inline void VectorSpace<Form, Cmpt, Ncmpts>::operator=
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline void Foam::VectorSpace<Form, Cmpt, Ncmpts>::operator=
 (
     const VectorSpace<Form, Cmpt, Ncmpts>& vs
 )
@@ -297,8 +337,8 @@ inline void VectorSpace<Form, Cmpt, Ncmpts>::operator=
 }
 
 
-template<class Form, class Cmpt, direction Ncmpts>
-inline void VectorSpace<Form, Cmpt, Ncmpts>::operator+=
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline void Foam::VectorSpace<Form, Cmpt, Ncmpts>::operator+=
 (
     const VectorSpace<Form, Cmpt, Ncmpts>& vs
 )
@@ -307,8 +347,8 @@ inline void VectorSpace<Form, Cmpt, Ncmpts>::operator+=
 }
 
 
-template<class Form, class Cmpt, direction Ncmpts>
-inline void VectorSpace<Form, Cmpt, Ncmpts>::operator-=
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline void Foam::VectorSpace<Form, Cmpt, Ncmpts>::operator-=
 (
     const VectorSpace<Form, Cmpt, Ncmpts>& vs
 )
@@ -317,15 +357,15 @@ inline void VectorSpace<Form, Cmpt, Ncmpts>::operator-=
 }
 
 
-template<class Form, class Cmpt, direction Ncmpts>
-inline void VectorSpace<Form, Cmpt, Ncmpts>::operator=(const Foam::zero)
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline void Foam::VectorSpace<Form, Cmpt, Ncmpts>::operator=(const Foam::zero)
 {
     VectorSpaceOps<Ncmpts,0>::eqOpS(*this, 0, eqOp<Cmpt>());
 }
 
 
-template<class Form, class Cmpt, direction Ncmpts>
-inline void VectorSpace<Form, Cmpt, Ncmpts>::operator*=
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline void Foam::VectorSpace<Form, Cmpt, Ncmpts>::operator*=
 (
     const scalar s
 )
@@ -334,8 +374,8 @@ inline void VectorSpace<Form, Cmpt, Ncmpts>::operator*=
 }
 
 
-template<class Form, class Cmpt, direction Ncmpts>
-inline void VectorSpace<Form, Cmpt, Ncmpts>::operator/=
+template<class Form, class Cmpt, Foam::direction Ncmpts>
+inline void Foam::VectorSpace<Form, Cmpt, Ncmpts>::operator/=
 (
     const scalar s
 )
@@ -344,6 +384,11 @@ inline void VectorSpace<Form, Cmpt, Ncmpts>::operator/=
 }
 
 
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
 // * * * * * * * * * * * * * * * Global Functions  * * * * * * * * * * * * * //
 
 template<class Form, class Cmpt, direction Ncmpts>
diff --git a/src/OpenFOAM/primitives/spatialVectorAlgebra/SpatialTensor/SpatialTensor.H b/src/OpenFOAM/primitives/spatialVectorAlgebra/SpatialTensor/SpatialTensor.H
index 5bd51f6f3f85c04ad084151f625ad54a9bf08001..923a05bd611bb49af341e02c3bb5791094a0f09c 100644
--- a/src/OpenFOAM/primitives/spatialVectorAlgebra/SpatialTensor/SpatialTensor.H
+++ b/src/OpenFOAM/primitives/spatialVectorAlgebra/SpatialTensor/SpatialTensor.H
@@ -74,7 +74,7 @@ public:
     // Member constants
 
         //- Rank of Tensor is 2
-        static const direction rank = 2;
+        static constexpr direction rank = 2;
 
 
     // Static data members