14684ddb6SLionel Sambuc// -*- C++ -*- 24684ddb6SLionel Sambuc//===-------------------------- iterator ----------------------------------===// 34684ddb6SLionel Sambuc// 44684ddb6SLionel Sambuc// The LLVM Compiler Infrastructure 54684ddb6SLionel Sambuc// 64684ddb6SLionel Sambuc// This file is dual licensed under the MIT and the University of Illinois Open 74684ddb6SLionel Sambuc// Source Licenses. See LICENSE.TXT for details. 84684ddb6SLionel Sambuc// 94684ddb6SLionel Sambuc//===----------------------------------------------------------------------===// 104684ddb6SLionel Sambuc 114684ddb6SLionel Sambuc#ifndef _LIBCPP_ITERATOR 124684ddb6SLionel Sambuc#define _LIBCPP_ITERATOR 134684ddb6SLionel Sambuc 144684ddb6SLionel Sambuc/* 154684ddb6SLionel Sambuc iterator synopsis 164684ddb6SLionel Sambuc 174684ddb6SLionel Sambucnamespace std 184684ddb6SLionel Sambuc{ 194684ddb6SLionel Sambuc 204684ddb6SLionel Sambuctemplate<class Iterator> 214684ddb6SLionel Sambucstruct iterator_traits 224684ddb6SLionel Sambuc{ 234684ddb6SLionel Sambuc typedef typename Iterator::difference_type difference_type; 244684ddb6SLionel Sambuc typedef typename Iterator::value_type value_type; 254684ddb6SLionel Sambuc typedef typename Iterator::pointer pointer; 264684ddb6SLionel Sambuc typedef typename Iterator::reference reference; 274684ddb6SLionel Sambuc typedef typename Iterator::iterator_category iterator_category; 284684ddb6SLionel Sambuc}; 294684ddb6SLionel Sambuc 304684ddb6SLionel Sambuctemplate<class T> 314684ddb6SLionel Sambucstruct iterator_traits<T*> 324684ddb6SLionel Sambuc{ 334684ddb6SLionel Sambuc typedef ptrdiff_t difference_type; 344684ddb6SLionel Sambuc typedef T value_type; 354684ddb6SLionel Sambuc typedef T* pointer; 364684ddb6SLionel Sambuc typedef T& reference; 374684ddb6SLionel Sambuc typedef random_access_iterator_tag iterator_category; 384684ddb6SLionel Sambuc}; 394684ddb6SLionel Sambuc 404684ddb6SLionel Sambuctemplate<class T> 414684ddb6SLionel Sambucstruct iterator_traits<const T*> 424684ddb6SLionel Sambuc{ 434684ddb6SLionel Sambuc typedef ptrdiff_t difference_type; 444684ddb6SLionel Sambuc typedef T value_type; 454684ddb6SLionel Sambuc typedef const T* pointer; 464684ddb6SLionel Sambuc typedef const T& reference; 474684ddb6SLionel Sambuc typedef random_access_iterator_tag iterator_category; 484684ddb6SLionel Sambuc}; 494684ddb6SLionel Sambuc 504684ddb6SLionel Sambuctemplate<class Category, class T, class Distance = ptrdiff_t, 514684ddb6SLionel Sambuc class Pointer = T*, class Reference = T&> 524684ddb6SLionel Sambucstruct iterator 534684ddb6SLionel Sambuc{ 544684ddb6SLionel Sambuc typedef T value_type; 554684ddb6SLionel Sambuc typedef Distance difference_type; 564684ddb6SLionel Sambuc typedef Pointer pointer; 574684ddb6SLionel Sambuc typedef Reference reference; 584684ddb6SLionel Sambuc typedef Category iterator_category; 594684ddb6SLionel Sambuc}; 604684ddb6SLionel Sambuc 614684ddb6SLionel Sambucstruct input_iterator_tag {}; 624684ddb6SLionel Sambucstruct output_iterator_tag {}; 634684ddb6SLionel Sambucstruct forward_iterator_tag : public input_iterator_tag {}; 644684ddb6SLionel Sambucstruct bidirectional_iterator_tag : public forward_iterator_tag {}; 654684ddb6SLionel Sambucstruct random_access_iterator_tag : public bidirectional_iterator_tag {}; 664684ddb6SLionel Sambuc 674684ddb6SLionel Sambuc// extension: second argument not conforming to C++03 684684ddb6SLionel Sambuctemplate <class InputIterator> 694684ddb6SLionel Sambucvoid advance(InputIterator& i, 704684ddb6SLionel Sambuc typename iterator_traits<InputIterator>::difference_type n); 714684ddb6SLionel Sambuc 724684ddb6SLionel Sambuctemplate <class InputIterator> 734684ddb6SLionel Sambuctypename iterator_traits<InputIterator>::difference_type 744684ddb6SLionel Sambucdistance(InputIterator first, InputIterator last); 754684ddb6SLionel Sambuc 764684ddb6SLionel Sambuctemplate <class Iterator> 774684ddb6SLionel Sambucclass reverse_iterator 784684ddb6SLionel Sambuc : public iterator<typename iterator_traits<Iterator>::iterator_category, 794684ddb6SLionel Sambuc typename iterator_traits<Iterator>::value_type, 804684ddb6SLionel Sambuc typename iterator_traits<Iterator>::difference_type, 814684ddb6SLionel Sambuc typename iterator_traits<Iterator>::pointer, 824684ddb6SLionel Sambuc typename iterator_traits<Iterator>::reference> 834684ddb6SLionel Sambuc{ 844684ddb6SLionel Sambucprotected: 854684ddb6SLionel Sambuc Iterator current; 864684ddb6SLionel Sambucpublic: 874684ddb6SLionel Sambuc typedef Iterator iterator_type; 884684ddb6SLionel Sambuc typedef typename iterator_traits<Iterator>::difference_type difference_type; 894684ddb6SLionel Sambuc typedef typename iterator_traits<Iterator>::reference reference; 904684ddb6SLionel Sambuc typedef typename iterator_traits<Iterator>::pointer pointer; 914684ddb6SLionel Sambuc 924684ddb6SLionel Sambuc reverse_iterator(); 934684ddb6SLionel Sambuc explicit reverse_iterator(Iterator x); 944684ddb6SLionel Sambuc template <class U> reverse_iterator(const reverse_iterator<U>& u); 954684ddb6SLionel Sambuc Iterator base() const; 964684ddb6SLionel Sambuc reference operator*() const; 974684ddb6SLionel Sambuc pointer operator->() const; 984684ddb6SLionel Sambuc reverse_iterator& operator++(); 994684ddb6SLionel Sambuc reverse_iterator operator++(int); 1004684ddb6SLionel Sambuc reverse_iterator& operator--(); 1014684ddb6SLionel Sambuc reverse_iterator operator--(int); 1024684ddb6SLionel Sambuc reverse_iterator operator+ (difference_type n) const; 1034684ddb6SLionel Sambuc reverse_iterator& operator+=(difference_type n); 1044684ddb6SLionel Sambuc reverse_iterator operator- (difference_type n) const; 1054684ddb6SLionel Sambuc reverse_iterator& operator-=(difference_type n); 1064684ddb6SLionel Sambuc reference operator[](difference_type n) const; 1074684ddb6SLionel Sambuc}; 1084684ddb6SLionel Sambuc 1094684ddb6SLionel Sambuctemplate <class Iterator1, class Iterator2> 1104684ddb6SLionel Sambucbool 1114684ddb6SLionel Sambucoperator==(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); 1124684ddb6SLionel Sambuc 1134684ddb6SLionel Sambuctemplate <class Iterator1, class Iterator2> 1144684ddb6SLionel Sambucbool 1154684ddb6SLionel Sambucoperator<(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); 1164684ddb6SLionel Sambuc 1174684ddb6SLionel Sambuctemplate <class Iterator1, class Iterator2> 1184684ddb6SLionel Sambucbool 1194684ddb6SLionel Sambucoperator!=(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); 1204684ddb6SLionel Sambuc 1214684ddb6SLionel Sambuctemplate <class Iterator1, class Iterator2> 1224684ddb6SLionel Sambucbool 1234684ddb6SLionel Sambucoperator>(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); 1244684ddb6SLionel Sambuc 1254684ddb6SLionel Sambuctemplate <class Iterator1, class Iterator2> 1264684ddb6SLionel Sambucbool 1274684ddb6SLionel Sambucoperator>=(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); 1284684ddb6SLionel Sambuc 1294684ddb6SLionel Sambuctemplate <class Iterator1, class Iterator2> 1304684ddb6SLionel Sambucbool 1314684ddb6SLionel Sambucoperator<=(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); 1324684ddb6SLionel Sambuc 1334684ddb6SLionel Sambuctemplate <class Iterator1, class Iterator2> 1344684ddb6SLionel Sambuctypename reverse_iterator<Iterator1>::difference_type 1354684ddb6SLionel Sambucoperator-(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); 1364684ddb6SLionel Sambuc 1374684ddb6SLionel Sambuctemplate <class Iterator> 1384684ddb6SLionel Sambucreverse_iterator<Iterator> 1394684ddb6SLionel Sambucoperator+(typename reverse_iterator<Iterator>::difference_type n, const reverse_iterator<Iterator>& x); 1404684ddb6SLionel Sambuc 141*0a6a1f1dSLionel Sambuctemplate <class Iterator> reverse_iterator<Iterator> make_reverse_iterator(Iterator i); // C++14 142*0a6a1f1dSLionel Sambuc 1434684ddb6SLionel Sambuctemplate <class Container> 1444684ddb6SLionel Sambucclass back_insert_iterator 1454684ddb6SLionel Sambuc{ 1464684ddb6SLionel Sambucprotected: 1474684ddb6SLionel Sambuc Container* container; 1484684ddb6SLionel Sambucpublic: 1494684ddb6SLionel Sambuc typedef Container container_type; 1504684ddb6SLionel Sambuc typedef void value_type; 1514684ddb6SLionel Sambuc typedef void difference_type; 1524684ddb6SLionel Sambuc typedef back_insert_iterator<Cont>& reference; 1534684ddb6SLionel Sambuc typedef void pointer; 1544684ddb6SLionel Sambuc 1554684ddb6SLionel Sambuc explicit back_insert_iterator(Container& x); 1564684ddb6SLionel Sambuc back_insert_iterator& operator=(const typename Container::value_type& value); 1574684ddb6SLionel Sambuc back_insert_iterator& operator*(); 1584684ddb6SLionel Sambuc back_insert_iterator& operator++(); 1594684ddb6SLionel Sambuc back_insert_iterator operator++(int); 1604684ddb6SLionel Sambuc}; 1614684ddb6SLionel Sambuc 1624684ddb6SLionel Sambuctemplate <class Container> back_insert_iterator<Container> back_inserter(Container& x); 1634684ddb6SLionel Sambuc 1644684ddb6SLionel Sambuctemplate <class Container> 1654684ddb6SLionel Sambucclass front_insert_iterator 1664684ddb6SLionel Sambuc{ 1674684ddb6SLionel Sambucprotected: 1684684ddb6SLionel Sambuc Container* container; 1694684ddb6SLionel Sambucpublic: 1704684ddb6SLionel Sambuc typedef Container container_type; 1714684ddb6SLionel Sambuc typedef void value_type; 1724684ddb6SLionel Sambuc typedef void difference_type; 1734684ddb6SLionel Sambuc typedef front_insert_iterator<Cont>& reference; 1744684ddb6SLionel Sambuc typedef void pointer; 1754684ddb6SLionel Sambuc 1764684ddb6SLionel Sambuc explicit front_insert_iterator(Container& x); 1774684ddb6SLionel Sambuc front_insert_iterator& operator=(const typename Container::value_type& value); 1784684ddb6SLionel Sambuc front_insert_iterator& operator*(); 1794684ddb6SLionel Sambuc front_insert_iterator& operator++(); 1804684ddb6SLionel Sambuc front_insert_iterator operator++(int); 1814684ddb6SLionel Sambuc}; 1824684ddb6SLionel Sambuc 1834684ddb6SLionel Sambuctemplate <class Container> front_insert_iterator<Container> front_inserter(Container& x); 1844684ddb6SLionel Sambuc 1854684ddb6SLionel Sambuctemplate <class Container> 1864684ddb6SLionel Sambucclass insert_iterator 1874684ddb6SLionel Sambuc{ 1884684ddb6SLionel Sambucprotected: 1894684ddb6SLionel Sambuc Container* container; 1904684ddb6SLionel Sambuc typename Container::iterator iter; 1914684ddb6SLionel Sambucpublic: 1924684ddb6SLionel Sambuc typedef Container container_type; 1934684ddb6SLionel Sambuc typedef void value_type; 1944684ddb6SLionel Sambuc typedef void difference_type; 1954684ddb6SLionel Sambuc typedef insert_iterator<Cont>& reference; 1964684ddb6SLionel Sambuc typedef void pointer; 1974684ddb6SLionel Sambuc 1984684ddb6SLionel Sambuc insert_iterator(Container& x, typename Container::iterator i); 1994684ddb6SLionel Sambuc insert_iterator& operator=(const typename Container::value_type& value); 2004684ddb6SLionel Sambuc insert_iterator& operator*(); 2014684ddb6SLionel Sambuc insert_iterator& operator++(); 2024684ddb6SLionel Sambuc insert_iterator& operator++(int); 2034684ddb6SLionel Sambuc}; 2044684ddb6SLionel Sambuc 2054684ddb6SLionel Sambuctemplate <class Container, class Iterator> 2064684ddb6SLionel Sambucinsert_iterator<Container> inserter(Container& x, Iterator i); 2074684ddb6SLionel Sambuc 2084684ddb6SLionel Sambuctemplate <class T, class charT = char, class traits = char_traits<charT>, class Distance = ptrdiff_t> 2094684ddb6SLionel Sambucclass istream_iterator 2104684ddb6SLionel Sambuc : public iterator<input_iterator_tag, T, Distance, const T*, const T&> 2114684ddb6SLionel Sambuc{ 2124684ddb6SLionel Sambucpublic: 2134684ddb6SLionel Sambuc typedef charT char_type; 2144684ddb6SLionel Sambuc typedef traits traits_type; 2154684ddb6SLionel Sambuc typedef basic_istream<charT,traits> istream_type; 2164684ddb6SLionel Sambuc 217*0a6a1f1dSLionel Sambuc constexpr istream_iterator(); 2184684ddb6SLionel Sambuc istream_iterator(istream_type& s); 2194684ddb6SLionel Sambuc istream_iterator(const istream_iterator& x); 2204684ddb6SLionel Sambuc ~istream_iterator(); 2214684ddb6SLionel Sambuc 2224684ddb6SLionel Sambuc const T& operator*() const; 2234684ddb6SLionel Sambuc const T* operator->() const; 2244684ddb6SLionel Sambuc istream_iterator& operator++(); 2254684ddb6SLionel Sambuc istream_iterator operator++(int); 2264684ddb6SLionel Sambuc}; 2274684ddb6SLionel Sambuc 2284684ddb6SLionel Sambuctemplate <class T, class charT, class traits, class Distance> 2294684ddb6SLionel Sambucbool operator==(const istream_iterator<T,charT,traits,Distance>& x, 2304684ddb6SLionel Sambuc const istream_iterator<T,charT,traits,Distance>& y); 2314684ddb6SLionel Sambuctemplate <class T, class charT, class traits, class Distance> 2324684ddb6SLionel Sambucbool operator!=(const istream_iterator<T,charT,traits,Distance>& x, 2334684ddb6SLionel Sambuc const istream_iterator<T,charT,traits,Distance>& y); 2344684ddb6SLionel Sambuc 2354684ddb6SLionel Sambuctemplate <class T, class charT = char, class traits = char_traits<charT> > 2364684ddb6SLionel Sambucclass ostream_iterator 2374684ddb6SLionel Sambuc : public iterator<output_iterator_tag, void, void, void ,void> 2384684ddb6SLionel Sambuc{ 2394684ddb6SLionel Sambucpublic: 2404684ddb6SLionel Sambuc typedef charT char_type; 2414684ddb6SLionel Sambuc typedef traits traits_type; 2424684ddb6SLionel Sambuc typedef basic_ostream<charT,traits> ostream_type; 2434684ddb6SLionel Sambuc 2444684ddb6SLionel Sambuc ostream_iterator(ostream_type& s); 2454684ddb6SLionel Sambuc ostream_iterator(ostream_type& s, const charT* delimiter); 2464684ddb6SLionel Sambuc ostream_iterator(const ostream_iterator& x); 2474684ddb6SLionel Sambuc ~ostream_iterator(); 2484684ddb6SLionel Sambuc ostream_iterator& operator=(const T& value); 2494684ddb6SLionel Sambuc 2504684ddb6SLionel Sambuc ostream_iterator& operator*(); 2514684ddb6SLionel Sambuc ostream_iterator& operator++(); 2524684ddb6SLionel Sambuc ostream_iterator& operator++(int); 2534684ddb6SLionel Sambuc}; 2544684ddb6SLionel Sambuc 2554684ddb6SLionel Sambuctemplate<class charT, class traits = char_traits<charT> > 2564684ddb6SLionel Sambucclass istreambuf_iterator 2574684ddb6SLionel Sambuc : public iterator<input_iterator_tag, charT, 2584684ddb6SLionel Sambuc typename traits::off_type, unspecified, 2594684ddb6SLionel Sambuc charT> 2604684ddb6SLionel Sambuc{ 2614684ddb6SLionel Sambucpublic: 2624684ddb6SLionel Sambuc typedef charT char_type; 2634684ddb6SLionel Sambuc typedef traits traits_type; 2644684ddb6SLionel Sambuc typedef typename traits::int_type int_type; 2654684ddb6SLionel Sambuc typedef basic_streambuf<charT,traits> streambuf_type; 2664684ddb6SLionel Sambuc typedef basic_istream<charT,traits> istream_type; 2674684ddb6SLionel Sambuc 2684684ddb6SLionel Sambuc istreambuf_iterator() noexcept; 2694684ddb6SLionel Sambuc istreambuf_iterator(istream_type& s) noexcept; 2704684ddb6SLionel Sambuc istreambuf_iterator(streambuf_type* s) noexcept; 2714684ddb6SLionel Sambuc istreambuf_iterator(a-private-type) noexcept; 2724684ddb6SLionel Sambuc 2734684ddb6SLionel Sambuc charT operator*() const; 2744684ddb6SLionel Sambuc pointer operator->() const; 2754684ddb6SLionel Sambuc istreambuf_iterator& operator++(); 2764684ddb6SLionel Sambuc a-private-type operator++(int); 2774684ddb6SLionel Sambuc 2784684ddb6SLionel Sambuc bool equal(const istreambuf_iterator& b) const; 2794684ddb6SLionel Sambuc}; 2804684ddb6SLionel Sambuc 2814684ddb6SLionel Sambuctemplate <class charT, class traits> 2824684ddb6SLionel Sambucbool operator==(const istreambuf_iterator<charT,traits>& a, 2834684ddb6SLionel Sambuc const istreambuf_iterator<charT,traits>& b); 2844684ddb6SLionel Sambuctemplate <class charT, class traits> 2854684ddb6SLionel Sambucbool operator!=(const istreambuf_iterator<charT,traits>& a, 2864684ddb6SLionel Sambuc const istreambuf_iterator<charT,traits>& b); 2874684ddb6SLionel Sambuc 2884684ddb6SLionel Sambuctemplate <class charT, class traits = char_traits<charT> > 2894684ddb6SLionel Sambucclass ostreambuf_iterator 2904684ddb6SLionel Sambuc : public iterator<output_iterator_tag, void, void, void, void> 2914684ddb6SLionel Sambuc{ 2924684ddb6SLionel Sambucpublic: 2934684ddb6SLionel Sambuc typedef charT char_type; 2944684ddb6SLionel Sambuc typedef traits traits_type; 2954684ddb6SLionel Sambuc typedef basic_streambuf<charT,traits> streambuf_type; 2964684ddb6SLionel Sambuc typedef basic_ostream<charT,traits> ostream_type; 2974684ddb6SLionel Sambuc 2984684ddb6SLionel Sambuc ostreambuf_iterator(ostream_type& s) noexcept; 2994684ddb6SLionel Sambuc ostreambuf_iterator(streambuf_type* s) noexcept; 3004684ddb6SLionel Sambuc ostreambuf_iterator& operator=(charT c); 3014684ddb6SLionel Sambuc ostreambuf_iterator& operator*(); 3024684ddb6SLionel Sambuc ostreambuf_iterator& operator++(); 3034684ddb6SLionel Sambuc ostreambuf_iterator& operator++(int); 3044684ddb6SLionel Sambuc bool failed() const noexcept; 3054684ddb6SLionel Sambuc}; 3064684ddb6SLionel Sambuc 3074684ddb6SLionel Sambuctemplate <class C> auto begin(C& c) -> decltype(c.begin()); 3084684ddb6SLionel Sambuctemplate <class C> auto begin(const C& c) -> decltype(c.begin()); 3094684ddb6SLionel Sambuctemplate <class C> auto end(C& c) -> decltype(c.end()); 3104684ddb6SLionel Sambuctemplate <class C> auto end(const C& c) -> decltype(c.end()); 3114684ddb6SLionel Sambuctemplate <class T, size_t N> T* begin(T (&array)[N]); 3124684ddb6SLionel Sambuctemplate <class T, size_t N> T* end(T (&array)[N]); 3134684ddb6SLionel Sambuc 3144684ddb6SLionel Sambuctemplate <class C> auto cbegin(const C& c) -> decltype(std::begin(c)); // C++14 3154684ddb6SLionel Sambuctemplate <class C> auto cend(const C& c) -> decltype(std::end(c)); // C++14 3164684ddb6SLionel Sambuctemplate <class C> auto rbegin(C& c) -> decltype(c.rbegin()); // C++14 3174684ddb6SLionel Sambuctemplate <class C> auto rbegin(const C& c) -> decltype(c.rbegin()); // C++14 3184684ddb6SLionel Sambuctemplate <class C> auto rend(C& c) -> decltype(c.rend()); // C++14 3194684ddb6SLionel Sambuctemplate <class C> auto rend(const C& c) -> decltype(c.rend()); // C++14 3204684ddb6SLionel Sambuctemplate <class E> reverse_iterator<const E*> rbegin(initializer_list<E> il); // C++14 3214684ddb6SLionel Sambuctemplate <class E> reverse_iterator<const E*> rend(initializer_list<E> il); // C++14 3224684ddb6SLionel Sambuctemplate <class T, size_t N> reverse_iterator<T*> rbegin(T (&array)[N]); // C++14 3234684ddb6SLionel Sambuctemplate <class T, size_t N> reverse_iterator<T*> rend(T (&array)[N]); // C++14 3244684ddb6SLionel Sambuctemplate <class C> auto crbegin(const C& c) -> decltype(std::rbegin(c)); // C++14 3254684ddb6SLionel Sambuctemplate <class C> auto crend(const C& c) -> decltype(std::rend(c)); // C++14 3264684ddb6SLionel Sambuc 327*0a6a1f1dSLionel Sambuc// 24.8, container access: 328*0a6a1f1dSLionel Sambuctemplate <class C> constexpr auto size(const C& c) -> decltype(c.size()); // C++17 329*0a6a1f1dSLionel Sambuctemplate <class T, size_t N> constexpr size_t size(const T (&array)[N]) noexcept; // C++17 330*0a6a1f1dSLionel Sambuctemplate <class C> constexpr auto empty(const C& c) -> decltype(c.empty()); // C++17 331*0a6a1f1dSLionel Sambuctemplate <class T, size_t N> constexpr bool empty(const T (&array)[N]) noexcept; // C++17 332*0a6a1f1dSLionel Sambuctemplate <class E> constexpr bool empty(initializer_list<E> il) noexcept; // C++17 333*0a6a1f1dSLionel Sambuctemplate <class C> constexpr auto data(C& c) -> decltype(c.data()); // C++17 334*0a6a1f1dSLionel Sambuctemplate <class C> constexpr auto data(const C& c) -> decltype(c.data()); // C++17 335*0a6a1f1dSLionel Sambuctemplate <class T, size_t N> constexpr T* data(T (&array)[N]) noexcept; // C++17 336*0a6a1f1dSLionel Sambuctemplate <class E> constexpr const E* data(initializer_list<E> il) noexcept; // C++17 337*0a6a1f1dSLionel Sambuc 3384684ddb6SLionel Sambuc} // std 3394684ddb6SLionel Sambuc 3404684ddb6SLionel Sambuc*/ 3414684ddb6SLionel Sambuc 3424684ddb6SLionel Sambuc#include <__config> 343*0a6a1f1dSLionel Sambuc#include <__functional_base> 3444684ddb6SLionel Sambuc#include <type_traits> 3454684ddb6SLionel Sambuc#include <cstddef> 3464684ddb6SLionel Sambuc#include <iosfwd> 3474684ddb6SLionel Sambuc#include <initializer_list> 3484684ddb6SLionel Sambuc#ifdef __APPLE__ 3494684ddb6SLionel Sambuc#include <Availability.h> 3504684ddb6SLionel Sambuc#endif 3514684ddb6SLionel Sambuc 3524684ddb6SLionel Sambuc#include <__debug> 3534684ddb6SLionel Sambuc 3544684ddb6SLionel Sambuc#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 3554684ddb6SLionel Sambuc#pragma GCC system_header 3564684ddb6SLionel Sambuc#endif 3574684ddb6SLionel Sambuc 3584684ddb6SLionel Sambuc_LIBCPP_BEGIN_NAMESPACE_STD 3594684ddb6SLionel Sambuc 3604684ddb6SLionel Sambucstruct _LIBCPP_TYPE_VIS_ONLY input_iterator_tag {}; 3614684ddb6SLionel Sambucstruct _LIBCPP_TYPE_VIS_ONLY output_iterator_tag {}; 3624684ddb6SLionel Sambucstruct _LIBCPP_TYPE_VIS_ONLY forward_iterator_tag : public input_iterator_tag {}; 3634684ddb6SLionel Sambucstruct _LIBCPP_TYPE_VIS_ONLY bidirectional_iterator_tag : public forward_iterator_tag {}; 3644684ddb6SLionel Sambucstruct _LIBCPP_TYPE_VIS_ONLY random_access_iterator_tag : public bidirectional_iterator_tag {}; 3654684ddb6SLionel Sambuc 3664684ddb6SLionel Sambuctemplate <class _Tp> 3674684ddb6SLionel Sambucstruct __has_iterator_category 3684684ddb6SLionel Sambuc{ 3694684ddb6SLionel Sambucprivate: 3704684ddb6SLionel Sambuc struct __two {char __lx; char __lxx;}; 3714684ddb6SLionel Sambuc template <class _Up> static __two __test(...); 3724684ddb6SLionel Sambuc template <class _Up> static char __test(typename _Up::iterator_category* = 0); 3734684ddb6SLionel Sambucpublic: 3744684ddb6SLionel Sambuc static const bool value = sizeof(__test<_Tp>(0)) == 1; 3754684ddb6SLionel Sambuc}; 3764684ddb6SLionel Sambuc 377*0a6a1f1dSLionel Sambuctemplate <class _Iter, bool> struct __iterator_traits_impl {}; 3784684ddb6SLionel Sambuc 3794684ddb6SLionel Sambuctemplate <class _Iter> 380*0a6a1f1dSLionel Sambucstruct __iterator_traits_impl<_Iter, true> 3814684ddb6SLionel Sambuc{ 3824684ddb6SLionel Sambuc typedef typename _Iter::difference_type difference_type; 3834684ddb6SLionel Sambuc typedef typename _Iter::value_type value_type; 3844684ddb6SLionel Sambuc typedef typename _Iter::pointer pointer; 3854684ddb6SLionel Sambuc typedef typename _Iter::reference reference; 3864684ddb6SLionel Sambuc typedef typename _Iter::iterator_category iterator_category; 3874684ddb6SLionel Sambuc}; 3884684ddb6SLionel Sambuc 3894684ddb6SLionel Sambuctemplate <class _Iter, bool> struct __iterator_traits {}; 3904684ddb6SLionel Sambuc 3914684ddb6SLionel Sambuctemplate <class _Iter> 3924684ddb6SLionel Sambucstruct __iterator_traits<_Iter, true> 393*0a6a1f1dSLionel Sambuc : __iterator_traits_impl 3944684ddb6SLionel Sambuc < 3954684ddb6SLionel Sambuc _Iter, 3964684ddb6SLionel Sambuc is_convertible<typename _Iter::iterator_category, input_iterator_tag>::value || 3974684ddb6SLionel Sambuc is_convertible<typename _Iter::iterator_category, output_iterator_tag>::value 3984684ddb6SLionel Sambuc > 3994684ddb6SLionel Sambuc{}; 4004684ddb6SLionel Sambuc 4014684ddb6SLionel Sambuc// iterator_traits<Iterator> will only have the nested types if Iterator::iterator_category 4024684ddb6SLionel Sambuc// exists. Else iterator_traits<Iterator> will be an empty class. This is a 4034684ddb6SLionel Sambuc// conforming extension which allows some programs to compile and behave as 4044684ddb6SLionel Sambuc// the client expects instead of failing at compile time. 4054684ddb6SLionel Sambuc 4064684ddb6SLionel Sambuctemplate <class _Iter> 4074684ddb6SLionel Sambucstruct _LIBCPP_TYPE_VIS_ONLY iterator_traits 4084684ddb6SLionel Sambuc : __iterator_traits<_Iter, __has_iterator_category<_Iter>::value> {}; 4094684ddb6SLionel Sambuc 4104684ddb6SLionel Sambuctemplate<class _Tp> 4114684ddb6SLionel Sambucstruct _LIBCPP_TYPE_VIS_ONLY iterator_traits<_Tp*> 4124684ddb6SLionel Sambuc{ 4134684ddb6SLionel Sambuc typedef ptrdiff_t difference_type; 4144684ddb6SLionel Sambuc typedef typename remove_const<_Tp>::type value_type; 4154684ddb6SLionel Sambuc typedef _Tp* pointer; 4164684ddb6SLionel Sambuc typedef _Tp& reference; 4174684ddb6SLionel Sambuc typedef random_access_iterator_tag iterator_category; 4184684ddb6SLionel Sambuc}; 4194684ddb6SLionel Sambuc 4204684ddb6SLionel Sambuctemplate <class _Tp, class _Up, bool = __has_iterator_category<iterator_traits<_Tp> >::value> 4214684ddb6SLionel Sambucstruct __has_iterator_category_convertible_to 4224684ddb6SLionel Sambuc : public integral_constant<bool, is_convertible<typename iterator_traits<_Tp>::iterator_category, _Up>::value> 4234684ddb6SLionel Sambuc{}; 4244684ddb6SLionel Sambuc 4254684ddb6SLionel Sambuctemplate <class _Tp, class _Up> 4264684ddb6SLionel Sambucstruct __has_iterator_category_convertible_to<_Tp, _Up, false> : public false_type {}; 4274684ddb6SLionel Sambuc 4284684ddb6SLionel Sambuctemplate <class _Tp> 4294684ddb6SLionel Sambucstruct __is_input_iterator : public __has_iterator_category_convertible_to<_Tp, input_iterator_tag> {}; 4304684ddb6SLionel Sambuc 4314684ddb6SLionel Sambuctemplate <class _Tp> 4324684ddb6SLionel Sambucstruct __is_forward_iterator : public __has_iterator_category_convertible_to<_Tp, forward_iterator_tag> {}; 4334684ddb6SLionel Sambuc 4344684ddb6SLionel Sambuctemplate <class _Tp> 4354684ddb6SLionel Sambucstruct __is_bidirectional_iterator : public __has_iterator_category_convertible_to<_Tp, bidirectional_iterator_tag> {}; 4364684ddb6SLionel Sambuc 4374684ddb6SLionel Sambuctemplate <class _Tp> 4384684ddb6SLionel Sambucstruct __is_random_access_iterator : public __has_iterator_category_convertible_to<_Tp, random_access_iterator_tag> {}; 4394684ddb6SLionel Sambuc 4404684ddb6SLionel Sambuctemplate<class _Category, class _Tp, class _Distance = ptrdiff_t, 4414684ddb6SLionel Sambuc class _Pointer = _Tp*, class _Reference = _Tp&> 4424684ddb6SLionel Sambucstruct _LIBCPP_TYPE_VIS_ONLY iterator 4434684ddb6SLionel Sambuc{ 4444684ddb6SLionel Sambuc typedef _Tp value_type; 4454684ddb6SLionel Sambuc typedef _Distance difference_type; 4464684ddb6SLionel Sambuc typedef _Pointer pointer; 4474684ddb6SLionel Sambuc typedef _Reference reference; 4484684ddb6SLionel Sambuc typedef _Category iterator_category; 4494684ddb6SLionel Sambuc}; 4504684ddb6SLionel Sambuc 4514684ddb6SLionel Sambuctemplate <class _InputIter> 4524684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 4534684ddb6SLionel Sambucvoid __advance(_InputIter& __i, 4544684ddb6SLionel Sambuc typename iterator_traits<_InputIter>::difference_type __n, input_iterator_tag) 4554684ddb6SLionel Sambuc{ 4564684ddb6SLionel Sambuc for (; __n > 0; --__n) 4574684ddb6SLionel Sambuc ++__i; 4584684ddb6SLionel Sambuc} 4594684ddb6SLionel Sambuc 4604684ddb6SLionel Sambuctemplate <class _BiDirIter> 4614684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 4624684ddb6SLionel Sambucvoid __advance(_BiDirIter& __i, 4634684ddb6SLionel Sambuc typename iterator_traits<_BiDirIter>::difference_type __n, bidirectional_iterator_tag) 4644684ddb6SLionel Sambuc{ 4654684ddb6SLionel Sambuc if (__n >= 0) 4664684ddb6SLionel Sambuc for (; __n > 0; --__n) 4674684ddb6SLionel Sambuc ++__i; 4684684ddb6SLionel Sambuc else 4694684ddb6SLionel Sambuc for (; __n < 0; ++__n) 4704684ddb6SLionel Sambuc --__i; 4714684ddb6SLionel Sambuc} 4724684ddb6SLionel Sambuc 4734684ddb6SLionel Sambuctemplate <class _RandIter> 4744684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 4754684ddb6SLionel Sambucvoid __advance(_RandIter& __i, 4764684ddb6SLionel Sambuc typename iterator_traits<_RandIter>::difference_type __n, random_access_iterator_tag) 4774684ddb6SLionel Sambuc{ 4784684ddb6SLionel Sambuc __i += __n; 4794684ddb6SLionel Sambuc} 4804684ddb6SLionel Sambuc 4814684ddb6SLionel Sambuctemplate <class _InputIter> 4824684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 4834684ddb6SLionel Sambucvoid advance(_InputIter& __i, 4844684ddb6SLionel Sambuc typename iterator_traits<_InputIter>::difference_type __n) 4854684ddb6SLionel Sambuc{ 4864684ddb6SLionel Sambuc __advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category()); 4874684ddb6SLionel Sambuc} 4884684ddb6SLionel Sambuc 4894684ddb6SLionel Sambuctemplate <class _InputIter> 4904684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 4914684ddb6SLionel Sambuctypename iterator_traits<_InputIter>::difference_type 4924684ddb6SLionel Sambuc__distance(_InputIter __first, _InputIter __last, input_iterator_tag) 4934684ddb6SLionel Sambuc{ 4944684ddb6SLionel Sambuc typename iterator_traits<_InputIter>::difference_type __r(0); 4954684ddb6SLionel Sambuc for (; __first != __last; ++__first) 4964684ddb6SLionel Sambuc ++__r; 4974684ddb6SLionel Sambuc return __r; 4984684ddb6SLionel Sambuc} 4994684ddb6SLionel Sambuc 5004684ddb6SLionel Sambuctemplate <class _RandIter> 5014684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 5024684ddb6SLionel Sambuctypename iterator_traits<_RandIter>::difference_type 5034684ddb6SLionel Sambuc__distance(_RandIter __first, _RandIter __last, random_access_iterator_tag) 5044684ddb6SLionel Sambuc{ 5054684ddb6SLionel Sambuc return __last - __first; 5064684ddb6SLionel Sambuc} 5074684ddb6SLionel Sambuc 5084684ddb6SLionel Sambuctemplate <class _InputIter> 5094684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 5104684ddb6SLionel Sambuctypename iterator_traits<_InputIter>::difference_type 5114684ddb6SLionel Sambucdistance(_InputIter __first, _InputIter __last) 5124684ddb6SLionel Sambuc{ 5134684ddb6SLionel Sambuc return __distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category()); 5144684ddb6SLionel Sambuc} 5154684ddb6SLionel Sambuc 5164684ddb6SLionel Sambuctemplate <class _ForwardIter> 5174684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 5184684ddb6SLionel Sambuc_ForwardIter 5194684ddb6SLionel Sambucnext(_ForwardIter __x, 5204684ddb6SLionel Sambuc typename iterator_traits<_ForwardIter>::difference_type __n = 1, 5214684ddb6SLionel Sambuc typename enable_if<__is_forward_iterator<_ForwardIter>::value>::type* = 0) 5224684ddb6SLionel Sambuc{ 5234684ddb6SLionel Sambuc _VSTD::advance(__x, __n); 5244684ddb6SLionel Sambuc return __x; 5254684ddb6SLionel Sambuc} 5264684ddb6SLionel Sambuc 5274684ddb6SLionel Sambuctemplate <class _BidiretionalIter> 5284684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 5294684ddb6SLionel Sambuc_BidiretionalIter 5304684ddb6SLionel Sambucprev(_BidiretionalIter __x, 5314684ddb6SLionel Sambuc typename iterator_traits<_BidiretionalIter>::difference_type __n = 1, 5324684ddb6SLionel Sambuc typename enable_if<__is_bidirectional_iterator<_BidiretionalIter>::value>::type* = 0) 5334684ddb6SLionel Sambuc{ 5344684ddb6SLionel Sambuc _VSTD::advance(__x, -__n); 5354684ddb6SLionel Sambuc return __x; 5364684ddb6SLionel Sambuc} 5374684ddb6SLionel Sambuc 5384684ddb6SLionel Sambuctemplate <class _Iter> 5394684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY reverse_iterator 5404684ddb6SLionel Sambuc : public iterator<typename iterator_traits<_Iter>::iterator_category, 5414684ddb6SLionel Sambuc typename iterator_traits<_Iter>::value_type, 5424684ddb6SLionel Sambuc typename iterator_traits<_Iter>::difference_type, 5434684ddb6SLionel Sambuc typename iterator_traits<_Iter>::pointer, 5444684ddb6SLionel Sambuc typename iterator_traits<_Iter>::reference> 5454684ddb6SLionel Sambuc{ 5464684ddb6SLionel Sambucprivate: 547*0a6a1f1dSLionel Sambuc mutable _Iter __t; // no longer used as of LWG #2360, not removed due to ABI break 5484684ddb6SLionel Sambucprotected: 5494684ddb6SLionel Sambuc _Iter current; 5504684ddb6SLionel Sambucpublic: 5514684ddb6SLionel Sambuc typedef _Iter iterator_type; 5524684ddb6SLionel Sambuc typedef typename iterator_traits<_Iter>::difference_type difference_type; 5534684ddb6SLionel Sambuc typedef typename iterator_traits<_Iter>::reference reference; 5544684ddb6SLionel Sambuc typedef typename iterator_traits<_Iter>::pointer pointer; 5554684ddb6SLionel Sambuc 5564684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY reverse_iterator() : current() {} 5574684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY explicit reverse_iterator(_Iter __x) : __t(__x), current(__x) {} 5584684ddb6SLionel Sambuc template <class _Up> _LIBCPP_INLINE_VISIBILITY reverse_iterator(const reverse_iterator<_Up>& __u) 5594684ddb6SLionel Sambuc : __t(__u.base()), current(__u.base()) {} 5604684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY _Iter base() const {return current;} 561*0a6a1f1dSLionel Sambuc _LIBCPP_INLINE_VISIBILITY reference operator*() const {_Iter __tmp = current; return *--__tmp;} 562*0a6a1f1dSLionel Sambuc _LIBCPP_INLINE_VISIBILITY pointer operator->() const {return _VSTD::addressof(operator*());} 5634684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY reverse_iterator& operator++() {--current; return *this;} 5644684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY reverse_iterator operator++(int) 5654684ddb6SLionel Sambuc {reverse_iterator __tmp(*this); --current; return __tmp;} 5664684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY reverse_iterator& operator--() {++current; return *this;} 5674684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY reverse_iterator operator--(int) 5684684ddb6SLionel Sambuc {reverse_iterator __tmp(*this); ++current; return __tmp;} 5694684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY reverse_iterator operator+ (difference_type __n) const 5704684ddb6SLionel Sambuc {return reverse_iterator(current - __n);} 5714684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY reverse_iterator& operator+=(difference_type __n) 5724684ddb6SLionel Sambuc {current -= __n; return *this;} 5734684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY reverse_iterator operator- (difference_type __n) const 5744684ddb6SLionel Sambuc {return reverse_iterator(current + __n);} 5754684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY reverse_iterator& operator-=(difference_type __n) 5764684ddb6SLionel Sambuc {current += __n; return *this;} 5774684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const 578*0a6a1f1dSLionel Sambuc {return *(*this + __n);} 5794684ddb6SLionel Sambuc}; 5804684ddb6SLionel Sambuc 5814684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 5824684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 5834684ddb6SLionel Sambucbool 5844684ddb6SLionel Sambucoperator==(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) 5854684ddb6SLionel Sambuc{ 5864684ddb6SLionel Sambuc return __x.base() == __y.base(); 5874684ddb6SLionel Sambuc} 5884684ddb6SLionel Sambuc 5894684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 5904684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 5914684ddb6SLionel Sambucbool 5924684ddb6SLionel Sambucoperator<(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) 5934684ddb6SLionel Sambuc{ 5944684ddb6SLionel Sambuc return __x.base() > __y.base(); 5954684ddb6SLionel Sambuc} 5964684ddb6SLionel Sambuc 5974684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 5984684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 5994684ddb6SLionel Sambucbool 6004684ddb6SLionel Sambucoperator!=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) 6014684ddb6SLionel Sambuc{ 6024684ddb6SLionel Sambuc return __x.base() != __y.base(); 6034684ddb6SLionel Sambuc} 6044684ddb6SLionel Sambuc 6054684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 6064684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 6074684ddb6SLionel Sambucbool 6084684ddb6SLionel Sambucoperator>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) 6094684ddb6SLionel Sambuc{ 6104684ddb6SLionel Sambuc return __x.base() < __y.base(); 6114684ddb6SLionel Sambuc} 6124684ddb6SLionel Sambuc 6134684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 6144684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 6154684ddb6SLionel Sambucbool 6164684ddb6SLionel Sambucoperator>=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) 6174684ddb6SLionel Sambuc{ 6184684ddb6SLionel Sambuc return __x.base() <= __y.base(); 6194684ddb6SLionel Sambuc} 6204684ddb6SLionel Sambuc 6214684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 6224684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 6234684ddb6SLionel Sambucbool 6244684ddb6SLionel Sambucoperator<=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) 6254684ddb6SLionel Sambuc{ 6264684ddb6SLionel Sambuc return __x.base() >= __y.base(); 6274684ddb6SLionel Sambuc} 6284684ddb6SLionel Sambuc 6294684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 6304684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 6314684ddb6SLionel Sambuctypename reverse_iterator<_Iter1>::difference_type 6324684ddb6SLionel Sambucoperator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) 6334684ddb6SLionel Sambuc{ 6344684ddb6SLionel Sambuc return __y.base() - __x.base(); 6354684ddb6SLionel Sambuc} 6364684ddb6SLionel Sambuc 6374684ddb6SLionel Sambuctemplate <class _Iter> 6384684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 6394684ddb6SLionel Sambucreverse_iterator<_Iter> 6404684ddb6SLionel Sambucoperator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_iterator<_Iter>& __x) 6414684ddb6SLionel Sambuc{ 6424684ddb6SLionel Sambuc return reverse_iterator<_Iter>(__x.base() - __n); 6434684ddb6SLionel Sambuc} 6444684ddb6SLionel Sambuc 645*0a6a1f1dSLionel Sambuc#if _LIBCPP_STD_VER > 11 646*0a6a1f1dSLionel Sambuctemplate <class _Iter> 647*0a6a1f1dSLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 648*0a6a1f1dSLionel Sambucreverse_iterator<_Iter> make_reverse_iterator(_Iter __i) 649*0a6a1f1dSLionel Sambuc{ 650*0a6a1f1dSLionel Sambuc return reverse_iterator<_Iter>(__i); 651*0a6a1f1dSLionel Sambuc} 652*0a6a1f1dSLionel Sambuc#endif 653*0a6a1f1dSLionel Sambuc 6544684ddb6SLionel Sambuctemplate <class _Container> 6554684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY back_insert_iterator 6564684ddb6SLionel Sambuc : public iterator<output_iterator_tag, 6574684ddb6SLionel Sambuc void, 6584684ddb6SLionel Sambuc void, 6594684ddb6SLionel Sambuc void, 6604684ddb6SLionel Sambuc back_insert_iterator<_Container>&> 6614684ddb6SLionel Sambuc{ 6624684ddb6SLionel Sambucprotected: 6634684ddb6SLionel Sambuc _Container* container; 6644684ddb6SLionel Sambucpublic: 6654684ddb6SLionel Sambuc typedef _Container container_type; 6664684ddb6SLionel Sambuc 667*0a6a1f1dSLionel Sambuc _LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {} 6684684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value_) 6694684ddb6SLionel Sambuc {container->push_back(__value_); return *this;} 6704684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 6714684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value_) 6724684ddb6SLionel Sambuc {container->push_back(_VSTD::move(__value_)); return *this;} 6734684ddb6SLionel Sambuc#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 6744684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator*() {return *this;} 6754684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator++() {return *this;} 6764684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY back_insert_iterator operator++(int) {return *this;} 6774684ddb6SLionel Sambuc}; 6784684ddb6SLionel Sambuc 6794684ddb6SLionel Sambuctemplate <class _Container> 6804684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 6814684ddb6SLionel Sambucback_insert_iterator<_Container> 6824684ddb6SLionel Sambucback_inserter(_Container& __x) 6834684ddb6SLionel Sambuc{ 6844684ddb6SLionel Sambuc return back_insert_iterator<_Container>(__x); 6854684ddb6SLionel Sambuc} 6864684ddb6SLionel Sambuc 6874684ddb6SLionel Sambuctemplate <class _Container> 6884684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY front_insert_iterator 6894684ddb6SLionel Sambuc : public iterator<output_iterator_tag, 6904684ddb6SLionel Sambuc void, 6914684ddb6SLionel Sambuc void, 6924684ddb6SLionel Sambuc void, 6934684ddb6SLionel Sambuc front_insert_iterator<_Container>&> 6944684ddb6SLionel Sambuc{ 6954684ddb6SLionel Sambucprotected: 6964684ddb6SLionel Sambuc _Container* container; 6974684ddb6SLionel Sambucpublic: 6984684ddb6SLionel Sambuc typedef _Container container_type; 6994684ddb6SLionel Sambuc 700*0a6a1f1dSLionel Sambuc _LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {} 7014684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value_) 7024684ddb6SLionel Sambuc {container->push_front(__value_); return *this;} 7034684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 7044684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value_) 7054684ddb6SLionel Sambuc {container->push_front(_VSTD::move(__value_)); return *this;} 7064684ddb6SLionel Sambuc#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 7074684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator*() {return *this;} 7084684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator++() {return *this;} 7094684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY front_insert_iterator operator++(int) {return *this;} 7104684ddb6SLionel Sambuc}; 7114684ddb6SLionel Sambuc 7124684ddb6SLionel Sambuctemplate <class _Container> 7134684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7144684ddb6SLionel Sambucfront_insert_iterator<_Container> 7154684ddb6SLionel Sambucfront_inserter(_Container& __x) 7164684ddb6SLionel Sambuc{ 7174684ddb6SLionel Sambuc return front_insert_iterator<_Container>(__x); 7184684ddb6SLionel Sambuc} 7194684ddb6SLionel Sambuc 7204684ddb6SLionel Sambuctemplate <class _Container> 7214684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY insert_iterator 7224684ddb6SLionel Sambuc : public iterator<output_iterator_tag, 7234684ddb6SLionel Sambuc void, 7244684ddb6SLionel Sambuc void, 7254684ddb6SLionel Sambuc void, 7264684ddb6SLionel Sambuc insert_iterator<_Container>&> 7274684ddb6SLionel Sambuc{ 7284684ddb6SLionel Sambucprotected: 7294684ddb6SLionel Sambuc _Container* container; 7304684ddb6SLionel Sambuc typename _Container::iterator iter; 7314684ddb6SLionel Sambucpublic: 7324684ddb6SLionel Sambuc typedef _Container container_type; 7334684ddb6SLionel Sambuc 7344684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY insert_iterator(_Container& __x, typename _Container::iterator __i) 735*0a6a1f1dSLionel Sambuc : container(_VSTD::addressof(__x)), iter(__i) {} 7364684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value_) 7374684ddb6SLionel Sambuc {iter = container->insert(iter, __value_); ++iter; return *this;} 7384684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 7394684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value_) 7404684ddb6SLionel Sambuc {iter = container->insert(iter, _VSTD::move(__value_)); ++iter; return *this;} 7414684ddb6SLionel Sambuc#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 7424684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY insert_iterator& operator*() {return *this;} 7434684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY insert_iterator& operator++() {return *this;} 7444684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY insert_iterator& operator++(int) {return *this;} 7454684ddb6SLionel Sambuc}; 7464684ddb6SLionel Sambuc 7474684ddb6SLionel Sambuctemplate <class _Container> 7484684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 7494684ddb6SLionel Sambucinsert_iterator<_Container> 7504684ddb6SLionel Sambucinserter(_Container& __x, typename _Container::iterator __i) 7514684ddb6SLionel Sambuc{ 7524684ddb6SLionel Sambuc return insert_iterator<_Container>(__x, __i); 7534684ddb6SLionel Sambuc} 7544684ddb6SLionel Sambuc 7554684ddb6SLionel Sambuctemplate <class _Tp, class _CharT = char, 7564684ddb6SLionel Sambuc class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t> 7574684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY istream_iterator 7584684ddb6SLionel Sambuc : public iterator<input_iterator_tag, _Tp, _Distance, const _Tp*, const _Tp&> 7594684ddb6SLionel Sambuc{ 7604684ddb6SLionel Sambucpublic: 7614684ddb6SLionel Sambuc typedef _CharT char_type; 7624684ddb6SLionel Sambuc typedef _Traits traits_type; 7634684ddb6SLionel Sambuc typedef basic_istream<_CharT,_Traits> istream_type; 7644684ddb6SLionel Sambucprivate: 7654684ddb6SLionel Sambuc istream_type* __in_stream_; 7664684ddb6SLionel Sambuc _Tp __value_; 7674684ddb6SLionel Sambucpublic: 768*0a6a1f1dSLionel Sambuc _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istream_iterator() : __in_stream_(0), __value_() {} 7694684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY istream_iterator(istream_type& __s) : __in_stream_(&__s) 7704684ddb6SLionel Sambuc { 7714684ddb6SLionel Sambuc if (!(*__in_stream_ >> __value_)) 7724684ddb6SLionel Sambuc __in_stream_ = 0; 7734684ddb6SLionel Sambuc } 7744684ddb6SLionel Sambuc 7754684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY const _Tp& operator*() const {return __value_;} 7764684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY const _Tp* operator->() const {return &(operator*());} 7774684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY istream_iterator& operator++() 7784684ddb6SLionel Sambuc { 7794684ddb6SLionel Sambuc if (!(*__in_stream_ >> __value_)) 7804684ddb6SLionel Sambuc __in_stream_ = 0; 7814684ddb6SLionel Sambuc return *this; 7824684ddb6SLionel Sambuc } 7834684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY istream_iterator operator++(int) 7844684ddb6SLionel Sambuc {istream_iterator __t(*this); ++(*this); return __t;} 7854684ddb6SLionel Sambuc 7864684ddb6SLionel Sambuc friend _LIBCPP_INLINE_VISIBILITY 7874684ddb6SLionel Sambuc bool operator==(const istream_iterator& __x, const istream_iterator& __y) 7884684ddb6SLionel Sambuc {return __x.__in_stream_ == __y.__in_stream_;} 7894684ddb6SLionel Sambuc 7904684ddb6SLionel Sambuc friend _LIBCPP_INLINE_VISIBILITY 7914684ddb6SLionel Sambuc bool operator!=(const istream_iterator& __x, const istream_iterator& __y) 7924684ddb6SLionel Sambuc {return !(__x == __y);} 7934684ddb6SLionel Sambuc}; 7944684ddb6SLionel Sambuc 7954684ddb6SLionel Sambuctemplate <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT> > 7964684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY ostream_iterator 7974684ddb6SLionel Sambuc : public iterator<output_iterator_tag, void, void, void, void> 7984684ddb6SLionel Sambuc{ 7994684ddb6SLionel Sambucpublic: 8004684ddb6SLionel Sambuc typedef _CharT char_type; 8014684ddb6SLionel Sambuc typedef _Traits traits_type; 8024684ddb6SLionel Sambuc typedef basic_ostream<_CharT,_Traits> ostream_type; 8034684ddb6SLionel Sambucprivate: 8044684ddb6SLionel Sambuc ostream_type* __out_stream_; 8054684ddb6SLionel Sambuc const char_type* __delim_; 8064684ddb6SLionel Sambucpublic: 8074684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s) 8084684ddb6SLionel Sambuc : __out_stream_(&__s), __delim_(0) {} 8094684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter) 8104684ddb6SLionel Sambuc : __out_stream_(&__s), __delim_(__delimiter) {} 8114684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value_) 8124684ddb6SLionel Sambuc { 8134684ddb6SLionel Sambuc *__out_stream_ << __value_; 8144684ddb6SLionel Sambuc if (__delim_) 8154684ddb6SLionel Sambuc *__out_stream_ << __delim_; 8164684ddb6SLionel Sambuc return *this; 8174684ddb6SLionel Sambuc } 8184684ddb6SLionel Sambuc 8194684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator*() {return *this;} 8204684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator++() {return *this;} 8214684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator++(int) {return *this;} 8224684ddb6SLionel Sambuc}; 8234684ddb6SLionel Sambuc 8244684ddb6SLionel Sambuctemplate<class _CharT, class _Traits> 8254684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY istreambuf_iterator 8264684ddb6SLionel Sambuc : public iterator<input_iterator_tag, _CharT, 8274684ddb6SLionel Sambuc typename _Traits::off_type, _CharT*, 8284684ddb6SLionel Sambuc _CharT> 8294684ddb6SLionel Sambuc{ 8304684ddb6SLionel Sambucpublic: 8314684ddb6SLionel Sambuc typedef _CharT char_type; 8324684ddb6SLionel Sambuc typedef _Traits traits_type; 8334684ddb6SLionel Sambuc typedef typename _Traits::int_type int_type; 8344684ddb6SLionel Sambuc typedef basic_streambuf<_CharT,_Traits> streambuf_type; 8354684ddb6SLionel Sambuc typedef basic_istream<_CharT,_Traits> istream_type; 8364684ddb6SLionel Sambucprivate: 8374684ddb6SLionel Sambuc mutable streambuf_type* __sbuf_; 8384684ddb6SLionel Sambuc 8394684ddb6SLionel Sambuc class __proxy 8404684ddb6SLionel Sambuc { 8414684ddb6SLionel Sambuc char_type __keep_; 8424684ddb6SLionel Sambuc streambuf_type* __sbuf_; 8434684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY __proxy(char_type __c, streambuf_type* __s) 8444684ddb6SLionel Sambuc : __keep_(__c), __sbuf_(__s) {} 8454684ddb6SLionel Sambuc friend class istreambuf_iterator; 8464684ddb6SLionel Sambuc public: 8474684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY char_type operator*() const {return __keep_;} 8484684ddb6SLionel Sambuc }; 8494684ddb6SLionel Sambuc 8504684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY 8514684ddb6SLionel Sambuc bool __test_for_eof() const 8524684ddb6SLionel Sambuc { 8534684ddb6SLionel Sambuc if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof())) 8544684ddb6SLionel Sambuc __sbuf_ = 0; 8554684ddb6SLionel Sambuc return __sbuf_ == 0; 8564684ddb6SLionel Sambuc } 8574684ddb6SLionel Sambucpublic: 8584684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {} 8594684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) _NOEXCEPT 8604684ddb6SLionel Sambuc : __sbuf_(__s.rdbuf()) {} 8614684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) _NOEXCEPT 8624684ddb6SLionel Sambuc : __sbuf_(__s) {} 8634684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) _NOEXCEPT 8644684ddb6SLionel Sambuc : __sbuf_(__p.__sbuf_) {} 8654684ddb6SLionel Sambuc 8664684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY char_type operator*() const 8674684ddb6SLionel Sambuc {return static_cast<char_type>(__sbuf_->sgetc());} 8684684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;} 8694684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++() 8704684ddb6SLionel Sambuc { 8714684ddb6SLionel Sambuc __sbuf_->sbumpc(); 8724684ddb6SLionel Sambuc return *this; 8734684ddb6SLionel Sambuc } 8744684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY __proxy operator++(int) 8754684ddb6SLionel Sambuc { 8764684ddb6SLionel Sambuc return __proxy(__sbuf_->sbumpc(), __sbuf_); 8774684ddb6SLionel Sambuc } 8784684ddb6SLionel Sambuc 8794684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY bool equal(const istreambuf_iterator& __b) const 8804684ddb6SLionel Sambuc {return __test_for_eof() == __b.__test_for_eof();} 8814684ddb6SLionel Sambuc}; 8824684ddb6SLionel Sambuc 8834684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 8844684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 8854684ddb6SLionel Sambucbool operator==(const istreambuf_iterator<_CharT,_Traits>& __a, 8864684ddb6SLionel Sambuc const istreambuf_iterator<_CharT,_Traits>& __b) 8874684ddb6SLionel Sambuc {return __a.equal(__b);} 8884684ddb6SLionel Sambuc 8894684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 8904684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 8914684ddb6SLionel Sambucbool operator!=(const istreambuf_iterator<_CharT,_Traits>& __a, 8924684ddb6SLionel Sambuc const istreambuf_iterator<_CharT,_Traits>& __b) 8934684ddb6SLionel Sambuc {return !__a.equal(__b);} 8944684ddb6SLionel Sambuc 8954684ddb6SLionel Sambuctemplate <class _CharT, class _Traits> 8964684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY ostreambuf_iterator 8974684ddb6SLionel Sambuc : public iterator<output_iterator_tag, void, void, void, void> 8984684ddb6SLionel Sambuc{ 8994684ddb6SLionel Sambucpublic: 9004684ddb6SLionel Sambuc typedef _CharT char_type; 9014684ddb6SLionel Sambuc typedef _Traits traits_type; 9024684ddb6SLionel Sambuc typedef basic_streambuf<_CharT,_Traits> streambuf_type; 9034684ddb6SLionel Sambuc typedef basic_ostream<_CharT,_Traits> ostream_type; 9044684ddb6SLionel Sambucprivate: 9054684ddb6SLionel Sambuc streambuf_type* __sbuf_; 9064684ddb6SLionel Sambucpublic: 9074684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(ostream_type& __s) _NOEXCEPT 9084684ddb6SLionel Sambuc : __sbuf_(__s.rdbuf()) {} 9094684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(streambuf_type* __s) _NOEXCEPT 9104684ddb6SLionel Sambuc : __sbuf_(__s) {} 9114684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator=(_CharT __c) 9124684ddb6SLionel Sambuc { 9134684ddb6SLionel Sambuc if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sputc(__c), traits_type::eof())) 9144684ddb6SLionel Sambuc __sbuf_ = 0; 9154684ddb6SLionel Sambuc return *this; 9164684ddb6SLionel Sambuc } 9174684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator*() {return *this;} 9184684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++() {return *this;} 9194684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++(int) {return *this;} 9204684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == 0;} 9214684ddb6SLionel Sambuc 9224684ddb6SLionel Sambuc#if !defined(__APPLE__) || \ 9234684ddb6SLionel Sambuc (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_8) || \ 9244684ddb6SLionel Sambuc (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_0) 9254684ddb6SLionel Sambuc 9264684ddb6SLionel Sambuc template <class _Ch, class _Tr> 9274684ddb6SLionel Sambuc friend 9284684ddb6SLionel Sambuc _LIBCPP_HIDDEN 9294684ddb6SLionel Sambuc ostreambuf_iterator<_Ch, _Tr> 9304684ddb6SLionel Sambuc __pad_and_output(ostreambuf_iterator<_Ch, _Tr> __s, 9314684ddb6SLionel Sambuc const _Ch* __ob, const _Ch* __op, const _Ch* __oe, 9324684ddb6SLionel Sambuc ios_base& __iob, _Ch __fl); 9334684ddb6SLionel Sambuc#endif 9344684ddb6SLionel Sambuc}; 9354684ddb6SLionel Sambuc 9364684ddb6SLionel Sambuctemplate <class _Iter> 9374684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY move_iterator 9384684ddb6SLionel Sambuc{ 9394684ddb6SLionel Sambucprivate: 9404684ddb6SLionel Sambuc _Iter __i; 9414684ddb6SLionel Sambucpublic: 9424684ddb6SLionel Sambuc typedef _Iter iterator_type; 9434684ddb6SLionel Sambuc typedef typename iterator_traits<iterator_type>::iterator_category iterator_category; 9444684ddb6SLionel Sambuc typedef typename iterator_traits<iterator_type>::value_type value_type; 9454684ddb6SLionel Sambuc typedef typename iterator_traits<iterator_type>::difference_type difference_type; 9464684ddb6SLionel Sambuc typedef typename iterator_traits<iterator_type>::pointer pointer; 9474684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 9484684ddb6SLionel Sambuc typedef value_type&& reference; 9494684ddb6SLionel Sambuc#else 9504684ddb6SLionel Sambuc typedef typename iterator_traits<iterator_type>::reference reference; 9514684ddb6SLionel Sambuc#endif 9524684ddb6SLionel Sambuc 9534684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY move_iterator() : __i() {} 9544684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY explicit move_iterator(_Iter __x) : __i(__x) {} 9554684ddb6SLionel Sambuc template <class _Up> _LIBCPP_INLINE_VISIBILITY move_iterator(const move_iterator<_Up>& __u) 9564684ddb6SLionel Sambuc : __i(__u.base()) {} 9574684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY _Iter base() const {return __i;} 9584684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY reference operator*() const { 9594684ddb6SLionel Sambuc return static_cast<reference>(*__i); 9604684ddb6SLionel Sambuc } 9614684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY pointer operator->() const { 9624684ddb6SLionel Sambuc typename iterator_traits<iterator_type>::reference __ref = *__i; 9634684ddb6SLionel Sambuc return &__ref; 9644684ddb6SLionel Sambuc } 9654684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY move_iterator& operator++() {++__i; return *this;} 9664684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY move_iterator operator++(int) 9674684ddb6SLionel Sambuc {move_iterator __tmp(*this); ++__i; return __tmp;} 9684684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY move_iterator& operator--() {--__i; return *this;} 9694684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY move_iterator operator--(int) 9704684ddb6SLionel Sambuc {move_iterator __tmp(*this); --__i; return __tmp;} 9714684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY move_iterator operator+ (difference_type __n) const 9724684ddb6SLionel Sambuc {return move_iterator(__i + __n);} 9734684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY move_iterator& operator+=(difference_type __n) 9744684ddb6SLionel Sambuc {__i += __n; return *this;} 9754684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY move_iterator operator- (difference_type __n) const 9764684ddb6SLionel Sambuc {return move_iterator(__i - __n);} 9774684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY move_iterator& operator-=(difference_type __n) 9784684ddb6SLionel Sambuc {__i -= __n; return *this;} 9794684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const 9804684ddb6SLionel Sambuc { 9814684ddb6SLionel Sambuc return static_cast<reference>(__i[__n]); 9824684ddb6SLionel Sambuc } 9834684ddb6SLionel Sambuc}; 9844684ddb6SLionel Sambuc 9854684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 9864684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 9874684ddb6SLionel Sambucbool 9884684ddb6SLionel Sambucoperator==(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) 9894684ddb6SLionel Sambuc{ 9904684ddb6SLionel Sambuc return __x.base() == __y.base(); 9914684ddb6SLionel Sambuc} 9924684ddb6SLionel Sambuc 9934684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 9944684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 9954684ddb6SLionel Sambucbool 9964684ddb6SLionel Sambucoperator<(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) 9974684ddb6SLionel Sambuc{ 9984684ddb6SLionel Sambuc return __x.base() < __y.base(); 9994684ddb6SLionel Sambuc} 10004684ddb6SLionel Sambuc 10014684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 10024684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 10034684ddb6SLionel Sambucbool 10044684ddb6SLionel Sambucoperator!=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) 10054684ddb6SLionel Sambuc{ 10064684ddb6SLionel Sambuc return __x.base() != __y.base(); 10074684ddb6SLionel Sambuc} 10084684ddb6SLionel Sambuc 10094684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 10104684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 10114684ddb6SLionel Sambucbool 10124684ddb6SLionel Sambucoperator>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) 10134684ddb6SLionel Sambuc{ 10144684ddb6SLionel Sambuc return __x.base() > __y.base(); 10154684ddb6SLionel Sambuc} 10164684ddb6SLionel Sambuc 10174684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 10184684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 10194684ddb6SLionel Sambucbool 10204684ddb6SLionel Sambucoperator>=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) 10214684ddb6SLionel Sambuc{ 10224684ddb6SLionel Sambuc return __x.base() >= __y.base(); 10234684ddb6SLionel Sambuc} 10244684ddb6SLionel Sambuc 10254684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 10264684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 10274684ddb6SLionel Sambucbool 10284684ddb6SLionel Sambucoperator<=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) 10294684ddb6SLionel Sambuc{ 10304684ddb6SLionel Sambuc return __x.base() <= __y.base(); 10314684ddb6SLionel Sambuc} 10324684ddb6SLionel Sambuc 10334684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 10344684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 10354684ddb6SLionel Sambuctypename move_iterator<_Iter1>::difference_type 10364684ddb6SLionel Sambucoperator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) 10374684ddb6SLionel Sambuc{ 10384684ddb6SLionel Sambuc return __x.base() - __y.base(); 10394684ddb6SLionel Sambuc} 10404684ddb6SLionel Sambuc 10414684ddb6SLionel Sambuctemplate <class _Iter> 10424684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 10434684ddb6SLionel Sambucmove_iterator<_Iter> 10444684ddb6SLionel Sambucoperator+(typename move_iterator<_Iter>::difference_type __n, const move_iterator<_Iter>& __x) 10454684ddb6SLionel Sambuc{ 10464684ddb6SLionel Sambuc return move_iterator<_Iter>(__x.base() + __n); 10474684ddb6SLionel Sambuc} 10484684ddb6SLionel Sambuc 10494684ddb6SLionel Sambuctemplate <class _Iter> 10504684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 10514684ddb6SLionel Sambucmove_iterator<_Iter> 10524684ddb6SLionel Sambucmake_move_iterator(_Iter __i) 10534684ddb6SLionel Sambuc{ 10544684ddb6SLionel Sambuc return move_iterator<_Iter>(__i); 10554684ddb6SLionel Sambuc} 10564684ddb6SLionel Sambuc 10574684ddb6SLionel Sambuc// __wrap_iter 10584684ddb6SLionel Sambuc 10594684ddb6SLionel Sambuctemplate <class _Iter> class __wrap_iter; 10604684ddb6SLionel Sambuc 10614684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 10624684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY 10634684ddb6SLionel Sambucbool 10644684ddb6SLionel Sambucoperator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; 10654684ddb6SLionel Sambuc 10664684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 10674684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY 10684684ddb6SLionel Sambucbool 10694684ddb6SLionel Sambucoperator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; 10704684ddb6SLionel Sambuc 10714684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 10724684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY 10734684ddb6SLionel Sambucbool 10744684ddb6SLionel Sambucoperator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; 10754684ddb6SLionel Sambuc 10764684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 10774684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY 10784684ddb6SLionel Sambucbool 10794684ddb6SLionel Sambucoperator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; 10804684ddb6SLionel Sambuc 10814684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 10824684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY 10834684ddb6SLionel Sambucbool 10844684ddb6SLionel Sambucoperator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; 10854684ddb6SLionel Sambuc 10864684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 10874684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY 10884684ddb6SLionel Sambucbool 10894684ddb6SLionel Sambucoperator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; 10904684ddb6SLionel Sambuc 10914684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 10924684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY 10934684ddb6SLionel Sambuctypename __wrap_iter<_Iter1>::difference_type 10944684ddb6SLionel Sambucoperator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; 10954684ddb6SLionel Sambuc 10964684ddb6SLionel Sambuctemplate <class _Iter> 10974684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY 10984684ddb6SLionel Sambuc__wrap_iter<_Iter> 10994684ddb6SLionel Sambucoperator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT; 11004684ddb6SLionel Sambuc 11014684ddb6SLionel Sambuctemplate <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY copy(_Ip, _Ip, _Op); 11024684ddb6SLionel Sambuctemplate <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY copy_backward(_B1, _B1, _B2); 11034684ddb6SLionel Sambuctemplate <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY move(_Ip, _Ip, _Op); 11044684ddb6SLionel Sambuctemplate <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY move_backward(_B1, _B1, _B2); 11054684ddb6SLionel Sambuc 11064684ddb6SLionel Sambuctemplate <class _Tp> 11074684ddb6SLionel Sambuc_LIBCPP_INLINE_VISIBILITY 11084684ddb6SLionel Sambuctypename enable_if 11094684ddb6SLionel Sambuc< 11104684ddb6SLionel Sambuc is_trivially_copy_assignable<_Tp>::value, 11114684ddb6SLionel Sambuc _Tp* 11124684ddb6SLionel Sambuc>::type 11134684ddb6SLionel Sambuc__unwrap_iter(__wrap_iter<_Tp*>); 11144684ddb6SLionel Sambuc 11154684ddb6SLionel Sambuctemplate <class _Iter> 11164684ddb6SLionel Sambucclass __wrap_iter 11174684ddb6SLionel Sambuc{ 11184684ddb6SLionel Sambucpublic: 11194684ddb6SLionel Sambuc typedef _Iter iterator_type; 11204684ddb6SLionel Sambuc typedef typename iterator_traits<iterator_type>::iterator_category iterator_category; 11214684ddb6SLionel Sambuc typedef typename iterator_traits<iterator_type>::value_type value_type; 11224684ddb6SLionel Sambuc typedef typename iterator_traits<iterator_type>::difference_type difference_type; 11234684ddb6SLionel Sambuc typedef typename iterator_traits<iterator_type>::pointer pointer; 11244684ddb6SLionel Sambuc typedef typename iterator_traits<iterator_type>::reference reference; 11254684ddb6SLionel Sambucprivate: 11264684ddb6SLionel Sambuc iterator_type __i; 11274684ddb6SLionel Sambucpublic: 11284684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY __wrap_iter() _NOEXCEPT 11294684ddb6SLionel Sambuc#if _LIBCPP_STD_VER > 11 11304684ddb6SLionel Sambuc : __i{} 11314684ddb6SLionel Sambuc#endif 11324684ddb6SLionel Sambuc { 11334684ddb6SLionel Sambuc#if _LIBCPP_DEBUG_LEVEL >= 2 11344684ddb6SLionel Sambuc __get_db()->__insert_i(this); 11354684ddb6SLionel Sambuc#endif 11364684ddb6SLionel Sambuc } 11374684ddb6SLionel Sambuc template <class _Up> _LIBCPP_INLINE_VISIBILITY __wrap_iter(const __wrap_iter<_Up>& __u, 11384684ddb6SLionel Sambuc typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0) _NOEXCEPT 11394684ddb6SLionel Sambuc : __i(__u.base()) 11404684ddb6SLionel Sambuc { 11414684ddb6SLionel Sambuc#if _LIBCPP_DEBUG_LEVEL >= 2 11424684ddb6SLionel Sambuc __get_db()->__iterator_copy(this, &__u); 11434684ddb6SLionel Sambuc#endif 11444684ddb6SLionel Sambuc } 11454684ddb6SLionel Sambuc#if _LIBCPP_DEBUG_LEVEL >= 2 11464684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY 11474684ddb6SLionel Sambuc __wrap_iter(const __wrap_iter& __x) 11484684ddb6SLionel Sambuc : __i(__x.base()) 11494684ddb6SLionel Sambuc { 11504684ddb6SLionel Sambuc __get_db()->__iterator_copy(this, &__x); 11514684ddb6SLionel Sambuc } 11524684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY 11534684ddb6SLionel Sambuc __wrap_iter& operator=(const __wrap_iter& __x) 11544684ddb6SLionel Sambuc { 11554684ddb6SLionel Sambuc if (this != &__x) 11564684ddb6SLionel Sambuc { 11574684ddb6SLionel Sambuc __get_db()->__iterator_copy(this, &__x); 11584684ddb6SLionel Sambuc __i = __x.__i; 11594684ddb6SLionel Sambuc } 11604684ddb6SLionel Sambuc return *this; 11614684ddb6SLionel Sambuc } 11624684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY 11634684ddb6SLionel Sambuc ~__wrap_iter() 11644684ddb6SLionel Sambuc { 11654684ddb6SLionel Sambuc __get_db()->__erase_i(this); 11664684ddb6SLionel Sambuc } 11674684ddb6SLionel Sambuc#endif 11684684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT 11694684ddb6SLionel Sambuc { 11704684ddb6SLionel Sambuc#if _LIBCPP_DEBUG_LEVEL >= 2 11714684ddb6SLionel Sambuc _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), 11724684ddb6SLionel Sambuc "Attempted to dereference a non-dereferenceable iterator"); 11734684ddb6SLionel Sambuc#endif 11744684ddb6SLionel Sambuc return *__i; 11754684ddb6SLionel Sambuc } 11764684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY pointer operator->() const _NOEXCEPT 11774684ddb6SLionel Sambuc { 11784684ddb6SLionel Sambuc#if _LIBCPP_DEBUG_LEVEL >= 2 11794684ddb6SLionel Sambuc _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), 11804684ddb6SLionel Sambuc "Attempted to dereference a non-dereferenceable iterator"); 11814684ddb6SLionel Sambuc#endif 11824684ddb6SLionel Sambuc return (pointer)&reinterpret_cast<const volatile char&>(*__i); 11834684ddb6SLionel Sambuc } 11844684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator++() _NOEXCEPT 11854684ddb6SLionel Sambuc { 11864684ddb6SLionel Sambuc#if _LIBCPP_DEBUG_LEVEL >= 2 11874684ddb6SLionel Sambuc _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), 11884684ddb6SLionel Sambuc "Attempted to increment non-incrementable iterator"); 11894684ddb6SLionel Sambuc#endif 11904684ddb6SLionel Sambuc ++__i; 11914684ddb6SLionel Sambuc return *this; 11924684ddb6SLionel Sambuc } 11934684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY __wrap_iter operator++(int) _NOEXCEPT 11944684ddb6SLionel Sambuc {__wrap_iter __tmp(*this); ++(*this); return __tmp;} 11954684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator--() _NOEXCEPT 11964684ddb6SLionel Sambuc { 11974684ddb6SLionel Sambuc#if _LIBCPP_DEBUG_LEVEL >= 2 11984684ddb6SLionel Sambuc _LIBCPP_ASSERT(__get_const_db()->__decrementable(this), 11994684ddb6SLionel Sambuc "Attempted to decrement non-decrementable iterator"); 12004684ddb6SLionel Sambuc#endif 12014684ddb6SLionel Sambuc --__i; 12024684ddb6SLionel Sambuc return *this; 12034684ddb6SLionel Sambuc } 12044684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY __wrap_iter operator--(int) _NOEXCEPT 12054684ddb6SLionel Sambuc {__wrap_iter __tmp(*this); --(*this); return __tmp;} 12064684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY __wrap_iter operator+ (difference_type __n) const _NOEXCEPT 12074684ddb6SLionel Sambuc {__wrap_iter __w(*this); __w += __n; return __w;} 12084684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator+=(difference_type __n) _NOEXCEPT 12094684ddb6SLionel Sambuc { 12104684ddb6SLionel Sambuc#if _LIBCPP_DEBUG_LEVEL >= 2 12114684ddb6SLionel Sambuc _LIBCPP_ASSERT(__get_const_db()->__addable(this, __n), 12124684ddb6SLionel Sambuc "Attempted to add/subtract iterator outside of valid range"); 12134684ddb6SLionel Sambuc#endif 12144684ddb6SLionel Sambuc __i += __n; 12154684ddb6SLionel Sambuc return *this; 12164684ddb6SLionel Sambuc } 12174684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY __wrap_iter operator- (difference_type __n) const _NOEXCEPT 12184684ddb6SLionel Sambuc {return *this + (-__n);} 12194684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator-=(difference_type __n) _NOEXCEPT 12204684ddb6SLionel Sambuc {*this += -__n; return *this;} 12214684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const _NOEXCEPT 12224684ddb6SLionel Sambuc { 12234684ddb6SLionel Sambuc#if _LIBCPP_DEBUG_LEVEL >= 2 12244684ddb6SLionel Sambuc _LIBCPP_ASSERT(__get_const_db()->__subscriptable(this, __n), 12254684ddb6SLionel Sambuc "Attempted to subscript iterator outside of valid range"); 12264684ddb6SLionel Sambuc#endif 12274684ddb6SLionel Sambuc return __i[__n]; 12284684ddb6SLionel Sambuc } 12294684ddb6SLionel Sambuc 12304684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY iterator_type base() const _NOEXCEPT {return __i;} 12314684ddb6SLionel Sambuc 12324684ddb6SLionel Sambucprivate: 12334684ddb6SLionel Sambuc#if _LIBCPP_DEBUG_LEVEL >= 2 12344684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY __wrap_iter(const void* __p, iterator_type __x) : __i(__x) 12354684ddb6SLionel Sambuc { 12364684ddb6SLionel Sambuc __get_db()->__insert_ic(this, __p); 12374684ddb6SLionel Sambuc } 12384684ddb6SLionel Sambuc#else 12394684ddb6SLionel Sambuc _LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {} 12404684ddb6SLionel Sambuc#endif 12414684ddb6SLionel Sambuc 12424684ddb6SLionel Sambuc template <class _Up> friend class __wrap_iter; 12434684ddb6SLionel Sambuc template <class _CharT, class _Traits, class _Alloc> friend class basic_string; 1244*0a6a1f1dSLionel Sambuc template <class _Tp, class _Alloc> friend class _LIBCPP_TYPE_VIS_ONLY vector; 12454684ddb6SLionel Sambuc 12464684ddb6SLionel Sambuc template <class _Iter1, class _Iter2> 12474684ddb6SLionel Sambuc friend 12484684ddb6SLionel Sambuc bool 12494684ddb6SLionel Sambuc operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; 12504684ddb6SLionel Sambuc 12514684ddb6SLionel Sambuc template <class _Iter1, class _Iter2> 12524684ddb6SLionel Sambuc friend 12534684ddb6SLionel Sambuc bool 12544684ddb6SLionel Sambuc operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; 12554684ddb6SLionel Sambuc 12564684ddb6SLionel Sambuc template <class _Iter1, class _Iter2> 12574684ddb6SLionel Sambuc friend 12584684ddb6SLionel Sambuc bool 12594684ddb6SLionel Sambuc operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; 12604684ddb6SLionel Sambuc 12614684ddb6SLionel Sambuc template <class _Iter1, class _Iter2> 12624684ddb6SLionel Sambuc friend 12634684ddb6SLionel Sambuc bool 12644684ddb6SLionel Sambuc operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; 12654684ddb6SLionel Sambuc 12664684ddb6SLionel Sambuc template <class _Iter1, class _Iter2> 12674684ddb6SLionel Sambuc friend 12684684ddb6SLionel Sambuc bool 12694684ddb6SLionel Sambuc operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; 12704684ddb6SLionel Sambuc 12714684ddb6SLionel Sambuc template <class _Iter1, class _Iter2> 12724684ddb6SLionel Sambuc friend 12734684ddb6SLionel Sambuc bool 12744684ddb6SLionel Sambuc operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; 12754684ddb6SLionel Sambuc 12764684ddb6SLionel Sambuc template <class _Iter1, class _Iter2> 12774684ddb6SLionel Sambuc friend 12784684ddb6SLionel Sambuc typename __wrap_iter<_Iter1>::difference_type 12794684ddb6SLionel Sambuc operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; 12804684ddb6SLionel Sambuc 12814684ddb6SLionel Sambuc template <class _Iter1> 12824684ddb6SLionel Sambuc friend 12834684ddb6SLionel Sambuc __wrap_iter<_Iter1> 12844684ddb6SLionel Sambuc operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT; 12854684ddb6SLionel Sambuc 12864684ddb6SLionel Sambuc template <class _Ip, class _Op> friend _Op copy(_Ip, _Ip, _Op); 12874684ddb6SLionel Sambuc template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2); 12884684ddb6SLionel Sambuc template <class _Ip, class _Op> friend _Op move(_Ip, _Ip, _Op); 12894684ddb6SLionel Sambuc template <class _B1, class _B2> friend _B2 move_backward(_B1, _B1, _B2); 12904684ddb6SLionel Sambuc 12914684ddb6SLionel Sambuc template <class _Tp> 12924684ddb6SLionel Sambuc friend 12934684ddb6SLionel Sambuc typename enable_if 12944684ddb6SLionel Sambuc < 12954684ddb6SLionel Sambuc is_trivially_copy_assignable<_Tp>::value, 12964684ddb6SLionel Sambuc _Tp* 12974684ddb6SLionel Sambuc >::type 12984684ddb6SLionel Sambuc __unwrap_iter(__wrap_iter<_Tp*>); 12994684ddb6SLionel Sambuc}; 13004684ddb6SLionel Sambuc 13014684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 13024684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 13034684ddb6SLionel Sambucbool 13044684ddb6SLionel Sambucoperator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT 13054684ddb6SLionel Sambuc{ 13064684ddb6SLionel Sambuc return __x.base() == __y.base(); 13074684ddb6SLionel Sambuc} 13084684ddb6SLionel Sambuc 13094684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 13104684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 13114684ddb6SLionel Sambucbool 13124684ddb6SLionel Sambucoperator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT 13134684ddb6SLionel Sambuc{ 13144684ddb6SLionel Sambuc#if _LIBCPP_DEBUG_LEVEL >= 2 13154684ddb6SLionel Sambuc _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y), 13164684ddb6SLionel Sambuc "Attempted to compare incomparable iterators"); 13174684ddb6SLionel Sambuc#endif 13184684ddb6SLionel Sambuc return __x.base() < __y.base(); 13194684ddb6SLionel Sambuc} 13204684ddb6SLionel Sambuc 13214684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 13224684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 13234684ddb6SLionel Sambucbool 13244684ddb6SLionel Sambucoperator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT 13254684ddb6SLionel Sambuc{ 13264684ddb6SLionel Sambuc return !(__x == __y); 13274684ddb6SLionel Sambuc} 13284684ddb6SLionel Sambuc 13294684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 13304684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 13314684ddb6SLionel Sambucbool 13324684ddb6SLionel Sambucoperator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT 13334684ddb6SLionel Sambuc{ 13344684ddb6SLionel Sambuc return __y < __x; 13354684ddb6SLionel Sambuc} 13364684ddb6SLionel Sambuc 13374684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 13384684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 13394684ddb6SLionel Sambucbool 13404684ddb6SLionel Sambucoperator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT 13414684ddb6SLionel Sambuc{ 13424684ddb6SLionel Sambuc return !(__x < __y); 13434684ddb6SLionel Sambuc} 13444684ddb6SLionel Sambuc 13454684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 13464684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 13474684ddb6SLionel Sambucbool 13484684ddb6SLionel Sambucoperator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT 13494684ddb6SLionel Sambuc{ 13504684ddb6SLionel Sambuc return !(__y < __x); 13514684ddb6SLionel Sambuc} 13524684ddb6SLionel Sambuc 13534684ddb6SLionel Sambuctemplate <class _Iter1> 13544684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 13554684ddb6SLionel Sambucbool 13564684ddb6SLionel Sambucoperator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT 13574684ddb6SLionel Sambuc{ 13584684ddb6SLionel Sambuc return !(__x == __y); 13594684ddb6SLionel Sambuc} 13604684ddb6SLionel Sambuc 13614684ddb6SLionel Sambuctemplate <class _Iter1> 13624684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 13634684ddb6SLionel Sambucbool 13644684ddb6SLionel Sambucoperator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT 13654684ddb6SLionel Sambuc{ 13664684ddb6SLionel Sambuc return __y < __x; 13674684ddb6SLionel Sambuc} 13684684ddb6SLionel Sambuc 13694684ddb6SLionel Sambuctemplate <class _Iter1> 13704684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 13714684ddb6SLionel Sambucbool 13724684ddb6SLionel Sambucoperator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT 13734684ddb6SLionel Sambuc{ 13744684ddb6SLionel Sambuc return !(__x < __y); 13754684ddb6SLionel Sambuc} 13764684ddb6SLionel Sambuc 13774684ddb6SLionel Sambuctemplate <class _Iter1> 13784684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 13794684ddb6SLionel Sambucbool 13804684ddb6SLionel Sambucoperator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT 13814684ddb6SLionel Sambuc{ 13824684ddb6SLionel Sambuc return !(__y < __x); 13834684ddb6SLionel Sambuc} 13844684ddb6SLionel Sambuc 13854684ddb6SLionel Sambuctemplate <class _Iter1, class _Iter2> 13864684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 13874684ddb6SLionel Sambuctypename __wrap_iter<_Iter1>::difference_type 13884684ddb6SLionel Sambucoperator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT 13894684ddb6SLionel Sambuc{ 13904684ddb6SLionel Sambuc#if _LIBCPP_DEBUG_LEVEL >= 2 13914684ddb6SLionel Sambuc _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y), 13924684ddb6SLionel Sambuc "Attempted to subtract incompatible iterators"); 13934684ddb6SLionel Sambuc#endif 13944684ddb6SLionel Sambuc return __x.base() - __y.base(); 13954684ddb6SLionel Sambuc} 13964684ddb6SLionel Sambuc 13974684ddb6SLionel Sambuctemplate <class _Iter> 13984684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 13994684ddb6SLionel Sambuc__wrap_iter<_Iter> 14004684ddb6SLionel Sambucoperator+(typename __wrap_iter<_Iter>::difference_type __n, 14014684ddb6SLionel Sambuc __wrap_iter<_Iter> __x) _NOEXCEPT 14024684ddb6SLionel Sambuc{ 14034684ddb6SLionel Sambuc __x += __n; 14044684ddb6SLionel Sambuc return __x; 14054684ddb6SLionel Sambuc} 14064684ddb6SLionel Sambuc 1407*0a6a1f1dSLionel Sambuctemplate <class _Tp, size_t _Np> 1408*0a6a1f1dSLionel Sambucinline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1409*0a6a1f1dSLionel Sambuc_Tp* 1410*0a6a1f1dSLionel Sambucbegin(_Tp (&__array)[_Np]) 1411*0a6a1f1dSLionel Sambuc{ 1412*0a6a1f1dSLionel Sambuc return __array; 1413*0a6a1f1dSLionel Sambuc} 1414*0a6a1f1dSLionel Sambuc 1415*0a6a1f1dSLionel Sambuctemplate <class _Tp, size_t _Np> 1416*0a6a1f1dSLionel Sambucinline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1417*0a6a1f1dSLionel Sambuc_Tp* 1418*0a6a1f1dSLionel Sambucend(_Tp (&__array)[_Np]) 1419*0a6a1f1dSLionel Sambuc{ 1420*0a6a1f1dSLionel Sambuc return __array + _Np; 1421*0a6a1f1dSLionel Sambuc} 1422*0a6a1f1dSLionel Sambuc 14234684ddb6SLionel Sambuc#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) 14244684ddb6SLionel Sambuc 14254684ddb6SLionel Sambuctemplate <class _Cp> 14264684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 14274684ddb6SLionel Sambucauto 14284684ddb6SLionel Sambucbegin(_Cp& __c) -> decltype(__c.begin()) 14294684ddb6SLionel Sambuc{ 14304684ddb6SLionel Sambuc return __c.begin(); 14314684ddb6SLionel Sambuc} 14324684ddb6SLionel Sambuc 14334684ddb6SLionel Sambuctemplate <class _Cp> 14344684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 14354684ddb6SLionel Sambucauto 14364684ddb6SLionel Sambucbegin(const _Cp& __c) -> decltype(__c.begin()) 14374684ddb6SLionel Sambuc{ 14384684ddb6SLionel Sambuc return __c.begin(); 14394684ddb6SLionel Sambuc} 14404684ddb6SLionel Sambuc 14414684ddb6SLionel Sambuctemplate <class _Cp> 14424684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 14434684ddb6SLionel Sambucauto 14444684ddb6SLionel Sambucend(_Cp& __c) -> decltype(__c.end()) 14454684ddb6SLionel Sambuc{ 14464684ddb6SLionel Sambuc return __c.end(); 14474684ddb6SLionel Sambuc} 14484684ddb6SLionel Sambuc 14494684ddb6SLionel Sambuctemplate <class _Cp> 14504684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 14514684ddb6SLionel Sambucauto 14524684ddb6SLionel Sambucend(const _Cp& __c) -> decltype(__c.end()) 14534684ddb6SLionel Sambuc{ 14544684ddb6SLionel Sambuc return __c.end(); 14554684ddb6SLionel Sambuc} 14564684ddb6SLionel Sambuc 14574684ddb6SLionel Sambuc#if _LIBCPP_STD_VER > 11 14584684ddb6SLionel Sambuc 1459*0a6a1f1dSLionel Sambuctemplate <class _Tp, size_t _Np> 14604684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 1461*0a6a1f1dSLionel Sambucreverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np]) 14624684ddb6SLionel Sambuc{ 1463*0a6a1f1dSLionel Sambuc return reverse_iterator<_Tp*>(__array + _Np); 1464*0a6a1f1dSLionel Sambuc} 1465*0a6a1f1dSLionel Sambuc 1466*0a6a1f1dSLionel Sambuctemplate <class _Tp, size_t _Np> 1467*0a6a1f1dSLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 1468*0a6a1f1dSLionel Sambucreverse_iterator<_Tp*> rend(_Tp (&__array)[_Np]) 1469*0a6a1f1dSLionel Sambuc{ 1470*0a6a1f1dSLionel Sambuc return reverse_iterator<_Tp*>(__array); 1471*0a6a1f1dSLionel Sambuc} 1472*0a6a1f1dSLionel Sambuc 1473*0a6a1f1dSLionel Sambuctemplate <class _Ep> 1474*0a6a1f1dSLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 1475*0a6a1f1dSLionel Sambucreverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il) 1476*0a6a1f1dSLionel Sambuc{ 1477*0a6a1f1dSLionel Sambuc return reverse_iterator<const _Ep*>(__il.end()); 1478*0a6a1f1dSLionel Sambuc} 1479*0a6a1f1dSLionel Sambuc 1480*0a6a1f1dSLionel Sambuctemplate <class _Ep> 1481*0a6a1f1dSLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 1482*0a6a1f1dSLionel Sambucreverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il) 1483*0a6a1f1dSLionel Sambuc{ 1484*0a6a1f1dSLionel Sambuc return reverse_iterator<const _Ep*>(__il.begin()); 14854684ddb6SLionel Sambuc} 14864684ddb6SLionel Sambuc 14874684ddb6SLionel Sambuctemplate <class _Cp> 1488*0a6a1f1dSLionel Sambucinline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 1489*0a6a1f1dSLionel Sambucauto cbegin(const _Cp& __c) -> decltype(begin(__c)) 1490*0a6a1f1dSLionel Sambuc{ 1491*0a6a1f1dSLionel Sambuc return begin(__c); 1492*0a6a1f1dSLionel Sambuc} 1493*0a6a1f1dSLionel Sambuc 1494*0a6a1f1dSLionel Sambuctemplate <class _Cp> 1495*0a6a1f1dSLionel Sambucinline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 14964684ddb6SLionel Sambucauto cend(const _Cp& __c) -> decltype(end(__c)) 14974684ddb6SLionel Sambuc{ 1498*0a6a1f1dSLionel Sambuc return end(__c); 14994684ddb6SLionel Sambuc} 15004684ddb6SLionel Sambuc 15014684ddb6SLionel Sambuctemplate <class _Cp> 15024684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 15034684ddb6SLionel Sambucauto rbegin(_Cp& __c) -> decltype(__c.rbegin()) 15044684ddb6SLionel Sambuc{ 15054684ddb6SLionel Sambuc return __c.rbegin(); 15064684ddb6SLionel Sambuc} 15074684ddb6SLionel Sambuc 15084684ddb6SLionel Sambuctemplate <class _Cp> 15094684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 15104684ddb6SLionel Sambucauto rbegin(const _Cp& __c) -> decltype(__c.rbegin()) 15114684ddb6SLionel Sambuc{ 15124684ddb6SLionel Sambuc return __c.rbegin(); 15134684ddb6SLionel Sambuc} 15144684ddb6SLionel Sambuc 15154684ddb6SLionel Sambuctemplate <class _Cp> 15164684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 15174684ddb6SLionel Sambucauto rend(_Cp& __c) -> decltype(__c.rend()) 15184684ddb6SLionel Sambuc{ 15194684ddb6SLionel Sambuc return __c.rend(); 15204684ddb6SLionel Sambuc} 15214684ddb6SLionel Sambuc 15224684ddb6SLionel Sambuctemplate <class _Cp> 15234684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 15244684ddb6SLionel Sambucauto rend(const _Cp& __c) -> decltype(__c.rend()) 15254684ddb6SLionel Sambuc{ 15264684ddb6SLionel Sambuc return __c.rend(); 15274684ddb6SLionel Sambuc} 15284684ddb6SLionel Sambuc 15294684ddb6SLionel Sambuctemplate <class _Cp> 15304684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 15314684ddb6SLionel Sambucauto crbegin(const _Cp& __c) -> decltype(rbegin(__c)) 15324684ddb6SLionel Sambuc{ 15334684ddb6SLionel Sambuc return rbegin(__c); 15344684ddb6SLionel Sambuc} 15354684ddb6SLionel Sambuc 15364684ddb6SLionel Sambuctemplate <class _Cp> 15374684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 15384684ddb6SLionel Sambucauto crend(const _Cp& __c) -> decltype(rend(__c)) 15394684ddb6SLionel Sambuc{ 15404684ddb6SLionel Sambuc return rend(__c); 15414684ddb6SLionel Sambuc} 15424684ddb6SLionel Sambuc 15434684ddb6SLionel Sambuc#endif 15444684ddb6SLionel Sambuc 15454684ddb6SLionel Sambuc 15464684ddb6SLionel Sambuc#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) 15474684ddb6SLionel Sambuc 15484684ddb6SLionel Sambuctemplate <class _Cp> 15494684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 15504684ddb6SLionel Sambuctypename _Cp::iterator 15514684ddb6SLionel Sambucbegin(_Cp& __c) 15524684ddb6SLionel Sambuc{ 15534684ddb6SLionel Sambuc return __c.begin(); 15544684ddb6SLionel Sambuc} 15554684ddb6SLionel Sambuc 15564684ddb6SLionel Sambuctemplate <class _Cp> 15574684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 15584684ddb6SLionel Sambuctypename _Cp::const_iterator 15594684ddb6SLionel Sambucbegin(const _Cp& __c) 15604684ddb6SLionel Sambuc{ 15614684ddb6SLionel Sambuc return __c.begin(); 15624684ddb6SLionel Sambuc} 15634684ddb6SLionel Sambuc 15644684ddb6SLionel Sambuctemplate <class _Cp> 15654684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 15664684ddb6SLionel Sambuctypename _Cp::iterator 15674684ddb6SLionel Sambucend(_Cp& __c) 15684684ddb6SLionel Sambuc{ 15694684ddb6SLionel Sambuc return __c.end(); 15704684ddb6SLionel Sambuc} 15714684ddb6SLionel Sambuc 15724684ddb6SLionel Sambuctemplate <class _Cp> 15734684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY 15744684ddb6SLionel Sambuctypename _Cp::const_iterator 15754684ddb6SLionel Sambucend(const _Cp& __c) 15764684ddb6SLionel Sambuc{ 15774684ddb6SLionel Sambuc return __c.end(); 15784684ddb6SLionel Sambuc} 15794684ddb6SLionel Sambuc 15804684ddb6SLionel Sambuc#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) 15814684ddb6SLionel Sambuc 1582*0a6a1f1dSLionel Sambuc#if _LIBCPP_STD_VER > 14 1583*0a6a1f1dSLionel Sambuctemplate <class _Cont> 1584*0a6a1f1dSLionel Sambucconstexpr auto size(const _Cont& __c) -> decltype(__c.size()) { return __c.size(); } 15854684ddb6SLionel Sambuc 1586*0a6a1f1dSLionel Sambuctemplate <class _Tp, size_t _Sz> 1587*0a6a1f1dSLionel Sambucconstexpr size_t size(const _Tp (&__array)[_Sz]) noexcept { return _Sz; } 15884684ddb6SLionel Sambuc 1589*0a6a1f1dSLionel Sambuctemplate <class _Cont> 1590*0a6a1f1dSLionel Sambucconstexpr auto empty(const _Cont& __c) -> decltype(__c.empty()) { return __c.empty(); } 15914684ddb6SLionel Sambuc 1592*0a6a1f1dSLionel Sambuctemplate <class _Tp, size_t _Sz> 1593*0a6a1f1dSLionel Sambucconstexpr bool empty(const _Tp (&__array)[_Sz]) noexcept { return false; } 15944684ddb6SLionel Sambuc 15954684ddb6SLionel Sambuctemplate <class _Ep> 1596*0a6a1f1dSLionel Sambucconstexpr bool empty(initializer_list<_Ep> __il) noexcept { return __il.size() == 0; } 1597*0a6a1f1dSLionel Sambuc 1598*0a6a1f1dSLionel Sambuctemplate <class _Cont> constexpr 1599*0a6a1f1dSLionel Sambucauto data(_Cont& __c) -> decltype(__c.data()) { return __c.data(); } 1600*0a6a1f1dSLionel Sambuc 1601*0a6a1f1dSLionel Sambuctemplate <class _Cont> constexpr 1602*0a6a1f1dSLionel Sambucauto data(const _Cont& __c) -> decltype(__c.data()) { return __c.data(); } 1603*0a6a1f1dSLionel Sambuc 1604*0a6a1f1dSLionel Sambuctemplate <class _Tp, size_t _Sz> 1605*0a6a1f1dSLionel Sambucconstexpr _Tp* data(_Tp (&__array)[_Sz]) noexcept { return __array; } 16064684ddb6SLionel Sambuc 16074684ddb6SLionel Sambuctemplate <class _Ep> 1608*0a6a1f1dSLionel Sambucconstexpr const _Ep* data(initializer_list<_Ep> __il) noexcept { return __il.begin(); } 16094684ddb6SLionel Sambuc#endif 16104684ddb6SLionel Sambuc 1611*0a6a1f1dSLionel Sambuc 16124684ddb6SLionel Sambuc_LIBCPP_END_NAMESPACE_STD 16134684ddb6SLionel Sambuc 16144684ddb6SLionel Sambuc#endif // _LIBCPP_ITERATOR 1615