{"id":212089,"date":"2014-02-11T01:34:03","date_gmt":"2014-02-10T21:34:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=212089"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=212089","title":{"rendered":"<span class=\"post_title\">\u041c\u0430\u0441\u043a\u0438\u0440\u0443\u0435\u043c \u043a\u043b\u0430\u0441\u0441 \u043f\u043e\u0434 \u0433\u0440\u0430\u0444 Boost. \u0427\u0430\u0441\u0442\u044c 2: \u0417\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0439<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/a5b\/77f\/599\/a5b77f5999db35249fa68daae2ff4415.png\" align=\"left\" width=\"300\" height=\"300\"\/><br \/>  <a href=\"http:\/\/habrahabr.ru\/post\/210838\/\">\u041f\u0440\u043e\u043b\u043e\u0433: \u041a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 Boost<\/a><br \/>  <a href=\"http:\/\/habrahabr.ru\/post\/211558\/\">\u0427\u0430\u0441\u0442\u044c 1: \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0431\u0435\u0437 \u0432\u043c\u0435\u0448\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430<\/a><\/p>\n<p>  \u041a\u0440\u0430\u0442\u043a\u043e \u043d\u0430\u043f\u043e\u043c\u043d\u044e \u0437\u0430\u0434\u0430\u0447\u0443. \u0415\u0441\u0442\u044c \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0435 \u0438\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u0438\u0437 \u043a\u043b\u0435\u0442\u043e\u043a, \u0447\u0430\u0441\u0442\u044c \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0430, \u0430 \u0447\u0430\u0441\u0442\u044c \u0437\u0430\u043d\u044f\u0442\u0430. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u043f\u0443\u0442\u044c \u043f\u043e \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u043c \u043a\u043b\u0435\u0442\u043a\u0430\u043c \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043f\u043e\u043b\u044f \u0432 \u0434\u0440\u0443\u0433\u0443\u044e. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u0443\u0442\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0432 Boost. \u041d\u043e \u043e\u043d \u0442\u0440\u0435\u0431\u0443\u0435\u0442, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0448\u0435 \u043f\u043e\u043b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u043b\u043e \u043f\u043e\u0434 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0433\u0440\u0430\u0444\u0430. \u0422\u043e\u0447\u043d\u0435\u0435 \u043a\u043b\u0430\u0441\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0442\u044c \u0434\u0432\u0443\u043c \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f\u043c \u2014 <b>boost::VertexListGraph<\/b> \u0438 <b>boost:: IncidenceGraph<\/b>. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u2014 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u044d\u0442\u043e \u043d\u0435 \u0433\u0440\u0430\u0444 \u0438 \u0433\u0440\u0430\u0444\u043e\u043c \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u0442\u0430\u043d\u0435\u0442.<\/p>\n<p>  \u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0431\u044b\u043b\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 \u043a\u0430\u043a boost-\u0433\u0440\u0430\u0444\u0430. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043e\u0434\u043d\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u0422\u0430\u043a\u0436\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u043e\u0439 \u0438 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0441\u043c\u043e\u0436\u0435\u0442 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0433\u0440\u043e\u0432\u044b\u043c \u043f\u043e\u043b\u0435\u043c \u043a\u0430\u043a \u0433\u0440\u0430\u0444\u043e\u043c.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>num_vertices<\/b>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f \u0438\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f, \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0435\u0440\u0448\u0438\u043d \u0433\u0440\u0430\u0444\u0430. \u0414\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f \u044d\u0442\u043e \u0434\u043b\u0438\u043d\u043d\u0430 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u043d\u0430 \u0448\u0438\u0440\u0438\u043d\u0443. \u0422\u0438\u043f <b>VerticesSizeType<\/b> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432 <a href=\"http:\/\/habrahabr.ru\/post\/211558\/\">\u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438<\/a> (\u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u044d\u0442\u043e int).<\/p>\n<pre><code class=\"cpp\">VerticesSizeType num_vertices(const GameField& graph) {     return graph.getWidth() * graph.getHeight(); } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0430. \u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c \u0437\u0430 \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u0432\u0441\u0435\u0445 \u0432\u0435\u0440\u0448\u0438\u043d \u0433\u0440\u0430\u0444\u0430. \u0420\u0430\u043d\u0435\u0435 \u043c\u044b \u0443\u0441\u043b\u043e\u0432\u0438\u043b\u0438\u0441\u044c, \u0447\u0442\u043e \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c \u0446\u0435\u043b\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u043e\u0442 \u043d\u0443\u043b\u044f \u0434\u043e <b>num_vertices<\/b>. \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0441 \u043d\u0443\u043b\u044f, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c <b>boost::forward_iterator_helper<\/b>. \u041e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0432 \u043b\u0438\u0448\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432: \u0438\u043d\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u0430 (++), \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f (==) \u0438 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f (*). \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0438\u0441\u043a\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442, \u0447\u0442\u043e\u0431\u044b \u0434\u043b\u044f \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u2014 \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0443 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043a\u043b\u0430\u0441\u0441\u0430<\/p>\n<pre><code class=\"cpp\">class VertexIteratorImpl : public boost::forward_iterator_helper&lt;VertexIteratorImpl, Vertex, std::ptrdiff_t, Vertex*, Vertex&gt; { public:     VertexIteratorImpl();     VertexIteratorImpl(const GameField& field, int index);          void operator++ ();     bool operator== (const VertexIteratorImpl& anotherIterator) const;     Vertex operator*() const;      private:     bool isValid();          int mIndex;     const GameField* mField; }; <\/code><\/pre>\n<p>  \u0418\u0442\u0435\u0440\u0430\u0442\u043e\u0440 \u0445\u0440\u0430\u043d\u0438\u0442 \u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0438\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435. \u042f\u0432\u043d\u044b\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u2014 \u00ab\u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e\u00bb \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043e\u043d \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u0442:<\/p>\n<pre><code class=\"cpp\">VertexIteratorImpl::VertexIteratorImpl() : mField(NULL) , mIndex(0) {      } <\/code><\/pre>\n<p>  \u0412\u0442\u043e\u0440\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442<\/p>\n<pre><code class=\"cpp\">VertexIteratorImpl::VertexIteratorImpl(const GameField& field, int index) : mField(&field) , mIndex(index) {      } <\/code><\/pre>\n<p>  <b>isValid <\/b> \u2014 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043b\u0438 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440 \u0432 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 (\u0438\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u0437\u0430\u0434\u0430\u043d\u043e, \u0438\u043d\u0434\u0435\u043a\u0441 \u0438\u043c\u0435\u0435\u0442 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435)<\/p>\n<pre><code class=\"cpp\">bool VertexIteratorImpl::isValid() {     return (mField != NULL) && (mIndex &lt; num_vertices(*mField)) && (mIndex &gt;=0); } <\/code><\/pre>\n<p>  \u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u0432\u0435\u0440\u0448\u0438\u043d\u0430 \u2014 \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e, \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430, \u0438 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043f\u043e\u043b\u0435\u043c mIndex. \u0412\u043e\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e<\/p>\n<pre><code class=\"cpp\">bool VertexIteratorImpl::operator== (const VertexIteratorImpl& anotherIterator) const {     return mIndex == anotherIterator.mIndex; } <\/code><\/pre>\n<p>  \u0422\u0430\u043a \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u2014 \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0441\u0438\u043b \u043b\u0438 \u0438\u043d\u0434\u0435\u043a\u0441 \u0447\u0438\u0441\u043b\u043e \u0432\u0435\u0440\u0448\u0438\u043d \u0433\u0440\u0430\u0444\u0430<\/p>\n<pre><code class=\"cpp\">void VertexIteratorImpl::operator++ () {     if (isValid()) {         ++mIndex;     } } <\/code><\/pre>\n<p>  \u0420\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0443 \u043d\u043e\u043c\u0435\u0440\u0430 \u0432\u0435\u0440\u0448\u0438\u043d\u044b<\/p>\n<pre><code class=\"cpp\">Vertex VertexIteratorImpl::operator*() const {     return mIndex; } <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u0443\u044e \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f\u043c\u0438 \u0433\u0440\u0430\u0444\u043e\u0432 \u2014 <b>vertices<\/b>. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0434\u0432\u0430 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0432\u0435\u0440\u0448\u0438\u043d \u2014 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c (\u0430\u043d\u0430\u043b\u043e\u0433<b> end()<\/b> \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f\u0445). <\/p>\n<pre><code class=\"cpp\">std::pair&lt;VertexIterator, VertexIterator&gt; vertices(const GameField& graph) {     return std::make_pair(VertexIterator(graph, 0), VertexIterator(graph, num_vertices(graph))); } <\/code><\/pre>\n<p>  \u0422\u0438\u043f VertexIterator \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432 <a href=\"http:\/\/habrahabr.ru\/post\/211558\/\">\u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u044c\u0438<\/a> (\u044d\u0442\u043e \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c VertexIteratorImpl). \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0434\u0430\u0434\u0438\u043c \u0440\u0435\u0431\u0440\u0430. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0430\u0440\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435, \u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u0440\u0435\u0431\u0440\u043e, \u0431\u0443\u0434\u0443\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u0443\u044e \u0432\u0435\u0440\u0448\u0438\u043d\u0443.<\/p>\n<pre><code class=\"cpp\">Vertex source(Edge edge, const GameField &graph) {     return edge.first; }  Vertex target(Edge edge, const GameField &graph) {     return edge.second; } <\/code><\/pre>\n<p>  \u0412\u0442\u043e\u0440\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0438\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0433\u0440\u0430\u0444, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u043d \u043d\u0435 \u043d\u0443\u0436\u0435\u043d (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0435\u0431\u0440\u043e \u2014 \u044d\u0442\u043e \u043f\u0430\u0440\u0430 \u0432\u0435\u0440\u0448\u0438\u043d). \u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0438\u0437 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0440\u0435\u0431\u0435\u0440. \u041e\u043d \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0435\u043d. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u044b: \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c 8 \u0432\u0435\u0440\u0448\u0438\u043d \u0432\u043e\u043a\u0440\u0443\u0433 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b, \u0437\u043d\u0430\u0447\u0438\u0442, \u0440\u0435\u0431\u0440\u0430 \u0435\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u0437\u0430\u043d\u044f\u0442\u044b, \u0442\u043e \u043f\u0443\u0442\u0438 \u0432 \u044d\u0442\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430<\/p>\n<pre><code class=\"cpp\">class OutEdgeIteratorImpl : public boost::forward_iterator_helper&lt;OutEdgeIterator, Edge, std::ptrdiff_t, Edge*, Edge&gt; { public:          OutEdgeIteratorImpl(const GameField& field, Vertex cellPosition, int index = 0);     OutEdgeIteratorImpl();          Edge operator*() const;     void operator++ ();     bool operator== (const OutEdgeIterator& other) const;      private:          Vertex getCurrentPosition() const;     Vertex getTargetPosition() const;     void updateShift();     bool isValid();          int mShift;     Vertex mCellPosition;     const GameField* mField;          static const int sShiftsX[8];     static const int sShiftsY[8]; }; <\/code><\/pre>\n<p>  <b>sShiftsX<\/b> \u0438 <b>sShiftsY<\/b> \u2014 \u044d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0441\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u043e \u043e\u0441\u044f\u043c x \u0438 y \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0445 \u0432\u0435\u0440\u0448\u0438\u043d.<\/p>\n<pre><code class=\"cpp\">const int OutEdgeIteratorImpl::sShiftsX[8] = {     -1, 0, 1,     -1,    1,     -1, 0, 1 }; const int OutEdgeIteratorImpl::sShiftsY[8] = {     1,  1,  1,     0,      0,     -1, -1, -1}; <\/code><\/pre>\n<p>  \u0421 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430\u043c\u0438 \u0442\u0430 \u0436\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b\u043b\u0430 \u0434\u043b\u044f \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0432\u0435\u0440\u0448\u0438\u043d \u2014 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442-\u043f\u0443\u0441\u0442\u044b\u0448\u043a\u0443 (\u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438), \u0432\u0442\u043e\u0440\u044b\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0430\u043c\u0438.<\/p>\n<pre><code class=\"cpp\">OutEdgeIteratorImpl::OutEdgeIteratorImpl() : mField(NULL) , mCellPosition(0) , mShift(0) {      }  OutEdgeIteratorImpl::OutEdgeIteratorImpl(const GameField& field, Vertex cellPosition, int index\/* = 0*\/) : mField(&field) , mCellPosition(cellPosition) , mShift(index) {     updateShift(); } <\/code><\/pre>\n<p>  \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043e\u0431\u0445\u043e\u0434\u0430 \u0432\u0435\u0440\u0448\u0438\u043d, \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u0441\u0435 \u0440\u0435\u0431\u0440\u0430 \u043f\u043e\u0434\u0440\u044f\u0434 \u2014 \u0447\u0430\u0441\u0442\u044c \u0438\u0437 \u043d\u0438\u0445 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u043f\u0440\u0438\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <b>updateShift<\/b>, \u0437\u0430\u0434\u0430\u0447\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0438 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u00ab\u043f\u0440\u043e\u043a\u0440\u0443\u0442\u0438\u0442\u044c\u00bb \u0435\u0433\u043e \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<pre><code class=\"cpp\">void OutEdgeIteratorImpl::operator++ () {     ++mShift;     updateShift(); } <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f <b>GameField::canPass(int x, int y)<\/b>, \u0435\u0441\u043b\u0438 \u043e\u043d \u0432\u0435\u0440\u043d\u0435\u0442 \u043b\u043e\u0436\u044c (\u0432 \u0437\u0430\u0434\u0430\u043d\u043d\u0443\u044e \u044f\u0447\u0435\u0439\u043a\u0443 \u043f\u0443\u0442\u0438 \u043d\u0435\u0442), \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0441\u043e\u0441\u0435\u0434\u043d\u044f\u044f \u044f\u0447\u0435\u0439\u043a\u0430. \u0418\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0440\u0435\u0431\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0442 \u043d\u0443\u043b\u044f \u0434\u043e \u0432\u043e\u0441\u044c\u043c\u0438.<\/p>\n<pre><code class=\"cpp\">void OutEdgeIteratorImpl::updateShift() {     if (isValid()) {         int x, y;         std::tie(x, y) = getCoordinates(mCellPosition, *mField);         int dx = sShiftsX[mShift];         int dy = sShiftsY[mShift];         if (!mField-&gt;canPass(x + dx, y + dy)) {             ++mShift;             updateShift();         }     } }  bool OutEdgeIteratorImpl::isValid() {     return (mField != NULL) && (mShift &lt; 8) && (mShift &gt;=0); } <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0432\u0430 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0445 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u0432\u0435\u0440\u0448\u0438\u043d\u0443 (\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b\u043b\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u0430 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440) \u0438 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0443\u044e (\u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u0443\u044e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f <b>mShift<\/b>).<\/p>\n<pre><code class=\"cpp\">Vertex OutEdgeIteratorImpl::getCurrentPosition() const {     return mCellPosition; }  Vertex OutEdgeIteratorImpl::getTargetPosition() const {     return getCurrentPosition() + sShiftsX[mShift] + mField-&gt;getWidth() * sShiftsY[mShift]; } <\/code><\/pre>\n<p>  \u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u044d\u0442\u0443 \u043f\u0430\u0440\u0443 \u0432\u0435\u0440\u0448\u0438\u043d:<\/p>\n<pre><code class=\"cpp\">Edge OutEdgeIteratorImpl::operator*() const {     return std::make_pair(getCurrentPosition(), getTargetPosition()); } <\/code><\/pre>\n<p>  \u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0440\u0435\u0431\u0435\u0440, \u043a\u0430\u043a \u0438 \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f \u0441 \u0432\u0435\u0440\u0448\u0438\u043d\u0430\u043c\u0438, \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432<\/p>\n<pre><code class=\"cpp\">bool OutEdgeIteratorImpl::operator== (const OutEdgeIteratorImpl& other) const {     return mShift == other.mShift; } <\/code><\/pre>\n<p>  \u0418 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0448\u0430\u0433 \u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 \u0440\u0435\u0431\u0435\u0440, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432. \u0422\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0440\u0435\u0431\u0435\u0440 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0448\u0438\u043d\u044b<\/p>\n<pre><code class=\"cpp\">std::pair&lt;OutEdgeIterator, OutEdgeIterator&gt; out_edges(Vertex v, const GameField& graph) {     return std::make_pair(OutEdgeIterator(graph, v, 0), OutEdgeIterator(graph, v, 8)); } <\/code><\/pre>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c 8, \u0442\u0430\u043a \u043a\u0430\u043a \u0440\u0435\u0431\u0440\u0430 \u0441 \u0442\u0430\u043a\u0438\u043c \u043d\u043e\u043c\u0435\u0440\u043e\u043c \u0431\u044b\u0442\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 (\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0442 0 \u0434\u043e 7). \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0440\u0435\u0431\u0435\u0440 \u0442\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440 <b>OutEdgeIterator<\/b> \u2014 \u043e\u043d\u0430 \u0441\u043e\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0440\u0435\u0431\u0440\u0430 \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u043e\u043c<\/p>\n<pre><code class=\"cpp\">DegreeSizeType out_degree(Vertex v, const GameField& graph) {     DegreeSizeType result = 0;          std::pair&lt;OutEdgeIterator, OutEdgeIterator&gt; edges = out_edges(v, graph);     for (OutEdgeIterator i = edges.first; i != edges.second; ++i) {         ++result;     }          return result; } <\/code><\/pre>\n<p>  \u0412\u0441\u0435. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0439 \u0438 \u043d\u0430\u0441\u043b\u0430\u0434\u0438\u0442\u044c\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u2014 \u043d\u0430\u0448\u0435 \u0438\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c \u043a \u0433\u0440\u0430\u0444\u0430\u043c \u0434\u0432\u0443\u0445 \u0442\u0438\u043f\u043e\u0432:<\/p>\n<pre><code class=\"cpp\">    boost::function_requires&lt;boost::VertexListGraphConcept&lt;GameField&gt; &gt;();     boost::function_requires&lt;boost::IncidenceGraphConcept&lt;GameField&gt; &gt;(); <\/code><\/pre>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0439 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u0443\u0442\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0435\u0449\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043e\u043a \u2014 \u043e \u043d\u0438\u0445 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432 \u0437\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0446\u0438\u043a\u043b\u0430.    \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\/212089\/\"> http:\/\/habrahabr.ru\/post\/212089\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/a5b\/77f\/599\/a5b77f5999db35249fa68daae2ff4415.png\" align=\"left\" width=\"300\" height=\"300\"\/><br \/>  <a href=\"http:\/\/habrahabr.ru\/post\/210838\/\">\u041f\u0440\u043e\u043b\u043e\u0433: \u041a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 Boost<\/a><br \/>  <a href=\"http:\/\/habrahabr.ru\/post\/211558\/\">\u0427\u0430\u0441\u0442\u044c 1: \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0431\u0435\u0437 \u0432\u043c\u0435\u0448\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430<\/a><\/p>\n<p>  \u041a\u0440\u0430\u0442\u043a\u043e \u043d\u0430\u043f\u043e\u043c\u043d\u044e \u0437\u0430\u0434\u0430\u0447\u0443. \u0415\u0441\u0442\u044c \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u043e\u0435 \u0438\u0433\u0440\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u0438\u0437 \u043a\u043b\u0435\u0442\u043e\u043a, \u0447\u0430\u0441\u0442\u044c \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0430, \u0430 \u0447\u0430\u0441\u0442\u044c \u0437\u0430\u043d\u044f\u0442\u0430. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u043f\u0443\u0442\u044c \u043f\u043e \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u043c \u043a\u043b\u0435\u0442\u043a\u0430\u043c \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u043f\u043e\u043b\u044f \u0432 \u0434\u0440\u0443\u0433\u0443\u044e. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u0443\u0442\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0432 Boost. \u041d\u043e \u043e\u043d \u0442\u0440\u0435\u0431\u0443\u0435\u0442, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0448\u0435 \u043f\u043e\u043b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u043b\u043e \u043f\u043e\u0434 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0433\u0440\u0430\u0444\u0430. \u0422\u043e\u0447\u043d\u0435\u0435 \u043a\u043b\u0430\u0441\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0442\u044c \u0434\u0432\u0443\u043c \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f\u043c \u2014 <b>boost::VertexListGraph<\/b> \u0438 <b>boost:: IncidenceGraph<\/b>. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u2014 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u044d\u0442\u043e \u043d\u0435 \u0433\u0440\u0430\u0444 \u0438 \u0433\u0440\u0430\u0444\u043e\u043c \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u0442\u0430\u043d\u0435\u0442.<\/p>\n<p>  \u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0431\u044b\u043b\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 \u043a\u0430\u043a boost-\u0433\u0440\u0430\u0444\u0430. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043e\u0434\u043d\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u0422\u0430\u043a\u0436\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u043e\u0439 \u0438 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0441\u043c\u043e\u0436\u0435\u0442 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0433\u0440\u043e\u0432\u044b\u043c \u043f\u043e\u043b\u0435\u043c \u043a\u0430\u043a \u0433\u0440\u0430\u0444\u043e\u043c.  <\/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-212089","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/212089","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=212089"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/212089\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=212089"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=212089"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=212089"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}