tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
prev.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_ITERATOR_PREV_HPP
4#define TETL_ITERATOR_PREV_HPP
5
8
9namespace etl {
10
13template <typename BidirIt>
14[[nodiscard]] constexpr auto prev(BidirIt it, typename iterator_traits<BidirIt>::difference_type n = 1) -> BidirIt
15{
16 etl::advance(it, -n);
17 return it;
18}
19} // namespace etl
20
21#endif // TETL_ITERATOR_PREV_HPP
constexpr auto prev(BidirIt it, typename iterator_traits< BidirIt >::difference_type n=1) -> BidirIt
Return the nth predecessor of iterator it.
Definition prev.hpp:14
constexpr auto advance(It &it, Distance n) -> void
Increments given iterator it by n elements.
Definition advance.hpp:22
Definition adjacent_find.hpp:8
iterator_traits is the type trait class that provides uniform interface to the properties of LegacyIt...
Definition iterator_traits.hpp:47