{"id":272907,"date":"2016-01-26T13:03:02","date_gmt":"2016-01-26T10:03:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=272907"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=272907","title":{"rendered":"\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f Swift \u0441\u043b\u043e\u0432\u0430\u0440\u044f"},"content":{"rendered":"<p>       <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/34b\/d41\/8fd\/34bd418fda252189e7daabd1b5aa3113.png\" alt=\"image\"\/><\/p>\n<p>  <i>Swift \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0442\u043e\u0433\u043e \u0436\u0435 \u0442\u0438\u043f\u0430. \u041a\u0430\u0436\u0434\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u044d\u0442\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u043b\u043e\u0432\u0430\u0440\u044f. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435, \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435 \u043d\u0435 \u0438\u043c\u0435\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043a\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u0445 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430, \u0442\u0430\u043a \u0436\u0435 \u043a\u0430\u043a \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430. (\u043f\u0440\u0438\u043c.)<\/i><\/p>\n<p>  <b>Swift \u0441\u043b\u043e\u0432\u0430\u0440\u044c:<\/b><\/p>\n<ul>\n<li>Swift \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u043e\u0431\u0449\u0438\u0445 \u0442\u0438\u043f\u043e\u0432: \u043a\u043b\u044e\u0447\u0435\u0439 (\u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u044c\u0441\u044f \u043a \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 Hashable) \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439;<\/li>\n<li>\u041c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0430 \u0438 \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f;<\/li>\n<li>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u043d\u0435\u0435 \u043a\u043b\u044e\u0447;<\/li>\n<li>\u041c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c, \u0443\u043a\u0430\u0437\u0430\u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043b\u044e\u0447;<\/li>\n<li>\u041a\u0430\u0436\u0434\u044b\u0439 \u043a\u043b\u044e\u0447 \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u043e\u0434\u043d\u0438\u043c \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c.<\/li>\n<\/ul>\n<p>  \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (\u043a\u043b\u044e\u0447\u0435\u0439, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439), \u043e\u0434\u0438\u043d \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u043e\u0442\u043a\u0440\u044b\u0442\u0443\u044e \u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u044e \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0433\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 Swift-\u0441\u043b\u043e\u0432\u0430\u0440\u044f.<\/p>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043b\u043e\u0432\u0430\u0440\u044f, \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430 8 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432: \u0432 \u043d\u0435\u043c \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c 7 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (\u043a\u043b\u044e\u0447\u0435\u0439, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439) \u0438, \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u043e\u0434\u043d\u043e \u043f\u0443\u0441\u0442\u043e\u0435 \u043c\u0435\u0441\u0442\u043e (\u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u043f\u0440\u043e\u0431\u0435\u043b) \u0432 \u0431\u0443\u0444\u0435\u0440\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044f, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0432\u043e\u0435\u043e\u0431\u0440\u0430\u0437\u043d\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u0432\u044b\u0431\u043e\u0440\u043a\u0430\u043c\/\u0432\u0441\u0442\u0430\u0432\u043a\u0430\u043c (retrivals\/insertions).<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412 \u043f\u0430\u043c\u044f\u0442\u0438 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c, \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e, \u0442\u0430\u043a:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/807\/75b\/6f3\/80775b6f383343dddf283ff211835b0c.png\" alt=\"image\"\/><\/p>\n<p>  \u041f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437:<\/p>\n<p>  <code>size = capacity * (sizeof(Bitmap) + sizeof(Keys) + sizeof(Values))<\/code><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7be\/c07\/39c\/7bec0739cbf9f137ae03026733517c96.png\" alt=\"image\"\/> <\/p>\n<p>  \u041a\u0430\u0436\u0434\u0430\u044f \u043a\u043e\u043b\u043e\u043d\u043a\u0430 \u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u043f\u0430\u043c\u044f\u0442\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0442\u0440\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430: bitmap value, \u043a\u043b\u044e\u0447 \u0438 value.<\/p>\n<p>  Bitmap value \u0432 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043b\u0438 \u043a\u043b\u044e\u0447 \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0415\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\/\u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u043c.<\/p>\n<p>  <code>_HashedContainerStorageHeader (struct)<\/code><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9b6\/ef5\/efd\/9b6ef5efd6cf7a22f75d8ce6f8893145.png\" alt=\"image\"\/><\/p>\n<p>  \u042d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0434\u043b\u044f \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e \u0431\u0443\u0444\u0435\u0440\u0430 \u043f\u0430\u043c\u044f\u0442\u0438. \u0412 \u043d\u0435\u0439 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0435\u043c\u043a\u043e\u0441\u0442\u044c \u0438 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0431\u044a\u0435\u043c\u0435, \u0433\u0434\u0435 \u0435\u043c\u043a\u043e\u0441\u0442\u044c \u2014 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0435\u043c\u043a\u043e\u0441\u0442\u044c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u0430 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0431\u044a\u0435\u043c\u0435 \u2013 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0445\u0441\u044f \u0432 \u0431\u0443\u0444\u0435\u0440\u0435 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442.<\/p>\n<p>  <code>maxLoadFactorInverse<\/code> \u2014 \u044d\u0442\u043e \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0431\u0443\u0444\u0435\u0440 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<h4><code>_NativeDictionaryStorageImpl&lt;Key, Value&gt; (class)<\/code><\/h4>\n<p>  \u041f\u043e\u0434\u043a\u043b\u0430\u0441\u0441 <code>ManagedBuffer&lt;_HashedContainerStorageHeader, UInt8&gt;<\/code><\/p>\n<p>  \u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u2014 \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0434\u043b\u044f \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u043f\u0430\u043c\u044f\u0442\u044c \u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043d\u0430 bitmap, \u043a\u043b\u044e\u0447\u0438 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"objectivec\">internal var _values: UnsafeMutablePointer&lt;Value&gt; {   @warn_unused_result   get {     let start = UInt(Builtin.ptrtoint_Word(_keys._rawValue)) &+       UInt(_capacity) &* UInt(strideof(Key.self))     let alignment = UInt(alignof(Value))     let alignMask = alignment &- UInt(1)     return UnsafeMutablePointer&lt;Value&gt;(         bitPattern:(start &+ alignMask) & ~alignMask)   } } <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u0430\u043c\u044f\u0442\u044c Bitmap, \u043a\u043b\u044e\u0447\u0435\u0439 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441\u043c\u0435\u0436\u043d\u0430\u044f, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 \u0431\u0443\u0434\u0443\u0442 \u0438\u043c\u0435\u0442\u044c \u0432\u0438\u0434:<\/p>\n<pre><code>internal class func create(capacity: Int) -&gt; StorageImpl {   let requiredCapacity = bytesForBitMap(capacity) + bytesForKeys(capacity)       + bytesForValues(capacity)    let r = super.create(requiredCapacity) { _ in     return _HashedContainerStorageHeader(capacity: capacity)   }   let storage = r as! StorageImpl   let initializedEntries = _BitMap(       storage: storage._initializedHashtableEntriesBitMapStorage,       bitCount: capacity)   initializedEntries.initializeToZero()   return storage } <\/code><\/pre>\n<p>  \u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u0443\u0444\u0435\u0440\u0430 \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 bitmap \u043f\u0440\u0438\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0443\u043b\u044e, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u0441\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b \u043f\u0430\u043c\u044f\u0442\u0438, \u043f\u043e \u0441\u0443\u0442\u0438, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u043f\u0440\u043e\u0431\u0435\u043b\u044b. \u0421\u0442\u043e\u0438\u0442 \u0442\u0430\u043a\u0436\u0435 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0434\u043b\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431\u0449\u0438\u0439 \u0442\u0438\u043f \u043a\u043b\u044e\u0447\u0430 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c Hashable.<\/p>\n<p>  <code>\/\/ \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043a\u043b\u044e\u0447, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \/\/ (\u0431\u0435\u0437:  Hashable) - \u044d\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \/\/ \u0441 \u0442\u0438\u043f\u0430\u043c\u0438, \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043e\u0442 Hashable.<\/code><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/137\/e87\/bca\/137e87bcaac77cd2986babe759b09584.png\" alt=\"image\"\/><\/p>\n<h4><code>_NativeDictionaryStorage&lt;Key : Hashable, Value&gt; (\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430)<\/code><\/h4>\n<p>  \u042d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u0431\u0443\u0444\u0435\u0440\u0435 \u0438 \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0449\u0443\u044e \u0441\u043c\u0435\u0436\u043d\u0443\u044e \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430. \u0422\u0430\u043a\u0436\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0447\u0435\u043c\u0443 \u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043a\u043e\u043b\u044c\u0446\u043e. \u0410, \u0437\u043d\u0430\u0447\u0438\u0442, \u0435\u0441\u043b\u0438 \u0432\u044b \u0432 \u043a\u043e\u043d\u0446\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u0438 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0432 \u0438\u0442\u043e\u0433\u0435, \u0432\u0430\u0441 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u044f\u0442 \u043a \u043d\u0430\u0447\u0430\u043b\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c \u0432\u0441\u0442\u0430\u0432\u043a\u0443 \u0438\u043b\u0438 \u0437\u0430\u0434\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u044e\u0447\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c, \u043a \u043a\u0430\u043a\u043e\u043c\u0443 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0443 \u044d\u0442\u043e\u0442 \u043a\u043b\u044e\u0447 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442. \u0422\u0430\u043a \u043a\u0430\u043a \u043a\u043b\u044e\u0447 \u0443 \u043d\u0430\u0441 Hashable, \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f hashValue, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043b\u0443\u0436\u0438\u0442 Int. \u041f\u0440\u0430\u0432\u0434\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 hashValue \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0442\u044c \u0435\u043c\u043a\u043e\u0441\u0442\u044c \u0431\u0443\u0444\u0435\u0440\u0430 \u0441\u043b\u043e\u0432\u0430\u0440\u044f, \u0430 \u043f\u043e\u0442\u043e\u043c\u0443, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0435\u0433\u043e \u0441\u0436\u0430\u0442\u044c \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043e\u0442 \u043d\u0443\u043b\u044f \u0434\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0435\u043c\u043a\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"objectivec\">@warn_unused_result internal func _bucket(k: Key) -&gt; Int {   return _squeezeHashValue(k.hashValue, 0..&lt;capacity) } <\/code><\/pre>\n<p>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u043c\u0438, \u043e\u0431\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u043a \u043e\u043f\u0446\u0438\u044f\u043c <code>_next<\/code> \u0438 <code>_prev<\/code>. <b>\u0415\u043c\u043a\u043e\u0441\u0442\u044c \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0447\u0438\u0441\u043b\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u044c \u0432 \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435.<\/b> \u0415\u0441\u043b\u0438 \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u0432 \u043a\u043e\u043d\u0446\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430, \u043f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u043e\u0442\u043a\u0430\u0442 \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0437\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0432\u044b\u0437\u043e\u0432 <code>_next<\/code>.<\/p>\n<pre><code class=\"objectivec\">internal var _bucketMask: Int {   \/\/ The capacity is not negative, therefore subtracting 1 will not overflow.   return capacity &- 1 }  @warn_unused_result internal func _next(bucket: Int) -&gt; Int {   \/\/ Bucket is within 0 and capacity. Therefore adding 1 does not overflow.   return (bucket &+ 1) & _bucketMask }  @warn_unused_result internal func _prev(bucket: Int) -&gt; Int {   \/\/ Bucket is not negative. Therefore subtracting 1 does not overflow.   return (bucket &- 1) & _bucketMask } <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0443\u0437\u043d\u0430\u0442\u044c, \u043a \u043a\u0430\u043a\u043e\u043c\u0443 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0443 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442\u044c \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0443\u044e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043b\u044e\u0447 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u0434\u0430\u044e\u0449\u0443\u044e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 bitmap.<\/p>\n<pre><code class=\"objectivec\">@_transparent internal func initializeKey(k: Key, value v: Value, at i: Int) {   _sanityCheck(!isInitializedEntry(i))    (keys + i).initialize(k)   (values + i).initialize(v)   initializedEntries[i] = true   _fixLifetime(self) } <\/code><\/pre>\n<h4>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>_find<\/code><\/h4>\n<p>  <\/p>\n<ul>\n<li>\u0424\u0443\u043d\u043a\u0446\u0438\u044f _find \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043a\u043b\u044e\u0447\u043e\u043c (\u0432\u0441\u0442\u0430\u0432\u043a\u0430 \u0438\u043b\u0438 \u0432\u044b\u0431\u043e\u0440\u043a\u0430);<\/li>\n<li>\u0417\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043a\u043b\u044e\u0447\u0430, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>_bucket(key)<\/code>;<\/li>\n<li>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043a\u043b\u044e\u0447 \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043a\u043b\u044e\u0447\u043e\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u043e\u0431\u044a\u0435\u043a\u0442\u0430;<\/li>\n<li>\u0415\u0441\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0431\u0435\u043b\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u0443\u0447\u0430\u0441\u0442\u043a\u043e\u043c \u0434\u043b\u044f \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u043a\u043b\u044e\u0447\u0430;<\/li>\n<li>Bitmap \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b, \u043e\u0442\u0434\u0435\u043b\u044f\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0435 \u0443\u0447\u0430\u0441\u0442\u043a\u0438 \u043e\u0442 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432;<\/li>\n<li>\u042d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0435 \u043f\u0440\u043e\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 (<a href=\"https:\/\/en.wikipedia.org\/wiki\/Linear_probing\">linear probing<\/a>);<\/li>\n<\/ul>\n<pre><code class=\"objectivec\">\/\/\/ \u041f\u043e\u0438\u0441\u043a \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430. \/\/\/ \/\/\/\u0415\u0441\u043b\u0438 \u043a\u043b\u044e\u0447 \u043d\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d, \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u043a \u043c\u0435\u0441\u0442\u0443 \u0435\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0439 \/\/\/ \u0432\u0441\u0442\u0430\u0432\u043a\u0438. @warn_unused_result internal func _find(key: Key, _ startBucket: Int) -&gt; (pos: Index, found: Bool) {   var bucket = startBucket    \/\/ The invariant guarantees there's always a hole, so we just loop   \/\/ until we find one   while true {     let isHole = !isInitializedEntry(bucket)     if isHole {       return (Index(nativeStorage: self, offset: bucket), false)     }     if keyAt(bucket) == key {       return (Index(nativeStorage: self, offset: bucket), true)     }     bucket = _next(bucket)   } } <\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li> \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, squeezeHashValue \u2013 \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043a\u043b\u044e\u0447 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430, \u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b, \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u0434\u0432\u0443\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0445\u0435\u0448;<\/li>\n<li>\u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u044f\u0432\u0438\u0442 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u043a\u043b\u044e\u0447\u0430.<\/li>\n<\/ul>\n<h4>\u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0445\u0435\u0448 Hashable \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0432 \u0440\u043e\u043b\u0438, \u0435\u0434\u0432\u0430 \u043b\u0438 \u043d\u0435 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u0432\u044b\u0441\u043e\u043a\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/h4>\n<p>  <\/p>\n<ul>\n<li>squeezeHashValue \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0445\u0435\u0448 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043e\u043f\u0446\u0438\u0439;<\/li>\n<li>\u041f\u043e\u0445\u043e\u0436\u0435, \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0445\u0435\u0448, \u044f\u0434\u0440\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043e \u043a hashValue, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u0432 \u0442\u0438\u043f\u0435 \u043a\u043b\u044e\u0447\u0430. \u041f\u0440\u0430\u0432\u0434\u0430, \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044f;<\/li>\n<li><code>_BitMap<\/code> struct \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0439 \u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 bitmap.<\/li>\n<\/ul>\n<p>  \u041d\u0430\u0433\u043b\u044f\u0434\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c, \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/i.imgur.com\/2pT2qXZ.png\" alt=\"image\"\/><\/p>\n<h4><code>_NativeDictionaryStorageOwner (class)<\/code><\/h4>\n<p>  \u042d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d \u0434\u043b\u044f \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430 \u0441\u043d\u043e\u0441\u043e\u043a \u0434\u043b\u044f \u043a\u043e\u043f\u0438\u0439, \u0441\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u0445 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438. \u0422\u0430\u043a \u043a\u0430\u043a \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0446\u0438\u0439 Dictionary \u0438 DictionaryIndex, \u0441\u0447\u0435\u0442\u0447\u0438\u043a \u0441\u0441\u044b\u043b\u043e\u043a \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0442\u044c \u0432\u0432\u043e\u0434\u0438\u043c\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 2, \u043d\u043e, \u0435\u0441\u043b\u0438 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e\u043c\u0443 \u043a\u043b\u0430\u0441\u0441\u0443 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0441\u044b\u043b\u043e\u043a \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u0432\u0430\u043c \u043d\u0435 \u043e \u0447\u0435\u043c \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c\u0441\u044f.<\/p>\n<p>  <i>\/\/\/ \u0414\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u2013 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 COW. \u041e\u043d<br \/>   \/\/\/ \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u043e\u0432 \u0441\u0441\u044b\u043b\u043e\u043a \u0434\u043b\u044f:<br \/>   \/\/\/ \u2014 `Dictionary` \u0438 `NSDictionary`,<br \/>   \/\/\/ \u2014 `DictionaryIndex`.<br \/>   \/\/\/<br \/>   \/\/\/ \u042d\u0442\u043e \u0432\u0430\u0436\u043d\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f COW \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e<br \/>   \/\/\/ \u0434\u043b\u044f \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0447\u0435\u0442\u0447\u0438\u043a\u043e\u0432 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u0438\u0434\u0430.<br \/>  <\/i><br \/>  \u0422\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u0438\u044f\u0442\u043d\u043e:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/i.imgur.com\/h6TW7Aj.png\" alt=\"image\"\/><\/p>\n<h4><code>_VariantDictionaryStorage&lt;Key : Hashable, Value&gt; (\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0439 \u0442\u0438\u043f)<\/code><\/h4>\n<p>  \u042d\u0442\u043e\u0442 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0439 \u0442\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0434\u0432\u0443\u043c\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430\u043c\u0438 Native\/Cocoa \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c\u044b\u0445 \u0432 \u043d\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code class=\"objectivec\">case Native(_NativeDictionaryStorageOwner&lt;Key, Value&gt;) case Cocoa(_CocoaDictionaryStorage) <\/code><\/pre>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438:<\/p>\n<ul>\n<li>\u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0439 \u0442\u0438\u043f, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 Native \u0438\u043b\u0438 Cocoa, \u0437\u0430\u0434\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435 \u0434\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u043a\u0430\u043a, \u043a\u0430\u043a \u0432\u0441\u0442\u0430\u0432\u043a\u0430, \u0432\u044b\u0431\u043e\u0440\u043a\u0430, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0438 \u0442.\u0434;<\/li>\n<li>\u0420\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442 \u043e\u0431\u044a\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u043c\u0435\u0440\u0435 \u0435\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f;<\/li>\n<li>\u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0438\u043b\u0438 \u0437\u0430\u0434\u0430\u0435\u0442 \u0441\u0432\u044f\u0437\u043a\u0443 \u043a\u043b\u044e\u0447-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/li>\n<li>\u0415\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430, \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0431\u0435\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u044b \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u0440\u043e\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u0435\u0433\u043e \u043f\u0440\u0435\u0436\u0434\u0435\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c\u0443 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044e. \u0414\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u044f\u0432\u043b\u0435\u043d\u0438\u0439 \u0432\u0430\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044f.<\/li>\n<\/ul>\n<pre><code class=\"objectivec\">\/\/\/ - \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 idealBucket: \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0449\u0438\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430. \/\/\/ - \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 offset: \u043e\u0444\u0441\u0435\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d. \/\/\/\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0430 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435. internal mutating func nativeDeleteImpl(   nativeStorage: NativeStorage, idealBucket: Int, offset: Int ) {   _sanityCheck(       nativeStorage.isInitializedEntry(offset), &quot;expected initialized entry&quot;)    \/\/ \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442   nativeStorage.destroyEntryAt(offset)   nativeStorage.count -= 1   \/\/ \u0415\u0441\u043b\u0438 \u0432 \u0440\u044f\u0434\u0443 \u0441\u043c\u0435\u0436\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u0435\u043b,  \/\/ \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u0430 \u043c\u043e\u0433\u0443\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0431\u0435\u043b\u0430.   var hole = offset    \/\/ \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u0441\u043c\u0435\u0436\u043d\u043e\u0433\u043e \u0440\u044f\u0434\u0430   var start = idealBucket   while nativeStorage.isInitializedEntry(nativeStorage._prev(start)) {     start = nativeStorage._prev(start)   }    \/\/ \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u0441\u043c\u0435\u0436\u043d\u043e\u0433\u043e \u0440\u044f\u0434\u0430   var lastInChain = hole   var b = nativeStorage._next(lastInChain)   while nativeStorage.isInitializedEntry(b) {     lastInChain = b     b = nativeStorage._next(b)   }    \/\/ \u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0439\u0442\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043d\u043d\u044b\u0435 \u043d\u0430 \u043d\u043e\u0432\u044b\u0435 \u043c\u0435\u0441\u0442\u0430 \u0432 \u0440\u044f\u0434\u0443, \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440,   \/\/ \u043f\u043e\u043a\u0430 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043d\u0435 \u043e\u043a\u0430\u0436\u0443\u0442\u0441\u044f \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u044f\u0445.   while hole != lastInChain {     \/\/ \u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438, \u0441 \u043a\u043e\u043d\u0446\u0430 \u0440\u044f\u0434\u0430 \u0441\u043c\u0435\u0436\u043d\u044b\u0445 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043f\u043e\u0438\u0441\u043a\u0435     \/\/ \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u043d\u0435 \u043d\u0430 \u0441\u0432\u043e\u0438\u0445 \u043c\u0435\u0441\u0442\u0430\u0445.     var b = lastInChain     while b != hole {       let idealBucket = nativeStorage._bucket(nativeStorage.keyAt(b))        \/\/ \u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0438 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u043c? \u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e        \/\/ \u0434\u0432\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u0430 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0433\u043e \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0443\u043f\u0430\u043a\u043e\u0432\u0449\u0438\u043a\u043e\u0432 [\u043d\u0430\u0447\u0430\u043b\u043e, \u043f\u0440\u043e\u0431\u0435\u043b]       \/\/ \u0432 \u043a\u043e\u043d\u0446\u0435 \u0431\u0443\u0444\u0435\u0440\u0430       let c0 = idealBucket &gt;= start       let c1 = idealBucket &lt;= hole       if start &lt;= hole ? (c0 && c1) : (c0 || c1) {         break \/\/ Found it       }       b = nativeStorage._prev(b)     }      if b == hole { \/\/ No out-of-place elements found; we're done adjusting       break     }      \/\/ \u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0430 \u043c\u0435\u0441\u0442\u043e \u043f\u0440\u043e\u0431\u0435\u043b\u0430     nativeStorage.moveInitializeFrom(nativeStorage, at: b, toEntryAt: hole)     hole = b   } } <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"http:\/\/i.imgur.com\/6rwgJ0T.png\" alt=\"image\"\/><\/p>\n<h4>\u0418 \u0432\u043e\u0442 \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0430\u0448 \u0441\u043b\u043e\u0432\u0430\u0440\u044c<\/h4>\n<p>  (\u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u0432\u0438\u0434\u043e\u0432 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445)<br \/>  <img decoding=\"async\" src=\"http:\/\/i.imgur.com\/8busLKc.png\" alt=\"image\"\/>       <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/275911\/\"> https:\/\/habrahabr.ru\/post\/275911\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/34b\/d41\/8fd\/34bd418fda252189e7daabd1b5aa3113.png\" alt=\"image\"\/><\/p>\n<p>  <i>Swift \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0442\u043e\u0433\u043e \u0436\u0435 \u0442\u0438\u043f\u0430. \u041a\u0430\u0436\u0434\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u044d\u0442\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u043b\u043e\u0432\u0430\u0440\u044f. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435, \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435 \u043d\u0435 \u0438\u043c\u0435\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0430. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043a\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u0445 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430, \u0442\u0430\u043a \u0436\u0435 \u043a\u0430\u043a \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430. (\u043f\u0440\u0438\u043c.)<\/i><\/p>\n<p>  <b>Swift \u0441\u043b\u043e\u0432\u0430\u0440\u044c:<\/b><\/p>\n<ul>\n<li>Swift \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u043e\u0431\u0449\u0438\u0445 \u0442\u0438\u043f\u043e\u0432: \u043a\u043b\u044e\u0447\u0435\u0439 (\u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u044c\u0441\u044f \u043a \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 Hashable) \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439;<\/li>\n<li>\u041c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0430 \u0438 \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f;<\/li>\n<li>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u043d\u0435\u0435 \u043a\u043b\u044e\u0447;<\/li>\n<li>\u041c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c, \u0443\u043a\u0430\u0437\u0430\u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043b\u044e\u0447;<\/li>\n<li>\u041a\u0430\u0436\u0434\u044b\u0439 \u043a\u043b\u044e\u0447 \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u043e\u0434\u043d\u0438\u043c \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c.<\/li>\n<\/ul>\n<p>  \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (\u043a\u043b\u044e\u0447\u0435\u0439, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439), \u043e\u0434\u0438\u043d \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u043e\u0442\u043a\u0440\u044b\u0442\u0443\u044e \u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u044e \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0433\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 Swift-\u0441\u043b\u043e\u0432\u0430\u0440\u044f.<\/p>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043b\u043e\u0432\u0430\u0440\u044f, \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430 8 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432: \u0432 \u043d\u0435\u043c \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c 7 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (\u043a\u043b\u044e\u0447\u0435\u0439, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439) \u0438, \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u043e\u0434\u043d\u043e \u043f\u0443\u0441\u0442\u043e\u0435 \u043c\u0435\u0441\u0442\u043e (\u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u043f\u0440\u043e\u0431\u0435\u043b) \u0432 \u0431\u0443\u0444\u0435\u0440\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044f, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0432\u043e\u0435\u043e\u0431\u0440\u0430\u0437\u043d\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e\u0438\u0441\u043a\u0430 \u043f\u043e \u0432\u044b\u0431\u043e\u0440\u043a\u0430\u043c\/\u0432\u0441\u0442\u0430\u0432\u043a\u0430\u043c (retrivals\/insertions).  <\/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-272907","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/272907","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=272907"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/272907\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=272907"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=272907"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=272907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}