diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2014-12-03 09:09:58 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2014-12-03 09:24:12 +0100 |
commit | 881458eb2970d6be0ac0648159efcd37fa1623e2 (patch) | |
tree | 8f1bd97f66db9ca010510ce74ca670352b36151e /sw/inc/ring.hxx | |
parent | acf5b740e3dc763eb53c3fdf507a27479386728e (diff) |
move size() into the container too
Change-Id: I22ee641e7d07fa7c0cae7a4b36ce61dbed62b31f
Diffstat (limited to 'sw/inc/ring.hxx')
-rw-r--r-- | sw/inc/ring.hxx | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sw/inc/ring.hxx b/sw/inc/ring.hxx index 61181ebd4c07..174a5bb1458c 100644 --- a/sw/inc/ring.hxx +++ b/sw/inc/ring.hxx @@ -22,6 +22,7 @@ #include <swdllapi.h> #include <swtypes.hxx> #include <utility> +#include <iterator> #include <boost/iterator/iterator_facade.hpp> #include <boost/intrusive/circular_list_algorithms.hpp> @@ -94,9 +95,6 @@ namespace sw /** @return the previous item in the ring container */ T* GetPrev() const { return pPrev; } - /** @return the number of elements in the container */ - size_t size() const - { return algo::count(static_cast< const T* >(this)); } /** @return a stl-like container with begin()/end() for iteration */ ring_container GetRingContainer(); /** @return a stl-like container with begin()/end() for const iteration */ @@ -161,9 +159,9 @@ namespace sw iterator end(); const_iterator begin() const; const_iterator end() const; - ///** @return the number of elements in the container */ - //size_t size() const - // { return algo::count(static_cast< const T* >(this)); } + /** @return the number of elements in the container */ + size_t size() const + { return std::distance(begin(), end()); } }; template <class T> class RingIterator SAL_FINAL : public boost::iterator_facade< |