{"id":393640,"date":"2024-06-29T11:08:05","date_gmt":"2024-06-29T11:08:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=393640"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=393640","title":{"rendered":"<span>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441\u044b<\/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-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f C++ \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043d\u0430\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0435\u0441\u043b\u0438 \u043d\u0435 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438, \u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0438\u043c\u0438.<\/p>\n<p>\u0422\u0430\u043a, \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0432\u0432\u043e\u0434\u0438\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 <em>\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 <\/em><a href=\"https:\/\/en.cppreference.com\/w\/cpp\/named_req\/BitmaskType\" rel=\"noopener noreferrer nofollow\">BitmaskType<\/a>, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043a\u0430\u043a\u0438\u043c\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u044c \u0431\u0438\u0442\u043e\u0432\u044b\u0435 \u043c\u0430\u0441\u043a\u0438 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435: \u0434\u043b\u044f \u043d\u0438\u0445 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u00ab\u0438\u00bb, \u00ab\u0438\u043b\u0438\u00bb, \u00ab\u043d\u0435\u00bb, \u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>0<\/code> \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0443\u0441\u0442\u0443\u044e \u043c\u0430\u0441\u043a\u0443.<\/p>\n<p>\u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f, \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e: <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/utility\/chars_format\" rel=\"noopener noreferrer nofollow\">std::chars_format<\/a>, <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/thread\/launch\" rel=\"noopener noreferrer nofollow\">std::launch<\/a>, <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/filesystem\/perms\" rel=\"noopener noreferrer nofollow\">std::filesystem::perms<\/a>, <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/filesystem\/perm_options\" rel=\"noopener noreferrer nofollow\">std::filesystem::perm_options<\/a>, <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/filesystem\/copy_options\" rel=\"noopener noreferrer nofollow\">std::filesystem::copy_options<\/a>, <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/filesystem\/directory_options\" rel=\"noopener noreferrer nofollow\">std::filesystem::directory_options<\/a>&#8230; \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0447\u0435\u043c \u043e\u043d\u0438 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u2014 \u044d\u0442\u043e \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0436\u0435 \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430\u0434 \u043d\u0438\u043c\u0438 \u043f\u043e\u0445\u043e\u0436\u0438 \u043a\u0430\u043a \u0434\u0432\u0435 \u043a\u0430\u043f\u043b\u0438 \u0432\u043e\u0434\u044b.<\/p>\n<p>\u0421\u0440\u0430\u0432\u043d\u0438\u0442\u0435 \u0441\u0430\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0434\u043b\u044f <code>perms<\/code>, <code>directory_options<\/code> \u0438 <code>perm_options<\/code> (\u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0432\u0437\u044f\u0442\u044b \u0438\u0437 <a href=\"https:\/\/github.com\/llvm\/llvm-project\/tree\/main\/libcxx\" rel=\"noopener noreferrer nofollow\">libc++<\/a> \u2014 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0441\u0430\u043c\u043e\u0439 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438): <a href=\"https:\/\/github.com\/PatriotRossii\/metaclasses-article\/blob\/master\/impl_comparison.md\" rel=\"noopener noreferrer nofollow\">comparison table<\/a>. \u041e\u043d\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b \u043e\u0434\u0438\u043d \u0432 \u043e\u0434\u0438\u043d \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u044b (<em>underlying type<\/em> \u0443 <code>enum class<\/code>). \u0418\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u2014 \u0447\u0438\u0441\u0442\u044b\u0439 \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u043d\u0435 \u043c\u043e\u0433\u0443 \u043d\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0430\u0448\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 <em>\u043d\u0435\u0434\u043e\u0447\u0435\u0442, \u0437\u0430\u043a\u0440\u0430\u0432\u0448\u0438\u0439\u0441\u044f \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0434\u043b\u044f perm_options <\/em>\u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0430: \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 <em>underlying type<\/em> \u0434\u043b\u044f <code>perm_options<\/code> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d <code>unsigned char<\/code>, \u0430 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043c\u044b \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 (\u0432 <code>static_cast<\/code>) \u043a <code>unsigned<\/code> (<code>unsigned int<\/code>). \u042d\u0442\u043e \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u043e\u0439, \u043d\u043e \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u0432 \u0437\u0430\u0431\u043b\u0443\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0433\u043e \u0441 \u0434\u0430\u043d\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432 \u043f\u043b\u044e\u0441\u0430\u0445 <strong>\u043d\u0435\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u0430<\/strong><em> <\/em>\u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442. \u041d\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435, \u043d\u0438 \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u043f\u043e\u043c\u043e\u0449\u043d\u0438\u043a.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0435 (<a href=\"https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2018\/p0707r3.pdf\" rel=\"noopener noreferrer nofollow\">P0707R3<\/a>) <a href=\"https:\/\/isocpp.org\/wiki\/faq\/wg21#herb-sutter\" rel=\"noopener noreferrer nofollow\">\u0413\u0435\u0440\u0431\u043e\u043c \u0421\u0430\u0442\u0442\u0435\u0440\u043e\u043c, \u043f\u0440\u0435\u0434\u0441\u0435\u0434\u0430\u0442\u0435\u043b\u0435\u043c \u0441\u043e\u0432\u0435\u0442\u0430 \u043f\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u0438 C++<\/a> \u2014 <em>\u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441\u044b, <\/em>\u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0430\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430<em>.<\/em><\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435:<\/p>\n<pre><code class=\"cpp\">\/\/ \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441\u0430 constexpr void interface(meta::type target, const meta::type source) {   compiler.require(source.variables().empty(), \"interfaces may not contain data\");   for (auto f: source.functions()) {     compiler.require(!f.is_copy() &amp;&amp; !f.is_move(), \"interfaces may not copy or move; consider a virtual clone() instead\");     if (!f.has_access()) f.make_public();     compiler.require(f.is_public(), \"interface functions must be public\");     f.make_pure_virtual();     ->(target) f;   }   ->(target) { virtual ~(source.name()$)() noexcept { } } } \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441\u0430 interface Shape {   int area() const;   void scale_by(double factor); };<\/code><\/pre>\n<p>\u041c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0435\u0439\u0441\u044f \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0435\u0439 \u0434\u0432\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430: <code>target<\/code> \u2014 \u0442\u0438\u043f, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u0438 <code>source<\/code> \u2014 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441:<\/p>\n<pre><code class=\"cpp\">constexpr void interface(meta::type target, const meta::type source) {<\/code><\/pre>\n<p>\u0412 \u043d\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438:<\/p>\n<p>1. \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432\u044b\u0434\u0430\u0441\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \u00abinterfaces may not contain data\u00bb, \u0435\u0441\u043b\u0438 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u043f\u043e\u043b\u044f:<\/p>\n<pre><code class=\"cpp\">compiler.require(source.variables().empty(), \"interfaces may not contain data\");<\/code><\/pre>\n<p>2. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434\u044b \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 <code>source<\/code>. \u0422\u0438\u043f <code>meta::type<\/code> \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043a\u043b\u0430\u0441\u0441\u0435: \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0435\u0433\u043e \u043f\u043e\u043b\u044f\u0445, \u043c\u0435\u0442\u043e\u0434\u0430\u0445, \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0430\u0445, \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u0445, \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0445 \u043a \u043d\u0435\u043c\u0443, \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p>3. \u041c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f (\u0438\u043d\u044a\u0435\u043a\u0446\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430) \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 <code>target<\/code> \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u0432 \u043d\u0435\u0433\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 (\u0437\u043d\u0430\u043a <code>$<\/code> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0437\u043e\u0432\u0430 <code>source.name()<\/code> \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u043b\u0441\u044f \u0432 \u0438\u043d\u044a\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434):<\/p>\n<pre><code class=\"cpp\">->(target) { virtual ~(source.name()$)() noexcept { } }<\/code><\/pre>\n<p>\u0410 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u2014 \u043f\u043e\u043b\u0435 <code>value<\/code>\u0442\u0438\u043f\u0430 <code>int<\/code>:<\/p>\n<pre><code class=\"cpp\">->(target) { int value; }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0441\u043c\u044b\u0441\u043b\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<p>\u041e\u043d \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>interface<\/code>:<\/p>\n<pre><code class=\"cpp\">constexpr void interface(meta::type target, const meta::type source) {<\/code><\/pre>\n<p>\u041a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0434\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438, \u0435\u0441\u043b\u0438 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u0430\u043a\u0438\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u043e\u043b\u044f:<\/p>\n<pre><code class=\"cpp\">compiler.require(source.variables().empty(), \"interfaces may not contain data\");<\/code><\/pre>\n<p>\u0418\u0442\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e \u0432\u0441\u0435\u043c \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430\u043c (\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u044b\u043c \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e, \u0442\u0430\u043a \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0445 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c), \u0432\u044b\u0434\u0430\u0432\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0443, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f <code>copy<\/code>\/<code>move <\/code>\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430\u043c\u0438 \u0438\u043b\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"cpp\">for (auto f: source.functions()) { compiler.require(!f.is_copy() &amp;&amp; !f.is_move(), \"interfaces may not copy or move; consider a virtual clone() instead\");<\/code><\/pre>\n<p> \u041f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u044f \u0438\u043c, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u044f\u0432\u043d\u043e \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043b \u0438\u0445 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, <code>public<\/code> \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440:<\/p>\n<pre><code class=\"cpp\">    if (!f.has_access()) f.make_public();<\/code><\/pre>\n<p>\u0418 \u0432\u044b\u0434\u0430\u0432\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0443, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u043a\u0430\u043a <code>public<\/code>, \u0430 \u043a\u0430\u043a <code>private <\/code>\u0438\u043b\u0438 <code>protected<\/code>:<\/p>\n<pre><code class=\"cpp\">    compiler.require(f.is_public(), \"interface functions must be public\");<\/code><\/pre>\n<p>\u0414\u0435\u043b\u0430\u044f \u0438\u0445 \u0447\u0438\u0441\u0442\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c\u0438:<\/p>\n<pre><code class=\"cpp\">    f.make_pure_virtual();<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u0438\u0445 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043a\u043b\u0430\u0441\u0441 <code>target<\/code> (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043f\u0443\u0441\u0442\u044b\u043c):<\/p>\n<pre><code class=\"cpp\">    ->(target) f;<\/code><\/pre>\n<p>\u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u0440\u043e\u0438\u0442\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0432\u0448\u0438\u0441\u044c \u043f\u043e \u0432\u0441\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0430\u043c, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 target \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0441 \u043f\u0443\u0441\u0442\u044b\u043c \u0442\u0435\u043b\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">  ->(target) { virtual ~(source.name()$)() noexcept { } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">interface Shape { int area() const; void scale_by(double factor); };<\/code><\/pre>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440, \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0432 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u044d\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435, \u0432\u0432\u0438\u0434\u0443 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b\u0438 \u043a \u043d\u0435\u043c\u0443 \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441, \u043f\u0435\u0440\u0435\u0434\u0430\u0441\u0442 \u043d\u0430\u0448 \u043a\u043b\u0430\u0441\u0441 <code>Shape<\/code> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 <code>source<\/code> \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0443\u044e \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441 <code>interface<\/code>, \u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 <code>target<\/code> \u043f\u0435\u0440\u0435\u0434\u0430\u0441\u0442 \u0442\u0438\u043f, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u043f\u0443\u0441\u0442\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 (\u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0431\u043b\u0430\u0434\u0430\u044e\u0449\u0438\u0439 \u0442\u0435\u043c \u0436\u0435 \u0438\u043c\u0435\u043d\u0435\u043c, \u0447\u0442\u043e \u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439).<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f, \u043e\u043d \u0437\u0430\u043c\u0435\u043d\u0438\u0442 \u043d\u0430\u0448 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>interface<\/code> \u043a\u0430\u043a <code>target<\/code>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441 \u043f\u043e\u043f\u0440\u043e\u0441\u0442\u0443 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 (\u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0438 \u043d\u0438\u0436\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u044b):<\/p>\n<pre><code class=\"cpp\">class Shape { public:   virtual int area() const = 0;   virtual void scale_by(double factor) = 0;   virtual ~Shape() { } };<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u044f\u0441\u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b: \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441 \u0431\u0438\u0442\u043e\u0432\u043e\u0439 \u043c\u0430\u0441\u043a\u0438, \u0438\u0437\u0431\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043e\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043e\u043d \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0438\u0445 \u0441\u0430\u043c.<\/p>\n<p>\u0415\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">\/\/ \u0412 \u043a\u043e\u0434\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 bitmask perm_options: unsigned char { auto replace, add, remove, nofollow; }  \/\/ \u0412 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u0436\u0435 \u043a\u043e\u0434\u0435 \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a \u0436\u0435 \/\/ \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 perm_options \u0441 \u043a\u0443\u0447\u0435\u0439 \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442\u0430 \/\/ \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u0432\u0435\u0441\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0437\u0430 \u043d\u0430\u0441  perm_options options = (perm_options::add | perm_options::remove) &amp; (~perm_options::replace);<\/code><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u0439 \u0440\u0430\u0434\u043e\u0441\u0442\u043d\u043e\u0439 \u043d\u043e\u0442\u0435 (\u043c\u044b \u043d\u0430\u0448\u043b\u0438 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u0435\u0434\u0443\u0431\u043b\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432-\u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043c\u0430\u0441\u043e\u043a: <a href=\"https:\/\/github.com\/PatriotRossii\/metaclasses-article\/blob\/master\/metaclass_impl_comparison.md\" rel=\"noopener noreferrer nofollow\">\u0441\u0440\u0430\u0432\u043d\u0438\u0442\u0435 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b, \u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u044b\u0439 \u0435\u043c\u0443 \u043a\u043e\u0434, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441\u0430\u043c \u043b\u0438\u0448\u0435\u043d\u043d\u044b\u0439 \u0432\u0441\u044f\u043a\u043e\u0433\u043e \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442\u0430<\/a>) \u043c\u044b \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043c \u043d\u0430\u0448\u0435 \u0441\u043a\u0440\u043e\u043c\u043d\u043e\u0435 \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0436\u0435 \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441\u0430 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0443\u043f\u0440\u0430\u0436\u043d\u0435\u043d\u0438\u044f \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e.<\/p>\n<\/p>\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\/articles\/685644\/\"> https:\/\/habr.com\/ru\/articles\/685644\/<\/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-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f C++ \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043d\u0430\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0435\u0441\u043b\u0438 \u043d\u0435 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438, \u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0438\u043c\u0438.<\/p>\n<p>\u0422\u0430\u043a, \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0432\u0432\u043e\u0434\u0438\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 <em>\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 <\/em><a href=\"https:\/\/en.cppreference.com\/w\/cpp\/named_req\/BitmaskType\" rel=\"noopener noreferrer nofollow\">BitmaskType<\/a>, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043a\u0430\u043a\u0438\u043c\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0431\u043b\u0430\u0434\u0430\u0442\u044c \u0431\u0438\u0442\u043e\u0432\u044b\u0435 \u043c\u0430\u0441\u043a\u0438 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435: \u0434\u043b\u044f \u043d\u0438\u0445 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u00ab\u0438\u00bb, \u00ab\u0438\u043b\u0438\u00bb, \u00ab\u043d\u0435\u00bb, \u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>0<\/code> \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0443\u0441\u0442\u0443\u044e \u043c\u0430\u0441\u043a\u0443.<\/p>\n<p>\u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043e\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f, \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e: <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/utility\/chars_format\" rel=\"noopener noreferrer nofollow\">std::chars_format<\/a>, <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/thread\/launch\" rel=\"noopener noreferrer nofollow\">std::launch<\/a>, <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/filesystem\/perms\" rel=\"noopener noreferrer nofollow\">std::filesystem::perms<\/a>, <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/filesystem\/perm_options\" rel=\"noopener noreferrer nofollow\">std::filesystem::perm_options<\/a>, <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/filesystem\/copy_options\" rel=\"noopener noreferrer nofollow\">std::filesystem::copy_options<\/a>, <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/filesystem\/directory_options\" rel=\"noopener noreferrer nofollow\">std::filesystem::directory_options<\/a>&#8230; \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0447\u0435\u043c \u043e\u043d\u0438 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u2014 \u044d\u0442\u043e \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0436\u0435 \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430\u0434 \u043d\u0438\u043c\u0438 \u043f\u043e\u0445\u043e\u0436\u0438 \u043a\u0430\u043a \u0434\u0432\u0435 \u043a\u0430\u043f\u043b\u0438 \u0432\u043e\u0434\u044b.<\/p>\n<p>\u0421\u0440\u0430\u0432\u043d\u0438\u0442\u0435 \u0441\u0430\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0434\u043b\u044f <code>perms<\/code>, <code>directory_options<\/code> \u0438 <code>perm_options<\/code> (\u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0432\u0437\u044f\u0442\u044b \u0438\u0437 <a href=\"https:\/\/github.com\/llvm\/llvm-project\/tree\/main\/libcxx\" rel=\"noopener noreferrer nofollow\">libc++<\/a> \u2014 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0441\u0430\u043c\u043e\u0439 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438): <a href=\"https:\/\/github.com\/PatriotRossii\/metaclasses-article\/blob\/master\/impl_comparison.md\" rel=\"noopener noreferrer nofollow\">comparison table<\/a>. \u041e\u043d\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b \u043e\u0434\u0438\u043d \u0432 \u043e\u0434\u0438\u043d \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u044b (<em>underlying type<\/em> \u0443 <code>enum class<\/code>). \u0418\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u2014 \u0447\u0438\u0441\u0442\u044b\u0439 \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u043d\u0435 \u043c\u043e\u0433\u0443 \u043d\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0430\u0448\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 <em>\u043d\u0435\u0434\u043e\u0447\u0435\u0442, \u0437\u0430\u043a\u0440\u0430\u0432\u0448\u0438\u0439\u0441\u044f \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0434\u043b\u044f perm_options <\/em>\u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0430: \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 <em>underlying type<\/em> \u0434\u043b\u044f <code>perm_options<\/code> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d <code>unsigned char<\/code>, \u0430 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043c\u044b \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 (\u0432 <code>static_cast<\/code>) \u043a <code>unsigned<\/code> (<code>unsigned int<\/code>). \u042d\u0442\u043e \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u043e\u0439, \u043d\u043e \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u0432 \u0437\u0430\u0431\u043b\u0443\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0433\u043e \u0441 \u0434\u0430\u043d\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432 \u043f\u043b\u044e\u0441\u0430\u0445 <strong>\u043d\u0435\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u0430<\/strong><em> <\/em>\u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442. \u041d\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435, \u043d\u0438 \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u043f\u043e\u043c\u043e\u0449\u043d\u0438\u043a.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0435 (<a href=\"https:\/\/www.open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2018\/p0707r3.pdf\" rel=\"noopener noreferrer nofollow\">P0707R3<\/a>) <a href=\"https:\/\/isocpp.org\/wiki\/faq\/wg21#herb-sutter\" rel=\"noopener noreferrer nofollow\">\u0413\u0435\u0440\u0431\u043e\u043c \u0421\u0430\u0442\u0442\u0435\u0440\u043e\u043c, \u043f\u0440\u0435\u0434\u0441\u0435\u0434\u0430\u0442\u0435\u043b\u0435\u043c \u0441\u043e\u0432\u0435\u0442\u0430 \u043f\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u0438 C++<\/a> \u2014 <em>\u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441\u044b, <\/em>\u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0430\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430<em>.<\/em><\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435:<\/p>\n<pre><code class=\"cpp\">\/\/ \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441\u0430 constexpr void interface(meta::type target, const meta::type source) {   compiler.require(source.variables().empty(), \"interfaces may not contain data\");   for (auto f: source.functions()) {     compiler.require(!f.is_copy() &amp;&amp; !f.is_move(), \"interfaces may not copy or move; consider a virtual clone() instead\");     if (!f.has_access()) f.make_public();     compiler.require(f.is_public(), \"interface functions must be public\");     f.make_pure_virtual();     ->(target) f;   }   ->(target) { virtual ~(source.name()$)() noexcept { } } } \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441\u0430 interface Shape {   int area() const;   void scale_by(double factor); };<\/code><\/pre>\n<p>\u041c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0435\u0439\u0441\u044f \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0435\u0439 \u0434\u0432\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430: <code>target<\/code> \u2014 \u0442\u0438\u043f, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u0438 <code>source<\/code> \u2014 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441:<\/p>\n<pre><code class=\"cpp\">constexpr void interface(meta::type target, const meta::type source) {<\/code><\/pre>\n<p>\u0412 \u043d\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438:<\/p>\n<p>1. \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432\u044b\u0434\u0430\u0441\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043e\u0448\u0438\u0431\u043a\u0443 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \u00abinterfaces may not contain data\u00bb, \u0435\u0441\u043b\u0438 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u043f\u043e\u043b\u044f:<\/p>\n<pre><code class=\"cpp\">compiler.require(source.variables().empty(), \"interfaces may not contain data\");<\/code><\/pre>\n<p>2. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434\u044b \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 <code>source<\/code>. \u0422\u0438\u043f <code>meta::type<\/code> \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043a\u043b\u0430\u0441\u0441\u0435: \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0435\u0433\u043e \u043f\u043e\u043b\u044f\u0445, \u043c\u0435\u0442\u043e\u0434\u0430\u0445, \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0430\u0445, \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u0445, \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0445 \u043a \u043d\u0435\u043c\u0443, \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p>3. \u041c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f (\u0438\u043d\u044a\u0435\u043a\u0446\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430) \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 <code>target<\/code> \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u0432 \u043d\u0435\u0433\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 (\u0437\u043d\u0430\u043a <code>$<\/code> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0437\u043e\u0432\u0430 <code>source.name()<\/code> \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u043b\u0441\u044f \u0432 \u0438\u043d\u044a\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434):<\/p>\n<pre><code class=\"cpp\">->(target) { virtual ~(source.name()$)() noexcept { } }<\/code><\/pre>\n<p>\u0410 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u2014 \u043f\u043e\u043b\u0435 <code>value<\/code>\u0442\u0438\u043f\u0430 <code>int<\/code>:<\/p>\n<pre><code class=\"cpp\">->(target) { int value; }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0441\u043c\u044b\u0441\u043b\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<p>\u041e\u043d \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>interface<\/code>:<\/p>\n<pre><code class=\"cpp\">constexpr void interface(meta::type target, const meta::type source) {<\/code><\/pre>\n<p>\u041a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0434\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438, \u0435\u0441\u043b\u0438 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u0430\u043a\u0438\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u043e\u043b\u044f:<\/p>\n<pre><code class=\"cpp\">compiler.require(source.variables().empty(), \"interfaces may not contain data\");<\/code><\/pre>\n<p>\u0418\u0442\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e \u0432\u0441\u0435\u043c \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430\u043c (\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u044b\u043c \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e, \u0442\u0430\u043a \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0445 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c), \u0432\u044b\u0434\u0430\u0432\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0443, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f <code>copy<\/code>\/<code>move <\/code>\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430\u043c\u0438 \u0438\u043b\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"cpp\">for (auto f: source.functions()) { compiler.require(!f.is_copy() &amp;&amp; !f.is_move(), \"interfaces may not copy or move; consider a virtual clone() instead\");<\/code><\/pre>\n<p> \u041f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u044f \u0438\u043c, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u044f\u0432\u043d\u043e \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043b \u0438\u0445 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, <code>public<\/code> \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440:<\/p>\n<pre><code class=\"cpp\">    if (!f.has_access()) f.make_public();<\/code><\/pre>\n<p>\u0418 \u0432\u044b\u0434\u0430\u0432\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0443, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u043a\u0430\u043a <code>public<\/code>, \u0430 \u043a\u0430\u043a <code>private <\/code>\u0438\u043b\u0438 <code>protected<\/code>:<\/p>\n<pre><code class=\"cpp\">    compiler.require(f.is_public(), \"interface functions must be public\");<\/code><\/pre>\n<p>\u0414\u0435\u043b\u0430\u044f \u0438\u0445 \u0447\u0438\u0441\u0442\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c\u0438:<\/p>\n<pre><code class=\"cpp\">    f.make_pure_virtual();<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u0438\u0445 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043a\u043b\u0430\u0441\u0441 <code>target<\/code> (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043f\u0443\u0441\u0442\u044b\u043c):<\/p>\n<pre><code class=\"cpp\">    ->(target) f;<\/code><\/pre>\n<p>\u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u0440\u043e\u0438\u0442\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0432\u0448\u0438\u0441\u044c \u043f\u043e \u0432\u0441\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0430\u043c, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 target \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0441 \u043f\u0443\u0441\u0442\u044b\u043c \u0442\u0435\u043b\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">  ->(target) { virtual ~(source.name()$)() noexcept { } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">interface Shape { int area() const; void scale_by(double factor); };<\/code><\/pre>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440, \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0432 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u044d\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435, \u0432\u0432\u0438\u0434\u0443 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b\u0438 \u043a \u043d\u0435\u043c\u0443 \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441, \u043f\u0435\u0440\u0435\u0434\u0430\u0441\u0442 \u043d\u0430\u0448 \u043a\u043b\u0430\u0441\u0441 <code>Shape<\/code> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 <code>source<\/code> \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0443\u044e \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441 <code>interface<\/code>, \u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 <code>target<\/code> \u043f\u0435\u0440\u0435\u0434\u0430\u0441\u0442 \u0442\u0438\u043f, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u043f\u0443\u0441\u0442\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 (\u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0431\u043b\u0430\u0434\u0430\u044e\u0449\u0438\u0439 \u0442\u0435\u043c \u0436\u0435 \u0438\u043c\u0435\u043d\u0435\u043c, \u0447\u0442\u043e \u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439).<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f, \u043e\u043d \u0437\u0430\u043c\u0435\u043d\u0438\u0442 \u043d\u0430\u0448 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>interface<\/code> \u043a\u0430\u043a <code>target<\/code>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441 \u043f\u043e\u043f\u0440\u043e\u0441\u0442\u0443 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 (\u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0438 \u043d\u0438\u0436\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u044b):<\/p>\n<pre><code class=\"cpp\">class Shape { public:   virtual int area() const = 0;   virtual void scale_by(double factor) = 0;   virtual ~Shape() { } };<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u044f\u0441\u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b: \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441 \u0431\u0438\u0442\u043e\u0432\u043e\u0439 \u043c\u0430\u0441\u043a\u0438, \u0438\u0437\u0431\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043e\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043e\u043d \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0438\u0445 \u0441\u0430\u043c.<\/p>\n<p>\u0415\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">\/\/ \u0412 \u043a\u043e\u0434\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 bitmask perm_options: unsigned char { auto replace, add, remove, nofollow; }  \/\/ \u0412 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u0436\u0435 \u043a\u043e\u0434\u0435 \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a \u0436\u0435 \/\/ \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 perm_options \u0441 \u043a\u0443\u0447\u0435\u0439 \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442\u0430 \/\/ \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u0432\u0435\u0441\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0437\u0430 \u043d\u0430\u0441  perm_options options = (perm_options::add | perm_options::remove) &amp; (~perm_options::replace);<\/code><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u0439 \u0440\u0430\u0434\u043e\u0441\u0442\u043d\u043e\u0439 \u043d\u043e\u0442\u0435 (\u043c\u044b \u043d\u0430\u0448\u043b\u0438 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u0435\u0434\u0443\u0431\u043b\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432-\u0431\u0438\u0442\u043e\u0432\u044b\u0445 \u043c\u0430\u0441\u043e\u043a: <a href=\"https:\/\/github.com\/PatriotRossii\/metaclasses-article\/blob\/master\/metaclass_impl_comparison.md\" rel=\"noopener noreferrer nofollow\">\u0441\u0440\u0430\u0432\u043d\u0438\u0442\u0435 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b, \u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u044b\u0439 \u0435\u043c\u0443 \u043a\u043e\u0434, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441\u0430\u043c \u043b\u0438\u0448\u0435\u043d\u043d\u044b\u0439 \u0432\u0441\u044f\u043a\u043e\u0433\u043e \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442\u0430<\/a>) \u043c\u044b \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043c \u043d\u0430\u0448\u0435 \u0441\u043a\u0440\u043e\u043c\u043d\u043e\u0435 \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0436\u0435 \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u0430\u043a\u043b\u0430\u0441\u0441\u0430 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0443\u043f\u0440\u0430\u0436\u043d\u0435\u043d\u0438\u044f \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e.<\/p>\n<\/p>\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\/articles\/685644\/\"> https:\/\/habr.com\/ru\/articles\/685644\/<\/a><br \/><\/br><\/br><\/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-393640","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/393640","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=393640"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/393640\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=393640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=393640"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=393640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}