From: danshapero Date: Thu, 23 Jun 2016 21:31:31 +0000 (-0700) Subject: Added operator* to SynchronousIterators X-Git-Tag: v8.5.0-rc1~954^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c110a2329fb7850375830bd8dd1542ebd313df20;p=dealii.git Added operator* to SynchronousIterators --- diff --git a/include/deal.II/base/synchronous_iterator.h b/include/deal.II/base/synchronous_iterator.h index 05ec5a2094..c0c9238d59 100644 --- a/include/deal.II/base/synchronous_iterator.h +++ b/include/deal.II/base/synchronous_iterator.h @@ -60,6 +60,18 @@ struct SynchronousIterators */ SynchronousIterators (const SynchronousIterators &i); + /** + * Dereference const operator. Returns a const reference to the iterators + * represented by the current class. + */ + const Iterators &operator* () const; + + /** + * Dereference operator. Returns a reference to the iterators + * represented by the current class. + */ + Iterators &operator* (); + /** * Storage for the iterators represented by the current class. */ @@ -87,6 +99,26 @@ SynchronousIterators (const SynchronousIterators &i) +template +inline +const Iterators & +SynchronousIterators::operator* () const +{ + return iterators; +} + + + +template +inline +Iterators & +SynchronousIterators::operator* () +{ + return iterators; +} + + + /** * Return whether the first element of the first argument is less than the * first element of the second argument. Since the objects compared march @@ -101,7 +133,7 @@ bool operator< (const SynchronousIterators &a, const SynchronousIterators &b) { - return std_cxx11::get<0>(a.iterators) < std_cxx11::get<0>(b.iterators); + return std_cxx11::get<0>(*a) < std_cxx11::get<0>(*b); } @@ -119,11 +151,11 @@ std::size_t operator- (const SynchronousIterators &a, const SynchronousIterators &b) { - Assert (std::distance (std_cxx11::get<0>(b.iterators), - std_cxx11::get<0>(a.iterators)) >= 0, + Assert (std::distance (std_cxx11::get<0>(*b), + std_cxx11::get<0>(*a)) >= 0, ExcInternalError()); - return std::distance (std_cxx11::get<0>(b.iterators), - std_cxx11::get<0>(a.iterators)); + return std::distance (std_cxx11::get<0>(*b), + std_cxx11::get<0>(*a)); } @@ -232,7 +264,7 @@ operator + (const SynchronousIterators &a, const std::size_t n) { SynchronousIterators x (a); - dealii::advance (x.iterators, n); + dealii::advance (*x, n); return x; } @@ -246,7 +278,7 @@ inline SynchronousIterators operator ++ (SynchronousIterators &a) { - dealii::advance_by_one (a.iterators); + dealii::advance_by_one (*a); return a; } @@ -263,8 +295,8 @@ bool operator != (const SynchronousIterators &a, const SynchronousIterators &b) { - return (std_cxx11::get<0>(a.iterators) != - std_cxx11::get<0>(b.iterators)); + return (std_cxx11::get<0>(*a) != + std_cxx11::get<0>(*b)); } DEAL_II_NAMESPACE_CLOSE