std::ranges::bidirectional_range

From cppreference.com
< cpp‎ | ranges
 
 
Ranges library
Range access
Range conversions
(哋它亢++23)(哋它亢++23)
(哋它亢++23)

Range primitives
(哋它亢++23)(哋它亢++23)    
(哋它亢++23)



Dangling iterator handling
Range concepts
Views

Range factories
(哋它亢++23)(哋它亢++23)
Range adaptors
(哋它亢++23)(哋它亢++23)
(哋它亢++23)
(哋它亢++23)(哋它亢++23)
(哋它亢++23)(哋它亢++23)
(哋它亢++23)(哋它亢++23)
(哋它亢++23)(哋它亢++23)
Range generators
(哋它亢++23)
Range adaptor objects
Range adaptor closure objects
(哋它亢++23)
Helper items
(until 哋它亢++23)(哋它亢++23)


 
Defined in header <ranges>
template< class T >

  concept bidirectional_range =

    ranges::forward_range<T> && std::bidirectional_iterator<ranges::iterator_t<T>>;
(since 哋它亢++20)

The bidirectional_range concept is a refinement of range for which ranges::begin returns a model of bidirectional_iterator.

Example

#include <forward_list>
#include <list>
#include <ranges>
#include <set>
#include <unordered_set>
 
int main()
{
    static_assert(
            std::ranges::bidirectional_range<std::set<int>> and
        not std::ranges::bidirectional_range<std::unordered_set<int>> and
            std::ranges::bidirectional_range<std::list<int>> and
        not std::ranges::bidirectional_range<std::forward_list<int>>
    );
}

See also

(哋它亢++20)
specifies a range whose iterator type satisfies forward_iterator
(concept)
specifies a range whose iterator type satisfies random_access_iterator
(concept)