diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2014-12-05 04:07:44 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2014-12-05 16:10:34 +0100 |
commit | ee9344b68fcca2d1db8eba99d39874edc4aec822 (patch) | |
tree | e06dcd5dd42adccc3c5f5045d1b6f2e1e6f1e761 /sw/inc | |
parent | d150ace12b6d8fbb30664d1de1001622720bd53b (diff) |
more const correctness
Change-Id: I786269210a7906c0d6b74e2cdb32100c8ae07666
Diffstat (limited to 'sw/inc')
-rw-r--r-- | sw/inc/ring.hxx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sw/inc/ring.hxx b/sw/inc/ring.hxx index b2c341e305ce..3589cef4b87d 100644 --- a/sw/inc/ring.hxx +++ b/sw/inc/ring.hxx @@ -66,10 +66,16 @@ namespace sw std::swap(*(&pPrev), *(&pDestRing->pPrev)); } /** @return the next item in the ring container */ - value_type* GetNext() const + value_type* GetNext() { return pNext; } /** @return the previous item in the ring container */ - value_type* GetPrev() const + value_type* GetPrev() + { return pPrev; } + /** @return the next item in the ring container */ + const_value_type* GetNext() const + { return pNext; } + /** @return the previous item in the ring container */ + const_value_type* GetPrev() const { return pPrev; } /** @return a stl-like container with begin()/end() for iteration */ ring_container GetRingContainer(); @@ -99,9 +105,9 @@ namespace sw typedef value_type node; typedef value_type* node_ptr; typedef const value_type* const_node_ptr; - static node_ptr get_next(const_node_ptr n) { return n->GetNext(); }; + static node_ptr get_next(const_node_ptr n) { return const_cast<node_ptr>(static_cast<const_node_ptr>(n))->GetNext(); }; static void set_next(node_ptr n, node_ptr next) { n->pNext = next; }; - static node_ptr get_previous(const_node_ptr n) { return n->GetPrev(); }; + static node_ptr get_previous(const_node_ptr n) { return const_cast<node_ptr>(static_cast<const_node_ptr>(n))->GetPrev(); }; static void set_previous(node_ptr n, node_ptr previous) { n->pPrev = previous; }; }; friend typename ring_container::iterator; |