diff --git a/common/bitsetvector.hh b/common/bitsetvector.hh index 38e6312c46cf7b77499102adaf1301bbbc19d997..40ab94f3532e79c9303a59ff0578dc2cfc6f1bae 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 f9dfa4d67803a2909b1095c4d17ca93cd2168273..5c4cf045dc42bd2df2c11aae044fdc54d6c2ca29 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];