{"id":168233,"date":"2013-02-06T14:44:05","date_gmt":"2013-02-06T10:44:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=168233"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=168233","title":{"rendered":"<span class=\"post_title\">\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044f C++ \u0438 Python. \u0422\u043e\u043d\u043a\u043e\u0441\u0442\u0438 Boost.Python. \u0427\u0430\u0441\u0442\u044c \u0432\u0442\u043e\u0440\u0430\u044f<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435\u043c <a href=\"http:\/\/habrahabr.ru\/post\/168083\/\">\u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/a>.<br \/>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043c\u0443\u0447\u0438\u0442\u044c Boost.Python. \u0412 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043d\u0430\u0441\u0442\u0430\u043b\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043a\u043b\u0430\u0441\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043b\u044c\u0437\u044f \u043d\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c, \u043d\u0438 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<br \/>  \u041e\u0431\u0435\u0440\u043d\u0451\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u043e\u0431\u044b\u0447\u043d\u0443\u044e \u0441\u0438\u0448\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441 \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u043c. <br \/>  \u0418 \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043f\u043e\u043b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 C++, \u0442\u0430\u043a \u0447\u0442\u043e\u0431\u044b \u0441\u0431\u043e\u0440\u0449\u0438\u043a \u043c\u0443\u0441\u043e\u0440\u0430 Python \u0435\u0433\u043e \u043d\u0435 \u0443\u0434\u0430\u043b\u0438\u043b \u043d\u0435\u043d\u0430\u0440\u043e\u043a\u043e\u043c. \u041d\u0443 \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u0447\u0442\u043e\u0431\u044b Python \u043f\u0440\u0438\u0431\u0440\u0430\u043b \u043c\u0443\u0441\u043e\u0440 \u043f\u043e\u0441\u043b\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0435\u043c\u0443 \u043e\u0442\u0434\u0430\u043b\u0438 \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435.<br \/>  \u041f\u043e\u0435\u0445\u0430\u043b\u0438\u2026<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u041f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442<\/h4>\n<p>  \u041d\u0430\u043c \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 \u0432\u043f\u043e\u043b\u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 example \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0439\u0441\u044f \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438.<br \/>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u0435\u0433\u043e \u0435\u0449\u0451 \u043f\u0430\u0440\u0443 \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d\u0430:<br \/>  <b>single.h<\/b><br \/>  <b>single.cpp<\/b><br \/>  \u0418 \u0432\u044b\u043d\u0435\u0441\u0435\u043c \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u0432 Python \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b:<br \/>  <b>wrap.h<\/b><\/p>\n<p>  \u041e\u0442 \u043f\u0440\u0435\u0436\u043d\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u043e\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0431\u0443\u0434\u0435\u043c \u043c\u0435\u043d\u044f\u0442\u044c:<br \/>  <b>wrap.cpp<\/b><br \/>  \u0418 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0441 \u0447\u0443\u0434\u043e-\u043a\u043b\u0430\u0441\u0441\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0430\u043a \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0433 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u043e\u043d\u0438 \u043e\u0441\u0442\u0430\u043d\u0443\u0442\u0441\u044f \u043a\u0430\u043a \u0435\u0441\u0442\u044c:<br \/>  <b>some.h<\/b><br \/>  <b>some.cpp<\/b><\/p>\n<h4>\u041e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443<\/h4>\n<p>  \u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0437\u0430\u0432\u0435\u0434\u0451\u043c \u0432 single.h \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e C-style \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u043f\u0440\u043e\u0441\u0442\u043e \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u043f\u043e\u043b\u0435\u0439.<br \/>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u0430 \u043d\u0435\u043a\u0438\u0439 \u0437\u0430\u0433\u0430\u0434\u043e\u0447\u043d\u044b\u0439 \u0442\u0438\u043f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:  <\/p>\n<pre><code class=\"cpp\">struct Config {     double coef;     string path;     int max_size;      Config( double def_coef, string const& def_path, int def_max_size ); }; <\/code><\/pre>\n<p>  \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0431\u0451\u0440\u0442\u043a\u0443 \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043d\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0442\u0440\u0443\u0434\u0430, \u043d\u0443\u0436\u043d\u043e \u043b\u0438\u0448\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 boost::python::init&lt;&#8230;&gt;(&#8230;) \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043e\u0431\u0451\u0440\u0442\u043a\u0438 boost::python::class_:  <\/p>\n<pre><code class=\"cpp\">    class_&lt;Config&gt;( &quot;Config&quot;, init&lt;double,string,int&gt;( args( &quot;coef&quot;, &quot;path&quot;, &quot;max_size&quot; ) )         .add_property( &quot;coef&quot;, make_getter( &Config::coef ), make_setter( &Config::coef ) )         .add_property( &quot;path&quot;, make_getter( &Config::path ), make_setter( &Config::path ) )         .add_property( &quot;max_size&quot;, make_getter( &Config::max_size ), make_setter( &Config::max_size ) )     ; <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0437\u0434\u0435\u0441\u044c \u0434\u0430\u0436\u0435 \u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c return_value_policy&lt;copy_const_reference&gt; \u0434\u043b\u044f \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f. \u041f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043f\u043e\u043b\u0435 \u0437\u0434\u0435\u0441\u044c \u0431\u0435\u0440\u0451\u0442\u0441\u044f \u043f\u043e \u0441\u0443\u0442\u0438 \u043f\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e, \u0430 \u0441\u0442\u0430\u043b\u043e \u0431\u044b\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 <b>str<\/b> \u044f\u0437\u044b\u043a\u0430 Python.<br \/>  \u0424\u0443\u043d\u043a\u0446\u0438\u0438 make_setter \u0434\u0435\u043b\u0430\u044e\u0442 \u0435\u0449\u0451 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0442\u0438\u043f\u0430 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0432 \u043f\u0438\u0442\u043e\u043d\u0435 \u043f\u043e\u043b\u044e coef \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0438\u043b\u0438 \u0437\u0430\u0434\u0430\u0442\u044c max_size \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u0438\u043f\u0430 float, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435.<br \/>  \u041f\u043e\u043b\u044f \u0441\u0438\u0448\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b Config \u043f\u043e \u0441\u0443\u0442\u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0438\u0442\u043e\u043d\u043e\u0432\u0441\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 Config. \u041d\u0443 \u043f\u043e\u0447\u0442\u0438 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0433\u043e\u2026 \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c Some \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0433\u043b\u0430\u0432\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043e\u0431\u0451\u0440\u0442\u043a\u0443 \u043c\u0435\u0442\u043e\u0434\u044b <b>__str__<\/b> \u0438 <b>__repr__<\/b>, \u0430 \u0437\u0430\u043e\u0434\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e as_dict \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 dict \u043f\u0438\u0442\u043e\u043d\u0430 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e.<br \/>  \u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0442\u0430\u043a \u0436\u0435 \u043a\u0430\u043a \u0438 \u0441\u0442\u0430\u0440\u044b\u0445, \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0451\u043c \u0432 \u043d\u0430\u0448 \u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b wrap.h:  <\/p>\n<pre><code class=\"cpp\">#pragma once  #include &lt;boost\/python.hpp&gt; #include &quot;some.h&quot; #include &quot;single.h&quot; #include &quot;protocol.h&quot;  using namespace boost::python;  string Some_Str( Some const& ); string Some_Repr( Some const& ); dict Some_ToDict( Some const& ); void Some_FromDict( Some&, dict const& );  string Config_Str( Config const& ); string Config_Repr( Config const& ); dict Config_ToDict( Config const& ); void Config_FromDict( Config&, dict const& ); <\/code><\/pre>\n<p>  \u0412 \u0444\u0430\u0439\u043b\u0435 wrap.cpp \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043d\u0438\u0447\u0435\u0433\u043e \u043b\u0438\u0448\u043d\u0435\u0433\u043e \u0438 \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u044f example, \u0447\u0442\u043e \u044f\u0432\u043d\u043e \u043f\u0440\u0438\u0431\u0430\u0432\u0438\u0442 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<br \/>  \u0412 \u043a\u043e\u043d\u0446\u0435 wrap.cpp \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043d\u0430\u0448\u0438\u0445 \u043d\u043e\u0432\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 \u0442\u0435\u043c, \u043a\u0430\u043a \u043c\u044b \u0438\u0445 \u043f\u0438\u0441\u0430\u043b\u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438:  <\/p>\n<pre><code class=\"cpp\">string Config_Str( Config const& config ) {     stringstream output;     output &lt;&lt; &quot;{ coef: &quot; &lt;&lt; config.coef &lt;&lt; &quot;, path: '&quot; &lt;&lt; config.path &lt;&lt; &quot;', max_size: &quot; &lt;&lt; config.max_size &lt;&lt; &quot; }&quot;;     return output.str(); }  string Config_Repr( Config const& config ) {     return &quot;Config: &quot; + Config_Str( config ); }  dict Config_ToDict( Config const& config ) {     dict res;     res[&quot;coef&quot;] = config.coef;     res[&quot;path&quot;] = config.path;     res[&quot;max_size&quot;] = config.max_size;     return res; }  void Config_FromDict( Config& config, dict const& src ) {     if( src.has_key( &quot;coef&quot; ) ) config.coef = extract&lt;double&gt;( src[&quot;coef&quot;] );     if( src.has_key( &quot;path&quot; ) ) config.path = extract&lt;string&gt;( src[&quot;path&quot;] );     if( src.has_key( &quot;max_size&quot; ) ) config.max_size = extract&lt;int&gt;( src[&quot;max_size&quot;] ); } <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u044f \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0443\u0436\u0435 \u0441 \u0436\u0438\u0440\u0443 \u0431\u0435\u0448\u0443\u0441\u044c, \u043d\u043e \u043d\u0430\u0437\u043e\u0432\u0451\u043c \u044d\u0442\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u043d\u043e\u0433\u043e.<br \/>  \u0412 \u043e\u0431\u0451\u0440\u0442\u043a\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u044b\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f:  <\/p>\n<pre><code class=\"cpp\">    class_&lt;Config&gt;( &quot;Config&quot;, init&lt;double,string,int&gt;( args( &quot;coef&quot;, &quot;path&quot;, &quot;max_size&quot; ) ) )         .add_property( &quot;coef&quot;, make_getter( &Config::coef ), make_setter( &Config::coef ) )         .add_property( &quot;path&quot;, make_getter( &Config::path ), make_setter( &Config::path ) )         .add_property( &quot;max_size&quot;, make_getter( &Config::max_size ), make_setter( &Config::max_size ) )         .def( &quot;__str__&quot;, Config_Str )         .def( &quot;__repr__&quot;, Config_Repr )         .add_property( &quot;as_dict&quot;, Config_ToDict, Config_FromDict )     ; <\/code><\/pre>\n<p>  \u0421\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e, \u0438\u0437 \u043d\u0435\u0451 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0438\u0442\u043e\u043d\u043e\u0432\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441, \u0437\u0435\u0440\u043a\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0439 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b Config \u0432 C++ \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441 \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u0438\u0442\u043e\u043d\u0438\u0441\u0442. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u044c.<br \/>  \u0414\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043d\u0438\u043c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u0432\u0435\u0434\u0451\u043c \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d, \u0437\u0430\u043e\u0434\u043d\u043e \u0441\u043d\u0430\u0431\u0434\u0438\u043c \u0435\u0433\u043e \u00ab\u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c\u00bb \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u043e\u043c.<\/p>\n<h4>\u041e\u0431\u0451\u0440\u0442\u043a\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u0431\u0435\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/h4>\n<p>  \u0418\u0442\u0430\u043a \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d. \u041f\u0443\u0441\u0442\u044c \u0432 \u043d\u0451\u043c \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c\u0441\u044f \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043d\u0435\u043a\u0438\u0439 \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u044b\u0439 \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430.  <\/p>\n<pre><code class=\"cpp\">class Single { public:     static int CurrentID();     static Config& AppConfig();     static void AppConfig( Config const& );  private:     int mCurrentID;     Config mAppConfig;      Single();     Single( Single const& );      static Single& Instance();      int ThisCurrentID();     Config& ThisAppConfig();     void ThisAppConfig( Config const& ); }; <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u044b \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0443\u0441\u043f\u0435\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c-\u0442\u043e \u043b\u044e\u0431\u043b\u044e \u0432\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u0442\u044c \u0432 \u0441\u0435\u043a\u0446\u0438\u044e <b>public<\/b> \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 Instance() \u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d\u0430 \u043a\u0430\u043a \u0441 \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u041e\u0442 \u044d\u0442\u043e\u0433\u043e \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0451\u0442 \u0431\u044b\u0442\u044c \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d\u043e\u043c, \u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043a\u043b\u0430\u0441\u0441\u0430 \u0441\u043a\u0430\u0436\u0435\u0442 \u0432\u0430\u043c \u0441\u043f\u0430\u0441\u0438\u0431\u043e, \u0437\u0430 \u0442\u043e, \u0447\u0442\u043e \u0441\u043f\u0440\u044f\u0442\u0430\u043b\u0438 \u0432\u044b\u0437\u043e\u0432 Instance() \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e.<br \/>  \u0412\u043e\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438 \u043e\u043d\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 <b>single.cpp<\/b>:  <\/p>\n<pre><code class=\"cpp\">#include &quot;single.h&quot;  #include &lt;boost\/thread.hpp&gt;  using boost::mutex; using boost::unique_lock;  const double CONFIG_DEFAULT_COEF     = 2.5; const int    CONFIG_DEFAULT_MAX_SIZE = 0x1000; const string CONFIG_DEFAULT_PATH     = &quot;.&quot;;  int Single::CurrentID() {     return Instance().ThisCurrentID(); }  Config& Single::AppConfig() {     return Instance().ThisAppConfig(); }  void Single::AppConfig( Config const& config ) {     Instance().ThisAppConfig( config ); }  Single::Single()     : mCurrentID( 0 ) {     mAppConfig.coef     = CONFIG_DEFAULT_COEF;     mAppConfig.max_size = CONFIG_DEFAULT_MAX_SIZE;     mAppConfig.path     = CONFIG_DEFAULT_PATH; }  Single& Single::Instance() {     static mutex single_mutex;     unique_lock&lt;mutex&gt; single_lock( single_mutex );     static Single instance;     return instance; }  int Single::ThisCurrentID() {     static mutex id_mutex;     unique_lock&lt;mutex&gt; id_lock( id_mutex );     return ++mCurrentID; }  Config& Single::ThisAppConfig() {     return mAppConfig; }  void Single::ThisAppConfig( Config const& config ) {     mAppConfig = config; } <\/code><\/pre>\n<p>  \u0412\u0441\u0435\u0433\u043e \u0442\u0440\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430, \u043e\u0431\u0451\u0440\u0442\u043a\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0439, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043e\u0434\u043d\u043e \u043d\u043e\u2026 \u0445\u043e\u0442\u044f \u043d\u0435\u0442, \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043e\u0434\u043d\u043e:<br \/>  1. \u041d\u0435\u043b\u044c\u0437\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430<br \/>  2. \u041d\u0435\u043b\u044c\u0437\u044f \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430<br \/>  3. \u041c\u044b \u0435\u0449\u0451 \u043d\u0435 \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043b\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b  <\/p>\n<pre><code class=\"cpp\">    class_&lt;Single, noncopyable&gt;( &quot;Single&quot;, no_init )         .def( &quot;CurrentID&quot;, &Single::CurrentID )         .staticmethod( &quot;CurrentID&quot; )         .def( &quot;AppConfig&quot;, static_cast&lt; Config& (*)() &gt;( &Single::AppConfig ), return_value_policy&lt;reference_existing_object&gt;() )         .def( &quot;AppConfig&quot;, static_cast&lt; void (*)( Config const& ) &gt;( &Single::AppConfig ) )         .staticmethod( &quot;AppConfig&quot; )     ; <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435 \u0432\u0441\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 1-\u043c \u0438 2-\u043c \u043f\u0443\u043d\u043a\u0442\u0430\u043c \u0441\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043a \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 <b>boost::noncopyable<\/b> \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 <b>boost::python::no_init<\/b> \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 boost::python::class_.<br \/>  \u0415\u0441\u043b\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043a\u043b\u0430\u0441\u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043b \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u043b\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0442\u0435\u0440\u0435\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0433\u043b\u0443\u0448\u0438\u0442\u0435\u043b\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u043a\u043b\u0430\u0441\u0441\u0430-\u043e\u0431\u0451\u0440\u0442\u043a\u0438.<br \/>  \u0412\u043e\u043e\u0431\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043d\u0438\u0436\u0435 \u0432 <b>.def( init&lt;&gt;() )<\/b>, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0430\u043a \u0438 \u0434\u0435\u043b\u0430\u044e\u0442, \u0434\u043b\u044f \u0435\u0434\u0438\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u044f \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430\u043c\u0438 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u044b\u043c\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e, \u0442\u0430\u043a\u0436\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f <b>no_init<\/b> \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043e\u0431\u0451\u0440\u0442\u043a\u0438. \u0415\u0441\u0442\u044c \u0442\u0430\u043a\u0436\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u0437\u0430\u043c\u0435\u043d\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u043f\u0440\u044f\u043c\u043e \u043f\u0440\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u0430-\u043e\u0431\u0451\u0440\u0442\u043a\u0438, \u043a\u0430\u043a \u044d\u0442\u043e \u043c\u044b \u0443\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0434\u043b\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b Config.<br \/>  \u0421 \u0442\u0440\u0435\u0442\u044c\u0438\u043c \u043f\u0443\u043d\u043a\u0442\u043e\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u0435\u0442\u043e\u0434 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0439 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f <b>.staticmethod()<\/b> \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 .def() \u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u0432\u0441\u0435\u0445 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043e\u043a \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430.<br \/>  \u0412 \u043e\u0431\u0449\u0435\u043c-\u0442\u043e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0443\u0436\u0435 \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0437\u043d\u0430\u043a\u043e\u043c\u043e \u043d\u0430\u043c \u043f\u043e \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u043a\u0440\u043e\u043c\u0435 \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u0431\u0430\u0432\u043d\u043e\u0439 \u043c\u0435\u043b\u043e\u0447\u0438 \u2014 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f return_value_policy&lt;reference_existing_object&gt;, \u043e \u043d\u0435\u0439 \u0434\u0430\u043b\u0435\u0435.<\/p>\n<h4>\u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430 \u00ab\u043d\u0435 \u0431\u0435\u0439\u0442\u0435 \u043c\u0435\u043d\u044f, \u044f \u2014 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0447\u0438\u043a\u00bb<\/h4>\n<p>  \u0421\u0430\u043c\u0443\u044e \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432 \u043e\u0431\u0451\u0440\u0442\u043a\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d\u0430 \u0432\u044b\u0437\u0432\u0430\u043b\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u0430  <\/p>\n<pre><code class=\"cpp\">    static Config& AppConfig(); <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b Garbage Collector (GC) \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 Python \u043d\u0435 \u0443\u0434\u0430\u043b\u0438\u043b \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u043e\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0451\u043d\u043d\u043e\u0433\u043e \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u0430, \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <b>return_value_policy&lt;reference_existing_object&gt;<\/b>.<br \/>  \u041c\u0430\u0433\u0438\u044f Boost.Python \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0443\u0440\u043e\u0432\u0430, \u0447\u0442\u043e \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u0434\u0430 \u043d\u0430 Python, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0435\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 AppConfig() \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c \u0432 \u043f\u043e\u043b\u0435 \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d\u0430 \u0442\u0430\u043a, \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 C++! \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 Python \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:  <\/p>\n<pre><code class=\"python\">from example import * Single.AppConfig().coef = 123.45 Single.AppConfig() <\/code><\/pre>\n<p>  \u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0432\u044b\u0432\u043e\u0434:  <\/p>\n<pre><code class=\"python\">Config: { coef: 123.45, path: '.', max_size: 4096 } <\/code><\/pre>\n<h4>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0441 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u043e\u0439 \u0434\u043b\u044f get-\u043c\u0435\u0442\u043e\u0434\u0430<\/h4>\n<p>  \u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0443\u0436\u0435 \u0432\u0441\u0435 \u0443\u0441\u043f\u0435\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u044f \u043b\u044e\u0431\u043b\u044e \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434-\u0434\u0440\u0443\u0433\u043e\u0439 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u0437\u0443\u0431\u043e\u0434\u0440\u043e\u0431\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c. \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u0430 Single \u0432 \u043f\u0438\u0442\u043e\u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430 \u0438 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0431\u043b\u0430\u0433\u043e \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0443\u0436\u0435 \u0435\u0441\u0442\u044c.  <\/p>\n<pre><code class=\"cpp\">        .add_static_property( &quot;current_id&quot;, &Single::CurrentID )         .add_static_property( &quot;app_config&quot;, make_function( static_cast&lt; Config& (*)() &gt;( &Single::AppConfig ), return_value_policy&lt;reference_existing_object&gt;() ), static_cast&lt; void (*)( Config const& ) &gt;( &Single::AppConfig ) ) <\/code><\/pre>\n<p>  \u041c\u0435\u0442\u043e\u0434 Single::CurrentID \u043e\u0431\u0435\u0440\u043d\u0443\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c <b>current_id<\/b> \u043d\u0430 \u0440\u0430\u0437-\u0434\u0432\u0430, \u0437\u0430\u0442\u043e \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043a\u0430\u043a\u0430\u044f \u00ab\u043a\u0440\u0430\u0441\u0438\u0432\u0430\u044f\u00bb \u043e\u0431\u0451\u0440\u0442\u043a\u0430 \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043e\u043a Single::AppConfig, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e get- \u0438 set-\u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <b>app_config<\/b>. \u041f\u0440\u0438\u0447\u0451\u043c \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0434\u043b\u044f get-\u043c\u0435\u0442\u043e\u0434\u0430 \u043d\u0430\u043c \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <b>make_function<\/b> \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0432\u0435\u0441\u0438\u0442\u044c \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <b>return_value_policy&lt;reference_existing_object&gt;<\/b>.<br \/>  \u0411\u0443\u0434\u044c\u0442\u0435 \u043e\u0447\u0435\u043d\u044c \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b, \u0432\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <b>make_getter<\/b> \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043e\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u0435\u0439 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 C++, \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043a\u0430\u043a \u0435\u0441\u0442\u044c. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u0434\u0430\u0442\u044c \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <b>make_function<\/b>. \u0412\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f <b>return_value_policy<\/b> \u043a\u0430\u043a \u0432 <b>.def<\/b> \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u043d\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0434\u043d\u0438\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0438 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<h4>\u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430 \u00ab\u0432\u043e\u0442 \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u2014 \u0443\u0434\u0430\u043b\u0438 \u0435\u0433\u043e\u00bb<\/h4>\n<p>  \u0418\u0442\u0430\u043a, \u043c\u044b \u0443\u0436\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c, \u043a\u0430\u043a \u043d\u0435 \u0434\u0430\u0432\u0430\u0442\u044c GC \u043f\u0438\u0442\u043e\u043d\u0430 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u043e\u0431\u044a\u0435\u043a\u0442. \u041e\u0434\u043d\u0430\u043a\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 \u043f\u0438\u0442\u043e\u043d \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442. GC \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u043c\u0440\u0451\u0442 <s>\u0432 \u043c\u0443\u0447\u0435\u043d\u0438\u044f\u0445<\/s> \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f, \u0441\u0441\u044b\u043b\u0430\u044e\u0449\u0430\u044f\u0441\u044f \u043d\u0430 \u0432\u0430\u0448 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0430 <b>return_value_policy&lt;manage_new_object&gt;<\/b>.<br \/>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u0432\u0435\u0434\u0451\u043c \u043c\u0435\u0442\u043e\u0434, \u043a\u043b\u043e\u043d\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432 \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u043e wrap.h \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435:  <\/p>\n<pre><code class=\"cpp\">Config* Single_CloneAppConfig(); <\/code><\/pre>\n<p>  \u0418 \u0432\u043e wrap.cpp \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0451 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e:  <\/p>\n<pre><code class=\"cpp\">Config* Single_CloneAppConfig() {     return new Config( Single::AppConfig() ); } <\/code><\/pre>\n<p>  \u0412 \u043e\u0431\u0451\u0440\u0442\u043a\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 Single \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u043e\u0439 manage_new_object:  <\/p>\n<pre><code class=\"cpp\">        .def( &quot;CloneAppConfig&quot;, Single_CloneAppConfig, return_value_policy&lt;manage_new_object&gt;() ) <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e Config \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u0434\u043e, \u043e\u0431\u044a\u044f\u0432\u0438\u043c \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0432 \u0441\u043e\u0432\u0441\u0435\u043c \u0443\u0436\u0435 \u043d\u0435 C-style \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 Config. \u0412 \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0432 STDOUT \u0447\u0435\u0440\u0435\u0437 std::cout \u043f\u043e\u043b\u044f \u0443\u0434\u0430\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 Config:  <\/p>\n<pre><code class=\"cpp\">Config::~Config() {     cout &lt;&lt; &quot;Config destructor of Config: { coef: &quot; &lt;&lt; coef           &lt;&lt; &quot;, path: '&quot; &lt;&lt; path &lt;&lt; &quot;', max_size: &quot; &lt;&lt; max_size &lt;&lt; &quot; }&quot; &lt;&lt; endl; } <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0431\u0443\u0435\u043c!<br \/>  \u0412 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043d\u0430 Python 3.x \u043a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0438, \u043f\u043e\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u0438\u0445 \u043f\u043e-\u0432\u0441\u044f\u043a\u043e\u043c\u0443 \u0438 \u0441\u0431\u0440\u043e\u0441\u0438\u043c \u0432\u0441\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0447\u0435\u0440\u0435\u0437 <b>CloneAppConfig()<\/b> \u043e\u0431\u044a\u0435\u043a\u0442:  <\/p>\n<pre><code class=\"python\">from example import * c = Single.CloneAppConfig() c.coef = 11.11; c.path = 'cloned'; c.max_size = 111111 print( &quot;c.coef = 12.34; c.path = 'cloned'; c.max_size = 100500&quot; ) print( &quot;c:&quot;, c ); print( &quot;Single.AppConfig():&quot;, Single.AppConfig() ) print( &quot;c = Single.CloneAppConfig()&quot; ); c = Single.CloneAppConfig() c.coef = 22.22; c.path = 'another'; c.max_size = 222222 print( &quot;c.coef = 22.22; c.path = 'another'; c.max_size = 222222&quot; ) print( &quot;c:&quot;, c ); print( &quot;Single.app_config:&quot;, Single.app_config ) print( &quot;c = None&quot; ); c = None print( &quot;Single.app_config:&quot;, Single.app_config ) <\/code><\/pre>\n<p>  \u0414\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0440\u043e\u0432\u043d\u043e \u0442\u043e\u0433\u0434\u0430 \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0441\u0441\u044b\u043b\u043a\u0430.<br \/>  \u0412\u043e\u0442 \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438\u0441\u044c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d:  <\/p>\n<pre><code class=\"python\">c.coef = 12.34; c.path = 'cloned'; c.max_size = 100500 c: { coef: 11.11, path: 'cloned', max_size: 111111 } Single.AppConfig(): { coef: 2.5, path: '.', max_size: 4096 } c = Single.CloneAppConfig() Config::~Config() destructor of object: { coef: 11.11, path: 'cloned', max_size: 111111 } c.coef = 22.22; c.path = 'another'; c.max_size = 222222 c: { coef: 22.22, path: 'another', max_size: 222222 } Single.app_config: { coef: 2.5, path: '.', max_size: 4096 } c = None Config::~Config() destructor of object: { coef: 22.22, path: 'another', max_size: 222222 } Single.app_config: { coef: 2.5, path: '.', max_size: 4096 } Config::~Config() destructor of object: { coef: 2.5, path: '.', max_size: 4096 } <\/code><\/pre>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0433\u043e \u0437\u0430\u0434\u0430\u043d\u0438\u044f, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0451 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043e\u0431\u0451\u0440\u0442\u043a\u0443 Config \u043c\u0435\u0442\u043e\u0434 __del__ \u2014 \u0430\u043d\u0430\u043b\u043e\u0433 \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u0432 Python, \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043f\u043e\u0445\u043e\u0436\u0435 \u0432\u0435\u0434\u0443\u0442 \u0441\u0435\u0431\u044f \u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d\u0438 \u0441\u0441\u044b\u043b\u0430\u044e\u0442\u0441\u044f.<\/p>\n<h4>\u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/h4>\n<p>  \u0418\u0442\u0430\u043a, \u043c\u044b \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0438\u0441\u044c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0441 \u0434\u0432\u0443\u043c\u044f \u043d\u043e\u0432\u044b\u043c\u0438 \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0430\u043c\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435: <b>reference_existing_object <\/b>\u0438 <b>manage_new_object<\/b>. \u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442-\u043e\u0431\u0451\u0440\u0442\u043a\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a\u0430\u043a \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 C++ \u043e\u0431\u044a\u0435\u043a\u0442, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430 \u043f\u043e\u043f\u0435\u0447\u0435\u043d\u0438\u0435 GC Python \u043d\u043e\u0432\u044b\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u0432 C++ \u043e\u0431\u044a\u0435\u043a\u0442\u044b.<br \/>  \u0420\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0432\u043a\u0440\u0430\u0442\u0446\u0435 \u043a\u0430\u043a \u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u043d\u0430 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b \u043a\u043b\u0430\u0441\u0441\u0430 \u0432 C++ \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u044b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d\u0430 \u0438\u043b\u0438 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0438 \u0434\u043b\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u0443 \u0432\u0430\u0441 \u043f\u0435\u0440\u0435\u0434 \u0433\u043b\u0430\u0437\u0430\u043c\u0438.<br \/>  \u0412 \u0442\u0440\u0435\u0442\u044c\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043d\u0430\u0441 \u0436\u0434\u0451\u0442 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u0430\u044f \u043e\u0431\u0451\u0440\u0442\u043a\u0430 enum, \u043c\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0432\u043e\u0439 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440 \u0434\u043b\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0431\u0430\u0439\u0442 \u0438\u0437 C++ \u0432 Python \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0443\u0447\u0438\u043c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 C++ \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0438\u0445 \u043e\u0431\u0451\u0440\u0442\u043e\u043a.<br \/>  \u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u0441 \u0436\u0434\u0451\u0442 \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u044b\u0439 \u043c\u0438\u0440 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0438\u0437 C++ \u0432 Python \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e.<br \/>  \u0427\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043a\u0430 \u0437\u0430\u0433\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443, \u0442\u0435\u043c\u0430 \u0440\u0430\u0441\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043a\u043b\u0443\u0431\u043e\u043a: \u0442\u0430\u043a\u043e\u0439 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u0438 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u0439, \u043f\u043e\u043a\u0430 \u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0448\u044c\u2026<br \/>  \u0421\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442 2-\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"http:\/\/www.megafileupload.com\/en\/file\/390402\/example-part2-7z.html\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u041f\u0440\u043e\u0435\u043a\u0442 MSVS v11, \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 \u0441\u0431\u043e\u0440\u043a\u0443 \u0441 Python 3.3 x64.<\/p>\n<h4>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/h4>\n<p>  <a href=\"http:\/\/www.boost.org\/doc\/libs\/1_52_0\/libs\/python\/doc\/\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f Boost.Python<\/a><br \/>  <a href=\"http:\/\/wiki.python.org\/moin\/boost.python\/class\">\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043e\u0431\u0451\u0440\u0442\u043a\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 boost::python::class_<br \/>  <a href=\"http:\/\/wiki.python.org\/moin\/boost.python\/CallPolicy\">\u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 Boost.Python<\/a><br \/>  <a href=\"http:\/\/www.boost.org\/doc\/libs\/1_52_0\/more\/getting_started\/windows.html\">\u041d\u0430\u0447\u0430\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Boost \u0434\u043b\u044f Windows<\/a><br \/>  <a href=\"http:\/\/www.boost.org\/doc\/libs\/1_52_0\/more\/getting_started\/unix-variants.html\">\u041d\u0430\u0447\u0430\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Boost \u0434\u043b\u044f *nix<\/a><br \/>  <a href=\"http:\/\/www.boost.org\/doc\/libs\/1_52_0\/libs\/python\/doc\/building.html\">\u0422\u043e\u043d\u043a\u043e\u0441\u0442\u0438 \u0441\u0431\u043e\u0440\u043a\u0438 Boost.Python<\/a><\/a>    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/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=\"http:\/\/habrahabr.ru\/post\/168233\/\"> http:\/\/habrahabr.ru\/post\/168233\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435\u043c <a href=\"http:\/\/habrahabr.ru\/post\/168083\/\">\u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/a>.<br \/>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043c\u0443\u0447\u0438\u0442\u044c Boost.Python. \u0412 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043d\u0430\u0441\u0442\u0430\u043b\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043a\u043b\u0430\u0441\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043b\u044c\u0437\u044f \u043d\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c, \u043d\u0438 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<br \/>  \u041e\u0431\u0435\u0440\u043d\u0451\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u043e\u0431\u044b\u0447\u043d\u0443\u044e \u0441\u0438\u0448\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441 \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u044b\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u043c. <br \/>  \u0418 \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435\u043c \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043f\u043e\u043b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 C++, \u0442\u0430\u043a \u0447\u0442\u043e\u0431\u044b \u0441\u0431\u043e\u0440\u0449\u0438\u043a \u043c\u0443\u0441\u043e\u0440\u0430 Python \u0435\u0433\u043e \u043d\u0435 \u0443\u0434\u0430\u043b\u0438\u043b \u043d\u0435\u043d\u0430\u0440\u043e\u043a\u043e\u043c. \u041d\u0443 \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u0447\u0442\u043e\u0431\u044b Python \u043f\u0440\u0438\u0431\u0440\u0430\u043b \u043c\u0443\u0441\u043e\u0440 \u043f\u043e\u0441\u043b\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0435\u043c\u0443 \u043e\u0442\u0434\u0430\u043b\u0438 \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435.<br \/>  \u041f\u043e\u0435\u0445\u0430\u043b\u0438\u2026  <\/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-168233","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/168233","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=168233"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/168233\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=168233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=168233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=168233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}