{"id":305275,"date":"2020-06-12T21:00:31","date_gmt":"2020-06-12T21:00:31","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=305275"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=305275","title":{"rendered":"\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 json \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 C++"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/506506\/\">\n<p>\u0412 \u0438\u0434\u0435\u0430\u043b\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0421++<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">struct Person {  std::string name;  int age;  bool student; } person;<\/code><\/pre>\n<p>  <\/p>\n<p>\u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 person \u0432 \u043c\u0435\u0442\u043e\u0434 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 json_data<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">map_json_to_struct(person, json_data)<\/code><\/pre>\n<p>  <\/p>\n<p>\u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">std::cout &lt;&lt; person.name &lt;&lt; &quot; : &quot; &lt;&lt; person.age;<\/code><\/pre>\n<p>  <\/p>\n<p>StructMapping \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u0414\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f, \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043a \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c\u0443 \u0432\u044b\u0448\u0435, StructMapping \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0441\u043e\u0431\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u043b\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b.<\/p>\n<p>  <\/p>\n<h1 id=\"realizaciya-scenariya-so-strukturoy-person\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u0441\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 Person<\/h1>\n<p>  <\/p>\n<pre><code class=\"cpp\">#define MANAGED_STRUCT_NAME Person \/\/ \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043c\u0430\u043a\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0434\u0430\u0435\u0442 \u0438\u043c\u044f                                    \/\/ \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b BEGIN_MANAGED_STRUCT               \/\/ \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043d\u0430\u0447\u0430\u043b\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b  MANAGED_FIELD(std::string, name)   \/\/ \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u0435 \u0441 \u0442\u0438\u043f\u043e\u043c 'std::string'\u0438 \u0438\u043c\u0435\u043d\u0435\u043c                                    \/\/ 'name' MANAGED_FIELD(int, age)            \/\/ \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u0435 \u0441 \u0442\u0438\u043f\u043e\u043c 'int' \u0438 \u0438\u043c\u0435\u043d\u0435\u043c 'age' MANAGED_FIELD(bool, student)       \/\/ \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u0435 \u0441 \u0442\u0438\u043f\u043e\u043c 'bool' \u0438 \u0438\u043c\u0435\u043d\u0435\u043c                                    \/\/ 'student'  END_MANAGED_STRUCT                 \/\/ \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043a\u043e\u043d\u0435\u0446 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b #undef MANAGED_STRUCT_NAME         \/\/ \u0443\u0431\u0438\u0440\u0430\u0435\u043c \u043c\u0430\u043a\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0434\u0430\u0432\u0430\u043b \u0438\u043c\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b,                                    \/\/ \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u0432\u0430\u0440\u043d\u0438\u043d\u0433\u043e\u0432 \u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438                                    \/\/ \u043c\u0430\u043a\u0440\u043e\u0441\u0430 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c<\/code><\/pre>\n<p>  <\/p>\n<p>\u0441\u043e\u0437\u0434\u0430\u0435\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">Person person;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0437\u0430\u0434\u0430\u0435\u043c json \u0434\u0430\u043d\u043d\u044b\u0435<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">std::istringstream json_data(R&quot;json( {  &quot;name&quot;: &quot;Jeebs&quot;,  &quot;age&quot;: 42,  &quot;student&quot;: true } )json&quot;);<\/code><\/pre>\n<p>  <\/p>\n<p>\u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 person \u0432 \u043c\u0435\u0442\u043e\u0434 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 json<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">struct_mapping::mapper::map_json_to_struct(person, json_data);<\/code><\/pre>\n<p>  <\/p>\n<p>\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">std::cout &lt;&lt; person.name &lt;&lt; &quot; : &quot; &lt;&lt; person.age;<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043a\u043e\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#include &lt;iostream&gt; #include &lt;sstream&gt;  #include &quot;struct_mapping\/struct_mapping.h&quot;  #define MANAGED_STRUCT_NAME Person BEGIN_MANAGED_STRUCT  MANAGED_FIELD(std::string, name) MANAGED_FIELD(int, age) MANAGED_FIELD(bool, student)  END_MANAGED_STRUCT #undef MANAGED_STRUCT_NAME  int main() {  Person person;   std::istringstream json_data(R&quot;json(   {    &quot;name&quot;: &quot;Jeebs&quot;,    &quot;age&quot;: 42,    &quot;student&quot;: true   }  )json&quot;);   struct_mapping::mapper::map_json_to_struct(person, json_data);   std::cout &lt;&lt;   person.name &lt;&lt; &quot; : &quot; &lt;&lt;   person.age &lt;&lt; &quot; : &quot; &lt;&lt;   std::boolalpha &lt;&lt; person.student &lt;&lt;   std::endl; }<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<h1 id=\"dopolnitelnye-tipy-poley\">\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u043f\u043e\u043b\u0435\u0439<\/h1>\n<p>  <\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 (\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435, \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0438 \u0441\u0442\u0440\u043e\u043a\u0438) \u043f\u043e\u043b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0430\u043a \u0436\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">MANAGED_FIELD_STRUCT(\u0442\u0438\u043f \u043f\u043e\u043b\u044f, \u0438\u043c\u044f \u043f\u043e\u043b\u044f)<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#define MANAGED_STRUCT_NAME President &lt;-- \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 President BEGIN_MANAGED_STRUCT  MANAGED_FIELD(std::string, name) MANAGED_FIELD(double, mass)  END_MANAGED_STRUCT #undef MANAGED_STRUCT_NAME  #define MANAGED_STRUCT_NAME Earth BEGIN_MANAGED_STRUCT  MANAGED_FIELD_STRUCT(President, president) &lt;-- \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u0435 \u0441 \u0442\u0438\u043f\u043e\u043c President  END_MANAGED_STRUCT #undef MANAGED_STRUCT_NAME<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u0438\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">MANAGED_FIELD_ARRAY(\u0442\u0438\u043f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0438\u043c\u044f \u043f\u043e\u043b\u044f)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0442\u044c<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">MANAGED_FIELD_ARRAY(MANAGED_ARRAY(MANAGED_ARRAY(std::string)), planet_groups)<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#define MANAGED_STRUCT_NAME MiB BEGIN_MANAGED_STRUCT  MANAGED_FIELD_ARRAY(std::string, friends) MANAGED_FIELD_ARRAY(MANAGED_ARRAY(std::string), alien_groups) MANAGED_FIELD_ARRAY(MANAGED_ARRAY(MANAGED_ARRAY(std::string)), planet_groups)  END_MANAGED_STRUCT #undef MANAGED_STRUCT_NAME<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<h1 id=\"kak-eto-rabotaet\">\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/h1>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 json \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441++. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0441++ \u2014 \u044d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u043f\u043e\u043b\u0435\u0439. \u041a\u0430\u0436\u0434\u043e\u0435 \u043f\u043e\u043b\u0435 \u0438\u043c\u0435\u0435\u0442 \u0438\u043c\u044f \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441++ \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442\u0441\u044f json \u043e\u0431\u044a\u0435\u043a\u0442\u044b. \u0412 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0441++ \u0442\u0438\u043f\u044b \u043f\u043e\u043b\u0435\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0442\u0438\u043f\u0430\u043c json \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>bool \u2014 \u0445\u0440\u0430\u043d\u0438\u0442 json \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 true \u0438\u043b\u0438 false<\/li>\n<li>integral \u0438\u043b\u0438 floating point \u2014 \u0445\u0440\u0430\u043d\u0438\u0442 json \u0447\u0438\u0441\u043b\u043e<\/li>\n<li>std::string \u2014 \u0445\u0440\u0430\u043d\u0438\u0442 json \u0441\u0442\u0440\u043e\u043a\u0443<\/li>\n<li>\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u2014 \u0445\u0440\u0430\u043d\u0438\u0442 json \u043e\u0431\u044a\u0435\u043a\u0442<\/li>\n<li>\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u2014 \u0445\u0440\u0430\u043d\u0438\u0442 json \u043c\u0430\u0441\u0441\u0438\u0432<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043f\u0430\u0440\u0441\u0435\u0440 json \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b.<\/p>\n<p>  <\/p>\n<h3 id=\"parser-json\">\u041f\u0430\u0440\u0441\u0435\u0440 json<\/h3>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043f\u0430\u0440\u0441\u0435\u0440\u0430 \u0435\u043c\u0443 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0430\u0440\u0441\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u044b:<\/p>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th>\u0444\u0443\u043d\u043a\u0446\u0438\u044f<\/th>\n<th>\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>set_bool<\/td>\n<td>\u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/td>\n<\/tr>\n<tr>\n<td>set_integral<\/td>\n<td>\u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/td>\n<\/tr>\n<tr>\n<td>set_floating_point<\/td>\n<td>\u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u043a\u043e\u0439<\/td>\n<\/tr>\n<tr>\n<td>set_string<\/td>\n<td>\u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/td>\n<\/tr>\n<tr>\n<td>start_struct<\/td>\n<td>\u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 json \u043e\u0431\u044a\u0435\u043a\u0442\u0430<\/td>\n<\/tr>\n<tr>\n<td>end_struct<\/td>\n<td>\u0434\u043b\u044f \u043a\u043e\u043d\u0446\u0430 json \u043e\u0431\u044a\u0435\u043a\u0442\u0430<\/td>\n<\/tr>\n<tr>\n<td>start_array<\/td>\n<td>\u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 json \u043c\u0430\u0441\u0441\u0438\u0432\u0430<\/td>\n<\/tr>\n<tr>\n<td>end_array<\/td>\n<td>\u0434\u043b\u044f \u043a\u043e\u043d\u0446\u0430 json \u043c\u0430\u0441\u0441\u0438\u0432\u0430<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f json \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\"> {   &quot;price&quot;: 273,   &quot;author&quot;: {    &quot;name&quot;: &quot;bk192077&quot;   },   &quot;chapters&quot;: [    &quot;launch&quot;,    &quot;new horizons&quot;   ]  }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u043e\u0432<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">start_struct(&quot;&quot;) set_integral(&quot;price&quot;, 273) start_struct(&quot;author&quot;) set_string(&quot;name&quot;, &quot;bk192077&quot;) end_struct() start_array(&quot;chapters&quot;) set_string(&quot;&quot;, &quot;launch&quot;) set_string(&quot;&quot;, &quot;new horizons&quot;) end_array() end_struct()<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"upravlyaemye-struktury\">\u0423\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b<\/h3>\n<p>  <\/p>\n<p>\u041e\u0431\u0449\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u0430\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0438\u043c\u0435\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e (use_name), \u0445\u0440\u0430\u043d\u044f\u0449\u0443\u044e \u0438\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u043f\u043e\u043b\u044f. \u0415\u0441\u043b\u0438 use_name \u043d\u0435 \u043f\u0443\u0441\u0442\u0430\u044f, \u0442\u043e \u043e\u043d\u0430 \u0445\u0440\u0430\u043d\u0438\u0442 \u0438\u043c\u044f \u043f\u043e\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u0443\u0434\u0443\u0442 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043e\u0442 \u043f\u0430\u0440\u0441\u0435\u0440\u0430. \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e use_name \u043f\u0443\u0441\u0442\u0430\u044f (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u043f\u043e\u043b\u0435\u0439 \u043d\u0435\u0442).<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0435\u0441\u043b\u0438 \u043f\u0440\u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0447\u0430\u043b\u043e json \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438\u043b\u0438 json \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0442\u043e:<br \/> \n<ul>\n<li>\u0435\u0441\u043b\u0438 use_name \u043f\u0443\u0441\u0442\u0430\u044f, \u0442\u043e \u0432 \u043d\u0435\u0435 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0438\u043c\u044f \u043f\u043e\u043b\u044f, \u043f\u0430\u0440\u0441\u0438\u043d\u0433 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u044b\u043b \u043d\u0430\u0447\u0430\u0442<\/li>\n<li>\u0435\u0441\u043b\u0438 use_name \u043d\u0435 \u043f\u0443\u0441\u0442\u0430\u044f, \u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044e, \u0438\u043c\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 use_name<\/li>\n<\/ul>\n<\/li>\n<li>\u0435\u0441\u043b\u0438 \u043f\u0440\u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0435\u0446 json \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438\u043b\u0438 json \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0442\u043e:<br \/> \n<ul>\n<li>\u0435\u0441\u043b\u0438 use_name \u043f\u0443\u0441\u0442\u0430\u044f, \u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442<\/li>\n<li>\u0435\u0441\u043b\u0438 use_name \u043d\u0435 \u043f\u0443\u0441\u0442\u0430\u044f, \u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044e, \u0438\u043c\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 use_name. \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043b\u0435 \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u043f\u0440\u0438\u0437\u043d\u0430\u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u043e use_name \u043e\u0447\u0438\u0449\u0430\u0435\u0442\u0441\u044f<\/li>\n<\/ul>\n<\/li>\n<li>\u0435\u0441\u043b\u0438 \u043f\u0440\u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0442\u043e:<br \/> \n<ul>\n<li>\u0435\u0441\u043b\u0438 use_name \u043f\u0443\u0441\u0442\u0430\u044f, \u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043f\u043e \u0438\u043c\u0435\u043d\u0438 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044f (\u0430 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432)<\/li>\n<li>\u0435\u0441\u043b\u0438 use_name \u043d\u0435 \u043f\u0443\u0441\u0442\u0430\u044f, \u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044e, \u0438\u043c\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 use_name<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">void set(std::string const &amp;, bool) {...} void set(std::string const &amp;, long long) {...} void set(std::string const &amp;, double) {...} void set(std::string const &amp;, std::string const &amp;) {...} void use(std::string const &amp;) {...} bool release() {...}<\/code><\/pre>\n<p>  <\/p>\n<p>\u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u044d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0430\u0440\u0441\u0435\u0440\u043e\u043c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438<\/p>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th>\u043f\u0430\u0440\u0441\u0435\u0440<\/th>\n<th>\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>set_bool<\/td>\n<td>set(std::string const &amp;, bool)<\/td>\n<\/tr>\n<tr>\n<td>set_integral<\/td>\n<td>set(std::string const &amp;, long long)<\/td>\n<\/tr>\n<tr>\n<td>set_floating_point<\/td>\n<td>set(std::string const &amp;, double)<\/td>\n<\/tr>\n<tr>\n<td>set_string<\/td>\n<td>set(std::string const &amp;, std::string const &amp;)<\/td>\n<\/tr>\n<tr>\n<td>start_struct<\/td>\n<td>use(std::string const &amp;)<\/td>\n<\/tr>\n<tr>\n<td>end_struct<\/td>\n<td>release()<\/td>\n<\/tr>\n<tr>\n<td>start_array<\/td>\n<td>use(std::string const &amp;)<\/td>\n<\/tr>\n<tr>\n<td>end_array<\/td>\n<td>release()<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f <code>Person<\/code><\/p>\n<p>  <\/p>\n<p>\u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>set<\/code> (\u043f\u043e\u0447\u0442\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b \u043f\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0435\u043d\u044b \u043f\u043e \u0442\u0438\u043f\u0443 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f)<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">void set(std::string const &amp; field_name, bool value) {  if (use_name.empty()) {   \/\/ \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b   Fs_set_field&lt;std::function&lt;void(Person&amp;, bool)&gt;&gt;::fs[field_name](*this, value);  } else {   \/\/ \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043f\u043e\u043b\u044e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043e \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0435   Fs_set&lt;std::function&lt;void(Person&amp;, std::string const &amp;, bool)&gt;&gt;    ::fs[use_name](*this, field_name, value);  } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>use<\/code> (\u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u0441\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0431\u0443\u0434\u0443\u0442 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u043b\u044e field_name)<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">void use(std::string const &amp; field_name) {  if (use_name.empty()) {   \/\/ \u043f\u043e\u043b\u0435 field_name \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u043c   use_name = field_name;  } else {   \/\/ \u0432\u044b\u0437\u043e\u0432 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u044e use_name   Fs_use&lt;std::function&lt;void(Person&amp;, std::string const &amp;)&gt;&gt;    ::fs[use_name](*this, field_name);  } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>release<\/code> (\u0438\u0437 \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442)<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">bool release() {  \/\/ \u044d\u0442\u043e \u0431\u044b\u043b\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f  if (use_name.empty()) return true;   if (Fs_release&lt;std::function&lt;bool(Person&amp;)&gt;&gt;::fs[use_name](*this)) {   use_name.clear();  }   \/\/ \u044d\u0442\u043e \u0431\u044b\u043b\u0430 \u043d\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f  return false; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u041f\u0435\u0440\u0435\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0438\u0435 \u043e\u0442 \u0442\u0438\u043f\u0430 \u043f\u043e\u043b\u044f.<\/p>\n<p>  <\/p>\n<h4 id=\"dlya-prostyh-tipov\">\u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0442\u0438\u043f\u043e\u0432<\/h4>\n<p>  <\/p>\n<p>\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044f \u043f\u043e \u0438\u043c\u0435\u043d\u0438 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <code>Person<\/code> \u0438 \u043f\u043e\u043b\u044f <code>age<\/code> \u0442\u0438\u043f\u0430 <code>int<\/code><\/p>\n<p>  <\/p>\n<p><em>(\u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043c\u0430\u043a\u0440\u043e\u0441\u0430)<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">int age = [] {  using value_type =   std::conditional_t&lt;std::is_same_v&lt;bool, bool&gt;, bool,    std::conditional_t&lt;std::is_same_v&lt;std::string, bool&gt;, std::string const &amp;,     std::conditional_t&lt;std::is_floating_point_v&lt;bool&gt;, double, long long&gt;&gt;&gt;;      Fs_set_field&lt;std::function&lt;void(Person&amp;, value_type)&gt;&gt;::add(   &quot;age&quot;,   [] (Person &amp; o, value_type value) {    o.age = static_cast&lt;bool&gt;(value);   });   using USING_bool = bool;  return USING_bool{}; }();<\/code><\/pre>\n<p>  <\/p>\n<p>\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">o.age = static_cast&lt;bool&gt;(value);<\/code><\/pre>\n<p>  <\/p>\n<p>\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b. \u0412 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u043e\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 gcc, \u0434\u043b\u044f clang \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">bool Person::*p= &amp;Person::age; o.*p = static_cast&lt;bool&gt;(value);     <\/code><\/pre>\n<p>  <\/p>\n<p><em>(\u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e clang \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u0430 gcc \u043f\u0430\u0434\u0430\u0435\u0442 \u043f\u043e ICE \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435)<\/em><\/p>\n<p>  <\/p>\n<h4 id=\"dlya-struktur-i-massivov\">\u0434\u043b\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432<\/h4>\n<p>  <\/p>\n<p>\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0448\u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0442\u0430\u043a\u0443\u044e \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <code>Earth<\/code> \u0438 \u043f\u043e\u043b\u044f <code>president<\/code> \u0442\u0438\u043f\u0430 <code>President<\/code><\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">President president = [] {  Fs_set&lt;std::function&lt;void(Earth&amp;, std::string const &amp;, bool)&gt;&gt;::add(   &quot;president&quot;,   [] (Earth &amp; o, std::string const &amp; field_name, bool value) {    o.president.set(field_name, value);   });   Fs_set&lt;std::function&lt;void(Earth&amp;, std::string const &amp;, double)&gt;&gt;::add(   &quot;president&quot;,   [] (Earth &amp; o, std::string const &amp; field_name, double value) {    o.president.set(field_name, value);  });   Fs_set&lt;std::function&lt;void(Earth&amp;, std::string const &amp;, long long)&gt;&gt;::add(   &quot;president&quot;,   [] (Earth &amp; o, std::string const &amp; field_name, long long value) {    o.president.set(field_name, value);   });   Fs_set&lt;std::function&lt;void(Earth&amp;, std::string const &amp;, std::string const &amp;)&gt;&gt;::add(   &quot;president&quot;,   [] (Earth &amp; o, std::string const &amp; field_name, std::string const &amp; value) {    o.president.set(field_name, value);   });   Fs_use&lt;std::function&lt;void(Earth&amp;, std::string const &amp;)&gt;&gt;::add(   &quot;president&quot;,   [] (Earth &amp; o, std::string const &amp; name) {    o.president.use(name);   });   Fs_release&lt;std::function&lt;bool(Earth&amp;)&gt;&gt;::add(   &quot;president&quot;,   [] (Earth &amp; o) {    return o.president.release();   });   using USING_President = President;  return USING_President{}; }();<\/code><\/pre>\n<p>  <\/p>\n<p>\u0434\u043b\u044f clang, \u043e\u043f\u044f\u0442\u044c \u0436\u0435, \u0432\u043c\u0435\u0441\u0442\u043e<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">o.president.set(field_name, value);<\/code><\/pre>\n<p>  <\/p>\n<p>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">President Earth::*p = &amp;Earth::president; auto&amp; pp = o.*p; pp.set(field_name, value);<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"kak-vse-budet-rabotat-na-primere-sleduyuschego-koda\">\u043a\u0430\u043a \u0432\u0441\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430<\/h3>\n<p>  <\/p>\n<pre><code class=\"cpp\">#include &lt;sstream&gt;  #include &quot;struct_mapping\/struct_mapping.h&quot;  #define MANAGED_STRUCT_NAME Author BEGIN_MANAGED_STRUCT  MANAGED_FIELD(std::string, name)  END_MANAGED_STRUCT #undef MANAGED_STRUCT_NAME  #define MANAGED_STRUCT_NAME Book BEGIN_MANAGED_STRUCT  MANAGED_FIELD(int, price) MANAGED_FIELD_STRUCT(Author, author) MANAGED_FIELD_ARRAY(std::string, chapters)  END_MANAGED_STRUCT #undef MANAGED_STRUCT_NAME  int main() {  Book white_space;   std::istringstream json_data(R&quot;json(   {    &quot;price&quot;: 273,    &quot;author&quot;: {     &quot;name&quot;: &quot;bk192077&quot;    },    &quot;chapters&quot;: [     &quot;launch&quot;,     &quot;new horizons&quot;    ]   }  )json&quot;);   struct_mapping::mapper::map_json_to_struct(white_space, json_data); }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"pri-kompilyacii\">\u043f\u0440\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438<\/h4>\n<p>  <\/p>\n<p>\u043a\u043e\u0434<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#define MANAGED_STRUCT_NAME Author BEGIN_MANAGED_STRUCT  MANAGED_FIELD(std::string, name)  END_MANAGED_STRUCT #undef MANAGED_STRUCT_NAME<\/code><\/pre>\n<p>  <\/p>\n<p>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">struct Author {  void set(std::string const &amp;, bool) {...}  void set(std::string const &amp;, std::string &amp;) {...}  void set(std::string const &amp;, long long) {...}  void set(std::string const &amp;, double) {...}  void use(std::string const &amp;) {...}  bool release() {...}   std::string name; };<\/code><\/pre>\n<p>  <\/p>\n<p>\u043f\u043e\u043b\u0435 <code>name<\/code> \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439. \u0414\u043e \u044d\u0442\u043e\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 Fs_set_field \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">Fs_set_field&lt;std::function&lt;void(Author &amp;, std::string const &amp;)&gt;&gt;::add(  &quot;name&quot;,  [] (Author &amp; o, std::string cont &amp; value) {   o.name = value;  });<\/code><\/pre>\n<p>  <\/p>\n<p>\u043a\u043e\u0434<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#define MANAGED_STRUCT_NAME Book BEGIN_MANAGED_STRUCT  MANAGED_FIELD(int, price) MANAGED_FIELD_STRUCT(Author, author) MANAGED_FIELD_ARRAY(std::string, chapters)  END_MANAGED_STRUCT #undef MANAGED_STRUCT_NAME<\/code><\/pre>\n<p>  <\/p>\n<p>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">struct Book {  void set(std::string const &amp;, bool) {...}  void set(std::string const &amp;, std::string &amp;) {...}  void set(std::string const &amp;, long long) {...}  void set(std::string const &amp;, double) {...}  void use(std::string const &amp;) {...}  bool release() {...}   int price;  Author author;  ManagedArray&lt;std::string&gt; chapters; };<\/code><\/pre>\n<p>  <\/p>\n<p>\u043f\u043e\u043b\u0435 <code>price<\/code> \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043d\u0443\u043b\u0435\u043c. \u0414\u043e \u044d\u0442\u043e\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 Fs_set_field \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">Fs_set_field&lt;std::function&lt;void(Book &amp;, long long)&gt;&gt;::add(  &quot;price&quot;,  [] (Book &amp; o, long long value) {   o.price = static_cast&lt;int&gt;(value);  });<\/code><\/pre>\n<p>  <\/p>\n<p>\u043f\u043e\u043b\u0435 <code>author<\/code> \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e Author. \u0414\u043e \u044d\u0442\u043e\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u043a\u043b\u0430\u0441\u0441\u043e\u0432 Fs_ \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">Fs_set&lt;std::function&lt;void(Book &amp;, std::string const &amp;, bool)&gt;&gt;::add(  &quot;author&quot;,  [] (Book &amp; o, std::string const &amp; field_name, bool value) {   o.author.set(field_name, value);  });  Fs_set&lt;std::function&lt;void(Book &amp;, std::string const &amp;, double)&gt;&gt;::add(  &quot;author&quot;,  [] (Book &amp; o, std::string const &amp; field_name, double value) {   o.author.set(field_name, value);  });  Fs_set&lt;std::function&lt;void(Book &amp;, std::string const &amp;, long long)&gt;&gt;::add(  &quot;author&quot;,  [] (Book &amp; o, std::string const &amp; field_name, long long value) {   o.author.set(field_name, value);  });  Fs_set&lt;std::function&lt;void(Book &amp;, std::string const &amp;, std::string cont &amp;)&gt;&gt;::add(  &quot;author&quot;,  [] (Book &amp; o, std::string const &amp; field_name, std::string cont &amp; value) {   o.author.set(field_name, value);  });  Fs_use&lt;std::function&lt;void(Book &amp;, std::string const &amp;)&gt;&gt;::add(  &quot;author&quot;,  [] (Book &amp; o, std::string const &amp; name) {   o.author.use(name);  });  Fs_release&lt;std::function&lt;bool(Book &amp;)&gt;&gt;::add(  &quot;author&quot;,  [] (Book &amp; o) {   return o.author.release();  });<\/code><\/pre>\n<p>  <\/p>\n<p>\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043f\u043e\u043b\u0435\u043c <code>chapters<\/code> \u0431\u0443\u0434\u0443\u0442 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c \u0441 \u043f\u043e\u043b\u0435\u043c <code>author<\/code><\/p>\n<p>  <\/p>\n<h4 id=\"pri-vypolnenii\">\u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438<\/h4>\n<p>  <\/p>\n<p>\u0432\u044b\u0437\u043e\u0432 map_json_to_struct \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043f\u0430\u0440\u0441\u0435\u0440\u0430 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430, \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0447\u0435\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f (map_json_to_struct \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442 \u0432\u044b\u0437\u043e\u0432\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442\u0441\u044f):<\/p>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th>parser<\/th>\n<th>managed<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>start_struct(&quot;&quot;)<\/td>\n<td>\u044d\u0442\u043e \u043d\u0430\u0447\u0430\u043b\u043e \u0441\u0430\u043c\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b Book, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 map_json_to_struct \u043d\u0435 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442 \u044d\u0442\u043e\u0442 \u0432\u044b\u0437\u043e\u0432 \u0438 \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f<\/td>\n<\/tr>\n<tr>\n<td>set_integral(&quot;price&quot;, 273)<\/td>\n<td><code>white_space.set(&quot;price&quot;, 273)<\/code><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044f price \u0443 white_space: <code>Fs_set_field&lt;std::function&lt;void(Book&amp;, long long)&gt;&gt;::fs[&quot;price&quot;](white_space, 273)<\/code><\/td>\n<\/tr>\n<tr>\n<td>start_struct(&quot;author&quot;)<\/td>\n<td>\u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u0441\u0435 \u0432\u044b\u0437\u043e\u0432\u044b white_space \u0431\u0443\u0434\u0435\u0442 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044e author: <code>white_space.use(&quot;author&quot;)<\/code><\/td>\n<\/tr>\n<tr>\n<td>set_string:(&quot;name&quot;, &quot;bk192077&quot;)<\/td>\n<td><code>white_space.set(&quot;name&quot;, &quot;bk192077&quot;)<\/code><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f \u043a author (\u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 set \u0443 author): <code>Fs_set&lt;std::function&lt;void(Book, std::string const &amp;, bool)&gt;&gt;::fs[&quot;author&quot;](white_space, &quot;name&quot;, &quot;bk192077&quot;)<\/code><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044f name \u0443 author: <code>Fs_set_field&lt;std::function&lt;void(Author&amp;, std::string const &amp;)&gt;&gt;::fs[&quot;name&quot;](author, &quot;bk192077&quot;)<\/code><\/td>\n<\/tr>\n<tr>\n<td>end_struct()<\/td>\n<td><code>white_space.release()<\/code><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f \u043a author (\u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 release \u0443 author): <code>Fs_release&lt;std::function&lt;bool(Book&amp;)&gt;&gt;::fs[&quot;author&quot;](white_space))<\/code><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u044b \u043a white_space \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a author<\/td>\n<\/tr>\n<tr>\n<td>start_array(&quot;chapters&quot;)<\/td>\n<td>\u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u0441\u0435 \u0432\u044b\u0437\u043e\u0432\u044b white_space \u0431\u0443\u0434\u0435\u0442 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044e chapters: <code>white_space.use(&quot;chapters&quot;)<\/code><\/td>\n<\/tr>\n<tr>\n<td>set_string:(&quot;&quot;, &quot;launch&quot;)<\/td>\n<td><code>white_space.set(&quot;&quot;, &quot;launch&quot;)<\/code><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f \u043a chapters (\u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 set \u0443 chapters): <code>Fs_set&lt;std::function&lt;void(Book, std::string const &amp;, bool)&gt;&gt;::fs[&quot;chapters&quot;](white_space, &quot;&quot;, &quot;launch&quot;)<\/code><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 &quot;launch&quot;<\/td>\n<\/tr>\n<tr>\n<td>set_string:(&quot;&quot;, &quot;new horizons&quot;)<\/td>\n<td><code>white_space.set(&quot;&quot;, &quot;new horizons&quot;)<\/code><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f \u043a chapters (\u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 set \u0443 chapters): <code>Fs_set&lt;std::function&lt;void(Book, std::string const &amp;, bool)&gt;&gt;::fs[&quot;chapters&quot;](white_space, &quot;&quot;, &quot;new horizons&quot;)<\/code><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 &quot;new horizons&quot;<\/td>\n<\/tr>\n<tr>\n<td>end_array()<\/td>\n<td><code>white_space.release()<\/code><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044f \u043a chapters (\u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 release \u0443 chapters): <code>Fs_release&lt;std::function&lt;bool(Book&amp;)&gt;&gt;::fs[&quot;chapters&quot;](white_space))<\/code><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u044b \u043a white_space \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a chapters<\/td>\n<\/tr>\n<tr>\n<td>end_struct(&quot;&quot;)<\/td>\n<td>\u044d\u0442\u043e \u043a\u043e\u043d\u0435\u0446 \u0441\u0430\u043c\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b Book, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 map_json_to_struct \u043d\u0435 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u0443\u0435\u0442 \u044d\u0442\u043e\u0442 \u0432\u044b\u0437\u043e\u0432 \u0438 \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  <\/p>\n<h1 id=\"v-itoge\">\u0412 \u0438\u0442\u043e\u0433\u0435<\/h1>\n<p>  <\/p>\n<ul>\n<li>\u0436\u0435\u043b\u0430\u0435\u043c\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0432\u0441\u0435 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u043d\u0430\u0431\u043e\u0440\u0430 \u043c\u0430\u043a\u0440\u043e\u0441\u043e\u0432 (\u0445\u043e\u0442\u044f \u043c\u043e\u0436\u043d\u043e \u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0432\u0441\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c)<\/li>\n<li>\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e, \u043d\u043e \u0434\u043b\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 (\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043d\u0435 \u0432\u0430\u0436\u043d\u0430)<\/li>\n<li>\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u0441 -std=c++17 \u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0434\u043b\u044f:<br \/> \n<ul>\n<li>if constexpr<\/li>\n<li>static inline<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/bk192077\/struct_mapping\">\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043d\u0430 GitHub<\/a><\/p>\n<\/div>\n<p> \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\/post\/506506\/\"> https:\/\/habr.com\/ru\/post\/506506\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/506506\/\">\n<p>\u0412 \u0438\u0434\u0435\u0430\u043b\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0421++<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">struct Person {  std::string name;  int age;  bool student; } person;<\/code><\/pre>\n<p>  <\/p>\n<p>\u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 person \u0432 \u043c\u0435\u0442\u043e\u0434 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 json_data<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">map_json_to_struct(person, json_data)<\/code><\/pre>\n<p>  <\/p>\n<p>\u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">std::cout &lt;&lt; person.name &lt;&lt; &quot; : &quot; &lt;&lt; person.age;<\/code><\/pre>\n<p>  <\/p>\n<p>StructMapping \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443.<\/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-305275","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/305275","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=305275"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/305275\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=305275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=305275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=305275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}