{"id":343327,"date":"2022-12-29T21:00:39","date_gmt":"2022-12-29T21:00:39","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=343327"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=343327","title":{"rendered":"<span>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u0432 C++20 \u2014 11 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><a href=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/707948\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/fs\/up\/t2\/fsupt2lfi6wbzs0tcmmgplo4gsa.png\" data-src=\"https:\/\/habrastorage.org\/webt\/fs\/up\/t2\/fsupt2lfi6wbzs0tcmmgplo4gsa.png\"\/><\/a><\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0441\u0435\u0440\u0438\u0438 \u00ab\u0414\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u044b\u00bb \u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043e\u0441\u043d\u043e\u0432\u044b \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0442\u0430\u043a\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u043a\u0430\u043a <code>transform<\/code>, <code>copy<\/code>, <code>generate<\/code>, <code>shuffle<\/code> \u0438 \u043c\u043d\u043e\u0433\u0438\u0445 \u0434\u0440\u0443\u0433\u0438\u0445\u2026 \u0434\u0430\u0436\u0435 <code>rotate<\/code>. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u2014 \u043a <a href=\"https:\/\/skillfactory.ru\/c-plus-plus-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_cplus_291222&amp;utm_term=cat\">\u0441\u0442\u0430\u0440\u0442\u0443 \u043a\u0443\u0440\u0441\u0430 \u043f\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043d\u0430 \u0421++<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"prezhde-chem-my-nachnyom\">\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043c\u044b \u043d\u0430\u0447\u043d\u0451\u043c<\/h2>\n<p>  <\/p>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u043e\u0431 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445 <code>std::ranges<\/code>:<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<ul>\n<li>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 <code>&lt;algorithm><\/code>, \u0430 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u0432 \u0438 \u0438\u0445 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u2014 \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 <code>&lt;ranges><\/code>.<\/li>\n<li>\u041e\u0431\u044b\u0447\u043d\u043e \u0435\u0441\u0442\u044c \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0434\u0432\u0435 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0438 \u0434\u043b\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430: \u0441 \u043f\u0430\u0440\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0438 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0430 \u0441 \u043e\u0434\u043d\u0438\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430.<\/li>\n<li>\u0412\u0435\u0440\u0441\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u043e\u0434\u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0438\u043b\u0438 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440 \u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <strong>\u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d<\/strong> \u0438\u043b\u0438 <strong>\u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440<\/strong>. \u042d\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0434\u043b\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u0432.<\/li>\n<li>\u0412\u0435\u0440\u0441\u0438\u0438 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0438\u043c\u0435\u044e\u0442 <strong>\u043f\u0440\u043e\u0435\u043a\u0446\u0438\u0438<\/strong>, \u0447\u0442\u043e \u0434\u0430\u0451\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438; \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0443 \u043f\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0434 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f.<\/li>\n<li>\u0412 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430\u043c\u0438 \u043d\u0435\u0442 \u043e\u043f\u0446\u0438\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (\u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<code>std::execution<\/code>).<\/li>\n<li>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u0432, \u043a\u0430\u043a \u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b C++20, \u0442\u0430\u043a\u0436\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f <code>constexpr<\/code>.<\/li>\n<li>\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 C++20, \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0445 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u0432, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0443 <code>&lt;numeric><\/code>.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0441 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430\u043c\u0438. \u041e\u043d\u0438 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438. \u042f \u0441\u0442\u0440\u0435\u043c\u0438\u043b\u0441\u044f \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0443\u044e \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u0432 \u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438\u0445 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u0432 <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/algorithm\">cppreference\/algorithms<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435, \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<blockquote><p>\u042d\u0442\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0438\u0437 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u0440\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u0432. \u0427\u0438\u0442\u0430\u0442\u044c:  <\/p>\n<ul>\n<li>\u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043e <a href=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/706458\/\">\u00ab7 \u043d\u0435\u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445\u00bb<\/a><\/li>\n<\/ul>\n<p>  <\/p><\/blockquote>\n<p>  <\/p>\n<h2 id=\"copy_if\"><code>copy_if<\/code><\/h2>\n<p>  <\/p>\n<p>\u0423 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 <code>copy<\/code> \u043c\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432: <code>copy_if<\/code>, <code>copy_n<\/code> \u0438 \u0434\u0430\u0436\u0435 <code>copy_backward<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0444\u043e\u0440\u043c\u0435 <code>copy_if<\/code> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">\/\/ skipping all concept\/templates declaration constexpr copy_if_result&lt;ranges::borrowed_iterator_t&lt;R>, O>           copy_if( R&amp;&amp; r, O result, Pred pred, Proj proj = {} );<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#include &lt;algorithm> #include &lt;vector> #include &lt;iostream> #include &lt;ranges>  struct Product {     std::string name_;     double value_ { 0.0 }; };  std::ostream&amp; operator&lt;&lt;(std::ostream&amp; os, const Product&amp; p) {     os &lt;&lt; p.name_ &lt;&lt; \", \" &lt;&lt; p.value_;     return os; }  int main() {     const std::vector&lt;Product> prods {         { \"box\", 10.0 }, {\"tv\", 100.0}, {\"rocket\", 10000.0},         { \"car\", 1000.0 }, {\"toy\", 40.0}, {\"none\", 0.0}     };      \/\/ standard version:       std::copy_if(begin(prods), end(prods),               std::ostream_iterator&lt;Product>(std::cout, \"; \"),               [](const Product&amp; p){         return !p.name_.starts_with(\"none\");     });     std::cout &lt;&lt; '\\n';      \/\/ ranges version:     std::ranges::copy_if(prods,               std::ostream_iterator&lt;Product>(std::cout, \"; \"),               [](const Product&amp; p){         return !p.name_.starts_with(\"none\");     }); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <a href=\"https:\/\/godbolt.org\/z\/8ovTxrer6\">@Compiler Explorer<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044f \u043a\u043e\u043f\u0438\u0440\u0443\u044e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u043e\u0442\u043e\u043a. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u044f \u0432\u044b\u0431\u0438\u0440\u0430\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0432\u0430\u0440\u044b \u043d\u0435 &#171;none&#187;. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 \u043f\u043e\u0442\u043e\u043a \u043a\u043e\u043f\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0446\u0435\u043b\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c <code>operator&lt;<\/code> \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 <code>Product<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044f\u043c \u044f \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0433 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043a\u043e\u0434\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">std::ranges::copy_if(prods,           std::ostream_iterator&lt;Product>(std::cout, \"; \"),           [](const std::string&amp; name){               return !name.starts_with(\"none\");           },           &amp;Product::name_);<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u043b\u0438\u043d\u043d\u0435\u0435, \u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 <code>string<\/code>, \u0430 \u043d\u0435 \u0432\u0435\u0441\u044c \u043e\u0431\u044a\u0435\u043a\u0442 <code>Product<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0427\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0430 <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/algorithm\/ranges\/copy\"><code>ranges::copy<\/code>, <code>ranges::copy_if<\/code> @Cppreference<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"fill\"><code>fill<\/code><\/h2>\n<p>  <\/p>\n<pre><code class=\"cpp\">#include &lt;algorithm> #include &lt;vector> #include &lt;iostream> #include &lt;ranges>  struct Product {     std::string name_;     double value_ { 0.0 };      Product&amp; operator=(int i) { name_ += std::to_string(i); return *this; } };  std::ostream&amp; operator&lt;&lt;(std::ostream&amp; os, const Product&amp; p) {     os &lt;&lt; p.name_ &lt;&lt; \", \" &lt;&lt; p.value_;     return os; }  int main() {     std::vector&lt;Product> prods{7, {\"Box \", 1.0}};      \/\/ standard version:       std::fill(begin(prods), end(prods), 4);     std::ranges::copy(prods, std::ostream_iterator&lt;Product>(std::cout, \"; \"));     std::cout &lt;&lt; '\\n';      \/\/ ranges version:       std::ranges::fill(prods, 2);     std::ranges::copy(prods, std::ostream_iterator&lt;Product>(std::cout, \"; \")); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <a href=\"https:\/\/godbolt.org\/z\/vTcb4EGc7\">@Compiler Explorer<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c <code>fill<\/code> \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0443, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u0438\u0435 \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u043c \u0432\u0430\u043c\u0438 <code>value<\/code>. \u0422\u0438\u043f <code>value<\/code> \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0442\u0438\u043f\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">while (first != last)     *first++ = value;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043a\u043b\u0430\u0441\u0441 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u0438\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0447\u043b\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 <code>name_<\/code> \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u0427\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0430 <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/algorithm\/ranges\/fill\"><code>ranges::fill<\/code> @Cppreference<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"generate\"><code>generate<\/code><\/h2>\n<p>  <\/p>\n<p>\u0412 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a <code>fill()<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c, <code>generate()<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e <code>iota<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#include &lt;algorithm> #include &lt;vector> #include &lt;iostream> #include &lt;ranges>  struct Product {     std::string name_;     double value_ { 0.0 };      Product&amp; operator=(int i) { name_ += std::to_string(i); return *this; } };  std::ostream&amp; operator&lt;&lt;(std::ostream&amp; os, const Product&amp; p) {     os &lt;&lt; p.name_ &lt;&lt; \", \" &lt;&lt; p.value_;     return os; }  int main() {     std::vector&lt;Product> prods{7, {\"Box \", 1.0}};      \/\/ standard version:       std::generate(begin(prods), end(prods), [v = 0]() mutable {         return v++;     });     std::ranges::copy(prods, std::ostream_iterator&lt;Product>(std::cout, \"; \"));     std::cout &lt;&lt; '\\n';      \/\/ ranges version:       std::ranges::generate(prods, [v = 0]() mutable {         return ++v;     });     std::ranges::copy(prods, std::ostream_iterator&lt;Product>(std::cout, \"; \")); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <a href=\"https:\/\/godbolt.org\/z\/anT3zrjYe\">@Compiler Explorer<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0432\u043e\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">Box 0, 1; Box 1, 1; Box 2, 1; Box 3, 1; Box 4, 1; Box 5, 1; Box 6, 1; Box 01, 1; Box 12, 1; Box 23, 1; Box 34, 1; Box 45, 1; Box 56, 1; Box 67, 1;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0427\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/algorithm\/ranges\/generate\"><code>ranges::generate<\/code> @Cppreference<\/a>. \u0415\u0441\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044f \u0441 <code>_n<\/code>: <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/algorithm\/ranges\/generate_n\"><code>ranges::generate_n<\/code><\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"transform\"><code>transform<\/code><\/h2>\n<p>  <\/p>\n<p><code>transform()<\/code> \u2014 \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u0438\u043c\u0435\u044e\u0449\u0438\u0439 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0439.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0444\u043e\u0440\u043c\u0435 \u043e\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">transform( R&amp;&amp; r, O result, F op, Proj proj = {} );<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d <code>r<\/code>, \u0430 \u0437\u0430\u0442\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <code>op<\/code> \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0438 \u0432\u044b\u0432\u043e\u0434\u0430 \u0432 <code>result<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#include &lt;algorithm> #include &lt;vector> #include &lt;iostream> #include &lt;ranges>  struct Product {     std::string name_;     double value_ { 0.0 }; };  int main() {     std::vector&lt;Product> prods{7, {\"Box \", 1.0}};      \/\/ standard version:       std::transform(begin(prods), end(prods), begin(prods), [v = 0](const Product &amp;p) mutable {         return Product { p.name_ + std::to_string(v++), 1.0};     });     for (auto &amp;p : prods) std::cout &lt;&lt; p.name_ &lt;&lt; \", \";     std::cout &lt;&lt; '\\n';      \/\/ ranges version:       std::ranges::transform(prods, begin(prods), [v = 0](const std::string &amp;n) mutable {         return Product { n + std::to_string(v++), 1.0};     }, &amp;Product::name_);     for (auto &amp;p : prods) std::cout &lt;&lt; p.name_ &lt;&lt; \", \"; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <a href=\"https:\/\/godbolt.org\/z\/89qMoYdb5\">@Compiler Explorer<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0432\u043e\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">Box 0, Box 1, Box 2, Box 3, Box 4, Box 5, Box 6, Box 00, Box 11, Box 22, Box 33, Box 44, Box 55, Box 66,<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u044b\u0448\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u0442 \u0436\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440, \u043d\u043e \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0438\u043c\u0435\u043d\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u0430, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0435\u0440\u0435\u0442 \u0434\u0432\u0430 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442 \u0438\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">transform( R1&amp;&amp; r1, R2&amp;&amp; r2, O result, F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {} );<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u00ab\u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f\u00bb \u0434\u0432\u0443\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">std::vector&lt;Product> prods{7, {\"Box \", 1.0}}; std::vector&lt;int> numbers{1, 2, 3, 4, 5, 6, 7};  std::ranges::transform(prods, numbers, begin(prods), [](const Product&amp; p, int v) {     return Product { p.name_ + std::to_string(v), 1.0}; }); for (auto &amp;p : prods) std::cout &lt;&lt; p.name_ &lt;&lt; \", \";<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <a href=\"https:\/\/godbolt.org\/z\/Wo1WzochE\">@Compiler Explorer<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0427\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0430 <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/algorithm\/ranges\/transform\">ranges::transform<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"remove\"><code>remove<\/code><\/h2>\n<p>  <\/p>\n<p>\u0412 C++20 \u0435\u0441\u0442\u044c \u0441\u043f\u043e\u0441\u043e\u0431 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0438 \u0441\u0442\u0438\u0440\u0430\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435. \u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 <code>std::erase_if<\/code>, \u043d\u0430\u0431\u043e\u0440 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u2014 \u0432 \u043c\u043e\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435: <a href=\"https:\/\/www.cppstories.com\/2022\/20-smaller-cpp20-features\/#15-consistent-container-erasure\">20 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445, \u043d\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 C++20 \u2014 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0442\u044b \u043a\u0430\u0440\u0442\u0438\u043d\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0432\u0441\u0435 \u0442\u0440\u0438 \u0432\u0435\u0440\u0441\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#include &lt;algorithm> #include &lt;vector> #include &lt;iostream> #include &lt;ranges>  struct Product {     std::string name_;     double value_ { 0.0 }; };  int main() {     const std::vector&lt;Product> prods {         { \"box\", 10.0 }, {\"tv\", 100.0}, {\"rocket\", 10000.0},         {\"no prod\", 0.0}, { \"car\", 1000.0 }, {\"toy\", 40.0}, {\"none\", 0.0}     };      auto printCont = [](const std::vector&lt;Product>&amp; cont) {         for (auto &amp;p : cont) std::cout &lt;&lt; p.name_ &lt;&lt; \", \";         std::cout &lt;&lt; '\\n';     };     std::cout &lt;&lt; \"removing products starting with \\\"no\\\"\\n\";     printCont(prods);      auto checkNoPrefix = [&amp;](const Product&amp; p) { return p.name_.starts_with(\"no\"); };      \/\/ standard version:     auto tempProds = prods;     tempProds.erase(std::remove_if(tempProds.begin(), tempProds.end(),         checkNoPrefix), tempProds.end());     printCont(tempProds);      \/\/ ranges version:     tempProds = prods;     tempProds.erase(std::ranges::remove_if(tempProds, checkNoPrefix).begin(), tempProds.end());     printCont(tempProds);      \/\/ C++20 version:       tempProds = prods;     std::erase_if(tempProds, checkNoPrefix);     printCont(tempProds); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <a href=\"https:\/\/godbolt.org\/z\/4cYjP83cP\">@Compiler Explorer<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412\u0435\u0440\u0441\u0438\u044f ranges \u0441\u043e\u043a\u0440\u0430\u0449\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 \u0432\u044b\u0437\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">tempProds.erase(std::remove_if(tempProds.begin(), tempProds.end(),         checkNoPrefix), tempProds.end());<\/code><\/pre>\n<p>  <\/p>\n<p>\u0432 \u0442\u0430\u043a\u043e\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">tempProds.erase(std::ranges::remove_if(tempProds, checkNoPrefix).begin(), tempProds.end());<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u043e, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435. <code>ranges::remove_if<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u043e\u0434\u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0433\u043e <code>begin()<\/code> \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, <code>end()<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0413\u043e\u0440\u0430\u0437\u0434\u043e \u043f\u0440\u043e\u0449\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">std::erase_if(tempProds, checkNoPrefix);<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0437\u0434\u0435\u0441\u044c: <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/algorithm\/ranges\/remove\"><code>ranges::removeranges::remove_if<\/code> @Cppreference<\/a>, \u0430 \u0442\u0430\u043a\u0436\u0435 <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/container\/vector\/erase2\"><code>std::erase, std::erase_if (std::vector)<\/code> @Cppreference<\/a> (\u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u044e \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0443 \u0434\u043b\u044f <code>std::erase<\/code>).<\/p>\n<p>  <\/p>\n<h2 id=\"replace\"><code>replace<\/code><\/h2>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#include &lt;algorithm> #include &lt;vector> #include &lt;iostream> #include &lt;ranges>  struct Product {     std::string name_;     double value_ { 0.0 };      friend bool operator==(const Product&amp; a, const Product&amp; b) {         return a.name_ == b.name_ &amp;&amp; abs(a.value_ - b.value_) &lt; 0.0001;     } };  std::ostream&amp; operator&lt;&lt;(std::ostream&amp; os, const Product&amp; p) {     os &lt;&lt; p.name_ &lt;&lt; \", \" &lt;&lt; p.value_;     return os; }  int main() {     std::vector&lt;Product> prods {         { \"box\", 10.0 }, {\"tv\", 100.0}, {\"rocket\", 10000.0},         { \"car\", 1000.0 }, {\"toy\", 40.0}, {\"none\", 0.0},         {\"invalid\", 0.0}, { \"invalid\", -10.0 }     };      std::ostream_iterator&lt;Product> out_iter(std::cout, \"; \");      \/\/ standard version:       std::cout &lt;&lt; \"before: \\n\";     std::copy(begin(prods), end(prods), out_iter);     std::replace(begin(prods), end(prods), Product{\"none\", 0.0}, Product{\"default\", 10.0});     std::cout &lt;&lt; \"\\nafter: \\n\";     std::copy(begin(prods), end(prods), out_iter);     std::cout &lt;&lt; '\\n';      \/\/ ranges version:     std::cout &lt;&lt; \"before: \\n\";     std::ranges::copy(prods, out_iter);     std::ranges::replace(prods, \"invalid\", Product{\"default\", 10.0}, &amp;Product::name_);     std::cout &lt;&lt; \"\\nafter: \\n\";     std::ranges::copy(prods, out_iter);     std::cout &lt;&lt; '\\n';     }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <a href=\"https:\/\/godbolt.org\/z\/vPP4dbGP3\">@Compiler Explorer<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0432\u043e\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">before: box, 10; tv, 100; rocket, 10000; car, 1000; toy, 40; none, 0; invalid, 0; invalid, -10; after: box, 10; tv, 100; rocket, 10000; car, 1000; toy, 40; default, 10; invalid, 0; invalid, -10; before: box, 10; tv, 100; rocket, 10000; car, 1000; toy, 40; default, 10; invalid, 0; invalid, -10; after: box, 10; tv, 100; rocket, 10000; car, 1000; toy, 40; default, 10; default, 10; default, 10;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0442\u043e \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">for (; first != last; ++first) {     if (*first == old_value) {         *first = new_value;     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f <code>==<\/code> (\u0438\u043b\u0438 &#171;\u043a\u043e\u0441\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043e\u0440\u0430\u0431\u043b\u044c&#187; <code>&lt;=><\/code> \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438).<\/p>\n<p>  <\/p>\n<p>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044e:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">for (; first != last; ++first) {     if (old_value == std::invoke(proj, *first)) {         *first = new_value;     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0435 <code>==<\/code> \u043d\u0435\u0442, \u0432\u0435\u0434\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e. \u042d\u0442\u043e \u0434\u0430\u0451\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0442\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 (\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>value_<\/code> \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u2014 <code>0.0<\/code> \u0438\u043b\u0438 <code>-10.0<\/code>).<\/p>\n<p>  <\/p>\n<p>\u0427\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0430 <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/algorithm\/ranges\/replace\"><code>ranges::replaceranges::replace_if<\/code> @Cppreference<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"reverse-httpswwwcppstoriescom2022ranges-alg-part-twosummaryreverse\"><code>reverse<\/code> <\/h2>\n<p>  <\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 reverse-\u043a\u043e\u043f\u0438\u0435\u0439 \u0441 \u0432\u044b\u0432\u043e\u0434\u043e\u043c \u0432 \u043f\u043e\u0442\u043e\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#include &lt;algorithm> #include &lt;vector> #include &lt;iostream> #include &lt;ranges>  int main() {     const std::vector numbers {         \"one\", \"two\", \"three\", \"four\", \"five\", \"six\"     };      auto outStream = std::ostream_iterator&lt;std::string>(std::cout, \"; \");      \/\/ standard version:     std::copy(begin(numbers), end(numbers), outStream);     std::cout &lt;&lt; '\\n';     std::reverse_copy(begin(numbers), end(numbers), outStream);      \/\/ ranges version:     std::cout &lt;&lt; \"\\nRanges\\n\";     std::ranges::copy(numbers, outStream);     std::cout &lt;&lt; '\\n';     std::ranges::reverse_copy(numbers, outStream); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <a href=\"https:\/\/godbolt.org\/z\/14E5e6KGK\">@Compiler Explorer<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0432\u043e\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">one; two; three; four; five; six; six; five; four; three; two; one; Ranges one; two; three; four; five; six; six; five; four; three; two; one;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u044d\u0442\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/algorithm\/ranges\/reverse\">@Cppreference \u2014 ranges::reverse<\/a> \u0438 <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/algorithm\/ranges\/reverse_copy\">@Cppreference \u2014 ranges::reverse_copy<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"rotate-httpswwwcppstoriescom2022ranges-alg-part-twosummaryrotate\"><code>rotate<\/code> <\/h2>\n<p>  <\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441\u043e \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0438\u0445:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#include &lt;algorithm> #include &lt;vector> #include &lt;ranges> #include &lt;iostream> #include &lt;iomanip>  int main() {     std::vector&lt;std::string> words { \"hello\", \"in\", \"the\",         \"wonderful\", \"world\", \"of\", \"c++\", \"programming\",     };      std::ostream_iterator&lt;std::string> out(std::cout, \" \");      \/\/ standard version:     std::ranges::copy(words, out);     std::cout &lt;&lt;'\\n';     auto firstWord = words[0];     auto newPos = std::rotate(begin(words), std::next(begin(words), 1), end(words));     std::ranges::copy(words, out);     std::cout &lt;&lt;'\\n';     std::cout &lt;&lt; std::quoted(firstWord) &lt;&lt; \" is now at pos \"               &lt;&lt; std::distance(begin(words), newPos) &lt;&lt; '\\n';      \/\/ ranges version:     auto helloPos = std::ranges::find(words, \"hello\");     if (helloPos != end(words)) {         auto firstWord = words[0];         auto ret = std::ranges::rotate(words, helloPos);         std::ranges::copy(words, out);         std::cout &lt;&lt;'\\n';         std::cout &lt;&lt; std::quoted(firstWord) &lt;&lt; \" is now at pos \"                   &lt;&lt; std::distance(begin(words), ret.begin()) &lt;&lt; '\\n';     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <a href=\"https:\/\/godbolt.org\/z\/jT5dfj7bo\">@Compiler Explorer<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u0435\u0433\u043e \u0442\u0430\u043a, \u0447\u0442\u043e \u0441\u043b\u043e\u0432\u043e <code>\"the\"<\/code> \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u043c \u0441\u043b\u043e\u0432\u043e\u043c. \u041f\u043e\u0437\u0436\u0435 \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430\u043c\u0438 \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u043f\u0435\u0440\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0430 \u0437\u0430\u0442\u0435\u043c \u0441\u043d\u043e\u0432\u0430 \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u0435\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u043d\u0430\u0447\u0430\u043b\u0430.<\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0432\u043e\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">hello in the wonderful world of c++ programming in the wonderful world of c++ programming hello \"hello\" is now at pos 7 hello in the wonderful world of c++ programming \"in\" is now at pos 1<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/algorithm\/ranges\/rotate\"><code>ranges::rotate<\/code> @Cppreference<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"shuffle-httpswwwcppstoriescom2022ranges-alg-part-twosummaryshuffle\"><code>shuffle<\/code> <\/h2>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e <code>std::random_shuffle<\/code> \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u043c \u0438 \u0443\u0434\u0430\u043b\u0451\u043d \u0432 C++17. \u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 C++11, \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>std::shuffle<\/code> \u0438\u043b\u0438 <code>std::ranges::shuffle<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430, \u0430 \u043d\u0435 \u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043d\u0430 <code>rand()<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#include &lt;iostream> #include &lt;random> #include &lt;iterator> #include &lt;algorithm> #include &lt;ranges>  int main() {     std::vector&lt;std::string> words {         \"box\", \"tv\", \"car\", \"bricks\", \"game\", \"ball\"     };      std::mt19937 rng{std::random_device{}()};      auto print = [](std::string_view str, const auto&amp; cont) {         std::cout &lt;&lt; str &lt;&lt; \": \";         for (const auto &amp;w : cont)             std::cout &lt;&lt; w &lt;&lt; \", \";         std::cout &lt;&lt; '\\n';     };      print(\"before\", words);      \/\/ the standard version:        std::shuffle(begin(words), end(words), rng);         print(\"after \", words);      \/\/ the ranges version:     \/\/ the standard version:        std::ranges::shuffle(words, rng);     print(\"after \", words);                 }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <a href=\"https:\/\/godbolt.org\/z\/bbMGdT15r\">@Compiler Explorer<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/algorithm\/ranges\/shuffle\"><code>ranges::shuffle<\/code> @Cppreference<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"sample-httpswwwcppstoriescom2022ranges-alg-part-twosummarysample\"><code>sample<\/code> <\/h2>\n<p>  <\/p>\n<p><code>std::sample<\/code> \u2014 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u043e\u0432\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0441 C++17. \u041e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c <code>n<\/code> \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u042d\u0442\u043e \u043d\u0435 \u0430\u043d\u0430\u043b\u043e\u0433 <code>constexpr<\/code>. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#include &lt;iostream> #include &lt;random> #include &lt;iterator> #include &lt;algorithm> #include &lt;ranges>  struct Product {     std::string name_;     double value_ { 0.0 }; };  int main() {     const std::vector&lt;Product> prods {         { \"box\", 10.0 }, {\"tv\", 100.0}, {\"ball\", 30.0},         { \"car\", 1000.0 }, {\"toy\", 40.0}, {\"cake\", 15.0},         { \"book\", 45.0}, {\"PC game\", 35.0}, {\"wine\", 25}     };      std::mt19937 rng{std::random_device{}()};     const size_t firstRoundCount = 4;     const size_t secondRoundCount = 2;      \/\/ the standard version:     std::vector&lt;Product> selected;         std::sample(begin(prods), end(prods),                 std::back_inserter(selected),                 firstRoundCount,  rng);      std::cout &lt;&lt; firstRoundCount &lt;&lt; \" selected products: \\n\";     for (const auto &amp;elem : selected)         std::cout &lt;&lt; elem.name_ &lt;&lt; '\\n';      \/\/ the ranges version:     std::vector&lt;Product> onlyTwo;     std::ranges::sample(selected,                 std::back_inserter(onlyTwo),                 secondRoundCount,  rng);             std::cout &lt;&lt; secondRoundCount &lt;&lt; \" winners: \\n\";     for (const auto &amp;elem : onlyTwo)         std::cout &lt;&lt; elem.name_ &lt;&lt; '\\n';                  }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <a href=\"https:\/\/godbolt.org\/z\/Wjnxc9jjd\">@Compiler Explorer<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0427\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0430 <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/algorithm\/ranges\/sample\"><code>ranges::sample<\/code> @Cppreference<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"unique-httpswwwcppstoriescom2022ranges-alg-part-twosummaryunique\"><code>unique<\/code> <\/h2>\n<p>  <\/p>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c <code>unique()<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437 <code>{1, 1, 5, 5, 2, 2, 3, 3, 4, 4, 5, 5}<\/code> \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c <code>{1 , 5, 2, 3, 4, 5}<\/code>. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043d\u0435 \u0432\u0441\u0435 <code>5<\/code> \u0431\u044b\u043b\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u044b, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435, \u0447\u0442\u043e \u0431\u044b\u043b\u0438 \u0432 \u0442\u043e\u0439 \u0436\u0435 \u00ab\u0433\u0440\u0443\u043f\u043f\u0435\u00bb.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u0433\u0434\u0435 \u044f \u0443\u0434\u0430\u043b\u044f\u044e \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b \u0441\u043b\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#include &lt;iostream> #include &lt;random> #include &lt;algorithm> #include &lt;ranges>  struct Product {     std::string name_;     double value_ { 0.0 }; };  int main() {     std::vector&lt;Product> prods {         { \"box\", 20.0}, {\"box\", 10.0 }, {\"toy\", 35.0},         { \"box\", 10.0 }, {\"tv\", 100.0}, {\"tv\", 30.0},         { \"car\", 1000.0 }, {\"box\", 0.0},  {\"toy\", 40.0}, {\"cake\", 15.0},     };      auto print = [](std::string_view str, const std::vector&lt;Product>&amp; cont) {         std::cout &lt;&lt; str &lt;&lt; \": \";         for (const auto &amp;p : cont)             std::cout &lt;&lt; p.name_ &lt;&lt; \", \";         std::cout &lt;&lt; '\\n';     };      print(\"before:        \", prods);     auto ret = std::ranges::unique(prods, {}, &amp;Product::name_);     prods.erase(ret.begin(), ret.end());     print(\"after unique:  \", prods);                      std::ranges::sort(prods, {}, &amp;Product::name_);     print(\"after sort:    \", prods);               ret = std::ranges::unique(prods, {}, &amp;Product::name_);     prods.erase(ret.begin(), ret.end());     print(\"another unique:\", prods);                  }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c <a href=\"https:\/\/godbolt.org\/z\/3hPqhTYcf\">@Compiler Explorer<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0432\u043e\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">before:        : box, box, toy, box, tv, tv, car, box, toy, cake, after unique:  : box, toy, box, tv, car, box, toy, cake, after sort:    : box, box, box, cake, car, toy, toy, tv, another unique:: box, cake, car, toy, tv,<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0435 \u043e\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e, \u0430 \u0444\u043e\u043a\u0443\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 <code>ranges::unique<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 <code>unique()<\/code> \u0432\u0435\u043a\u0442\u043e\u0440 <code>prods<\/code> \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e \u0443\u0434\u0430\u043b\u044f\u0435\u043c\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0435\u0446 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u043e\u043d\u0438 \u0438\u043c\u0435\u044e\u0442 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0412\u043e\u0442 \u043f\u043e\u0447\u0435\u043c\u0443 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b <code>erase<\/code>, \u0447\u0442\u043e\u0431\u044b \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u0442\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430. \u041e\u0431\u044a\u0435\u043a\u0442 <code>ret<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u043e\u0434\u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u00ab\u0443\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u0439\u00bb \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438 \u043a\u043e\u043d\u0435\u0446 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0432\u043e\u0439 \u00ab\u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438\u00bb \u0432\u0441\u0435 \u0435\u0449\u0435 \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043d\u043e \u043e\u043d\u0438 \u043d\u0435 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442 \u043e\u0434\u043d\u043e\u0439 \u0438 \u0442\u043e\u0439 \u0436\u0435 \u00ab\u0433\u0440\u0443\u043f\u043f\u0435\u00bb. \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e, \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b (\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u043f\u0440\u043e\u0435\u043a\u0446\u0438\u044e, \u0447\u0442\u043e\u0431\u044b \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 <code>name_<\/code>). \u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0434 \u0432\u0441\u0435\u0439 \u043e\u0447\u0438\u0441\u0442\u043a\u043e\u0439.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/algorithm\/ranges\/unique\"><code>ranges::unique<\/code> @Cppreference<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0435\u0440\u0441\u0438\u0439 \u0441 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u0434 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432\u0441\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0432\u0435\u0441\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440. \u0412\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434 \u043a\u0443\u0434\u0430 \u0431\u043e\u043b\u0435\u0435 \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u043c.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0443\u0447\u0438\u043c \u0432\u0430\u0441 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u00a0\u043f\u0440\u043e\u043a\u0430\u0447\u0430\u043b\u0438 \u043a\u0430\u0440\u044c\u0435\u0440\u0443 \u0438 \u0441\u0442\u0430\u043b\u0438 \u0432\u043e\u0441\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u043d\u044b\u043c IT-\u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u043e\u043c.<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/skillfactory.ru\/catalogue?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=sf_allcourses_291222&amp;utm_term=banner\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/j2\/_o\/gf\/j2_ogfhj6eyshhs0_viq_hce12i.png\" data-src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/j2\/_o\/gf\/j2_ogfhj6eyshhs0_viq_hce12i.png\"\/><\/a><\/p>\n<p>  <\/p>\n<ul>\n<li><u><a href=\"https:\/\/skillfactory.ru\/python-fullstack-web-developer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fpw_291222&amp;utm_term=conc\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Fullstack-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430\u00a0Python (16 \u043c\u0435\u0441\u044f\u0446\u0435\u0432)<\/a><\/u><\/li>\n<li><u><a href=\"https:\/\/skillfactory.ru\/data-scientist-pro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dspr_291222&amp;utm_term=conc\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Data Scientist (24 \u043c\u0435\u0441\u044f\u0446\u0430)<\/a><\/u><\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u0440\u0430\u0442\u043a\u0438\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u043a\u0443\u0440\u0441\u043e\u0432<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p><strong>Data Science \u0438\u00a0Machine Learning<\/strong><\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/skillfactory.ru\/data-scientist-pro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dspr_291222&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Data Scientist<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/data-analyst-pro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=analytics_dapr_291222&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Data Analyst<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/matematika-dlya-data-science#syllabus?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_mat_291222&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00ab\u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u0434\u043b\u044f Data Science\u00bb<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/matematika-i-machine-learning-dlya-data-science?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_matml_291222&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00ab\u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u0438\u00a0Machine Learning \u0434\u043b\u044f Data Science\u00bb<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/data-engineer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dea_291222&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u043f\u043e\u00a0Data Engineering<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/machine-learning-i-deep-learning?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_mldl_291222&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00abMachine Learning \u0438\u00a0Deep Learning\u00bb<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/machine-learning?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_ml_291222&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u043f\u043e\u00a0Machine Learning<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<p><strong>Python, \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/strong><\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/skillfactory.ru\/python-fullstack-web-developer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fpw_291222&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Fullstack-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430\u00a0Python<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/python-for-web-developers?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_pws_291222&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00abPython \u0434\u043b\u044f \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438\u00bb<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/frontend-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fr_291222&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Frontend-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/webdev?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_webdev_291222&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u0412\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<p><strong>\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/strong><\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/skillfactory.ru\/ios-razrabotchik-s-nulya?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_ios_291222&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f iOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/android-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_andr_291222&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Android-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<p><strong>Java \u0438\u00a0C#<\/strong><\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/skillfactory.ru\/java-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_java_291222&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Java-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/java-qa-engineer-testirovshik-po?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_qaja_291222&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f QA-\u0438\u043d\u0436\u0435\u043d\u0435\u0440 \u043d\u0430\u00a0JAVA<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/c-sharp-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_cdev_291222&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f C#-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/game-razrabotchik-na-unity-i-c-sharp?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_gamedev_291222&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438\u0433\u0440 \u043d\u0430\u00a0Unity<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<p><strong>\u041e\u0442\u00a0\u043e\u0441\u043d\u043e\u0432\u00a0\u2014 \u0432\u00a0\u0433\u043b\u0443\u0431\u0438\u043d\u0443<\/strong><\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/skillfactory.ru\/algoritmy-i-struktury-dannyh?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_algo_291222&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00ab\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0438\u00a0\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445\u00bb<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/c-plus-plus-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_cplus_291222&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f C++-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/cyber-security-etichnij-haker?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_hacker_291222&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u00ab\u0411\u0435\u043b\u044b\u0439 \u0445\u0430\u043a\u0435\u0440\u00bb<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<p><strong>\u0410\u00a0\u0442\u0430\u043a\u0436\u0435<\/strong><\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/skillfactory.ru\/devops-ingineer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_devops_291222&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u043f\u043e\u00a0DevOps<\/a><\/li>\n<li><a href=\"https:\/\/skillfactory.ru\/catalogue?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=sf_allcourses_291222&amp;utm_term=cat\">\u0412\u0441\u0435 \u043a\u0443\u0440\u0441\u044b<\/a><\/li>\n<\/ul>\n<\/div><\/div>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/707948\/\"> https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/707948\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><a href=\"https:\/\/habr.com\/ru\/company\/skillfactory\/blog\/707948\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/fs\/up\/t2\/fsupt2lfi6wbzs0tcmmgplo4gsa.png\" data-src=\"https:\/\/habrastorage.org\/webt\/fs\/up\/t2\/fsupt2lfi6wbzs0tcmmgplo4gsa.png\"\/><\/a><\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0441\u0435\u0440\u0438\u0438 \u00ab\u0414\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u044b\u00bb \u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043e\u0441\u043d\u043e\u0432\u044b \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0442\u0430\u043a\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432, \u043a\u0430\u043a <code>transform<\/code>, <code>copy<\/code>, <code>generate<\/code>, <code>shuffle<\/code> \u0438 \u043c\u043d\u043e\u0433\u0438\u0445 \u0434\u0440\u0443\u0433\u0438\u0445\u2026 \u0434\u0430\u0436\u0435 <code>rotate<\/code>. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u2014 \u043a <a href=\"https:\/\/skillfactory.ru\/c-plus-plus-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_cplus_291222&amp;utm_term=cat\">\u0441\u0442\u0430\u0440\u0442\u0443 \u043a\u0443\u0440\u0441\u0430 \u043f\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043d\u0430 \u0421++<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"prezhde-chem-my-nachnyom\">\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043c\u044b \u043d\u0430\u0447\u043d\u0451\u043c<\/h2>\n<p>  <\/p>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u043e\u0431 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445 <code>std::ranges<\/code>:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-343327","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/343327","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=343327"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/343327\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=343327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=343327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=343327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}