diff options
author | Chris Dyer <cdyer@allegro.clab.cs.cmu.edu> | 2014-01-28 00:18:37 -0500 |
---|---|---|
committer | Chris Dyer <cdyer@allegro.clab.cs.cmu.edu> | 2014-01-28 00:18:37 -0500 |
commit | 0ee2b44c5c0981358ade9ddab1d083bbe1de5daf (patch) | |
tree | 2dc8d9b9efb24b3a3b5c2bcaf0b55df30743d151 /klm/util/proxy_iterator.hh | |
parent | 2ac0704a463d45f0bfe23184a1ea9950d60fd546 (diff) | |
parent | 783c57b2d3312738ddcf992ac55ff750afe7cb47 (diff) |
Merge branch 'master' of github.com:redpony/cdec
Diffstat (limited to 'klm/util/proxy_iterator.hh')
-rw-r--r-- | klm/util/proxy_iterator.hh | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/klm/util/proxy_iterator.hh b/klm/util/proxy_iterator.hh index 0ee1716f..a2810a47 100644 --- a/klm/util/proxy_iterator.hh +++ b/klm/util/proxy_iterator.hh @@ -38,8 +38,8 @@ template <class Proxy> class ProxyIterator { typedef std::random_access_iterator_tag iterator_category; typedef typename Proxy::value_type value_type; typedef std::ptrdiff_t difference_type; - typedef Proxy & reference; - typedef Proxy * pointer; + typedef Proxy reference; + typedef ProxyIterator<Proxy> * pointer; ProxyIterator() {} @@ -47,10 +47,10 @@ template <class Proxy> class ProxyIterator { template <class AlternateProxy> ProxyIterator(const ProxyIterator<AlternateProxy> &in) : p_(*in) {} explicit ProxyIterator(const Proxy &p) : p_(p) {} - // p_'s swap does value swapping, but here we want iterator swapping +/* // p_'s swap does value swapping, but here we want iterator swapping friend inline void swap(ProxyIterator<Proxy> &first, ProxyIterator<Proxy> &second) { swap(first.I(), second.I()); - } + }*/ // p_'s operator= does value copying, but here we want iterator copying. S &operator=(const S &other) { @@ -77,8 +77,8 @@ template <class Proxy> class ProxyIterator { std::ptrdiff_t operator-(const S &other) const { return I() - other.I(); } - Proxy &operator*() { return p_; } - const Proxy &operator*() const { return p_; } + Proxy operator*() { return p_; } + const Proxy operator*() const { return p_; } Proxy *operator->() { return &p_; } const Proxy *operator->() const { return &p_; } Proxy operator[](std::ptrdiff_t amount) const { return *(*this + amount); } |