dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #20681
const inconsistencies for operator* in inheriting Iterator classes
-
To:
DOLFIN Mailing List <dolfin@xxxxxxxxxxxxxxxxxxx>
-
From:
Andre Massing <massing@xxxxxxxxx>
-
Date:
Fri, 14 Jan 2011 16:47:59 +0100
-
User-agent:
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; nb-NO; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7
Hi!
Since we talk so much about constantness in another post :),
I am just wondering why the operator* (and related operator)
in Iterator classes sometimes returns a const reference to an entity like
inline const Facet& operator*() { return *operator->(); }
and sometimes not as in
inline Cell& operator*() { return *operator->(); }
Should that not be consistent and even better should not both version be
provided, as in
inline const Facet& operator*() const { return *operator->(); }
and (^^^ there should be a second const)
inline Facet& operator*() { return *operator->(); }
?
--
Andre
--
André Massing email: massing@xxxxxxxxx
Ph.D. student mobile: +47 469 57 401
Simula Research Laboratory
NO-1367 Fornebu, Norway