From 2659608761b676ca6433bfc3fa6c393554885f8e Mon Sep 17 00:00:00 2001 From: mandreyel Date: Sun, 15 Apr 2018 19:07:19 +0200 Subject: [PATCH] Update iterator documentation --- include/mio/mmap.hpp | 16 ++++++++++++++-- include/mio/shared_mmap.hpp | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/include/mio/mmap.hpp b/include/mio/mmap.hpp index 6d71b25..b96552a 100644 --- a/include/mio/mmap.hpp +++ b/include/mio/mmap.hpp @@ -149,7 +149,7 @@ public: /** * Returns an iterator to the first requested byte, if a valid memory mapping - * exists, otherwise this function call is equivalent to invoking `end`. + * exists, otherwise this function call is undefined behaviour. */ template< access_mode A = AccessMode, @@ -158,7 +158,10 @@ public: const_iterator begin() const noexcept { return impl_.begin(); } const_iterator cbegin() const noexcept { return impl_.cbegin(); } - /** Returns an iterator one past the last requested byte. */ + /** + * Returns an iterator one past the last requested byte, if a valid memory mapping + * exists, otherwise this function call is undefined behaviour. + */ template< access_mode A = AccessMode, typename = typename std::enable_if::type @@ -166,6 +169,11 @@ public: const_iterator end() const noexcept { return impl_.end(); } const_iterator cend() const noexcept { return impl_.cend(); } + /** + * Returns a reverse iterator to the last memory mapped byte, if a valid + * memory mapping exists, otherwise this function call is undefined + * behaviour. + */ template< access_mode A = AccessMode, typename = typename std::enable_if::type @@ -173,6 +181,10 @@ public: const_reverse_iterator rbegin() const noexcept { return impl_.rbegin(); } const_reverse_iterator crbegin() const noexcept { return impl_.crbegin(); } + /** + * Returns a reverse iterator past the first mapped byte, if a valid memory + * mapping exists, otherwise this function call is undefined behaviour. + */ template< access_mode A = AccessMode, typename = typename std::enable_if::type diff --git a/include/mio/shared_mmap.hpp b/include/mio/shared_mmap.hpp index e478ac3..0d5ecda 100644 --- a/include/mio/shared_mmap.hpp +++ b/include/mio/shared_mmap.hpp @@ -163,13 +163,16 @@ public: /** * Returns an iterator to the first requested byte, if a valid memory mapping - * exists, otherwise this function call is equivalent to invoking `end`. + * exists, otherwise this function call is undefined behaviour. */ iterator begin() noexcept { return pimpl_->begin(); } const_iterator begin() const noexcept { return pimpl_->begin(); } const_iterator cbegin() const noexcept { return pimpl_->cbegin(); } - /** Returns an iterator one past the last requested byte. */ + /** + * Returns an iterator one past the last requested byte, if a valid memory mapping + * exists, otherwise this function call is undefined behaviour. + */ template< access_mode A = AccessMode, typename = typename std::enable_if::type @@ -177,6 +180,11 @@ public: const_iterator end() const noexcept { return pimpl_->end(); } const_iterator cend() const noexcept { return pimpl_->cend(); } + /** + * Returns a reverse iterator to the last memory mapped byte, if a valid + * memory mapping exists, otherwise this function call is undefined + * behaviour. + */ template< access_mode A = AccessMode, typename = typename std::enable_if::type @@ -184,6 +192,10 @@ public: const_reverse_iterator rbegin() const noexcept { return pimpl_->rbegin(); } const_reverse_iterator crbegin() const noexcept { return pimpl_->crbegin(); } + /** + * Returns a reverse iterator past the first mapped byte, if a valid memory + * mapping exists, otherwise this function call is undefined behaviour. + */ template< access_mode A = AccessMode, typename = typename std::enable_if::type