Mercurial > Algorithms__Sedgewick
changeset 26:2cbfacd2a3e9
Slight tweak to the iterator for Queue to make it return values by reference.
author | Eris Caffee <discordia@eldalin.com> |
---|---|
date | Tue, 23 Jun 2015 15:46:22 -0500 |
parents | 3cdac4c29445 |
children | 80ca1973e3bd |
files | algs4-c++/src/Queue.hpp |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line diff
1.1 --- a/algs4-c++/src/Queue.hpp Tue Jun 23 15:27:26 2015 -0500 1.2 +++ b/algs4-c++/src/Queue.hpp Tue Jun 23 15:46:22 2015 -0500 1.3 @@ -29,7 +29,7 @@ 1.4 1.5 private: 1.6 typedef typename std::conditional<is_const, const Node *, Node *>::type NodePtrType; 1.7 - typedef typename std::conditional<is_const, const T, T>::type ValueType; 1.8 + typedef typename std::conditional<is_const, const T&, T&>::type ValueReferenceType; 1.9 1.10 public: 1.11 1.12 @@ -54,7 +54,7 @@ 1.13 return t; 1.14 } 1.15 1.16 - ValueType operator*() { 1.17 + ValueReferenceType operator*() { 1.18 return this->curr->item; 1.19 } 1.20