]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use a private member object instead of public inheritance
authorMatthias Maier <tamiko@43-1.org>
Sat, 12 Sep 2015 21:36:40 +0000 (16:36 -0500)
committerMatthias Maier <tamiko@43-1.org>
Sat, 12 Sep 2015 21:42:11 +0000 (16:42 -0500)
include/deal.II/base/tensor_accessors.h

index a80057dd3760a5c43d41be6f0ff8dd2b89c92ab4..f1f3e79336baf4ade48b8dfc4e08fcf488beff41 100644 (file)
@@ -484,10 +484,10 @@ namespace TensorAccessors
     // subsequently stored indices:
 
     template <int rank, typename S>
-    class StoreIndex : public S
+    class StoreIndex
     {
     public:
-      StoreIndex(S s, int i) : S(s), i_(i) {}
+      StoreIndex(S s, int i) : s_(s), i_(i) {}
 
       typedef StoreIndex<rank - 1, StoreIndex<rank, S> > value_type;
 
@@ -502,10 +502,11 @@ namespace TensorAccessors
       inline
       typename ReferenceType<return_type>::type apply(unsigned int j) const
       {
-        return S::apply(j)[i_];
+        return s_.apply(j)[i_];
       }
 
     private:
+      const S s_;
       const int i_;
     };
 
@@ -514,10 +515,10 @@ namespace TensorAccessors
     // information available to return the actual object.
 
     template <typename S>
-    class StoreIndex<1, S> : public S
+    class StoreIndex<1, S>
     {
     public:
-      StoreIndex(S s, int i) : S(s), i_(i) {}
+      StoreIndex(S s, int i) : s_(s), i_(i) {}
 
       typedef typename ValueType<typename S::return_type>::value_type return_type;
       typedef return_type value_type;
@@ -528,6 +529,7 @@ namespace TensorAccessors
       }
 
     private:
+      const S s_;
       const int i_;
     };
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.