brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · 69ac995 Raw
118 lines · c
1#ifndef USE_RANGES_FAKE_STD_H2#define USE_RANGES_FAKE_STD_H3 4namespace std {5 6template <typename T> class vector {7public:8  using iterator = T *;9  using const_iterator = const T *;10  using reverse_iterator = T *;11  using reverse_const_iterator = const T *;12 13  constexpr const_iterator begin() const;14  constexpr const_iterator end() const;15  constexpr const_iterator cbegin() const;16  constexpr const_iterator cend() const;17  constexpr iterator begin();18  constexpr iterator end();19  constexpr reverse_const_iterator rbegin() const;20  constexpr reverse_const_iterator rend() const;21  constexpr reverse_const_iterator crbegin() const;22  constexpr reverse_const_iterator crend() const;23  constexpr reverse_iterator rbegin();24  constexpr reverse_iterator rend();25};26 27template <typename Container> constexpr auto begin(const Container &Cont) {28  return Cont.begin();29}30 31template <typename Container> constexpr auto begin(Container &Cont) {32  return Cont.begin();33}34 35template <typename Container> constexpr auto end(const Container &Cont) {36  return Cont.end();37}38 39template <typename Container> constexpr auto end(Container &Cont) {40  return Cont.end();41}42 43template <typename Container> constexpr auto cbegin(const Container &Cont) {44  return Cont.cbegin();45}46 47template <typename Container> constexpr auto cend(const Container &Cont) {48  return Cont.cend();49}50 51template <typename Container> constexpr auto rbegin(const Container &Cont) {52  return Cont.rbegin();53}54 55template <typename Container> constexpr auto rbegin(Container &Cont) {56  return Cont.rbegin();57}58 59template <typename Container> constexpr auto rend(const Container &Cont) {60  return Cont.rend();61}62 63template <typename Container> constexpr auto rend(Container &Cont) {64  return Cont.rend();65}66 67template <typename Container> constexpr auto crbegin(const Container &Cont) {68  return Cont.crbegin();69}70 71template <typename Container> constexpr auto crend(const Container &Cont) {72  return Cont.crend();73}74// Find75template <class InputIt, class T>76InputIt find(InputIt first, InputIt last, const T &value);77 78// Reverse79template <typename Iter> void reverse(Iter begin, Iter end);80 81// Includes82template <class InputIt1, class InputIt2>83bool includes(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2);84 85inline namespace _V1 {86// IsPermutation87template <class ForwardIt1, class ForwardIt2>88bool is_permutation(ForwardIt1 first1, ForwardIt1 last1, ForwardIt2 first2);89template <class ForwardIt1, class ForwardIt2>90bool is_permutation(ForwardIt1 first1, ForwardIt1 last1, ForwardIt2 first2,91                    ForwardIt2 last2);92 93// Equal94template <class InputIt1, class InputIt2>95bool equal(InputIt1 first1, InputIt1 last1, InputIt2 first2);96 97template <class InputIt1, class InputIt2>98bool equal(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2);99 100template <class InputIt1, class InputIt2, class BinaryPred>101bool equal(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2,102           BinaryPred p) {103  // Need a definition to suppress undefined_internal_type when invoked with104  // lambda105  return true;106}107 108template <class ForwardIt, class T>109void iota(ForwardIt first, ForwardIt last, T value);110 111template <class ForwardIt>112ForwardIt rotate(ForwardIt first, ForwardIt middle, ForwardIt last);113} // namespace _V1114 115} // namespace std116 117#endif // USE_RANGES_FAKE_STD_H118