diff options
Diffstat (limited to 'src/patch/grid.hh')
-rw-r--r-- | src/patch/grid.hh | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/patch/grid.hh b/src/patch/grid.hh index a8220f4..b548297 100644 --- a/src/patch/grid.hh +++ b/src/patch/grid.hh @@ -314,33 +314,34 @@ public: // // ***** gridfns ***** // + // ... all these functions (even the rvalue ones) must return + // references, to allow using gridfn(...) as the operand + // of a unary & (address-of) operator + // public: - // access to nominal-grid gridfn data - // ... rvalue (may be slightly faster since it's a const function - // and it returns by value rather than reference - fp gridfn(int gfn, int irho, int isigma) const + // ... rvalue + const fp& gridfn(int gfn, int irho, int isigma) const { assert(gridfn_data_ != NULL); return (*gridfn_data_)(gfn, irho, isigma); } - // ... lvalue (must return a reference) - fp& gridfn(int gfn, int irho, int isigma) + // ... lvalue + fp& gridfn(int gfn, int irho, int isigma) { assert(gridfn_data_ != NULL); return (*gridfn_data_)(gfn, irho, isigma); } // access to ghosted-grid gridfn data - // ... rvalue (may be slightly faster since it's a const function - // and it returns by value rather than reference - fp ghosted_gridfn(int gfn, int irho, int isigma) const + // ... rvalue + const fp& ghosted_gridfn(int gfn, int irho, int isigma) const { assert(gridfn_data_ != NULL); return (*ghosted_gridfn_data_)(gfn, irho, isigma); } // ... lvalue (must return a reference) - fp& ghosted_gridfn(int gfn, int irho, int isigma) + fp& ghosted_gridfn(int gfn, int irho, int isigma) { assert(gridfn_data_ != NULL); return (*ghosted_gridfn_data_)(gfn, irho, isigma); |