algorithm 97 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926
  1. // -*- C++ -*-
  2. //===----------------------------------------------------------------------===//
  3. //
  4. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  5. // See https://llvm.org/LICENSE.txt for license information.
  6. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #ifndef _LIBCPP_ALGORITHM
  10. #define _LIBCPP_ALGORITHM
  11. /*
  12. algorithm synopsis
  13. #include <initializer_list>
  14. namespace std
  15. {
  16. namespace ranges {
  17. // [algorithms.results], algorithm result types
  18. template <class I, class F>
  19. struct in_fun_result; // since C++20
  20. template <class I1, class I2>
  21. struct in_in_result; // since C++20
  22. template <class I, class O>
  23. struct in_out_result; // since C++20
  24. template <class I1, class I2, class O>
  25. struct in_in_out_result; // since C++20
  26. template <class I, class O1, class O2>
  27. struct in_out_out_result; // since C++20
  28. template <class I1, class I2>
  29. struct min_max_result; // since C++20
  30. template <class I>
  31. struct in_found_result; // since C++20
  32. template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
  33. indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20
  34. constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {});
  35. template<forward_range R, class Proj = identity,
  36. indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> // since C++20
  37. constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {});
  38. template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
  39. indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
  40. constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
  41. template<forward_range R, class Proj = identity,
  42. indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
  43. constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
  44. template<class I1, class I2>
  45. using mismatch_result = in_in_result<I1, I2>;
  46. template <input_iterator I1, sentinel_for<_I1> S1, input_iterator I2, sentinel_for<_I2> S2,
  47. class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
  48. requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
  49. constexpr mismatch_result<_I1, _I2>
  50. mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20
  51. template <input_range R1, input_range R2,
  52. class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
  53. requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
  54. constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
  55. mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20
  56. requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
  57. constexpr I find(I first, S last, const T& value, Proj proj = {}); // since C++20
  58. template<input_range R, class T, class Proj = identity>
  59. requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
  60. constexpr borrowed_iterator_t<R>
  61. find(R&& r, const T& value, Proj proj = {}); // since C++20
  62. template<input_iterator I, sentinel_for<I> S, class Proj = identity,
  63. indirect_unary_predicate<projected<I, Proj>> Pred>
  64. constexpr I find_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
  65. template<input_range R, class Proj = identity,
  66. indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
  67. constexpr borrowed_iterator_t<R>
  68. find_if(R&& r, Pred pred, Proj proj = {}); // since C++20
  69. template<input_iterator I, sentinel_for<I> S, class Proj = identity,
  70. indirect_unary_predicate<projected<I, Proj>> Pred>
  71. constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++20
  72. template<input_range R, class Proj = identity,
  73. indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
  74. constexpr borrowed_iterator_t<R>
  75. find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20
  76. template<class T, class Proj = identity,
  77. indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
  78. constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
  79. template<copyable T, class Proj = identity,
  80. indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
  81. constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
  82. template<input_range R, class Proj = identity,
  83. indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
  84. requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
  85. constexpr range_value_t<R>
  86. min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
  87. template<class T, class Proj = identity,
  88. indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
  89. constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
  90. template<copyable T, class Proj = identity,
  91. indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
  92. constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
  93. template<input_range R, class Proj = identity,
  94. indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
  95. requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
  96. constexpr range_value_t<R>
  97. max(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
  98. template<class I, class O>
  99. using unary_transform_result = in_out_result<I, O>; // since C++20
  100. template<class I1, class I2, class O>
  101. using binary_transform_result = in_in_out_result<I1, I2, O>; // since C++20
  102. template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
  103. copy_constructible F, class Proj = identity>
  104. requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>>
  105. constexpr ranges::unary_transform_result<I, O>
  106. transform(I first1, S last1, O result, F op, Proj proj = {}); // since C++20
  107. template<input_range R, weakly_incrementable O, copy_constructible F,
  108. class Proj = identity>
  109. requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>>
  110. constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O>
  111. transform(R&& r, O result, F op, Proj proj = {}); // since C++20
  112. template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
  113. weakly_incrementable O, copy_constructible F, class Proj1 = identity,
  114. class Proj2 = identity>
  115. requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>,
  116. projected<I2, Proj2>>>
  117. constexpr ranges::binary_transform_result<I1, I2, O>
  118. transform(I1 first1, S1 last1, I2 first2, S2 last2, O result,
  119. F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
  120. template<input_range R1, input_range R2, weakly_incrementable O,
  121. copy_constructible F, class Proj1 = identity, class Proj2 = identity>
  122. requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>,
  123. projected<iterator_t<R2>, Proj2>>>
  124. constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
  125. transform(R1&& r1, R2&& r2, O result,
  126. F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
  127. template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity>
  128. requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
  129. constexpr iter_difference_t<I>
  130. count(I first, S last, const T& value, Proj proj = {}); // since C++20
  131. template<input_range R, class T, class Proj = identity>
  132. requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
  133. constexpr range_difference_t<R>
  134. count(R&& r, const T& value, Proj proj = {}); // since C++20
  135. template<input_iterator I, sentinel_for<I> S, class Proj = identity,
  136. indirect_unary_predicate<projected<I, Proj>> Pred>
  137. constexpr iter_difference_t<I>
  138. count_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
  139. template<input_range R, class Proj = identity,
  140. indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
  141. constexpr range_difference_t<R>
  142. count_if(R&& r, Pred pred, Proj proj = {}); // since C++20
  143. template<class T>
  144. using minmax_result = min_max_result<T>;
  145. template<class T, class Proj = identity,
  146. indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
  147. constexpr ranges::minmax_result<const T&>
  148. minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20
  149. template<copyable T, class Proj = identity,
  150. indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
  151. constexpr ranges::minmax_result<T>
  152. minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20
  153. template<input_range R, class Proj = identity,
  154. indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
  155. requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*>
  156. constexpr ranges::minmax_result<range_value_t<R>>
  157. minmax(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
  158. template<class I>
  159. using minmax_element_result = min_max_result<I>;
  160. template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
  161. indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
  162. constexpr ranges::minmax_element_result<I>
  163. minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
  164. template<forward_range R, class Proj = identity,
  165. indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
  166. constexpr ranges::minmax_element_result<borrowed_iterator_t<R>>
  167. minmax_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
  168. template<class I, class O>
  169. using copy_result = in_out_result<I, O>; // since C++20
  170. template<class I, class O>
  171. using copy_n_result = in_out_result<I, O>; // since C++20
  172. template<class I, class O>
  173. using copy_if_result = in_out_result<I, O>; // since C++20
  174. template<class I1, class I2>
  175. using copy_backward_result = in_out_result<I1, I2>; // since C++20
  176. template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
  177. requires indirectly_copyable<I, O>
  178. constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result); // since C++20
  179. template<input_range R, weakly_incrementable O>
  180. requires indirectly_copyable<iterator_t<R>, O>
  181. constexpr ranges::copy_result<borrowed_iterator_t<R>, O> ranges::copy(R&& r, O result); // since C++20
  182. template<input_iterator I, weakly_incrementable O>
  183. requires indirectly_copyable<I, O>
  184. constexpr ranges::copy_n_result<I, O>
  185. ranges::copy_n(I first, iter_difference_t<I> n, O result); // since C++20
  186. template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
  187. indirect_unary_predicate<projected<I, Proj>> Pred>
  188. requires indirectly_copyable<I, O>
  189. constexpr ranges::copy_if_result<I, O>
  190. ranges::copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20
  191. template<input_range R, weakly_incrementable O, class Proj = identity,
  192. indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
  193. requires indirectly_copyable<iterator_t<R>, O>
  194. constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O>
  195. ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20
  196. template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
  197. requires indirectly_copyable<I1, I2>
  198. constexpr ranges::copy_backward_result<I1, I2>
  199. ranges::copy_backward(I1 first, S1 last, I2 result); // since C++20
  200. template<bidirectional_range R, bidirectional_iterator I>
  201. requires indirectly_copyable<iterator_t<R>, I>
  202. constexpr ranges::copy_backward_result<borrowed_iterator_t<R>, I>
  203. ranges::copy_backward(R&& r, I result); // since C++20
  204. template<class I, class F>
  205. using for_each_result = in_fun_result<I, F>; // since C++20
  206. template<input_iterator I, sentinel_for<I> S, class Proj = identity,
  207. indirectly_unary_invocable<projected<I, Proj>> Fun>
  208. constexpr ranges::for_each_result<I, Fun>
  209. ranges::for_each(I first, S last, Fun f, Proj proj = {}); // since C++20
  210. template<input_range R, class Proj = identity,
  211. indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun>
  212. constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun>
  213. ranges::for_each(R&& r, Fun f, Proj proj = {}); // since C++20
  214. template<input_iterator I, class Proj = identity,
  215. indirectly_unary_invocable<projected<I, Proj>> Fun>
  216. constexpr ranges::for_each_n_result<I, Fun>
  217. ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {}); // since C++20
  218. template<input_iterator I, sentinel_for<I> S, class Proj = identity,
  219. indirect_unary_predicate<projected<I, Proj>> Pred>
  220. constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {}); // since C++20
  221. template<input_range R, class Proj = identity,
  222. indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
  223. constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {}); // since C++20
  224. template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
  225. class Proj = identity>
  226. requires sortable<I, Comp, Proj>
  227. constexpr I
  228. ranges::push_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
  229. template<random_access_range R, class Comp = ranges::less, class Proj = identity>
  230. requires sortable<iterator_t<R>, Comp, Proj>
  231. constexpr borrowed_iterator_t<R>
  232. ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
  233. template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
  234. class Proj = identity>
  235. requires sortable<I, Comp, Proj>
  236. constexpr I
  237. ranges::pop_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
  238. template<random_access_range R, class Comp = ranges::less, class Proj = identity>
  239. requires sortable<iterator_t<R>, Comp, Proj>
  240. constexpr borrowed_iterator_t<R>
  241. ranges::pop_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
  242. template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
  243. class Proj = identity>
  244. requires sortable<I, Comp, Proj>
  245. constexpr I
  246. ranges::make_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
  247. template<random_access_range R, class Comp = ranges::less, class Proj = identity>
  248. requires sortable<iterator_t<R>, Comp, Proj>
  249. constexpr borrowed_iterator_t<R>
  250. ranges::make_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
  251. template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
  252. class Proj = identity>
  253. requires sortable<I, Comp, Proj>
  254. constexpr I
  255. ranges::sort_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
  256. template<random_access_range R, class Comp = ranges::less, class Proj = identity>
  257. requires sortable<iterator_t<R>, Comp, Proj>
  258. constexpr borrowed_iterator_t<R>
  259. ranges::sort_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
  260. template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
  261. indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
  262. constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); // Since C++20
  263. template<random_access_range R, class Proj = identity,
  264. indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
  265. constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); // Since C++20
  266. template<random_access_iterator I, sentinel_for<I> S, class Proj = identity,
  267. indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
  268. constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); // Since C++20
  269. template<random_access_range R, class Proj = identity,
  270. indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
  271. constexpr borrowed_iterator_t<R>
  272. is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); // Since C++20
  273. template<bidirectional_iterator I, sentinel_for<I> S>
  274. requires permutable<I>
  275. constexpr I ranges::reverse(I first, S last); // since C++20
  276. template<bidirectional_range R>
  277. requires permutable<iterator_t<R>>
  278. constexpr borrowed_iterator_t<R> ranges::reverse(R&& r); // since C++20
  279. template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
  280. class Proj = identity>
  281. requires sortable<I, Comp, Proj>
  282. constexpr I
  283. ranges::sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
  284. template<random_access_range R, class Comp = ranges::less, class Proj = identity>
  285. requires sortable<iterator_t<R>, Comp, Proj>
  286. constexpr borrowed_iterator_t<R>
  287. ranges::sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
  288. template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
  289. class Proj = identity>
  290. requires sortable<I, Comp, Proj>
  291. I ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
  292. template<random_access_range R, class Comp = ranges::less, class Proj = identity>
  293. requires sortable<iterator_t<R>, Comp, Proj>
  294. borrowed_iterator_t<R>
  295. ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
  296. template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
  297. class Proj = identity>
  298. requires sortable<I, Comp, Proj>
  299. constexpr I
  300. ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20
  301. template<random_access_range R, class Comp = ranges::less, class Proj = identity>
  302. requires sortable<iterator_t<R>, Comp, Proj>
  303. constexpr borrowed_iterator_t<R>
  304. ranges::partial_sort(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {}); // since C++20
  305. template<class T, output_iterator<const T&> O, sentinel_for<O> S>
  306. constexpr O ranges::fill(O first, S last, const T& value); // since C++20
  307. template<class T, output_range<const T&> R>
  308. constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value); // since C++20
  309. template<class T, output_iterator<const T&> O>
  310. constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value); // since C++20
  311. template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F>
  312. requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
  313. constexpr O generate(O first, S last, F gen); // Since C++20
  314. template<class R, copy_constructible F>
  315. requires invocable<F&> && output_range<R, invoke_result_t<F&>>
  316. constexpr borrowed_iterator_t<R> generate(R&& r, F gen); // Since C++20
  317. template<input_or_output_iterator O, copy_constructible F>
  318. requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>>
  319. constexpr O generate_n(O first, iter_difference_t<O> n, F gen); // Since C++20
  320. template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
  321. class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
  322. requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
  323. constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2,
  324. Pred pred = {},
  325. Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
  326. template<input_range R1, input_range R2, class Pred = ranges::equal_to,
  327. class Proj1 = identity, class Proj2 = identity>
  328. requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
  329. constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {},
  330. Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
  331. template<input_iterator I, sentinel_for<I> S, class Proj = identity,
  332. indirect_unary_predicate<projected<I, Proj>> Pred>
  333. constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
  334. template<input_range R, class Proj = identity,
  335. indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
  336. constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20
  337. template<input_iterator I, sentinel_for<I> S, class Proj = identity,
  338. indirect_unary_predicate<projected<I, Proj>> Pred>
  339. constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
  340. template<input_range R, class Proj = identity,
  341. indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
  342. constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20
  343. template<input_iterator I, sentinel_for<I> S, class Proj = identity,
  344. indirect_unary_predicate<projected<I, Proj>> Pred>
  345. constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20
  346. template<input_range R, class Proj = identity,
  347. indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
  348. constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20
  349. template<input_iterator I1, sentinel_for<I1> S1,
  350. random_access_iterator I2, sentinel_for<I2> S2,
  351. class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
  352. requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> &&
  353. indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>>
  354. constexpr partial_sort_copy_result<I1, I2>
  355. partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last,
  356. Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20
  357. template<input_range R1, random_access_range R2, class Comp = ranges::less,
  358. class Proj1 = identity, class Proj2 = identity>
  359. requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> &&
  360. sortable<iterator_t<R2>, Comp, Proj2> &&
  361. indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>,
  362. projected<iterator_t<R2>, Proj2>>
  363. constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
  364. partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {},
  365. Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20
  366. template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
  367. indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
  368. constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
  369. template<forward_range R, class Proj = identity,
  370. indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
  371. constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
  372. template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
  373. indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
  374. constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20
  375. template<forward_range R, class Proj = identity,
  376. indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less>
  377. constexpr borrowed_iterator_t<R>
  378. ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20
  379. template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less,
  380. class Proj = identity>
  381. requires sortable<I, Comp, Proj>
  382. constexpr I
  383. ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20
  384. template<random_access_range R, class Comp = ranges::less, class Proj = identity>
  385. requires sortable<iterator_t<R>, Comp, Proj>
  386. constexpr borrowed_iterator_t<R>
  387. ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {}); // since C++20
  388. template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
  389. indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
  390. constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
  391. template<forward_range R, class T, class Proj = identity,
  392. indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
  393. ranges::less>
  394. constexpr borrowed_iterator_t<R>
  395. upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
  396. template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
  397. indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
  398. constexpr I lower_bound(I first, S last, const T& value, Comp comp = {},
  399. Proj proj = {}); // since C++20
  400. template<forward_range R, class T, class Proj = identity,
  401. indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
  402. ranges::less>
  403. constexpr borrowed_iterator_t<R>
  404. lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
  405. template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
  406. indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
  407. constexpr bool binary_search(I first, S last, const T& value, Comp comp = {},
  408. Proj proj = {}); // since C++20
  409. template<forward_range R, class T, class Proj = identity,
  410. indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
  411. ranges::less>
  412. constexpr bool binary_search(R&& r, const T& value, Comp comp = {},
  413. Proj proj = {}); // since C++20
  414. template<permutable I, sentinel_for<I> S, class Proj = identity,
  415. indirect_unary_predicate<projected<I, Proj>> Pred>
  416. constexpr subrange<I>
  417. partition(I first, S last, Pred pred, Proj proj = {}); // Since C++20
  418. template<forward_range R, class Proj = identity,
  419. indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
  420. requires permutable<iterator_t<R>>
  421. constexpr borrowed_subrange_t<R>
  422. partition(R&& r, Pred pred, Proj proj = {}); // Since C++20
  423. template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity,
  424. indirect_unary_predicate<projected<I, Proj>> Pred>
  425. requires permutable<I>
  426. subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {}); // Since C++20
  427. template<bidirectional_range R, class Proj = identity,
  428. indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
  429. requires permutable<iterator_t<R>>
  430. borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {}); // Since C++20
  431. template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
  432. class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
  433. requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
  434. constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2,
  435. Pred pred = {},
  436. Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
  437. template<input_range R1, forward_range R2,
  438. class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
  439. requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
  440. constexpr borrowed_iterator_t<R1>
  441. ranges::find_first_of(R1&& r1, R2&& r2,
  442. Pred pred = {},
  443. Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
  444. template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
  445. indirect_binary_predicate<projected<I, Proj>,
  446. projected<I, Proj>> Pred = ranges::equal_to>
  447. constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C+20
  448. template<forward_range R, class Proj = identity,
  449. indirect_binary_predicate<projected<iterator_t<R>, Proj>,
  450. projected<iterator_t<R>, Proj>> Pred = ranges::equal_to>
  451. constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); // since C++20
  452. template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity>
  453. requires indirectly_writable<I, const T2&> &&
  454. indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
  455. constexpr I
  456. ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
  457. template<input_range R, class T1, class T2, class Proj = identity>
  458. requires indirectly_writable<iterator_t<R>, const T2&> &&
  459. indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*>
  460. constexpr borrowed_iterator_t<R>
  461. ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20
  462. template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity,
  463. indirect_unary_predicate<projected<I, Proj>> Pred>
  464. requires indirectly_writable<I, const T&>
  465. constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20
  466. template<input_range R, class T, class Proj = identity,
  467. indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
  468. requires indirectly_writable<iterator_t<R>, const T&>
  469. constexpr borrowed_iterator_t<R>
  470. ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); // since C++20
  471. template<class T, class Proj = identity,
  472. indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
  473. constexpr const T&
  474. ranges::clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {}); // since C++20
  475. template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
  476. class Proj1 = identity, class Proj2 = identity,
  477. indirect_strict_weak_order<projected<I1, Proj1>,
  478. projected<I2, Proj2>> Comp = ranges::less>
  479. constexpr bool
  480. ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2,
  481. Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
  482. template<input_range R1, input_range R2, class Proj1 = identity,
  483. class Proj2 = identity,
  484. indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
  485. projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
  486. constexpr bool
  487. ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {},
  488. Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
  489. template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2>
  490. requires indirectly_movable<I1, I2>
  491. constexpr ranges::move_backward_result<I1, I2>
  492. ranges::move_backward(I1 first, S1 last, I2 result); // since C++20
  493. template<bidirectional_range R, bidirectional_iterator I>
  494. requires indirectly_movable<iterator_t<R>, I>
  495. constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I>
  496. ranges::move_backward(R&& r, I result); // since C++20
  497. template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
  498. requires indirectly_movable<I, O>
  499. constexpr ranges::move_result<I, O>
  500. ranges::move(I first, S last, O result); // since C++20
  501. template<input_range R, weakly_incrementable O>
  502. requires indirectly_movable<iterator_t<R>, O>
  503. constexpr ranges::move_result<borrowed_iterator_t<R>, O>
  504. ranges::move(R&& r, O result); // since C++20
  505. template<class I, class O1, class O2>
  506. using partition_copy_result = in_out_out_result<I, O1, O2>; // since C++20
  507. template<input_iterator I, sentinel_for<I> S,
  508. weakly_incrementable O1, weakly_incrementable O2,
  509. class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
  510. requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2>
  511. constexpr partition_copy_result<I, O1, O2>
  512. partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred,
  513. Proj proj = {}); // Since C++20
  514. template<input_range R, weakly_incrementable O1, weakly_incrementable O2,
  515. class Proj = identity,
  516. indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
  517. requires indirectly_copyable<iterator_t<R>, O1> &&
  518. indirectly_copyable<iterator_t<R>, O2>
  519. constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2>
  520. partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // Since C++20
  521. template<forward_iterator I, sentinel_for<I> S, class Proj = identity,
  522. indirect_unary_predicate<projected<I, Proj>> Pred>
  523. constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // Since C++20
  524. template<forward_range R, class Proj = identity,
  525. indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
  526. constexpr borrowed_iterator_t<R>
  527. partition_point(R&& r, Pred pred, Proj proj = {}); // Since C++20
  528. template<class I1, class I2, class O>
  529. using merge_result = in_in_out_result<I1, I2, O>; // since C++20
  530. template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
  531. weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity,
  532. class Proj2 = identity>
  533. requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
  534. constexpr merge_result<I1, I2, O>
  535. merge(I1 first1, S1 last1, I2 first2, S2 last2, O result,
  536. Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
  537. template<input_range R1, input_range R2, weakly_incrementable O, class Comp = ranges::less,
  538. class Proj1 = identity, class Proj2 = identity>
  539. requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
  540. constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
  541. merge(R1&& r1, R2&& r2, O result,
  542. Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
  543. template<permutable I, sentinel_for<I> S, class T, class Proj = identity>
  544. requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
  545. constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {}); // since C++20
  546. template<forward_range R, class T, class Proj = identity>
  547. requires permutable<iterator_t<R>> &&
  548. indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*>
  549. constexpr borrowed_subrange_t<R>
  550. ranges::remove(R&& r, const T& value, Proj proj = {}); // since C++20
  551. template<permutable I, sentinel_for<I> S, class Proj = identity,
  552. indirect_unary_predicate<projected<I, Proj>> Pred>
  553. constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {}); // since C++20
  554. template<forward_range R, class Proj = identity,
  555. indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
  556. requires permutable<iterator_t<R>>
  557. constexpr borrowed_subrange_t<R>
  558. ranges::remove_if(R&& r, Pred pred, Proj proj = {}); // since C++20
  559. template<class I, class O>
  560. using set_difference_result = in_out_result<I, O>; // since C++20
  561. template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
  562. weakly_incrementable O, class Comp = ranges::less,
  563. class Proj1 = identity, class Proj2 = identity>
  564. requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
  565. constexpr set_difference_result<I1, O>
  566. set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
  567. Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
  568. template<input_range R1, input_range R2, weakly_incrementable O,
  569. class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
  570. requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
  571. constexpr set_difference_result<borrowed_iterator_t<R1>, O>
  572. set_difference(R1&& r1, R2&& r2, O result,
  573. Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
  574. template<class I1, class I2, class O>
  575. using set_intersection_result = in_in_out_result<I1, I2, O>; // since C++20
  576. template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
  577. weakly_incrementable O, class Comp = ranges::less,
  578. class Proj1 = identity, class Proj2 = identity>
  579. requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
  580. constexpr set_intersection_result<I1, I2, O>
  581. set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result,
  582. Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
  583. template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
  584. weakly_incrementable O, class Comp = ranges::less,
  585. class Proj1 = identity, class Proj2 = identity>
  586. requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
  587. constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
  588. set_intersection(R1&& r1, R2&& r2, O result,
  589. Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
  590. template <class _InIter, class _OutIter>
  591. using reverse_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
  592. template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O>
  593. requires indirectly_copyable<I, O>
  594. constexpr ranges::reverse_copy_result<I, O>
  595. ranges::reverse_copy(I first, S last, O result); // since C++20
  596. template<bidirectional_range R, weakly_incrementable O>
  597. requires indirectly_copyable<iterator_t<R>, O>
  598. constexpr ranges::reverse_copy_result<borrowed_iterator_t<R>, O>
  599. ranges::reverse_copy(R&& r, O result); // since C++20
  600. template<permutable I, sentinel_for<I> S>
  601. constexpr subrange<I> rotate(I first, I middle, S last); // since C++20
  602. template<forward_range R>
  603. requires permutable<iterator_t<R>>
  604. constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle); // Since C++20
  605. template <class _InIter, class _OutIter>
  606. using rotate_copy_result = in_out_result<_InIter, _OutIter>; // since C++20
  607. template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O>
  608. requires indirectly_copyable<I, O>
  609. constexpr ranges::rotate_copy_result<I, O>
  610. ranges::rotate_copy(I first, I middle, S last, O result); // since C++20
  611. template<forward_range R, weakly_incrementable O>
  612. requires indirectly_copyable<iterator_t<R>, O>
  613. constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O>
  614. ranges::rotate_copy(R&& r, iterator_t<R> middle, O result); // since C++20
  615. template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Gen>
  616. requires (forward_iterator<I> || random_access_iterator<O>) &&
  617. indirectly_copyable<I, O> &&
  618. uniform_random_bit_generator<remove_reference_t<Gen>>
  619. O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g); // Since C++20
  620. template<input_range R, weakly_incrementable O, class Gen>
  621. requires (forward_range<R> || random_access_iterator<O>) &&
  622. indirectly_copyable<iterator_t<R>, O> &&
  623. uniform_random_bit_generator<remove_reference_t<Gen>>
  624. O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // Since C++20
  625. template<random_access_iterator I, sentinel_for<I> S, class Gen>
  626. requires permutable<I> &&
  627. uniform_random_bit_generator<remove_reference_t<Gen>>
  628. I shuffle(I first, S last, Gen&& g); // Since C++20
  629. template<random_access_range R, class Gen>
  630. requires permutable<iterator_t<R>> &&
  631. uniform_random_bit_generator<remove_reference_t<Gen>>
  632. borrowed_iterator_t<R> shuffle(R&& r, Gen&& g); // Since C++20
  633. template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
  634. sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity,
  635. indirect_equivalence_relation<projected<I1, Proj1>,
  636. projected<I2, Proj2>> Pred = ranges::equal_to>
  637. constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2,
  638. Pred pred = {},
  639. Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20
  640. template<forward_range R1, forward_range R2,
  641. class Proj1 = identity, class Proj2 = identity,
  642. indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>,
  643. projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to>
  644. constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {},
  645. Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20
  646. template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2,
  647. sentinel_for<I2> S2, class Pred = ranges::equal_to,
  648. class Proj1 = identity, class Proj2 = identity>
  649. requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
  650. constexpr subrange<I1>
  651. ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
  652. Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
  653. template<forward_range R1, forward_range R2, class Pred = ranges::equal_to,
  654. class Proj1 = identity, class Proj2 = identity>
  655. requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
  656. constexpr borrowed_subrange_t<R1>
  657. ranges::search(R1&& r1, R2&& r2, Pred pred = {},
  658. Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
  659. template<forward_iterator I, sentinel_for<I> S, class T,
  660. class Pred = ranges::equal_to, class Proj = identity>
  661. requires indirectly_comparable<I, const T*, Pred, Proj>
  662. constexpr subrange<I>
  663. ranges::search_n(I first, S last, iter_difference_t<I> count,
  664. const T& value, Pred pred = {}, Proj proj = {}); // since C++20
  665. template<forward_range R, class T, class Pred = ranges::equal_to,
  666. class Proj = identity>
  667. requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj>
  668. constexpr borrowed_subrange_t<R>
  669. ranges::search_n(R&& r, range_difference_t<R> count,
  670. const T& value, Pred pred = {}, Proj proj = {}); // since C++20
  671. template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2,
  672. class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
  673. requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2>
  674. constexpr subrange<I1>
  675. ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {},
  676. Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
  677. template<forward_range R1, forward_range R2,
  678. class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity>
  679. requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2>
  680. constexpr borrowed_subrange_t<R1>
  681. ranges::find_end(R1&& r1, R2&& r2, Pred pred = {},
  682. Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
  683. template<class I1, class I2, class O>
  684. using set_symmetric_difference_result = in_in_out_result<I1, I2, O>; // since C++20
  685. template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
  686. weakly_incrementable O, class Comp = ranges::less,
  687. class Proj1 = identity, class Proj2 = identity>
  688. requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
  689. constexpr set_symmetric_difference_result<I1, I2, O>
  690. set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result,
  691. Comp comp = {}, Proj1 proj1 = {},
  692. Proj2 proj2 = {}); // since C++20
  693. template<input_range R1, input_range R2, weakly_incrementable O,
  694. class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
  695. requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
  696. constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>,
  697. borrowed_iterator_t<R2>, O>
  698. set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {},
  699. Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
  700. template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
  701. indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
  702. constexpr subrange<I>
  703. equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
  704. template<forward_range R, class T, class Proj = identity,
  705. indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp =
  706. ranges::less>
  707. constexpr borrowed_subrange_t<R>
  708. equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20
  709. template<class I1, class I2, class O>
  710. using set_union_result = in_in_out_result<I1, I2, O>; // since C++20
  711. template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
  712. weakly_incrementable O, class Comp = ranges::less,
  713. class Proj1 = identity, class Proj2 = identity>
  714. requires mergeable<I1, I2, O, Comp, Proj1, Proj2>
  715. constexpr set_union_result<I1, I2, O>
  716. set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {},
  717. Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
  718. template<input_range R1, input_range R2, weakly_incrementable O,
  719. class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity>
  720. requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2>
  721. constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O>
  722. set_union(R1&& r1, R2&& r2, O result, Comp comp = {},
  723. Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20
  724. template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2,
  725. class Proj1 = identity, class Proj2 = identity,
  726. indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp =
  727. ranges::less>
  728. constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {},
  729. Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20
  730. template<input_range R1, input_range R2, class Proj1 = identity,
  731. class Proj2 = identity,
  732. indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>,
  733. projected<iterator_t<R2>, Proj2>> Comp = ranges::less>
  734. constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {},
  735. Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20
  736. template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
  737. class Proj = identity>
  738. requires sortable<I, Comp, Proj>
  739. I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // Since C++20
  740. template<bidirectional_range R, class Comp = ranges::less, class Proj = identity>
  741. requires sortable<iterator_t<R>, Comp, Proj>
  742. borrowed_iterator_t<R>
  743. inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {},
  744. Proj proj = {}); // Since C++20
  745. template<permutable I, sentinel_for<I> S, class Proj = identity,
  746. indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
  747. constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {}); // Since C++20
  748. template<forward_range R, class Proj = identity,
  749. indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
  750. requires permutable<iterator_t<R>>
  751. constexpr borrowed_subrange_t<R>
  752. unique(R&& r, C comp = {}, Proj proj = {}); // Since C++20
  753. template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity,
  754. indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to>
  755. requires indirectly_copyable<I, O> &&
  756. (forward_iterator<I> ||
  757. (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) ||
  758. indirectly_copyable_storable<I, O>)
  759. constexpr unique_copy_result<I, O>
  760. unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); // Since C++20
  761. template<input_range R, weakly_incrementable O, class Proj = identity,
  762. indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to>
  763. requires indirectly_copyable<iterator_t<R>, O> &&
  764. (forward_iterator<iterator_t<R>> ||
  765. (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) ||
  766. indirectly_copyable_storable<iterator_t<R>, O>)
  767. constexpr unique_copy_result<borrowed_iterator_t<R>, O>
  768. unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); // Since C++20
  769. template<class I, class O>
  770. using remove_copy_result = in_out_result<I, O>; // Since C++20
  771. template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T,
  772. class Proj = identity>
  773. indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*>
  774. constexpr remove_copy_result<I, O>
  775. remove_copy(I first, S last, O result, const T& value, Proj proj = {}); // Since C++20
  776. template<input_range R, weakly_incrementable O, class T, class Proj = identity>
  777. requires indirectly_copyable<iterator_t<R>, O> &&
  778. indirect_binary_predicate<ranges::equal_to,
  779. projected<iterator_t<R>, Proj>, const T*>
  780. constexpr remove_copy_result<borrowed_iterator_t<R>, O>
  781. remove_copy(R&& r, O result, const T& value, Proj proj = {}); // Since C++20
  782. template<class I, class O>
  783. using remove_copy_if_result = in_out_result<I, O>; // Since C++20
  784. template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
  785. class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
  786. requires indirectly_copyable<I, O>
  787. constexpr remove_copy_if_result<I, O>
  788. remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // Since C++20
  789. template<input_range R, weakly_incrementable O, class Proj = identity,
  790. indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
  791. requires indirectly_copyable<iterator_t<R>, O>
  792. constexpr remove_copy_if_result<borrowed_iterator_t<R>, O>
  793. remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); // Since C++20
  794. template<class I, class O>
  795. using replace_copy_result = in_out_result<I, O>; // Since C++20
  796. template<input_iterator I, sentinel_for<I> S, class T1, class T2,
  797. output_iterator<const T2&> O, class Proj = identity>
  798. requires indirectly_copyable<I, O> &&
  799. indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*>
  800. constexpr replace_copy_result<I, O>
  801. replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value,
  802. Proj proj = {}); // Since C++20
  803. template<input_range R, class T1, class T2, output_iterator<const T2&> O,
  804. class Proj = identity>
  805. requires indirectly_copyable<iterator_t<R>, O> &&
  806. indirect_binary_predicate<ranges::equal_to,
  807. projected<iterator_t<R>, Proj>, const T1*>
  808. constexpr replace_copy_result<borrowed_iterator_t<R>, O>
  809. replace_copy(R&& r, O result, const T1& old_value, const T2& new_value,
  810. Proj proj = {}); // Since C++20
  811. template<class I, class O>
  812. using replace_copy_if_result = in_out_result<I, O>; // Since C++20
  813. template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O,
  814. class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred>
  815. requires indirectly_copyable<I, O>
  816. constexpr replace_copy_if_result<I, O>
  817. replace_copy_if(I first, S last, O result, Pred pred, const T& new_value,
  818. Proj proj = {}); // Since C++20
  819. template<input_range R, class T, output_iterator<const T&> O, class Proj = identity,
  820. indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred>
  821. requires indirectly_copyable<iterator_t<R>, O>
  822. constexpr replace_copy_if_result<borrowed_iterator_t<R>, O>
  823. replace_copy_if(R&& r, O result, Pred pred, const T& new_value,
  824. Proj proj = {}); // Since C++20
  825. template<class I>
  826. using prev_permutation_result = in_found_result<I>; // Since C++20
  827. template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
  828. class Proj = identity>
  829. requires sortable<I, Comp, Proj>
  830. constexpr ranges::prev_permutation_result<I>
  831. ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // Since C++20
  832. template<bidirectional_range R, class Comp = ranges::less,
  833. class Proj = identity>
  834. requires sortable<iterator_t<R>, Comp, Proj>
  835. constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>>
  836. ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); // Since C++20
  837. template<class I>
  838. using next_permutation_result = in_found_result<I>; // Since C++20
  839. template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
  840. class Proj = identity>
  841. requires sortable<I, Comp, Proj>
  842. constexpr ranges::next_permutation_result<I>
  843. ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // Since C++20
  844. template<bidirectional_range R, class Comp = ranges::less,
  845. class Proj = identity>
  846. requires sortable<iterator_t<R>, Comp, Proj>
  847. constexpr ranges::next_permutation_result<borrowed_iterator_t<R>>
  848. ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); // Since C++20
  849. }
  850. template <class InputIterator, class Predicate>
  851. constexpr bool // constexpr in C++20
  852. all_of(InputIterator first, InputIterator last, Predicate pred);
  853. template <class InputIterator, class Predicate>
  854. constexpr bool // constexpr in C++20
  855. any_of(InputIterator first, InputIterator last, Predicate pred);
  856. template <class InputIterator, class Predicate>
  857. constexpr bool // constexpr in C++20
  858. none_of(InputIterator first, InputIterator last, Predicate pred);
  859. template <class InputIterator, class Function>
  860. constexpr Function // constexpr in C++20
  861. for_each(InputIterator first, InputIterator last, Function f);
  862. template<class InputIterator, class Size, class Function>
  863. constexpr InputIterator // constexpr in C++20
  864. for_each_n(InputIterator first, Size n, Function f); // C++17
  865. template <class InputIterator, class T>
  866. constexpr InputIterator // constexpr in C++20
  867. find(InputIterator first, InputIterator last, const T& value);
  868. template <class InputIterator, class Predicate>
  869. constexpr InputIterator // constexpr in C++20
  870. find_if(InputIterator first, InputIterator last, Predicate pred);
  871. template<class InputIterator, class Predicate>
  872. constexpr InputIterator // constexpr in C++20
  873. find_if_not(InputIterator first, InputIterator last, Predicate pred);
  874. template <class ForwardIterator1, class ForwardIterator2>
  875. constexpr ForwardIterator1 // constexpr in C++20
  876. find_end(ForwardIterator1 first1, ForwardIterator1 last1,
  877. ForwardIterator2 first2, ForwardIterator2 last2);
  878. template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
  879. constexpr ForwardIterator1 // constexpr in C++20
  880. find_end(ForwardIterator1 first1, ForwardIterator1 last1,
  881. ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
  882. template <class ForwardIterator1, class ForwardIterator2>
  883. constexpr ForwardIterator1 // constexpr in C++20
  884. find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
  885. ForwardIterator2 first2, ForwardIterator2 last2);
  886. template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
  887. constexpr ForwardIterator1 // constexpr in C++20
  888. find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
  889. ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
  890. template <class ForwardIterator>
  891. constexpr ForwardIterator // constexpr in C++20
  892. adjacent_find(ForwardIterator first, ForwardIterator last);
  893. template <class ForwardIterator, class BinaryPredicate>
  894. constexpr ForwardIterator // constexpr in C++20
  895. adjacent_find(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
  896. template <class InputIterator, class T>
  897. constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
  898. count(InputIterator first, InputIterator last, const T& value);
  899. template <class InputIterator, class Predicate>
  900. constexpr typename iterator_traits<InputIterator>::difference_type // constexpr in C++20
  901. count_if(InputIterator first, InputIterator last, Predicate pred);
  902. template <class InputIterator1, class InputIterator2>
  903. constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
  904. mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
  905. template <class InputIterator1, class InputIterator2>
  906. constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
  907. mismatch(InputIterator1 first1, InputIterator1 last1,
  908. InputIterator2 first2, InputIterator2 last2); // **C++14**
  909. template <class InputIterator1, class InputIterator2, class BinaryPredicate>
  910. constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
  911. mismatch(InputIterator1 first1, InputIterator1 last1,
  912. InputIterator2 first2, BinaryPredicate pred);
  913. template <class InputIterator1, class InputIterator2, class BinaryPredicate>
  914. constexpr pair<InputIterator1, InputIterator2> // constexpr in C++20
  915. mismatch(InputIterator1 first1, InputIterator1 last1,
  916. InputIterator2 first2, InputIterator2 last2,
  917. BinaryPredicate pred); // **C++14**
  918. template <class InputIterator1, class InputIterator2>
  919. constexpr bool // constexpr in C++20
  920. equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
  921. template <class InputIterator1, class InputIterator2>
  922. constexpr bool // constexpr in C++20
  923. equal(InputIterator1 first1, InputIterator1 last1,
  924. InputIterator2 first2, InputIterator2 last2); // **C++14**
  925. template <class InputIterator1, class InputIterator2, class BinaryPredicate>
  926. constexpr bool // constexpr in C++20
  927. equal(InputIterator1 first1, InputIterator1 last1,
  928. InputIterator2 first2, BinaryPredicate pred);
  929. template <class InputIterator1, class InputIterator2, class BinaryPredicate>
  930. constexpr bool // constexpr in C++20
  931. equal(InputIterator1 first1, InputIterator1 last1,
  932. InputIterator2 first2, InputIterator2 last2,
  933. BinaryPredicate pred); // **C++14**
  934. template<class ForwardIterator1, class ForwardIterator2>
  935. constexpr bool // constexpr in C++20
  936. is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
  937. ForwardIterator2 first2);
  938. template<class ForwardIterator1, class ForwardIterator2>
  939. constexpr bool // constexpr in C++20
  940. is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
  941. ForwardIterator2 first2, ForwardIterator2 last2); // **C++14**
  942. template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
  943. constexpr bool // constexpr in C++20
  944. is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
  945. ForwardIterator2 first2, BinaryPredicate pred);
  946. template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
  947. constexpr bool // constexpr in C++20
  948. is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
  949. ForwardIterator2 first2, ForwardIterator2 last2,
  950. BinaryPredicate pred); // **C++14**
  951. template <class ForwardIterator1, class ForwardIterator2>
  952. constexpr ForwardIterator1 // constexpr in C++20
  953. search(ForwardIterator1 first1, ForwardIterator1 last1,
  954. ForwardIterator2 first2, ForwardIterator2 last2);
  955. template <class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
  956. constexpr ForwardIterator1 // constexpr in C++20
  957. search(ForwardIterator1 first1, ForwardIterator1 last1,
  958. ForwardIterator2 first2, ForwardIterator2 last2, BinaryPredicate pred);
  959. template <class ForwardIterator, class Size, class T>
  960. constexpr ForwardIterator // constexpr in C++20
  961. search_n(ForwardIterator first, ForwardIterator last, Size count, const T& value);
  962. template <class ForwardIterator, class Size, class T, class BinaryPredicate>
  963. constexpr ForwardIterator // constexpr in C++20
  964. search_n(ForwardIterator first, ForwardIterator last,
  965. Size count, const T& value, BinaryPredicate pred);
  966. template <class InputIterator, class OutputIterator>
  967. constexpr OutputIterator // constexpr in C++20
  968. copy(InputIterator first, InputIterator last, OutputIterator result);
  969. template<class InputIterator, class OutputIterator, class Predicate>
  970. constexpr OutputIterator // constexpr in C++20
  971. copy_if(InputIterator first, InputIterator last,
  972. OutputIterator result, Predicate pred);
  973. template<class InputIterator, class Size, class OutputIterator>
  974. constexpr OutputIterator // constexpr in C++20
  975. copy_n(InputIterator first, Size n, OutputIterator result);
  976. template <class BidirectionalIterator1, class BidirectionalIterator2>
  977. constexpr BidirectionalIterator2 // constexpr in C++20
  978. copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
  979. BidirectionalIterator2 result);
  980. // [alg.move], move
  981. template<class InputIterator, class OutputIterator>
  982. constexpr OutputIterator move(InputIterator first, InputIterator last,
  983. OutputIterator result);
  984. template<class BidirectionalIterator1, class BidirectionalIterator2>
  985. constexpr BidirectionalIterator2
  986. move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last,
  987. BidirectionalIterator2 result);
  988. template <class ForwardIterator1, class ForwardIterator2>
  989. constexpr ForwardIterator2 // constexpr in C++20
  990. swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2);
  991. namespace ranges {
  992. template<class I1, class I2>
  993. using swap_ranges_result = in_in_result<I1, I2>;
  994. template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2>
  995. requires indirectly_swappable<I1, I2>
  996. constexpr ranges::swap_ranges_result<I1, I2>
  997. swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2);
  998. template<input_range R1, input_range R2>
  999. requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>>
  1000. constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>>
  1001. swap_ranges(R1&& r1, R2&& r2);
  1002. }
  1003. template <class ForwardIterator1, class ForwardIterator2>
  1004. constexpr void // constexpr in C++20
  1005. iter_swap(ForwardIterator1 a, ForwardIterator2 b);
  1006. template <class InputIterator, class OutputIterator, class UnaryOperation>
  1007. constexpr OutputIterator // constexpr in C++20
  1008. transform(InputIterator first, InputIterator last, OutputIterator result, UnaryOperation op);
  1009. template <class InputIterator1, class InputIterator2, class OutputIterator, class BinaryOperation>
  1010. constexpr OutputIterator // constexpr in C++20
  1011. transform(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
  1012. OutputIterator result, BinaryOperation binary_op);
  1013. template <class ForwardIterator, class T>
  1014. constexpr void // constexpr in C++20
  1015. replace(ForwardIterator first, ForwardIterator last, const T& old_value, const T& new_value);
  1016. template <class ForwardIterator, class Predicate, class T>
  1017. constexpr void // constexpr in C++20
  1018. replace_if(ForwardIterator first, ForwardIterator last, Predicate pred, const T& new_value);
  1019. template <class InputIterator, class OutputIterator, class T>
  1020. constexpr OutputIterator // constexpr in C++20
  1021. replace_copy(InputIterator first, InputIterator last, OutputIterator result,
  1022. const T& old_value, const T& new_value);
  1023. template <class InputIterator, class OutputIterator, class Predicate, class T>
  1024. constexpr OutputIterator // constexpr in C++20
  1025. replace_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred, const T& new_value);
  1026. template <class ForwardIterator, class T>
  1027. constexpr void // constexpr in C++20
  1028. fill(ForwardIterator first, ForwardIterator last, const T& value);
  1029. template <class OutputIterator, class Size, class T>
  1030. constexpr OutputIterator // constexpr in C++20
  1031. fill_n(OutputIterator first, Size n, const T& value);
  1032. template <class ForwardIterator, class Generator>
  1033. constexpr void // constexpr in C++20
  1034. generate(ForwardIterator first, ForwardIterator last, Generator gen);
  1035. template <class OutputIterator, class Size, class Generator>
  1036. constexpr OutputIterator // constexpr in C++20
  1037. generate_n(OutputIterator first, Size n, Generator gen);
  1038. template <class ForwardIterator, class T>
  1039. constexpr ForwardIterator // constexpr in C++20
  1040. remove(ForwardIterator first, ForwardIterator last, const T& value);
  1041. template <class ForwardIterator, class Predicate>
  1042. constexpr ForwardIterator // constexpr in C++20
  1043. remove_if(ForwardIterator first, ForwardIterator last, Predicate pred);
  1044. template <class InputIterator, class OutputIterator, class T>
  1045. constexpr OutputIterator // constexpr in C++20
  1046. remove_copy(InputIterator first, InputIterator last, OutputIterator result, const T& value);
  1047. template <class InputIterator, class OutputIterator, class Predicate>
  1048. constexpr OutputIterator // constexpr in C++20
  1049. remove_copy_if(InputIterator first, InputIterator last, OutputIterator result, Predicate pred);
  1050. template <class ForwardIterator>
  1051. constexpr ForwardIterator // constexpr in C++20
  1052. unique(ForwardIterator first, ForwardIterator last);
  1053. template <class ForwardIterator, class BinaryPredicate>
  1054. constexpr ForwardIterator // constexpr in C++20
  1055. unique(ForwardIterator first, ForwardIterator last, BinaryPredicate pred);
  1056. template <class InputIterator, class OutputIterator>
  1057. constexpr OutputIterator // constexpr in C++20
  1058. unique_copy(InputIterator first, InputIterator last, OutputIterator result);
  1059. template <class InputIterator, class OutputIterator, class BinaryPredicate>
  1060. constexpr OutputIterator // constexpr in C++20
  1061. unique_copy(InputIterator first, InputIterator last, OutputIterator result, BinaryPredicate pred);
  1062. template <class BidirectionalIterator>
  1063. constexpr void // constexpr in C++20
  1064. reverse(BidirectionalIterator first, BidirectionalIterator last);
  1065. template <class BidirectionalIterator, class OutputIterator>
  1066. constexpr OutputIterator // constexpr in C++20
  1067. reverse_copy(BidirectionalIterator first, BidirectionalIterator last, OutputIterator result);
  1068. template <class ForwardIterator>
  1069. constexpr ForwardIterator // constexpr in C++20
  1070. rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
  1071. template <class ForwardIterator, class OutputIterator>
  1072. constexpr OutputIterator // constexpr in C++20
  1073. rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last, OutputIterator result);
  1074. template <class RandomAccessIterator>
  1075. void
  1076. random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17
  1077. template <class RandomAccessIterator, class RandomNumberGenerator>
  1078. void
  1079. random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
  1080. RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17
  1081. template<class PopulationIterator, class SampleIterator,
  1082. class Distance, class UniformRandomBitGenerator>
  1083. SampleIterator sample(PopulationIterator first, PopulationIterator last,
  1084. SampleIterator out, Distance n,
  1085. UniformRandomBitGenerator&& g); // C++17
  1086. template<class RandomAccessIterator, class UniformRandomNumberGenerator>
  1087. void shuffle(RandomAccessIterator first, RandomAccessIterator last,
  1088. UniformRandomNumberGenerator&& g);
  1089. template<class ForwardIterator>
  1090. constexpr ForwardIterator
  1091. shift_left(ForwardIterator first, ForwardIterator last,
  1092. typename iterator_traits<ForwardIterator>::difference_type n); // C++20
  1093. template<class ForwardIterator>
  1094. constexpr ForwardIterator
  1095. shift_right(ForwardIterator first, ForwardIterator last,
  1096. typename iterator_traits<ForwardIterator>::difference_type n); // C++20
  1097. template <class InputIterator, class Predicate>
  1098. constexpr bool // constexpr in C++20
  1099. is_partitioned(InputIterator first, InputIterator last, Predicate pred);
  1100. template <class ForwardIterator, class Predicate>
  1101. constexpr ForwardIterator // constexpr in C++20
  1102. partition(ForwardIterator first, ForwardIterator last, Predicate pred);
  1103. template <class InputIterator, class OutputIterator1,
  1104. class OutputIterator2, class Predicate>
  1105. constexpr pair<OutputIterator1, OutputIterator2> // constexpr in C++20
  1106. partition_copy(InputIterator first, InputIterator last,
  1107. OutputIterator1 out_true, OutputIterator2 out_false,
  1108. Predicate pred);
  1109. template <class ForwardIterator, class Predicate>
  1110. ForwardIterator
  1111. stable_partition(ForwardIterator first, ForwardIterator last, Predicate pred);
  1112. template<class ForwardIterator, class Predicate>
  1113. constexpr ForwardIterator // constexpr in C++20
  1114. partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);
  1115. template <class ForwardIterator>
  1116. constexpr bool // constexpr in C++20
  1117. is_sorted(ForwardIterator first, ForwardIterator last);
  1118. template <class ForwardIterator, class Compare>
  1119. constexpr bool // constexpr in C++20
  1120. is_sorted(ForwardIterator first, ForwardIterator last, Compare comp);
  1121. template<class ForwardIterator>
  1122. constexpr ForwardIterator // constexpr in C++20
  1123. is_sorted_until(ForwardIterator first, ForwardIterator last);
  1124. template <class ForwardIterator, class Compare>
  1125. constexpr ForwardIterator // constexpr in C++20
  1126. is_sorted_until(ForwardIterator first, ForwardIterator last, Compare comp);
  1127. template <class RandomAccessIterator>
  1128. constexpr void // constexpr in C++20
  1129. sort(RandomAccessIterator first, RandomAccessIterator last);
  1130. template <class RandomAccessIterator, class Compare>
  1131. constexpr void // constexpr in C++20
  1132. sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
  1133. template <class RandomAccessIterator>
  1134. void
  1135. stable_sort(RandomAccessIterator first, RandomAccessIterator last);
  1136. template <class RandomAccessIterator, class Compare>
  1137. void
  1138. stable_sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
  1139. template <class RandomAccessIterator>
  1140. constexpr void // constexpr in C++20
  1141. partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last);
  1142. template <class RandomAccessIterator, class Compare>
  1143. constexpr void // constexpr in C++20
  1144. partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last, Compare comp);
  1145. template <class InputIterator, class RandomAccessIterator>
  1146. constexpr RandomAccessIterator // constexpr in C++20
  1147. partial_sort_copy(InputIterator first, InputIterator last,
  1148. RandomAccessIterator result_first, RandomAccessIterator result_last);
  1149. template <class InputIterator, class RandomAccessIterator, class Compare>
  1150. constexpr RandomAccessIterator // constexpr in C++20
  1151. partial_sort_copy(InputIterator first, InputIterator last,
  1152. RandomAccessIterator result_first, RandomAccessIterator result_last, Compare comp);
  1153. template <class RandomAccessIterator>
  1154. constexpr void // constexpr in C++20
  1155. nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last);
  1156. template <class RandomAccessIterator, class Compare>
  1157. constexpr void // constexpr in C++20
  1158. nth_element(RandomAccessIterator first, RandomAccessIterator nth, RandomAccessIterator last, Compare comp);
  1159. template <class ForwardIterator, class T>
  1160. constexpr ForwardIterator // constexpr in C++20
  1161. lower_bound(ForwardIterator first, ForwardIterator last, const T& value);
  1162. template <class ForwardIterator, class T, class Compare>
  1163. constexpr ForwardIterator // constexpr in C++20
  1164. lower_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
  1165. template <class ForwardIterator, class T>
  1166. constexpr ForwardIterator // constexpr in C++20
  1167. upper_bound(ForwardIterator first, ForwardIterator last, const T& value);
  1168. template <class ForwardIterator, class T, class Compare>
  1169. constexpr ForwardIterator // constexpr in C++20
  1170. upper_bound(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
  1171. template <class ForwardIterator, class T>
  1172. constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
  1173. equal_range(ForwardIterator first, ForwardIterator last, const T& value);
  1174. template <class ForwardIterator, class T, class Compare>
  1175. constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++20
  1176. equal_range(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
  1177. template <class ForwardIterator, class T>
  1178. constexpr bool // constexpr in C++20
  1179. binary_search(ForwardIterator first, ForwardIterator last, const T& value);
  1180. template <class ForwardIterator, class T, class Compare>
  1181. constexpr bool // constexpr in C++20
  1182. binary_search(ForwardIterator first, ForwardIterator last, const T& value, Compare comp);
  1183. template <class InputIterator1, class InputIterator2, class OutputIterator>
  1184. constexpr OutputIterator // constexpr in C++20
  1185. merge(InputIterator1 first1, InputIterator1 last1,
  1186. InputIterator2 first2, InputIterator2 last2, OutputIterator result);
  1187. template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
  1188. constexpr OutputIterator // constexpr in C++20
  1189. merge(InputIterator1 first1, InputIterator1 last1,
  1190. InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
  1191. template <class BidirectionalIterator>
  1192. void
  1193. inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last);
  1194. template <class BidirectionalIterator, class Compare>
  1195. void
  1196. inplace_merge(BidirectionalIterator first, BidirectionalIterator middle, BidirectionalIterator last, Compare comp);
  1197. template <class InputIterator1, class InputIterator2>
  1198. constexpr bool // constexpr in C++20
  1199. includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
  1200. template <class InputIterator1, class InputIterator2, class Compare>
  1201. constexpr bool // constexpr in C++20
  1202. includes(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp);
  1203. template <class InputIterator1, class InputIterator2, class OutputIterator>
  1204. constexpr OutputIterator // constexpr in C++20
  1205. set_union(InputIterator1 first1, InputIterator1 last1,
  1206. InputIterator2 first2, InputIterator2 last2, OutputIterator result);
  1207. template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
  1208. constexpr OutputIterator // constexpr in C++20
  1209. set_union(InputIterator1 first1, InputIterator1 last1,
  1210. InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
  1211. template <class InputIterator1, class InputIterator2, class OutputIterator>
  1212. constexpr OutputIterator // constexpr in C++20
  1213. set_intersection(InputIterator1 first1, InputIterator1 last1,
  1214. InputIterator2 first2, InputIterator2 last2, OutputIterator result);
  1215. template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
  1216. constexpr OutputIterator // constexpr in C++20
  1217. set_intersection(InputIterator1 first1, InputIterator1 last1,
  1218. InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
  1219. template <class InputIterator1, class InputIterator2, class OutputIterator>
  1220. constexpr OutputIterator // constexpr in C++20
  1221. set_difference(InputIterator1 first1, InputIterator1 last1,
  1222. InputIterator2 first2, InputIterator2 last2, OutputIterator result);
  1223. template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
  1224. constexpr OutputIterator // constexpr in C++20
  1225. set_difference(InputIterator1 first1, InputIterator1 last1,
  1226. InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
  1227. template <class InputIterator1, class InputIterator2, class OutputIterator>
  1228. constexpr OutputIterator // constexpr in C++20
  1229. set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
  1230. InputIterator2 first2, InputIterator2 last2, OutputIterator result);
  1231. template <class InputIterator1, class InputIterator2, class OutputIterator, class Compare>
  1232. constexpr OutputIterator // constexpr in C++20
  1233. set_symmetric_difference(InputIterator1 first1, InputIterator1 last1,
  1234. InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp);
  1235. template <class RandomAccessIterator>
  1236. constexpr void // constexpr in C++20
  1237. push_heap(RandomAccessIterator first, RandomAccessIterator last);
  1238. template <class RandomAccessIterator, class Compare>
  1239. constexpr void // constexpr in C++20
  1240. push_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
  1241. template <class RandomAccessIterator>
  1242. constexpr void // constexpr in C++20
  1243. pop_heap(RandomAccessIterator first, RandomAccessIterator last);
  1244. template <class RandomAccessIterator, class Compare>
  1245. constexpr void // constexpr in C++20
  1246. pop_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
  1247. template <class RandomAccessIterator>
  1248. constexpr void // constexpr in C++20
  1249. make_heap(RandomAccessIterator first, RandomAccessIterator last);
  1250. template <class RandomAccessIterator, class Compare>
  1251. constexpr void // constexpr in C++20
  1252. make_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
  1253. template <class RandomAccessIterator>
  1254. constexpr void // constexpr in C++20
  1255. sort_heap(RandomAccessIterator first, RandomAccessIterator last);
  1256. template <class RandomAccessIterator, class Compare>
  1257. constexpr void // constexpr in C++20
  1258. sort_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
  1259. template <class RandomAccessIterator>
  1260. constexpr bool // constexpr in C++20
  1261. is_heap(RandomAccessIterator first, RandomAccessiterator last);
  1262. template <class RandomAccessIterator, class Compare>
  1263. constexpr bool // constexpr in C++20
  1264. is_heap(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
  1265. template <class RandomAccessIterator>
  1266. constexpr RandomAccessIterator // constexpr in C++20
  1267. is_heap_until(RandomAccessIterator first, RandomAccessiterator last);
  1268. template <class RandomAccessIterator, class Compare>
  1269. constexpr RandomAccessIterator // constexpr in C++20
  1270. is_heap_until(RandomAccessIterator first, RandomAccessiterator last, Compare comp);
  1271. template <class ForwardIterator>
  1272. constexpr ForwardIterator // constexpr in C++14
  1273. min_element(ForwardIterator first, ForwardIterator last);
  1274. template <class ForwardIterator, class Compare>
  1275. constexpr ForwardIterator // constexpr in C++14
  1276. min_element(ForwardIterator first, ForwardIterator last, Compare comp);
  1277. template <class T>
  1278. constexpr const T& // constexpr in C++14
  1279. min(const T& a, const T& b);
  1280. template <class T, class Compare>
  1281. constexpr const T& // constexpr in C++14
  1282. min(const T& a, const T& b, Compare comp);
  1283. template<class T>
  1284. constexpr T // constexpr in C++14
  1285. min(initializer_list<T> t);
  1286. template<class T, class Compare>
  1287. constexpr T // constexpr in C++14
  1288. min(initializer_list<T> t, Compare comp);
  1289. template<class T>
  1290. constexpr const T& clamp(const T& v, const T& lo, const T& hi); // C++17
  1291. template<class T, class Compare>
  1292. constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); // C++17
  1293. template <class ForwardIterator>
  1294. constexpr ForwardIterator // constexpr in C++14
  1295. max_element(ForwardIterator first, ForwardIterator last);
  1296. template <class ForwardIterator, class Compare>
  1297. constexpr ForwardIterator // constexpr in C++14
  1298. max_element(ForwardIterator first, ForwardIterator last, Compare comp);
  1299. template <class T>
  1300. constexpr const T& // constexpr in C++14
  1301. max(const T& a, const T& b);
  1302. template <class T, class Compare>
  1303. constexpr const T& // constexpr in C++14
  1304. max(const T& a, const T& b, Compare comp);
  1305. template<class T>
  1306. constexpr T // constexpr in C++14
  1307. max(initializer_list<T> t);
  1308. template<class T, class Compare>
  1309. constexpr T // constexpr in C++14
  1310. max(initializer_list<T> t, Compare comp);
  1311. template<class ForwardIterator>
  1312. constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
  1313. minmax_element(ForwardIterator first, ForwardIterator last);
  1314. template<class ForwardIterator, class Compare>
  1315. constexpr pair<ForwardIterator, ForwardIterator> // constexpr in C++14
  1316. minmax_element(ForwardIterator first, ForwardIterator last, Compare comp);
  1317. template<class T>
  1318. constexpr pair<const T&, const T&> // constexpr in C++14
  1319. minmax(const T& a, const T& b);
  1320. template<class T, class Compare>
  1321. constexpr pair<const T&, const T&> // constexpr in C++14
  1322. minmax(const T& a, const T& b, Compare comp);
  1323. template<class T>
  1324. constexpr pair<T, T> // constexpr in C++14
  1325. minmax(initializer_list<T> t);
  1326. template<class T, class Compare>
  1327. constexpr pair<T, T> // constexpr in C++14
  1328. minmax(initializer_list<T> t, Compare comp);
  1329. template <class InputIterator1, class InputIterator2>
  1330. constexpr bool // constexpr in C++20
  1331. lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2);
  1332. template <class InputIterator1, class InputIterator2, class Compare>
  1333. constexpr bool // constexpr in C++20
  1334. lexicographical_compare(InputIterator1 first1, InputIterator1 last1,
  1335. InputIterator2 first2, InputIterator2 last2, Compare comp);
  1336. template <class BidirectionalIterator>
  1337. constexpr bool // constexpr in C++20
  1338. next_permutation(BidirectionalIterator first, BidirectionalIterator last);
  1339. template <class BidirectionalIterator, class Compare>
  1340. constexpr bool // constexpr in C++20
  1341. next_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
  1342. template <class BidirectionalIterator>
  1343. constexpr bool // constexpr in C++20
  1344. prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
  1345. template <class BidirectionalIterator, class Compare>
  1346. constexpr bool // constexpr in C++20
  1347. prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp);
  1348. } // std
  1349. */
  1350. #include <__assert> // all public C++ headers provide the assertion handler
  1351. #include <__config>
  1352. #include <__debug>
  1353. #include <cstddef>
  1354. #include <type_traits>
  1355. #include <version>
  1356. #include <__algorithm/adjacent_find.h>
  1357. #include <__algorithm/all_of.h>
  1358. #include <__algorithm/any_of.h>
  1359. #include <__algorithm/binary_search.h>
  1360. #include <__algorithm/clamp.h>
  1361. #include <__algorithm/comp.h>
  1362. #include <__algorithm/comp_ref_type.h>
  1363. #include <__algorithm/copy.h>
  1364. #include <__algorithm/copy_backward.h>
  1365. #include <__algorithm/copy_if.h>
  1366. #include <__algorithm/copy_n.h>
  1367. #include <__algorithm/count.h>
  1368. #include <__algorithm/count_if.h>
  1369. #include <__algorithm/equal.h>
  1370. #include <__algorithm/equal_range.h>
  1371. #include <__algorithm/fill.h>
  1372. #include <__algorithm/fill_n.h>
  1373. #include <__algorithm/find.h>
  1374. #include <__algorithm/find_end.h>
  1375. #include <__algorithm/find_first_of.h>
  1376. #include <__algorithm/find_if.h>
  1377. #include <__algorithm/find_if_not.h>
  1378. #include <__algorithm/for_each.h>
  1379. #include <__algorithm/for_each_n.h>
  1380. #include <__algorithm/generate.h>
  1381. #include <__algorithm/generate_n.h>
  1382. #include <__algorithm/half_positive.h>
  1383. #include <__algorithm/in_found_result.h>
  1384. #include <__algorithm/in_fun_result.h>
  1385. #include <__algorithm/in_in_out_result.h>
  1386. #include <__algorithm/in_in_result.h>
  1387. #include <__algorithm/in_out_out_result.h>
  1388. #include <__algorithm/in_out_result.h>
  1389. #include <__algorithm/includes.h>
  1390. #include <__algorithm/inplace_merge.h>
  1391. #include <__algorithm/is_heap.h>
  1392. #include <__algorithm/is_heap_until.h>
  1393. #include <__algorithm/is_partitioned.h>
  1394. #include <__algorithm/is_permutation.h>
  1395. #include <__algorithm/is_sorted.h>
  1396. #include <__algorithm/is_sorted_until.h>
  1397. #include <__algorithm/iter_swap.h>
  1398. #include <__algorithm/lexicographical_compare.h>
  1399. #include <__algorithm/lower_bound.h>
  1400. #include <__algorithm/make_heap.h>
  1401. #include <__algorithm/max.h>
  1402. #include <__algorithm/max_element.h>
  1403. #include <__algorithm/merge.h>
  1404. #include <__algorithm/min.h>
  1405. #include <__algorithm/min_element.h>
  1406. #include <__algorithm/min_max_result.h>
  1407. #include <__algorithm/minmax.h>
  1408. #include <__algorithm/minmax_element.h>
  1409. #include <__algorithm/mismatch.h>
  1410. #include <__algorithm/move.h>
  1411. #include <__algorithm/move_backward.h>
  1412. #include <__algorithm/next_permutation.h>
  1413. #include <__algorithm/none_of.h>
  1414. #include <__algorithm/nth_element.h>
  1415. #include <__algorithm/partial_sort.h>
  1416. #include <__algorithm/partial_sort_copy.h>
  1417. #include <__algorithm/partition.h>
  1418. #include <__algorithm/partition_copy.h>
  1419. #include <__algorithm/partition_point.h>
  1420. #include <__algorithm/pop_heap.h>
  1421. #include <__algorithm/prev_permutation.h>
  1422. #include <__algorithm/push_heap.h>
  1423. #include <__algorithm/ranges_adjacent_find.h>
  1424. #include <__algorithm/ranges_all_of.h>
  1425. #include <__algorithm/ranges_any_of.h>
  1426. #include <__algorithm/ranges_binary_search.h>
  1427. #include <__algorithm/ranges_clamp.h>
  1428. #include <__algorithm/ranges_copy.h>
  1429. #include <__algorithm/ranges_copy_backward.h>
  1430. #include <__algorithm/ranges_copy_if.h>
  1431. #include <__algorithm/ranges_copy_n.h>
  1432. #include <__algorithm/ranges_count.h>
  1433. #include <__algorithm/ranges_count_if.h>
  1434. #include <__algorithm/ranges_equal.h>
  1435. #include <__algorithm/ranges_equal_range.h>
  1436. #include <__algorithm/ranges_fill.h>
  1437. #include <__algorithm/ranges_fill_n.h>
  1438. #include <__algorithm/ranges_find.h>
  1439. #include <__algorithm/ranges_find_end.h>
  1440. #include <__algorithm/ranges_find_first_of.h>
  1441. #include <__algorithm/ranges_find_if.h>
  1442. #include <__algorithm/ranges_find_if_not.h>
  1443. #include <__algorithm/ranges_for_each.h>
  1444. #include <__algorithm/ranges_for_each_n.h>
  1445. #include <__algorithm/ranges_generate.h>
  1446. #include <__algorithm/ranges_generate_n.h>
  1447. #include <__algorithm/ranges_includes.h>
  1448. #include <__algorithm/ranges_inplace_merge.h>
  1449. #include <__algorithm/ranges_is_heap.h>
  1450. #include <__algorithm/ranges_is_heap_until.h>
  1451. #include <__algorithm/ranges_is_partitioned.h>
  1452. #include <__algorithm/ranges_is_permutation.h>
  1453. #include <__algorithm/ranges_is_sorted.h>
  1454. #include <__algorithm/ranges_is_sorted_until.h>
  1455. #include <__algorithm/ranges_lexicographical_compare.h>
  1456. #include <__algorithm/ranges_lower_bound.h>
  1457. #include <__algorithm/ranges_make_heap.h>
  1458. #include <__algorithm/ranges_max.h>
  1459. #include <__algorithm/ranges_max_element.h>
  1460. #include <__algorithm/ranges_merge.h>
  1461. #include <__algorithm/ranges_min.h>
  1462. #include <__algorithm/ranges_min_element.h>
  1463. #include <__algorithm/ranges_minmax.h>
  1464. #include <__algorithm/ranges_minmax_element.h>
  1465. #include <__algorithm/ranges_mismatch.h>
  1466. #include <__algorithm/ranges_move.h>
  1467. #include <__algorithm/ranges_move_backward.h>
  1468. #include <__algorithm/ranges_next_permutation.h>
  1469. #include <__algorithm/ranges_none_of.h>
  1470. #include <__algorithm/ranges_nth_element.h>
  1471. #include <__algorithm/ranges_partial_sort.h>
  1472. #include <__algorithm/ranges_partial_sort_copy.h>
  1473. #include <__algorithm/ranges_partition.h>
  1474. #include <__algorithm/ranges_partition_copy.h>
  1475. #include <__algorithm/ranges_partition_point.h>
  1476. #include <__algorithm/ranges_pop_heap.h>
  1477. #include <__algorithm/ranges_prev_permutation.h>
  1478. #include <__algorithm/ranges_push_heap.h>
  1479. #include <__algorithm/ranges_remove.h>
  1480. #include <__algorithm/ranges_remove_copy.h>
  1481. #include <__algorithm/ranges_remove_copy_if.h>
  1482. #include <__algorithm/ranges_remove_if.h>
  1483. #include <__algorithm/ranges_replace.h>
  1484. #include <__algorithm/ranges_replace_copy.h>
  1485. #include <__algorithm/ranges_replace_copy_if.h>
  1486. #include <__algorithm/ranges_replace_if.h>
  1487. #include <__algorithm/ranges_reverse.h>
  1488. #include <__algorithm/ranges_reverse_copy.h>
  1489. #include <__algorithm/ranges_rotate.h>
  1490. #include <__algorithm/ranges_rotate_copy.h>
  1491. #include <__algorithm/ranges_sample.h>
  1492. #include <__algorithm/ranges_search.h>
  1493. #include <__algorithm/ranges_search_n.h>
  1494. #include <__algorithm/ranges_set_difference.h>
  1495. #include <__algorithm/ranges_set_intersection.h>
  1496. #include <__algorithm/ranges_set_symmetric_difference.h>
  1497. #include <__algorithm/ranges_set_union.h>
  1498. #include <__algorithm/ranges_shuffle.h>
  1499. #include <__algorithm/ranges_sort.h>
  1500. #include <__algorithm/ranges_sort_heap.h>
  1501. #include <__algorithm/ranges_stable_partition.h>
  1502. #include <__algorithm/ranges_stable_sort.h>
  1503. #include <__algorithm/ranges_swap_ranges.h>
  1504. #include <__algorithm/ranges_transform.h>
  1505. #include <__algorithm/ranges_unique.h>
  1506. #include <__algorithm/ranges_unique_copy.h>
  1507. #include <__algorithm/ranges_upper_bound.h>
  1508. #include <__algorithm/remove.h>
  1509. #include <__algorithm/remove_copy.h>
  1510. #include <__algorithm/remove_copy_if.h>
  1511. #include <__algorithm/remove_if.h>
  1512. #include <__algorithm/replace.h>
  1513. #include <__algorithm/replace_copy.h>
  1514. #include <__algorithm/replace_copy_if.h>
  1515. #include <__algorithm/replace_if.h>
  1516. #include <__algorithm/reverse.h>
  1517. #include <__algorithm/reverse_copy.h>
  1518. #include <__algorithm/rotate.h>
  1519. #include <__algorithm/rotate_copy.h>
  1520. #include <__algorithm/sample.h>
  1521. #include <__algorithm/search.h>
  1522. #include <__algorithm/search_n.h>
  1523. #include <__algorithm/set_difference.h>
  1524. #include <__algorithm/set_intersection.h>
  1525. #include <__algorithm/set_symmetric_difference.h>
  1526. #include <__algorithm/set_union.h>
  1527. #include <__algorithm/shift_left.h>
  1528. #include <__algorithm/shift_right.h>
  1529. #include <__algorithm/shuffle.h>
  1530. #include <__algorithm/sift_down.h>
  1531. #include <__algorithm/sort.h>
  1532. #include <__algorithm/sort_heap.h>
  1533. #include <__algorithm/stable_partition.h>
  1534. #include <__algorithm/stable_sort.h>
  1535. #include <__algorithm/swap_ranges.h>
  1536. #include <__algorithm/transform.h>
  1537. #include <__algorithm/unique.h>
  1538. #include <__algorithm/unique_copy.h>
  1539. #include <__algorithm/unwrap_iter.h>
  1540. #include <__algorithm/upper_bound.h>
  1541. // standard-mandated includes
  1542. // [algorithm.syn]
  1543. #include <initializer_list>
  1544. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  1545. # pragma GCC system_header
  1546. #endif
  1547. #if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17
  1548. #error # include <__pstl_algorithm>
  1549. #endif
  1550. #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
  1551. # include <chrono>
  1552. #endif
  1553. #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
  1554. # include <atomic>
  1555. # include <concepts>
  1556. # include <cstring>
  1557. # include <iterator>
  1558. # include <memory>
  1559. # include <stdexcept>
  1560. # include <utility>
  1561. #endif
  1562. #endif // _LIBCPP_ALGORITHM