Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/c++/v1/vector is written in an unsupported language. File is not indexed.

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP_VECTOR
0011 #define _LIBCPP_VECTOR
0012 
0013 // clang-format off
0014 
0015 /*
0016     vector synopsis
0017 
0018 namespace std
0019 {
0020 
0021 template <class T, class Allocator = allocator<T> >
0022 class vector
0023 {
0024 public:
0025     typedef T                                        value_type;
0026     typedef Allocator                                allocator_type;
0027     typedef typename allocator_type::reference       reference;
0028     typedef typename allocator_type::const_reference const_reference;
0029     typedef implementation-defined                   iterator;
0030     typedef implementation-defined                   const_iterator;
0031     typedef typename allocator_type::size_type       size_type;
0032     typedef typename allocator_type::difference_type difference_type;
0033     typedef typename allocator_type::pointer         pointer;
0034     typedef typename allocator_type::const_pointer   const_pointer;
0035     typedef std::reverse_iterator<iterator>          reverse_iterator;
0036     typedef std::reverse_iterator<const_iterator>    const_reverse_iterator;
0037 
0038     vector()
0039         noexcept(is_nothrow_default_constructible<allocator_type>::value);
0040     explicit vector(const allocator_type&);
0041     explicit vector(size_type n);
0042     explicit vector(size_type n, const allocator_type&); // C++14
0043     vector(size_type n, const value_type& value, const allocator_type& = allocator_type());
0044     template <class InputIterator>
0045         vector(InputIterator first, InputIterator last, const allocator_type& = allocator_type());
0046     template<container-compatible-range<T> R>
0047       constexpr vector(from_range_t, R&& rg, const Allocator& = Allocator()); // C++23
0048     vector(const vector& x);
0049     vector(vector&& x)
0050         noexcept(is_nothrow_move_constructible<allocator_type>::value);
0051     vector(initializer_list<value_type> il);
0052     vector(initializer_list<value_type> il, const allocator_type& a);
0053     ~vector();
0054     vector& operator=(const vector& x);
0055     vector& operator=(vector&& x)
0056         noexcept(
0057              allocator_type::propagate_on_container_move_assignment::value ||
0058              allocator_type::is_always_equal::value); // C++17
0059     vector& operator=(initializer_list<value_type> il);
0060     template <class InputIterator>
0061         void assign(InputIterator first, InputIterator last);
0062     template<container-compatible-range<T> R>
0063       constexpr void assign_range(R&& rg); // C++23
0064     void assign(size_type n, const value_type& u);
0065     void assign(initializer_list<value_type> il);
0066 
0067     allocator_type get_allocator() const noexcept;
0068 
0069     iterator               begin() noexcept;
0070     const_iterator         begin()   const noexcept;
0071     iterator               end() noexcept;
0072     const_iterator         end()     const noexcept;
0073 
0074     reverse_iterator       rbegin() noexcept;
0075     const_reverse_iterator rbegin()  const noexcept;
0076     reverse_iterator       rend() noexcept;
0077     const_reverse_iterator rend()    const noexcept;
0078 
0079     const_iterator         cbegin()  const noexcept;
0080     const_iterator         cend()    const noexcept;
0081     const_reverse_iterator crbegin() const noexcept;
0082     const_reverse_iterator crend()   const noexcept;
0083 
0084     size_type size() const noexcept;
0085     size_type max_size() const noexcept;
0086     size_type capacity() const noexcept;
0087     bool empty() const noexcept;
0088     void reserve(size_type n);
0089     void shrink_to_fit() noexcept;
0090 
0091     reference       operator[](size_type n);
0092     const_reference operator[](size_type n) const;
0093     reference       at(size_type n);
0094     const_reference at(size_type n) const;
0095 
0096     reference       front();
0097     const_reference front() const;
0098     reference       back();
0099     const_reference back() const;
0100 
0101     value_type*       data() noexcept;
0102     const value_type* data() const noexcept;
0103 
0104     void push_back(const value_type& x);
0105     void push_back(value_type&& x);
0106     template <class... Args>
0107         reference emplace_back(Args&&... args); // reference in C++17
0108     template<container-compatible-range<T> R>
0109       constexpr void append_range(R&& rg); // C++23
0110     void pop_back();
0111 
0112     template <class... Args> iterator emplace(const_iterator position, Args&&... args);
0113     iterator insert(const_iterator position, const value_type& x);
0114     iterator insert(const_iterator position, value_type&& x);
0115     iterator insert(const_iterator position, size_type n, const value_type& x);
0116     template <class InputIterator>
0117         iterator insert(const_iterator position, InputIterator first, InputIterator last);
0118     template<container-compatible-range<T> R>
0119       constexpr iterator insert_range(const_iterator position, R&& rg); // C++23
0120     iterator insert(const_iterator position, initializer_list<value_type> il);
0121 
0122     iterator erase(const_iterator position);
0123     iterator erase(const_iterator first, const_iterator last);
0124 
0125     void clear() noexcept;
0126 
0127     void resize(size_type sz);
0128     void resize(size_type sz, const value_type& c);
0129 
0130     void swap(vector&)
0131         noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value ||
0132                  allocator_traits<allocator_type>::is_always_equal::value);  // C++17
0133 
0134     bool __invariants() const;
0135 };
0136 
0137 template <class Allocator = allocator<T> >
0138 class vector<bool, Allocator>
0139 {
0140 public:
0141     typedef bool                                     value_type;
0142     typedef Allocator                                allocator_type;
0143     typedef implementation-defined                   iterator;
0144     typedef implementation-defined                   const_iterator;
0145     typedef typename allocator_type::size_type       size_type;
0146     typedef typename allocator_type::difference_type difference_type;
0147     typedef iterator                                 pointer;
0148     typedef const_iterator                           const_pointer;
0149     typedef std::reverse_iterator<iterator>          reverse_iterator;
0150     typedef std::reverse_iterator<const_iterator>    const_reverse_iterator;
0151 
0152     class reference
0153     {
0154     public:
0155         reference(const reference&) noexcept;
0156         operator bool() const noexcept;
0157         reference& operator=(bool x) noexcept;
0158         reference& operator=(const reference& x) noexcept;
0159         iterator operator&() const noexcept;
0160         void flip() noexcept;
0161     };
0162 
0163     class const_reference
0164     {
0165     public:
0166         const_reference(const reference&) noexcept;
0167         operator bool() const noexcept;
0168         const_iterator operator&() const noexcept;
0169     };
0170 
0171     vector()
0172         noexcept(is_nothrow_default_constructible<allocator_type>::value);
0173     explicit vector(const allocator_type&) noexcept;
0174     explicit vector(size_type n, const allocator_type& a = allocator_type()); // C++14
0175     vector(size_type n, const value_type& value, const allocator_type& = allocator_type());
0176     template <class InputIterator>
0177         vector(InputIterator first, InputIterator last, const allocator_type& = allocator_type());
0178     template<container-compatible-range<bool> R>
0179       constexpr vector(from_range_t, R&& rg, const Allocator& = Allocator());
0180     vector(const vector& x);
0181     vector(vector&& x) noexcept;
0182     vector(initializer_list<value_type> il);
0183     vector(initializer_list<value_type> il, const allocator_type& a);
0184     ~vector();
0185     vector& operator=(const vector& x);
0186     vector& operator=(vector&& x)
0187         noexcept(
0188              allocator_type::propagate_on_container_move_assignment::value ||
0189              allocator_type::is_always_equal::value); // C++17
0190     vector& operator=(initializer_list<value_type> il);
0191     template <class InputIterator>
0192         void assign(InputIterator first, InputIterator last);
0193     template<container-compatible-range<T> R>
0194       constexpr void assign_range(R&& rg); // C++23
0195     void assign(size_type n, const value_type& u);
0196     void assign(initializer_list<value_type> il);
0197 
0198     allocator_type get_allocator() const noexcept;
0199 
0200     iterator               begin() noexcept;
0201     const_iterator         begin()   const noexcept;
0202     iterator               end() noexcept;
0203     const_iterator         end()     const noexcept;
0204 
0205     reverse_iterator       rbegin() noexcept;
0206     const_reverse_iterator rbegin()  const noexcept;
0207     reverse_iterator       rend() noexcept;
0208     const_reverse_iterator rend()    const noexcept;
0209 
0210     const_iterator         cbegin()  const noexcept;
0211     const_iterator         cend()    const noexcept;
0212     const_reverse_iterator crbegin() const noexcept;
0213     const_reverse_iterator crend()   const noexcept;
0214 
0215     size_type size() const noexcept;
0216     size_type max_size() const noexcept;
0217     size_type capacity() const noexcept;
0218     bool empty() const noexcept;
0219     void reserve(size_type n);
0220     void shrink_to_fit() noexcept;
0221 
0222     reference       operator[](size_type n);
0223     const_reference operator[](size_type n) const;
0224     reference       at(size_type n);
0225     const_reference at(size_type n) const;
0226 
0227     reference       front();
0228     const_reference front() const;
0229     reference       back();
0230     const_reference back() const;
0231 
0232     void push_back(const value_type& x);
0233     template <class... Args> reference emplace_back(Args&&... args);  // C++14; reference in C++17
0234     template<container-compatible-range<T> R>
0235       constexpr void append_range(R&& rg); // C++23
0236     void pop_back();
0237 
0238     template <class... Args> iterator emplace(const_iterator position, Args&&... args);  // C++14
0239     iterator insert(const_iterator position, const value_type& x);
0240     iterator insert(const_iterator position, size_type n, const value_type& x);
0241     template <class InputIterator>
0242         iterator insert(const_iterator position, InputIterator first, InputIterator last);
0243     template<container-compatible-range<T> R>
0244       constexpr iterator insert_range(const_iterator position, R&& rg); // C++23
0245     iterator insert(const_iterator position, initializer_list<value_type> il);
0246 
0247     iterator erase(const_iterator position);
0248     iterator erase(const_iterator first, const_iterator last);
0249 
0250     void clear() noexcept;
0251 
0252     void resize(size_type sz);
0253     void resize(size_type sz, value_type x);
0254 
0255     void swap(vector&)
0256         noexcept(allocator_traits<allocator_type>::propagate_on_container_swap::value ||
0257                  allocator_traits<allocator_type>::is_always_equal::value);  // C++17
0258     void flip() noexcept;
0259 
0260     bool __invariants() const;
0261 };
0262 
0263 template <class InputIterator, class Allocator = allocator<typename iterator_traits<InputIterator>::value_type>>
0264    vector(InputIterator, InputIterator, Allocator = Allocator())
0265    -> vector<typename iterator_traits<InputIterator>::value_type, Allocator>; // C++17
0266 
0267 template<ranges::input_range R, class Allocator = allocator<ranges::range_value_t<R>>>
0268   vector(from_range_t, R&&, Allocator = Allocator())
0269     -> vector<ranges::range_value_t<R>, Allocator>; // C++23
0270 
0271 template <class Allocator> struct hash<std::vector<bool, Allocator>>;
0272 
0273 template <class T, class Allocator> bool operator==(const vector<T,Allocator>& x, const vector<T,Allocator>& y);   // constexpr since C++20
0274 template <class T, class Allocator> bool operator!=(const vector<T,Allocator>& x, const vector<T,Allocator>& y);   // removed in C++20
0275 template <class T, class Allocator> bool operator< (const vector<T,Allocator>& x, const vector<T,Allocator>& y);   // removed in C++20
0276 template <class T, class Allocator> bool operator> (const vector<T,Allocator>& x, const vector<T,Allocator>& y);   // removed in C++20
0277 template <class T, class Allocator> bool operator>=(const vector<T,Allocator>& x, const vector<T,Allocator>& y);   // removed in C++20
0278 template <class T, class Allocator> bool operator<=(const vector<T,Allocator>& x, const vector<T,Allocator>& y);   // removed in C++20
0279 template <class T, class Allocator> constexpr
0280   constexpr synth-three-way-result<T> operator<=>(const vector<T, Allocator>& x,
0281                                                   const vector<T, Allocator>& y);                                  // since C++20
0282 
0283 template <class T, class Allocator>
0284 void swap(vector<T,Allocator>& x, vector<T,Allocator>& y)
0285     noexcept(noexcept(x.swap(y)));
0286 
0287 template <class T, class Allocator, class U>
0288 typename vector<T, Allocator>::size_type
0289 erase(vector<T, Allocator>& c, const U& value);       // since C++20
0290 template <class T, class Allocator, class Predicate>
0291 typename vector<T, Allocator>::size_type
0292 erase_if(vector<T, Allocator>& c, Predicate pred);    // since C++20
0293 
0294 
0295 template<class T>
0296  inline constexpr bool is-vector-bool-reference = see below;        // exposition only, since C++23
0297 
0298 template<class T, class charT> requires is-vector-bool-reference<T> // Since C++23
0299  struct formatter<T, charT>;
0300 
0301 }  // std
0302 
0303 */
0304 
0305 // clang-format on
0306 
0307 #if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
0308 #  include <__cxx03/vector>
0309 #else
0310 #  include <__config>
0311 
0312 #  include <__vector/comparison.h>
0313 #  include <__vector/swap.h>
0314 #  include <__vector/vector.h>
0315 #  include <__vector/vector_bool.h>
0316 
0317 #  if _LIBCPP_STD_VER >= 17
0318 #    include <__vector/pmr.h>
0319 #  endif
0320 
0321 #  if _LIBCPP_STD_VER >= 20
0322 #    include <__vector/erase.h>
0323 #  endif
0324 
0325 #  if _LIBCPP_STD_VER >= 23
0326 #    include <__vector/vector_bool_formatter.h>
0327 #  endif
0328 
0329 #  include <version>
0330 
0331 // standard-mandated includes
0332 
0333 // [iterator.range]
0334 #  include <__iterator/access.h>
0335 #  include <__iterator/data.h>
0336 #  include <__iterator/empty.h>
0337 #  include <__iterator/reverse_access.h>
0338 #  include <__iterator/size.h>
0339 
0340 // [vector.syn]
0341 #  include <compare>
0342 #  include <initializer_list>
0343 
0344 // [vector.syn], [unord.hash]
0345 #  include <__functional/hash.h>
0346 
0347 #  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0348 #    pragma GCC system_header
0349 #  endif
0350 
0351 #  if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
0352 #    include <algorithm>
0353 #    include <array>
0354 #    include <atomic>
0355 #    include <cctype>
0356 #    include <cerrno>
0357 #    include <clocale>
0358 #    include <concepts>
0359 #    include <cstdint>
0360 #    include <cstdlib>
0361 #    include <iosfwd>
0362 #    if _LIBCPP_HAS_LOCALIZATION
0363 #      include <locale>
0364 #    endif
0365 #    include <string>
0366 #    include <string_view>
0367 #    include <tuple>
0368 #    include <type_traits>
0369 #    include <typeinfo>
0370 #    include <utility>
0371 #  endif
0372 #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
0373 
0374 #endif // _LIBCPP_VECTOR