From ec2e2892916135b732982bf621d13c3e749f7145 Mon Sep 17 00:00:00 2001
From: Christian Engwer <christi@dune-project.org>
Date: Sat, 15 Nov 2008 14:02:03 +0000
Subject: [PATCH] * test const interface of bitsetvectorreference. * add using
 statement to fix inaccessbility of "operator[] const"

[[Imported from SVN: r5367]]
---
 common/bitsetvector.hh          |  3 +++
 common/test/bitsetvectortest.cc | 25 +++++++++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/common/bitsetvector.hh b/common/bitsetvector.hh
index 38e6312c4..40ab94f35 100644
--- a/common/bitsetvector.hh
+++ b/common/bitsetvector.hh
@@ -11,6 +11,7 @@
 #include <bitset>
 #include <iostream>
 
+#include <dune/common/deprecated.hh>
 #include <dune/common/genericiterator.hh>
 #include <dune/common/exceptions.hh>
 
@@ -345,6 +346,8 @@ namespace Dune {
       return *this;
     }
 
+    using BitSetVectorConstReference::operator[];
+
     reference operator[](size_type i)
     {
       return getBit(i);
diff --git a/common/test/bitsetvectortest.cc b/common/test/bitsetvectortest.cc
index f9dfa4d67..5c4cf045d 100644
--- a/common/test/bitsetvectortest.cc
+++ b/common/test/bitsetvectortest.cc
@@ -20,6 +20,21 @@ struct ConstReferenceOp
   }
 };
 
+template <class T>
+void testConstBitSetMethods(const T t)
+{
+  t.size();
+  t[0];
+  t[t.size()-1];
+  t << 2;
+  t >> 2;
+  ~t;
+  t.count();
+  t.any();
+  t.none();
+  t.test(0);
+}
+
 template<class BBF>
 void testContainer(BBF & bbf)
 {
@@ -51,10 +66,12 @@ void testContainer(BBF & bbf)
   bbf[4] = true;
 
   // invoke methods
-  x.size();
-  y.size();
-  z.size();
-  v.size();
+  testConstBitSetMethods(x);
+  testConstBitSetMethods(y);
+  testConstBitSetMethods(z);
+  testConstBitSetMethods(v);
+  testConstBitSetMethods(bbf[1]);
+  testConstBitSetMethods(cbbf[2]);
 
   // equality
   y == cbbf[2];
-- 
GitLab