[iterator.range] # 24 Iterators library [[iterators]](./#iterators) ## 24.7 Range access [iterator.range] [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7229) In addition to being available via inclusion of the [](iterator.synopsis#header:%3citerator%3e "24.2 Header  synopsis [iterator.synopsis]") header, the function templates in [iterator.range] are available when any of the following headers are included:[](array.syn#header:%3carray%3e "23.3.2 Header synopsis [array.syn]"),[](deque.syn#header:%3cdeque%3e "23.3.4 Header synopsis [deque.syn]"),[](flat.map.syn#header:%3cflat_map%3e "23.6.7 Header synopsis [flat.map.syn]"),[](flat.set.syn#header:%3cflat_set%3e "23.6.10 Header synopsis [flat.set.syn]"),[](forward.list.syn#header:%3cforward_list%3e "23.3.6 Header synopsis [forward.list.syn]"),[](hive.syn#header:%3chive%3e "23.3.8 Header synopsis [hive.syn]"),[](inplace.vector.syn#header:%3cinplace_vector%3e "23.3.15 Header synopsis [inplace.vector.syn]"),[](list.syn#header:%3clist%3e "23.3.10 Header synopsis [list.syn]"),[](associative.map.syn#header:%3cmap%3e "23.4.2 Header synopsis [associative.map.syn]"),[](re.syn#header:%3cregex%3e "28.6.3 Header synopsis [re.syn]"),[](associative.set.syn#header:%3cset%3e "23.4.5 Header synopsis [associative.set.syn]"),[](span.syn#header:%3cspan%3e "23.7.2.1 Header synopsis [span.syn]"),[](string.syn#header:%3cstring%3e "27.4.2 Header synopsis [string.syn]"),[](string.view.synop#header:%3cstring_view%3e "27.3.2 Header synopsis [string.view.synop]"),[](unord.map.syn#header:%3cunordered_map%3e "23.5.2 Header synopsis [unord.map.syn]"),[](unord.set.syn#header:%3cunordered_set%3e "23.5.5 Header synopsis [unord.set.syn]"), and[](vector.syn#header:%3cvector%3e "23.3.12 Header synopsis [vector.syn]")[.](#1.sentence-1) [🔗](#lib:begin(C&)) `template constexpr auto begin(C& c) -> decltype(c.begin()); template constexpr auto begin(const C& c) -> decltype(c.begin()); ` [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7258) *Returns*: c.begin()[.](#2.sentence-1) [🔗](#lib:end(C&)) `template constexpr auto end(C& c) -> decltype(c.end()); template constexpr auto end(const C& c) -> decltype(c.end()); ` [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7270) *Returns*: c.end()[.](#3.sentence-1) [🔗](#lib:begin(T_(&)%5bN%5d)) `template constexpr T* begin(T (&array)[N]) noexcept; ` [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7281) *Returns*: array[.](#4.sentence-1) [🔗](#lib:end(T_(&)%5bN%5d)) `template constexpr T* end(T (&array)[N]) noexcept; ` [5](#5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7292) *Returns*: array + N[.](#5.sentence-1) [🔗](#lib:cbegin(const_C&)) `template constexpr auto cbegin(const C& c) noexcept(noexcept(std::begin(c))) -> decltype(std::begin(c)); ` [6](#6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7303) *Returns*: std​::​begin(c)[.](#6.sentence-1) [🔗](#lib:cend(const_C&)) `template constexpr auto cend(const C& c) noexcept(noexcept(std::end(c))) -> decltype(std::end(c)); ` [7](#7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7314) *Returns*: std​::​end(c)[.](#7.sentence-1) [🔗](#lib:rbegin(C&)) `template constexpr auto rbegin(C& c) -> decltype(c.rbegin()); template constexpr auto rbegin(const C& c) -> decltype(c.rbegin()); ` [8](#8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7325) *Returns*: c.rbegin()[.](#8.sentence-1) [🔗](#lib:rend(C&)) `template constexpr auto rend(C& c) -> decltype(c.rend()); template constexpr auto rend(const C& c) -> decltype(c.rend()); ` [9](#9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7336) *Returns*: c.rend()[.](#9.sentence-1) [🔗](#lib:rbegin(T_(&array)%5bN%5d)) `template constexpr reverse_iterator rbegin(T (&array)[N]); ` [10](#10) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7346) *Returns*: reverse_iterator(array + N)[.](#10.sentence-1) [🔗](#lib:rend(T_(&array)%5bN%5d)) `template constexpr reverse_iterator rend(T (&array)[N]); ` [11](#11) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7356) *Returns*: reverse_iterator(array)[.](#11.sentence-1) [🔗](#lib:rbegin(initializer_list%3cE%3e)) `template constexpr reverse_iterator rbegin(initializer_list il); ` [12](#12) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7366) *Returns*: reverse_iterator(il.end())[.](#12.sentence-1) [🔗](#lib:rend(initializer_list%3cE%3e)) `template constexpr reverse_iterator rend(initializer_list il); ` [13](#13) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7376) *Returns*: reverse_iterator(il.begin())[.](#13.sentence-1) [🔗](#lib:crbegin(const_C&_c)) `template constexpr auto crbegin(const C& c) -> decltype(std::rbegin(c)); ` [14](#14) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7386) *Returns*: std​::​rbegin(c)[.](#14.sentence-1) [🔗](#lib:crend(const_C&_c)) `template constexpr auto crend(const C& c) -> decltype(std::rend(c)); ` [15](#15) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7396) *Returns*: std​::​rend(c)[.](#15.sentence-1) [🔗](#lib:size(C&_c)) `template constexpr auto size(const C& c) -> decltype(c.size()); ` [16](#16) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7406) *Returns*: c.size()[.](#16.sentence-1) [🔗](#lib:size(T_(&array)%5bN%5d)) `template constexpr size_t size(const T (&array)[N]) noexcept; ` [17](#17) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7416) *Returns*: N[.](#17.sentence-1) [🔗](#lib:ssize(C&_c)) `template constexpr auto ssize(const C& c) -> common_type_t>; ` [18](#18) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7427) *Effects*: Equivalent to:return static_cast>>(c.size()); [🔗](#lib:ssize(T_(&array)%5bN%5d)) `template constexpr ptrdiff_t ssize(const T (&array)[N]) noexcept; ` [19](#19) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7440) *Returns*: N[.](#19.sentence-1) [🔗](#lib:empty(C&_c)) `template constexpr auto empty(const C& c) -> decltype(c.empty()); ` [20](#20) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7450) *Returns*: c.empty()[.](#20.sentence-1) [🔗](#lib:empty(T_(&array)%5bN%5d)) `template constexpr bool empty(const T (&array)[N]) noexcept; ` [21](#21) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7460) *Returns*: false[.](#21.sentence-1) [🔗](#lib:empty(initializer_list%3cE%3e)) `template constexpr bool empty(initializer_list il) noexcept; ` [22](#22) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7470) *Returns*: il.size() == 0[.](#22.sentence-1) [🔗](#lib:data(C&_c)) `template constexpr auto data(C& c) -> decltype(c.data()); template constexpr auto data(const C& c) -> decltype(c.data()); ` [23](#23) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7481) *Returns*: c.data()[.](#23.sentence-1) [🔗](#lib:data(T_(&array)%5bN%5d)) `template constexpr T* data(T (&array)[N]) noexcept; ` [24](#24) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7491) *Returns*: array[.](#24.sentence-1) [🔗](#lib:data(initializer_list%3cE%3e)) `template constexpr const E* data(initializer_list il) noexcept; ` [25](#25) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L7501) *Returns*: il.begin()[.](#25.sentence-1)