passenger 6.0.22 → 6.0.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (334) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +59 -1
  3. data/Rakefile +13 -2
  4. data/bin/passenger-install-apache2-module +5 -0
  5. data/bin/passenger-install-nginx-module +18 -2
  6. data/build/apache2.rb +1 -1
  7. data/build/basics.rb +10 -4
  8. data/build/cxx_tests.rb +18 -7
  9. data/build/support/cxx_dependency_map.rb +40 -6
  10. data/build/test_basics.rb +24 -13
  11. data/package.json +1 -1
  12. data/passenger.gemspec +4 -2
  13. data/resources/templates/standalone/server.erb +1 -0
  14. data/src/agent/Core/ApplicationPool/Group/InitializationAndShutdown.cpp +8 -0
  15. data/src/agent/Core/ApplicationPool/Group/InternalUtils.cpp +10 -2
  16. data/src/agent/Core/ApplicationPool/Group/LifetimeAndBasics.cpp +8 -0
  17. data/src/agent/Core/ApplicationPool/Group/Miscellaneous.cpp +9 -0
  18. data/src/agent/Core/ApplicationPool/Group/OutOfBandWork.cpp +9 -0
  19. data/src/agent/Core/ApplicationPool/Group/ProcessListManagement.cpp +63 -50
  20. data/src/agent/Core/ApplicationPool/Group/SessionManagement.cpp +19 -9
  21. data/src/agent/Core/ApplicationPool/Group/SpawningAndRestarting.cpp +8 -0
  22. data/src/agent/Core/ApplicationPool/Group/StateInspection.cpp +9 -1
  23. data/src/agent/Core/ApplicationPool/Group/Verification.cpp +8 -0
  24. data/src/agent/Core/ApplicationPool/Group.h +15 -5
  25. data/src/agent/Core/ApplicationPool/Pool/AnalyticsCollection.cpp +5 -0
  26. data/src/agent/Core/ApplicationPool/Pool/GarbageCollection.cpp +5 -0
  27. data/src/agent/Core/ApplicationPool/Pool/GeneralUtils.cpp +5 -0
  28. data/src/agent/Core/ApplicationPool/Pool/GroupUtils.cpp +5 -0
  29. data/src/agent/Core/ApplicationPool/Pool/InitializationAndShutdown.cpp +5 -0
  30. data/src/agent/Core/ApplicationPool/Pool/Miscellaneous.cpp +5 -0
  31. data/src/agent/Core/ApplicationPool/Pool/ProcessUtils.cpp +5 -0
  32. data/src/agent/Core/ApplicationPool/Pool/StateInspection.cpp +11 -4
  33. data/src/agent/Core/ApplicationPool/Pool.h +0 -2
  34. data/src/agent/Core/ApplicationPool/Process.h +22 -6
  35. data/src/agent/Core/ApplicationPool/Session.h +6 -1
  36. data/src/agent/Core/Config.h +8 -3
  37. data/src/agent/Core/Controller/CheckoutSession.cpp +24 -1
  38. data/src/agent/Core/Controller/Config.h +5 -1
  39. data/src/agent/Core/Controller.h +1 -0
  40. data/src/agent/Core/CoreMain.cpp +10 -17
  41. data/src/agent/Core/OptionParser.h +3 -0
  42. data/src/agent/Core/SpawningKit/ErrorRenderer.h +5 -0
  43. data/src/agent/Core/SpawningKit/Handshake/Prepare.h +1 -53
  44. data/src/agent/Core/SpawningKit/Handshake/Session.h +3 -0
  45. data/src/agent/Core/SpawningKit/Handshake/WorkDir.h +5 -2
  46. data/src/agent/Core/SpawningKit/SmartSpawner.h +6 -2
  47. data/src/agent/Core/SpawningKit/Spawner.h +4 -0
  48. data/src/agent/Shared/Fundamentals/AbortHandler.cpp +88 -9
  49. data/src/agent/Shared/Fundamentals/AbortHandler.h +2 -0
  50. data/src/agent/Shared/Fundamentals/Initialization.cpp +9 -3
  51. data/src/agent/Shared/Fundamentals/Initialization.h +3 -3
  52. data/src/agent/SpawnEnvSetupper/SpawnEnvSetupperMain.cpp +6 -7
  53. data/src/agent/Watchdog/Config.h +2 -1
  54. data/src/agent/Watchdog/WatchdogMain.cpp +4 -7
  55. data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +5 -0
  56. data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp +15 -0
  57. data/src/apache2_module/ConfigGeneral/ManifestGeneration.h +5 -3
  58. data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp +5 -0
  59. data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp +3 -0
  60. data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp +13 -0
  61. data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp +7 -0
  62. data/src/apache2_module/DirConfig/AutoGeneratedStruct.h +16 -0
  63. data/src/apache2_module/DirConfig/AutoGeneratedStruct.h.cxxcodebuilder +3 -0
  64. data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h +2 -1
  65. data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h.cxxcodebuilder +2 -1
  66. data/src/cxx_supportlib/Constants.h +1 -1
  67. data/src/cxx_supportlib/DataStructures/LString.h +4 -0
  68. data/src/cxx_supportlib/DataStructures/StringMap.h +0 -1
  69. data/src/cxx_supportlib/FileTools/PathManip.cpp +1 -1
  70. data/src/cxx_supportlib/SafeLibev.h +1 -3
  71. data/src/cxx_supportlib/ServerKit/Hooks.h +2 -2
  72. data/src/cxx_supportlib/ServerKit/HttpHeaderParser.h +0 -1
  73. data/src/cxx_supportlib/ServerKit/HttpServer.h +15 -10
  74. data/src/cxx_supportlib/ServerKit/Server.h +0 -6
  75. data/src/cxx_supportlib/Utils/AsyncSignalSafeUtils.h +2 -0
  76. data/src/cxx_supportlib/Utils/SpeedMeter.h +0 -3
  77. data/src/cxx_supportlib/oxt/implementation.cpp +11 -0
  78. data/src/cxx_supportlib/oxt/system_calls.cpp +10 -3
  79. data/src/cxx_supportlib/oxt/thread.hpp +1 -1
  80. data/src/cxx_supportlib/vendor-modified/boost/asio/as_tuple.hpp +35 -9
  81. data/src/cxx_supportlib/vendor-modified/boost/asio/associated_immediate_executor.hpp +3 -2
  82. data/src/cxx_supportlib/vendor-modified/boost/asio/associator.hpp +1 -1
  83. data/src/cxx_supportlib/vendor-modified/boost/asio/async_result.hpp +74 -68
  84. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_datagram_socket.hpp +11 -11
  85. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_deadline_timer.hpp +2 -2
  86. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_random_access_file.hpp +2 -2
  87. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_raw_socket.hpp +10 -10
  88. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_readable_pipe.hpp +1 -1
  89. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_seq_packet_socket.hpp +3 -3
  90. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_serial_port.hpp +2 -2
  91. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_signal_set.hpp +1 -1
  92. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket.hpp +2 -2
  93. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket_acceptor.hpp +9 -9
  94. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_stream_file.hpp +2 -2
  95. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_stream_socket.hpp +6 -6
  96. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_waitable_timer.hpp +2 -2
  97. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_writable_pipe.hpp +1 -1
  98. data/src/cxx_supportlib/vendor-modified/boost/asio/bind_allocator.hpp +88 -22
  99. data/src/cxx_supportlib/vendor-modified/boost/asio/bind_cancellation_slot.hpp +91 -22
  100. data/src/cxx_supportlib/vendor-modified/boost/asio/bind_executor.hpp +105 -23
  101. data/src/cxx_supportlib/vendor-modified/boost/asio/bind_immediate_executor.hpp +90 -23
  102. data/src/cxx_supportlib/vendor-modified/boost/asio/buffer.hpp +2 -2
  103. data/src/cxx_supportlib/vendor-modified/boost/asio/buffer_registration.hpp +1 -1
  104. data/src/cxx_supportlib/vendor-modified/boost/asio/cancel_after.hpp +303 -0
  105. data/src/cxx_supportlib/vendor-modified/boost/asio/cancel_at.hpp +296 -0
  106. data/src/cxx_supportlib/vendor-modified/boost/asio/{experimental/impl/co_composed.hpp → co_composed.hpp} +208 -61
  107. data/src/cxx_supportlib/vendor-modified/boost/asio/completion_condition.hpp +49 -0
  108. data/src/cxx_supportlib/vendor-modified/boost/asio/compose.hpp +10 -201
  109. data/src/cxx_supportlib/vendor-modified/boost/asio/composed.hpp +415 -0
  110. data/src/cxx_supportlib/vendor-modified/boost/asio/connect.hpp +214 -48
  111. data/src/cxx_supportlib/vendor-modified/boost/asio/coroutine.hpp +3 -4
  112. data/src/cxx_supportlib/vendor-modified/boost/asio/default_completion_token.hpp +91 -0
  113. data/src/cxx_supportlib/vendor-modified/boost/asio/deferred.hpp +9 -5
  114. data/src/cxx_supportlib/vendor-modified/boost/asio/detached.hpp +2 -2
  115. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/buffered_stream_storage.hpp +1 -1
  116. data/src/cxx_supportlib/vendor-modified/boost/asio/{experimental/detail/channel_message.hpp → detail/completion_message.hpp} +14 -16
  117. data/src/cxx_supportlib/vendor-modified/boost/asio/{experimental/detail/channel_payload.hpp → detail/completion_payload.hpp} +30 -32
  118. data/src/cxx_supportlib/vendor-modified/boost/asio/{experimental/detail/channel_handler.hpp → detail/completion_payload_handler.hpp} +15 -13
  119. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/config.hpp +26 -32
  120. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/deadline_timer_service.hpp +5 -1
  121. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/handler_alloc_helpers.hpp +14 -118
  122. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/descriptor_ops.ipp +36 -33
  123. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/dev_poll_reactor.ipp +1 -1
  124. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/reactive_descriptor_service.ipp +7 -5
  125. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/reactive_socket_service_base.ipp +6 -4
  126. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/socket_ops.ipp +44 -35
  127. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/socket_select_interrupter.ipp +1 -1
  128. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/initiation_base.hpp +64 -0
  129. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/memory.hpp +0 -11
  130. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_descriptor_service.hpp +20 -16
  131. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_socket_send_op.hpp +0 -1
  132. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_socket_service.hpp +4 -4
  133. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_socket_service_base.hpp +23 -18
  134. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/recycling_allocator.hpp +9 -0
  135. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/resolve_endpoint_op.hpp +1 -1
  136. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/resolve_query_op.hpp +1 -1
  137. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/thread_info_base.hpp +11 -1
  138. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/timed_cancel_op.hpp +363 -0
  139. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/wrapped_handler.hpp +29 -51
  140. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/allocator.hpp +1 -1
  141. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/blocking.hpp +1 -1
  142. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/blocking_adaptation.hpp +1 -1
  143. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/context.hpp +1 -1
  144. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/mapping.hpp +1 -1
  145. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/occupancy.hpp +1 -1
  146. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/outstanding_work.hpp +1 -1
  147. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/relationship.hpp +1 -1
  148. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/basic_channel.hpp +2 -1
  149. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/basic_concurrent_channel.hpp +2 -1
  150. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/co_composed.hpp +2 -114
  151. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detail/channel_receive_op.hpp +2 -3
  152. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detail/channel_send_functions.hpp +27 -19
  153. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detail/channel_send_op.hpp +0 -1
  154. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detail/channel_service.hpp +17 -15
  155. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detail/coro_promise_allocator.hpp +2 -3
  156. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detail/impl/channel_service.hpp +4 -2
  157. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detail/partial_promise.hpp +3 -5
  158. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/impl/as_single.hpp +12 -7
  159. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/impl/coro.hpp +1 -1
  160. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/parallel_group.hpp +38 -40
  161. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/promise.hpp +3 -3
  162. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/use_coro.hpp +5 -5
  163. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/use_promise.hpp +1 -1
  164. data/src/cxx_supportlib/vendor-modified/boost/asio/immediate.hpp +144 -0
  165. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/append.hpp +14 -7
  166. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/as_tuple.hpp +45 -14
  167. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/awaitable.hpp +3 -3
  168. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/cancel_after.hpp +270 -0
  169. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/cancel_at.hpp +270 -0
  170. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/co_spawn.hpp +8 -0
  171. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/connect.hpp +60 -166
  172. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/consign.hpp +14 -7
  173. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/detached.hpp +2 -2
  174. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/prepend.hpp +14 -7
  175. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/read.hpp +26 -177
  176. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/read_at.hpp +16 -82
  177. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/read_until.hpp +13 -286
  178. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/redirect_error.hpp +55 -18
  179. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/spawn.hpp +1 -1
  180. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/write.hpp +26 -185
  181. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/write_at.hpp +16 -87
  182. data/src/cxx_supportlib/vendor-modified/boost/asio/io_context_strand.hpp +5 -5
  183. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/basic_resolver.hpp +6 -6
  184. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/detail/socket_option.hpp +1 -1
  185. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/address_v6.ipp +1 -1
  186. data/src/cxx_supportlib/vendor-modified/boost/asio/placeholders.hpp +12 -6
  187. data/src/cxx_supportlib/vendor-modified/boost/asio/posix/basic_descriptor.hpp +1 -1
  188. data/src/cxx_supportlib/vendor-modified/boost/asio/posix/basic_stream_descriptor.hpp +2 -2
  189. data/src/cxx_supportlib/vendor-modified/boost/asio/read.hpp +127 -28
  190. data/src/cxx_supportlib/vendor-modified/boost/asio/read_at.hpp +70 -20
  191. data/src/cxx_supportlib/vendor-modified/boost/asio/read_until.hpp +114 -36
  192. data/src/cxx_supportlib/vendor-modified/boost/asio/redirect_error.hpp +43 -3
  193. data/src/cxx_supportlib/vendor-modified/boost/asio/registered_buffer.hpp +2 -2
  194. data/src/cxx_supportlib/vendor-modified/boost/asio/spawn.hpp +0 -1
  195. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/impl/openssl_init.ipp +2 -2
  196. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/impl/context.ipp +10 -7
  197. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/stream.hpp +5 -5
  198. data/src/cxx_supportlib/vendor-modified/boost/asio/this_coro.hpp +2 -2
  199. data/src/cxx_supportlib/vendor-modified/boost/asio/use_awaitable.hpp +2 -2
  200. data/src/cxx_supportlib/vendor-modified/boost/asio/use_future.hpp +1 -1
  201. data/src/cxx_supportlib/vendor-modified/boost/asio/uses_executor.hpp +1 -1
  202. data/src/cxx_supportlib/vendor-modified/boost/asio/version.hpp +1 -1
  203. data/src/cxx_supportlib/vendor-modified/boost/asio/write.hpp +147 -35
  204. data/src/cxx_supportlib/vendor-modified/boost/asio/write_at.hpp +74 -22
  205. data/src/cxx_supportlib/vendor-modified/boost/asio.hpp +6 -0
  206. data/src/cxx_supportlib/vendor-modified/boost/assert/source_location.hpp +4 -1
  207. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/futex.hpp +42 -11
  208. data/src/cxx_supportlib/vendor-modified/boost/bind/bind.hpp +15 -37
  209. data/src/cxx_supportlib/vendor-modified/boost/container/adaptive_pool.hpp +8 -8
  210. data/src/cxx_supportlib/vendor-modified/boost/container/allocator.hpp +1 -1
  211. data/src/cxx_supportlib/vendor-modified/boost/container/allocator_traits.hpp +151 -10
  212. data/src/cxx_supportlib/vendor-modified/boost/container/container_fwd.hpp +11 -9
  213. data/src/cxx_supportlib/vendor-modified/boost/container/deque.hpp +611 -102
  214. data/src/cxx_supportlib/vendor-modified/boost/container/detail/adaptive_node_pool.hpp +1 -1
  215. data/src/cxx_supportlib/vendor-modified/boost/container/detail/adaptive_node_pool_impl.hpp +47 -47
  216. data/src/cxx_supportlib/vendor-modified/boost/container/detail/advanced_insert_int.hpp +25 -24
  217. data/src/cxx_supportlib/vendor-modified/boost/container/detail/allocation_type.hpp +7 -7
  218. data/src/cxx_supportlib/vendor-modified/boost/container/detail/block_list.hpp +2 -2
  219. data/src/cxx_supportlib/vendor-modified/boost/container/detail/block_slist.hpp +2 -2
  220. data/src/cxx_supportlib/vendor-modified/boost/container/detail/construct_in_place.hpp +35 -1
  221. data/src/cxx_supportlib/vendor-modified/boost/container/detail/copy_move_algo.hpp +14 -14
  222. data/src/cxx_supportlib/vendor-modified/boost/container/detail/dispatch_uses_allocator.hpp +1 -1
  223. data/src/cxx_supportlib/vendor-modified/boost/container/detail/flat_tree.hpp +55 -23
  224. data/src/cxx_supportlib/vendor-modified/boost/container/detail/function_detector.hpp +1 -1
  225. data/src/cxx_supportlib/vendor-modified/boost/container/detail/is_container.hpp +2 -2
  226. data/src/cxx_supportlib/vendor-modified/boost/container/detail/is_contiguous_container.hpp +1 -1
  227. data/src/cxx_supportlib/vendor-modified/boost/container/detail/is_pair.hpp +4 -4
  228. data/src/cxx_supportlib/vendor-modified/boost/container/detail/iterators.hpp +8 -8
  229. data/src/cxx_supportlib/vendor-modified/boost/container/detail/math_functions.hpp +9 -9
  230. data/src/cxx_supportlib/vendor-modified/boost/container/detail/mpl.hpp +4 -4
  231. data/src/cxx_supportlib/vendor-modified/boost/container/detail/multiallocation_chain.hpp +96 -10
  232. data/src/cxx_supportlib/vendor-modified/boost/container/detail/node_alloc_holder.hpp +19 -4
  233. data/src/cxx_supportlib/vendor-modified/boost/container/detail/node_pool.hpp +1 -1
  234. data/src/cxx_supportlib/vendor-modified/boost/container/detail/pair.hpp +17 -17
  235. data/src/cxx_supportlib/vendor-modified/boost/container/detail/pool_common.hpp +1 -1
  236. data/src/cxx_supportlib/vendor-modified/boost/container/detail/pool_common_alloc.hpp +2 -2
  237. data/src/cxx_supportlib/vendor-modified/boost/container/detail/pool_resource.hpp +4 -4
  238. data/src/cxx_supportlib/vendor-modified/boost/container/detail/tree.hpp +86 -52
  239. data/src/cxx_supportlib/vendor-modified/boost/container/detail/version_type.hpp +4 -4
  240. data/src/cxx_supportlib/vendor-modified/boost/container/detail/workaround.hpp +12 -0
  241. data/src/cxx_supportlib/vendor-modified/boost/container/devector.hpp +145 -65
  242. data/src/cxx_supportlib/vendor-modified/boost/container/flat_map.hpp +105 -22
  243. data/src/cxx_supportlib/vendor-modified/boost/container/flat_set.hpp +2 -2
  244. data/src/cxx_supportlib/vendor-modified/boost/container/list.hpp +30 -22
  245. data/src/cxx_supportlib/vendor-modified/boost/container/map.hpp +19 -2
  246. data/src/cxx_supportlib/vendor-modified/boost/container/new_allocator.hpp +1 -1
  247. data/src/cxx_supportlib/vendor-modified/boost/container/node_allocator.hpp +15 -8
  248. data/src/cxx_supportlib/vendor-modified/boost/container/node_handle.hpp +6 -5
  249. data/src/cxx_supportlib/vendor-modified/boost/container/options.hpp +15 -15
  250. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/memory_resource.hpp +1 -1
  251. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/monotonic_buffer_resource.hpp +1 -1
  252. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/resource_adaptor.hpp +3 -3
  253. data/src/cxx_supportlib/vendor-modified/boost/container/scoped_allocator.hpp +1 -1
  254. data/src/cxx_supportlib/vendor-modified/boost/container/set.hpp +2 -2
  255. data/src/cxx_supportlib/vendor-modified/boost/container/slist.hpp +31 -24
  256. data/src/cxx_supportlib/vendor-modified/boost/container/small_vector.hpp +45 -43
  257. data/src/cxx_supportlib/vendor-modified/boost/container/stable_vector.hpp +45 -33
  258. data/src/cxx_supportlib/vendor-modified/boost/container/static_vector.hpp +5 -7
  259. data/src/cxx_supportlib/vendor-modified/boost/container/string.hpp +55 -47
  260. data/src/cxx_supportlib/vendor-modified/boost/container/uses_allocator.hpp +3 -3
  261. data/src/cxx_supportlib/vendor-modified/boost/container/vector.hpp +222 -73
  262. data/src/cxx_supportlib/vendor-modified/boost/core/detail/minstd_rand.hpp +58 -0
  263. data/src/cxx_supportlib/vendor-modified/boost/core/detail/string_view.hpp +13 -13
  264. data/src/cxx_supportlib/vendor-modified/boost/core/empty_value.hpp +53 -5
  265. data/src/cxx_supportlib/vendor-modified/boost/core/lightweight_test.hpp +1 -0
  266. data/src/cxx_supportlib/vendor-modified/boost/core/pointer_in_range.hpp +49 -0
  267. data/src/cxx_supportlib/vendor-modified/boost/core/span.hpp +2 -0
  268. data/src/cxx_supportlib/vendor-modified/boost/core/type_name.hpp +7 -2
  269. data/src/cxx_supportlib/vendor-modified/boost/function/function_base.hpp +22 -34
  270. data/src/cxx_supportlib/vendor-modified/boost/function/function_template.hpp +141 -38
  271. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/algorithm.hpp +8 -8
  272. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/hash.hpp +1 -1
  273. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/hook_traits.hpp +8 -6
  274. data/src/cxx_supportlib/vendor-modified/boost/intrusive/pointer_traits.hpp +18 -18
  275. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/converter_lexical_streams.hpp +22 -17
  276. data/src/cxx_supportlib/vendor-modified/boost/libs/random/src/random_device.cpp +3 -1
  277. data/src/cxx_supportlib/vendor-modified/boost/move/detail/config_begin.hpp +0 -1
  278. data/src/cxx_supportlib/vendor-modified/boost/move/detail/launder.hpp +53 -0
  279. data/src/cxx_supportlib/vendor-modified/boost/move/detail/type_traits.hpp +9 -1
  280. data/src/cxx_supportlib/vendor-modified/boost/move/detail/workaround.hpp +6 -1
  281. data/src/cxx_supportlib/vendor-modified/boost/mp11/version.hpp +1 -1
  282. data/src/cxx_supportlib/vendor-modified/boost/mpl/aux_/integral_wrapper.hpp +2 -1
  283. data/src/cxx_supportlib/vendor-modified/boost/predef/version.h +1 -1
  284. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/requires_cxx11.hpp +1 -1
  285. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_has_gcc_intrinsics.hpp +4 -1
  286. data/src/cxx_supportlib/vendor-modified/boost/system/detail/generic_category_message.hpp +13 -1
  287. data/src/cxx_supportlib/vendor-modified/boost/unordered/concurrent_flat_map.hpp +13 -1
  288. data/src/cxx_supportlib/vendor-modified/boost/unordered/concurrent_flat_map_fwd.hpp +15 -0
  289. data/src/cxx_supportlib/vendor-modified/boost/unordered/concurrent_flat_set.hpp +13 -1
  290. data/src/cxx_supportlib/vendor-modified/boost/unordered/concurrent_flat_set_fwd.hpp +15 -0
  291. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/fca.hpp +22 -6
  292. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/foa/concurrent_table.hpp +38 -10
  293. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/foa/core.hpp +111 -2
  294. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/foa/cumulative_stats.hpp +177 -0
  295. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/foa/table.hpp +11 -1
  296. data/src/cxx_supportlib/vendor-modified/boost/unordered/hash_traits.hpp +33 -7
  297. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_flat_map.hpp +12 -0
  298. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_flat_map_fwd.hpp +15 -0
  299. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_flat_set.hpp +12 -0
  300. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_flat_set_fwd.hpp +14 -0
  301. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_map_fwd.hpp +19 -0
  302. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_node_map.hpp +12 -0
  303. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_node_map_fwd.hpp +15 -0
  304. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_node_set.hpp +12 -0
  305. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_node_set_fwd.hpp +14 -0
  306. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_set_fwd.hpp +17 -0
  307. data/src/cxx_supportlib/vendor-modified/boost/utility/detail/minstd_rand.hpp +1 -43
  308. data/src/cxx_supportlib/vendor-modified/boost/version.hpp +2 -2
  309. data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c +8 -0
  310. data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c +12 -0
  311. data/src/nginx_module/Configuration.c +7 -2
  312. data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c +6 -0
  313. data/src/nginx_module/LocationConfig/AutoGeneratedHeaderSerialization.c +15 -0
  314. data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c +14 -0
  315. data/src/nginx_module/LocationConfig/AutoGeneratedMergeFunction.c +3 -0
  316. data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h +4 -0
  317. data/src/ruby_native_extension/passenger_native_support.c +1 -0
  318. data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +5 -0
  319. data/src/ruby_supportlib/phusion_passenger/config/compile_nginx_engine_command.rb +6 -2
  320. data/src/ruby_supportlib/phusion_passenger/config/install_standalone_runtime_command.rb +10 -0
  321. data/src/ruby_supportlib/phusion_passenger/config/nginx_engine_compiler.rb +12 -4
  322. data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +5 -0
  323. data/src/ruby_supportlib/phusion_passenger/platform_info/compiler.rb +32 -5
  324. data/src/ruby_supportlib/phusion_passenger/platform_info/depcheck_specs/gems.rb +10 -0
  325. data/src/ruby_supportlib/phusion_passenger/rack/handler.rb +73 -0
  326. data/src/ruby_supportlib/phusion_passenger/rack_handler.rb +30 -56
  327. data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +5 -0
  328. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +1 -0
  329. data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +0 -4
  330. data/src/ruby_supportlib/phusion_passenger/utils/json.rb +7 -198
  331. data/src/ruby_supportlib/phusion_passenger/utils/strscan.rb +67 -0
  332. data/src/ruby_supportlib/phusion_passenger/utils.rb +5 -15
  333. data/src/ruby_supportlib/phusion_passenger.rb +5 -5
  334. metadata +39 -10
@@ -68,16 +68,16 @@ template <class T>
68
68
  struct deque_value_traits
69
69
  {
70
70
  typedef T value_type;
71
- static const bool trivial_dctr = dtl::is_trivially_destructible<value_type>::value;
72
- static const bool trivial_dctr_after_move = ::boost::has_trivial_destructor_after_move<value_type>::value;
71
+ BOOST_STATIC_CONSTEXPR bool trivial_dctr = dtl::is_trivially_destructible<value_type>::value;
72
+ BOOST_STATIC_CONSTEXPR bool trivial_dctr_after_move = ::boost::has_trivial_destructor_after_move<value_type>::value;
73
73
  };
74
74
 
75
75
  template<class T, std::size_t BlockBytes, std::size_t BlockSize>
76
76
  struct deque_block_size
77
77
  {
78
78
  BOOST_CONTAINER_STATIC_ASSERT_MSG(!(BlockBytes && BlockSize), "BlockBytes and BlockSize can't be specified at the same time");
79
- static const std::size_t block_bytes = BlockBytes ? BlockBytes : 512u;
80
- static const std::size_t value = BlockSize ? BlockSize : (sizeof(T) < block_bytes ? (block_bytes/sizeof(T)) : std::size_t(1));
79
+ BOOST_STATIC_CONSTEXPR std::size_t block_bytes = BlockBytes ? BlockBytes : 512u;
80
+ BOOST_STATIC_CONSTEXPR std::size_t value = BlockSize ? BlockSize : (sizeof(T) < block_bytes ? (block_bytes/sizeof(T)) : std::size_t(1));
81
81
  };
82
82
 
83
83
  namespace dtl {
@@ -106,6 +106,10 @@ namespace dtl {
106
106
  // [map, map + map_size).
107
107
  // A pointer in the range [map, map + map_size) points to an allocated node
108
108
  // if and only if the pointer is in the range [start.node, finish.node].
109
+
110
+ #define BOOST_CONTAINER_DEQUE_LIGHTER_ITERATOR_LEVEL 0
111
+
112
+ #if BOOST_CONTAINER_DEQUE_LIGHTER_ITERATOR_LEVEL == 0
109
113
  template<class Pointer, bool IsConst>
110
114
  class deque_iterator
111
115
  {
@@ -241,15 +245,15 @@ class deque_iterator
241
245
  if (!n)
242
246
  return *this;
243
247
  BOOST_ASSERT(!!m_cur);
244
- difference_type offset = n + (this->m_cur - this->m_first);
248
+ const difference_type offset = n + (this->m_cur - this->m_first);
245
249
  const difference_type block_size = m_last - m_first;
246
250
  BOOST_ASSERT(block_size);
247
251
  if (offset >= 0 && offset < block_size)
248
252
  this->m_cur += difference_type(n);
249
253
  else {
250
- difference_type node_offset =
251
- offset > 0 ? (offset / block_size)
252
- : (-difference_type((-offset - 1) / block_size) - 1);
254
+ const difference_type node_offset =
255
+ offset > 0 ? (offset / block_size)
256
+ : (-difference_type((-offset - 1) / block_size) - 1);
253
257
  this->priv_set_node(this->m_node + node_offset, size_type(block_size));
254
258
  this->m_cur = this->m_first +
255
259
  (offset - node_offset * block_size);
@@ -313,6 +317,447 @@ class deque_iterator
313
317
  }
314
318
  };
315
319
 
320
+ #elif BOOST_CONTAINER_DEQUE_LIGHTER_ITERATOR_LEVEL == 1
321
+
322
+ template<class Pointer, bool IsConst, unsigned BlockBytes, unsigned BlockSize>
323
+ class deque_iterator
324
+ {
325
+ public:
326
+ typedef std::random_access_iterator_tag iterator_category;
327
+ typedef typename boost::intrusive::pointer_traits<Pointer>::element_type value_type;
328
+ typedef typename boost::intrusive::pointer_traits<Pointer>::difference_type difference_type;
329
+ typedef typename boost::intrusive::pointer_traits<Pointer>::size_type size_type;
330
+ typedef typename if_c
331
+ < IsConst
332
+ , typename boost::intrusive::pointer_traits<Pointer>::template
333
+ rebind_pointer<const value_type>::type
334
+ , Pointer
335
+ >::type pointer;
336
+ typedef typename if_c
337
+ < IsConst
338
+ , const value_type&
339
+ , value_type&
340
+ >::type reference;
341
+
342
+ BOOST_CONSTEXPR inline static size_type get_block_size() BOOST_NOEXCEPT_OR_NOTHROW
343
+ { return deque_block_size<value_type, BlockBytes, BlockSize>::value; }
344
+
345
+ BOOST_CONSTEXPR inline static difference_type get_block_ssize() BOOST_NOEXCEPT_OR_NOTHROW
346
+ { return difference_type((get_block_size())); }
347
+
348
+ class nat;
349
+ typedef typename dtl::if_c< IsConst
350
+ , deque_iterator<Pointer, false, BlockBytes, BlockSize>
351
+ , nat>::type nonconst_iterator;
352
+
353
+ typedef Pointer val_alloc_ptr;
354
+ typedef typename boost::intrusive::pointer_traits<Pointer>::
355
+ template rebind_pointer<Pointer>::type index_pointer;
356
+
357
+ Pointer m_cur;
358
+ Pointer m_first;
359
+ index_pointer m_node;
360
+
361
+ public:
362
+
363
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline Pointer get_cur() const { return m_cur; }
364
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline Pointer get_first() const { return m_first; }
365
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline Pointer get_last() const { return m_first + get_block_ssize(); }
366
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline index_pointer get_node() const { return m_node; }
367
+
368
+ inline deque_iterator(val_alloc_ptr x, index_pointer y, difference_type ) BOOST_NOEXCEPT_OR_NOTHROW
369
+ : m_cur(x), m_first(*y), m_node(y)
370
+ {}
371
+
372
+ inline deque_iterator(val_alloc_ptr x, index_pointer y, size_type ) BOOST_NOEXCEPT_OR_NOTHROW
373
+ : m_cur(x), m_first(*y), m_node(y)
374
+ {}
375
+
376
+ inline deque_iterator() BOOST_NOEXCEPT_OR_NOTHROW
377
+ : m_cur(), m_first(), m_node() //Value initialization to achieve "null iterators" (N3644)
378
+ {}
379
+
380
+ inline deque_iterator(const deque_iterator& x) BOOST_NOEXCEPT_OR_NOTHROW
381
+ : m_cur(x.get_cur()), m_first(x.get_first()), m_node(x.get_node())
382
+ {}
383
+
384
+ inline deque_iterator(const nonconst_iterator& x) BOOST_NOEXCEPT_OR_NOTHROW
385
+ : m_cur(x.get_cur()), m_first(x.get_first()), m_node(x.get_node())
386
+ {}
387
+
388
+ inline deque_iterator(Pointer cur, Pointer first, index_pointer node) BOOST_NOEXCEPT_OR_NOTHROW
389
+ : m_cur(cur), m_first(first), m_node(node)
390
+ {}
391
+
392
+ inline deque_iterator& operator=(const deque_iterator& x) BOOST_NOEXCEPT_OR_NOTHROW
393
+ { m_cur = x.get_cur(); m_first = x.get_first(); m_node = x.get_node(); return *this; }
394
+
395
+ inline nonconst_iterator unconst() const BOOST_NOEXCEPT_OR_NOTHROW
396
+ {
397
+ return nonconst_iterator(this->get_cur(), this->get_first(), this->get_node());
398
+ }
399
+
400
+ inline reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW
401
+ { return *this->m_cur; }
402
+
403
+ inline pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW
404
+ { return this->m_cur; }
405
+
406
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD difference_type operator-(const deque_iterator& x) const BOOST_NOEXCEPT_OR_NOTHROW
407
+ {
408
+ if(!this->m_cur && !x.m_cur){
409
+ return 0;
410
+ }
411
+ const difference_type block_size = get_block_ssize();
412
+ BOOST_ASSERT(block_size);
413
+ return block_size * (this->m_node - x.m_node - 1) +
414
+ (this->m_cur - this->m_first) + ((x.m_first+block_size) - x.m_cur);
415
+ }
416
+
417
+ deque_iterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW
418
+ {
419
+ BOOST_ASSERT(!!m_cur);
420
+ ++this->m_cur;
421
+ const difference_type block_size = get_block_ssize();
422
+ if (this->m_cur == (this->m_first+block_size)) {
423
+
424
+ BOOST_ASSERT(block_size);
425
+ ++this->m_node;
426
+ this->m_first = *this->m_node;
427
+ this->m_cur = this->m_first;
428
+ }
429
+ return *this;
430
+ }
431
+
432
+ inline deque_iterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW
433
+ {
434
+ deque_iterator tmp(*this);
435
+ ++*this;
436
+ return tmp;
437
+ }
438
+
439
+ deque_iterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW
440
+ {
441
+ BOOST_ASSERT(!!m_cur);
442
+ if (this->m_cur == this->m_first) {
443
+ --this->m_node;
444
+ this->m_first = *this->m_node;
445
+ this->m_cur = this->m_first + get_block_ssize();
446
+ }
447
+ --this->m_cur;
448
+ return *this;
449
+ }
450
+
451
+ inline deque_iterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW
452
+ {
453
+ deque_iterator tmp(*this);
454
+ --*this;
455
+ return tmp;
456
+ }
457
+
458
+ deque_iterator& operator+=(difference_type n) BOOST_NOEXCEPT_OR_NOTHROW
459
+ {
460
+ if (!n)
461
+ return *this;
462
+ BOOST_ASSERT(!!m_cur);
463
+ const difference_type offset = n + (this->m_cur - this->m_first);
464
+ const difference_type block_size = get_block_ssize();
465
+ BOOST_ASSERT(block_size);
466
+ if (offset >= 0 && offset < block_size)
467
+ this->m_cur += difference_type(n);
468
+ else {
469
+ const difference_type node_offset =
470
+ offset > 0 ? (offset / block_size)
471
+ : (-difference_type((-offset - 1) / block_size) - 1);
472
+ this->m_node += node_offset;
473
+ this->m_first = *this->m_node;
474
+ this->m_cur = this->m_first + (offset - node_offset * block_size);
475
+ }
476
+ return *this;
477
+ }
478
+
479
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
480
+ deque_iterator operator+(difference_type n) const BOOST_NOEXCEPT_OR_NOTHROW
481
+ { deque_iterator tmp(*this); return tmp += n; }
482
+
483
+ inline
484
+ deque_iterator& operator-=(difference_type n) BOOST_NOEXCEPT_OR_NOTHROW
485
+ { return *this += -n; }
486
+
487
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
488
+ deque_iterator operator-(difference_type n) const BOOST_NOEXCEPT_OR_NOTHROW
489
+ { deque_iterator tmp(*this); return tmp -= n; }
490
+
491
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
492
+ reference operator[](difference_type n) const BOOST_NOEXCEPT_OR_NOTHROW
493
+ { return *(*this + n); }
494
+
495
+ //Comparisons
496
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
497
+ friend bool operator==(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
498
+ { return l.m_cur == r.m_cur; }
499
+
500
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
501
+ friend bool operator!=(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
502
+ { return l.m_cur != r.m_cur; }
503
+
504
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
505
+ friend bool operator<(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
506
+ { return (l.m_node == r.m_node) ? (l.m_cur < r.m_cur) : (l.m_node < r.m_node); }
507
+
508
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
509
+ friend bool operator>(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
510
+ { return r < l; }
511
+
512
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
513
+ friend bool operator<=(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
514
+ { return !(r < l); }
515
+
516
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
517
+ friend bool operator>=(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
518
+ { return !(l < r); }
519
+
520
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
521
+ friend deque_iterator operator+(difference_type n, deque_iterator x) BOOST_NOEXCEPT_OR_NOTHROW
522
+ { return x += n; }
523
+
524
+ inline void priv_set_node(index_pointer new_node, size_type ) BOOST_NOEXCEPT_OR_NOTHROW
525
+ { return this->priv_set_node(new_node, difference_type()); }
526
+
527
+ inline void priv_set_node(index_pointer new_node, difference_type) BOOST_NOEXCEPT_OR_NOTHROW
528
+ {
529
+ this->m_node = new_node;
530
+ this->m_first = *new_node;
531
+ }
532
+ };
533
+
534
+ #elif BOOST_CONTAINER_DEQUE_LIGHTER_ITERATOR_LEVEL == 2
535
+
536
+ template<class Pointer, bool IsConst, unsigned BlockBytes, unsigned BlockSize>
537
+ class deque_iterator
538
+ {
539
+ public:
540
+ typedef std::random_access_iterator_tag iterator_category;
541
+ typedef typename boost::intrusive::pointer_traits<Pointer>::element_type value_type;
542
+ typedef typename boost::intrusive::pointer_traits<Pointer>::difference_type difference_type;
543
+ typedef typename boost::intrusive::pointer_traits<Pointer>::size_type size_type;
544
+ typedef typename if_c
545
+ < IsConst
546
+ , typename boost::intrusive::pointer_traits<Pointer>::template
547
+ rebind_pointer<const value_type>::type
548
+ , Pointer
549
+ >::type pointer;
550
+ typedef typename if_c
551
+ < IsConst
552
+ , const value_type&
553
+ , value_type&
554
+ >::type reference;
555
+
556
+ BOOST_CONSTEXPR inline static size_type get_block_size() BOOST_NOEXCEPT_OR_NOTHROW
557
+ {
558
+ BOOST_CONTAINER_STATIC_ASSERT((deque_block_size<value_type, BlockBytes, BlockSize>::value));
559
+ return deque_block_size<value_type, BlockBytes, BlockSize>::value;
560
+ }
561
+
562
+ BOOST_CONSTEXPR inline static difference_type get_block_ssize() BOOST_NOEXCEPT_OR_NOTHROW
563
+ { return difference_type((get_block_size())); }
564
+
565
+ class nat;
566
+ typedef typename dtl::if_c< IsConst
567
+ , deque_iterator<Pointer, false, BlockBytes, BlockSize>
568
+ , nat>::type nonconst_iterator;
569
+
570
+ typedef Pointer val_alloc_ptr;
571
+ typedef typename boost::intrusive::pointer_traits<Pointer>::
572
+ template rebind_pointer<Pointer>::type index_pointer;
573
+
574
+ Pointer m_cur;
575
+ index_pointer m_node;
576
+
577
+ public:
578
+
579
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline Pointer get_cur() const { return m_cur; }
580
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline Pointer get_first() const { return *m_node; }
581
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline Pointer get_last() const { return *m_node + get_block_ssize(); }
582
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline index_pointer get_node() const { return m_node; }
583
+
584
+ inline deque_iterator(val_alloc_ptr x, index_pointer y, difference_type ) BOOST_NOEXCEPT_OR_NOTHROW
585
+ : m_cur(x), m_node(y)
586
+ {}
587
+
588
+ inline deque_iterator(val_alloc_ptr x, index_pointer y, size_type ) BOOST_NOEXCEPT_OR_NOTHROW
589
+ : m_cur(x), m_node(y)
590
+ {}
591
+
592
+ inline deque_iterator() BOOST_NOEXCEPT_OR_NOTHROW
593
+ : m_cur(), m_node() //Value initialization to achieve "null iterators" (N3644)
594
+ {}
595
+
596
+ inline deque_iterator(const deque_iterator& x) BOOST_NOEXCEPT_OR_NOTHROW
597
+ : m_cur(x.get_cur()), m_node(x.get_node())
598
+ {}
599
+
600
+ inline deque_iterator(const nonconst_iterator& x) BOOST_NOEXCEPT_OR_NOTHROW
601
+ : m_cur(x.get_cur()), m_node(x.get_node())
602
+ {}
603
+
604
+ inline deque_iterator(Pointer cur, index_pointer node) BOOST_NOEXCEPT_OR_NOTHROW
605
+ : m_cur(cur), m_node(node)
606
+ {}
607
+
608
+ inline deque_iterator& operator=(const deque_iterator& x) BOOST_NOEXCEPT_OR_NOTHROW
609
+ { m_cur = x.get_cur(); m_node = x.get_node(); return *this; }
610
+
611
+ inline nonconst_iterator unconst() const BOOST_NOEXCEPT_OR_NOTHROW
612
+ {
613
+ return nonconst_iterator(this->get_cur(), this->get_node());
614
+ }
615
+
616
+ inline reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW
617
+ { return *this->m_cur; }
618
+
619
+ inline pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW
620
+ { return this->m_cur; }
621
+
622
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD difference_type operator-(const deque_iterator& x) const BOOST_NOEXCEPT_OR_NOTHROW
623
+ {
624
+ if(!this->m_cur && !x.m_cur){
625
+ return 0;
626
+ }
627
+ const difference_type block_size = get_block_ssize();
628
+ BOOST_ASSERT(block_size);
629
+ return block_size * (this->m_node - x.m_node - 1) +
630
+ (this->m_cur - this->get_first()) + (x.get_last() - x.m_cur);
631
+ }
632
+
633
+ deque_iterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW
634
+ {
635
+ BOOST_ASSERT(!!m_cur);
636
+ ++this->m_cur;
637
+ if (this->m_cur == (this->get_last())) {
638
+
639
+ ++this->m_node;
640
+ this->m_cur = *this->m_node;
641
+ }
642
+ return *this;
643
+ }
644
+
645
+ inline deque_iterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW
646
+ {
647
+ deque_iterator tmp(*this);
648
+ ++*this;
649
+ return tmp;
650
+ }
651
+
652
+ deque_iterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW
653
+ {
654
+ BOOST_ASSERT(!!m_cur);
655
+ if (this->m_cur == this->get_first()) {
656
+ --this->m_node;
657
+ this->m_cur = this->get_last();
658
+ }
659
+ --this->m_cur;
660
+ return *this;
661
+ }
662
+
663
+ inline deque_iterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW
664
+ {
665
+ deque_iterator tmp(*this);
666
+ --*this;
667
+ return tmp;
668
+ }
669
+
670
+ deque_iterator& operator+=(difference_type n) BOOST_NOEXCEPT_OR_NOTHROW
671
+ {
672
+ if (!n)
673
+ return *this;
674
+ BOOST_ASSERT(!!m_cur);
675
+ const difference_type offset = n + (this->m_cur - this->get_first());
676
+ const difference_type block_size = get_block_ssize();
677
+ BOOST_ASSERT(block_size);
678
+ if (offset >= 0 && offset < block_size)
679
+ this->m_cur += difference_type(n);
680
+ else {
681
+ const difference_type node_offset =
682
+ offset > 0 ? (offset / block_size)
683
+ : (-difference_type((-offset - 1) / block_size) - 1);
684
+ this->m_node += node_offset;
685
+ this->m_cur = this->get_first() + (offset - node_offset * block_size);
686
+ }
687
+ return *this;
688
+ }
689
+
690
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
691
+ deque_iterator operator+(difference_type n) const BOOST_NOEXCEPT_OR_NOTHROW
692
+ { deque_iterator tmp(*this); return tmp += n; }
693
+
694
+ inline
695
+ deque_iterator& operator-=(difference_type n) BOOST_NOEXCEPT_OR_NOTHROW
696
+ { return *this += -n; }
697
+
698
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
699
+ deque_iterator operator-(difference_type n) const BOOST_NOEXCEPT_OR_NOTHROW
700
+ { deque_iterator tmp(*this); return tmp -= n; }
701
+
702
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
703
+ reference operator[](difference_type n) const BOOST_NOEXCEPT_OR_NOTHROW
704
+ {
705
+ BOOST_ASSERT(!!m_cur);
706
+ const difference_type offset = n + (this->m_cur - this->get_first());
707
+ const difference_type block_size = get_block_ssize();
708
+ if (offset >= 0 && offset < block_size)
709
+ return this->m_cur[difference_type(n)];
710
+ else {
711
+ const difference_type node_offset = offset > 0
712
+ ? (offset / block_size)
713
+ : (-difference_type((-offset - 1) / block_size) - 1);
714
+ return (this->m_node[node_offset]) [offset - node_offset * block_size];
715
+ }
716
+ }
717
+
718
+ //Comparisons
719
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
720
+ friend bool operator==(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
721
+ { return l.m_cur == r.m_cur; }
722
+
723
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
724
+ friend bool operator!=(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
725
+ { return l.m_cur != r.m_cur; }
726
+
727
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
728
+ friend bool operator<(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
729
+ { return (l.m_node == r.m_node) ? (l.m_cur < r.m_cur) : (l.m_node < r.m_node); }
730
+
731
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
732
+ friend bool operator>(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
733
+ { return r < l; }
734
+
735
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
736
+ friend bool operator<=(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
737
+ { return !(r < l); }
738
+
739
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
740
+ friend bool operator>=(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
741
+ { return !(l < r); }
742
+
743
+ BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
744
+ friend deque_iterator operator+(difference_type n, deque_iterator x) BOOST_NOEXCEPT_OR_NOTHROW
745
+ { return x += n; }
746
+
747
+ inline void priv_set_node(index_pointer new_node, size_type ) BOOST_NOEXCEPT_OR_NOTHROW
748
+ { return this->priv_set_node(new_node, difference_type()); }
749
+
750
+ inline void priv_set_node(index_pointer new_node, difference_type) BOOST_NOEXCEPT_OR_NOTHROW
751
+ {
752
+ this->m_node = new_node;
753
+ }
754
+ };
755
+
756
+ #else
757
+
758
+ #error "Invalid BOOST_CONTAINER_DEQUE_LIGHTER_ITERATOR_LEVEL"
759
+
760
+ #endif
316
761
  } //namespace dtl {
317
762
 
318
763
  template<class Options>
@@ -360,15 +805,20 @@ class deque_base
360
805
  typedef typename get_deque_opt<Options>::type options_type;
361
806
 
362
807
  protected:
808
+ #if BOOST_CONTAINER_DEQUE_LIGHTER_ITERATOR_LEVEL == 0
363
809
  typedef dtl::deque_iterator<val_alloc_ptr, false> iterator;
364
- typedef dtl::deque_iterator<val_alloc_ptr, true > const_iterator;
810
+ typedef dtl::deque_iterator<val_alloc_ptr, true> const_iterator;
811
+ #else
812
+ typedef dtl::deque_iterator<val_alloc_ptr, false, options_type::block_bytes, options_type::block_size> iterator;
813
+ typedef dtl::deque_iterator<val_alloc_ptr, true, options_type::block_bytes, options_type::block_size> const_iterator;
814
+ #endif
815
+
816
+ BOOST_CONSTEXPR inline static val_alloc_diff get_block_ssize() BOOST_NOEXCEPT_OR_NOTHROW
817
+ { return val_alloc_diff((get_block_size())); }
365
818
 
366
819
  BOOST_CONSTEXPR inline static size_type get_block_size() BOOST_NOEXCEPT_OR_NOTHROW
367
820
  { return deque_block_size<val_alloc_val, options_type::block_bytes, options_type::block_size>::value; }
368
821
 
369
- BOOST_CONSTEXPR inline static val_alloc_diff get_block_ssize() BOOST_NOEXCEPT_OR_NOTHROW
370
- { return val_alloc_diff((get_block_size)()); }
371
-
372
822
  typedef deque_value_traits<val_alloc_val> traits_t;
373
823
  typedef ptr_alloc_t map_allocator_type;
374
824
 
@@ -446,8 +896,8 @@ class deque_base
446
896
 
447
897
  this->members_.m_start.priv_set_node(nstart, get_block_size());
448
898
  this->members_.m_finish.priv_set_node(nfinish - 1, get_block_size());
449
- this->members_.m_start.m_cur = this->members_.m_start.m_first;
450
- this->members_.m_finish.m_cur = this->members_.m_finish.m_first + difference_type(num_elements % get_block_size());
899
+ this->members_.m_start.m_cur = this->members_.m_start.get_first();
900
+ this->members_.m_finish.m_cur = this->members_.m_finish.get_first() + difference_type(num_elements % get_block_size());
451
901
  // }
452
902
  }
453
903
 
@@ -868,28 +1318,13 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
868
1318
  || allocator_traits_type::is_always_equal::value)
869
1319
  {
870
1320
  if (BOOST_LIKELY(this != &x)) {
871
- allocator_type &this_alloc = this->alloc();
872
- allocator_type &x_alloc = x.alloc();
873
- const bool propagate_alloc = allocator_traits_type::
874
- propagate_on_container_move_assignment::value;
875
- dtl::bool_<propagate_alloc> flag;
876
- const bool allocators_equal = this_alloc == x_alloc; (void)allocators_equal;
877
- //Resources can be transferred if both allocators are
878
- //going to be equal after this function (either propagated or already equal)
879
- if(propagate_alloc || allocators_equal){
880
- //Destroy objects but retain memory in case x reuses it in the future
881
- this->clear();
882
- //Move allocator if needed
883
- dtl::move_alloc(this_alloc, x_alloc, flag);
884
- dtl::move_alloc(this->ptr_alloc(), x.ptr_alloc(), flag);
885
- //Nothrow swap
886
- this->swap_members(x);
887
- }
888
- //Else do a one by one move
889
- else{
890
- this->assign( boost::make_move_iterator(x.begin())
891
- , boost::make_move_iterator(x.end()));
892
- }
1321
+ //We know resources can be transferred at comiple time if both allocators are
1322
+ //always equal or the allocator is going to be propagated
1323
+ const bool can_steal_resources_alloc
1324
+ = allocator_traits_type::propagate_on_container_move_assignment::value
1325
+ || allocator_traits_type::is_always_equal::value;
1326
+ dtl::bool_<can_steal_resources_alloc> flag;
1327
+ this->priv_move_assign(boost::move(x), flag);
893
1328
  }
894
1329
  return *this;
895
1330
  }
@@ -1741,7 +2176,7 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
1741
2176
  void pop_front() BOOST_NOEXCEPT_OR_NOTHROW
1742
2177
  {
1743
2178
  BOOST_ASSERT(!this->empty());
1744
- if (this->members_.m_start.m_cur != this->members_.m_start.m_last - 1) {
2179
+ if (this->members_.m_start.m_cur != this->members_.m_start.get_last() - 1) {
1745
2180
  allocator_traits_type::destroy
1746
2181
  ( this->alloc()
1747
2182
  , boost::movelib::to_raw_pointer(this->members_.m_start.m_cur)
@@ -1760,7 +2195,7 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
1760
2195
  void pop_back() BOOST_NOEXCEPT_OR_NOTHROW
1761
2196
  {
1762
2197
  BOOST_ASSERT(!this->empty());
1763
- if (this->members_.m_finish.m_cur != this->members_.m_finish.m_first) {
2198
+ if (this->members_.m_finish.m_cur != this->members_.m_finish.get_first()) {
1764
2199
  --this->members_.m_finish.m_cur;
1765
2200
  allocator_traits_type::destroy
1766
2201
  ( this->alloc()
@@ -1865,9 +2300,9 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
1865
2300
  }
1866
2301
 
1867
2302
  if (this->members_.m_start.m_node != this->members_.m_finish.m_node) {
1868
- this->priv_destroy_range(this->members_.m_start.m_cur, this->members_.m_start.m_last);
1869
- this->priv_destroy_range(this->members_.m_finish.m_first, this->members_.m_finish.m_cur);
1870
- this->priv_deallocate_node(this->members_.m_finish.m_first);
2303
+ this->priv_destroy_range(this->members_.m_start.m_cur, this->members_.m_start.get_last());
2304
+ this->priv_destroy_range(this->members_.m_finish.get_first(), this->members_.m_finish.m_cur);
2305
+ this->priv_deallocate_node(this->members_.m_finish.get_first());
1871
2306
  }
1872
2307
  else
1873
2308
  this->priv_destroy_range(this->members_.m_start.m_cur, this->members_.m_finish.m_cur);
@@ -1928,6 +2363,30 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
1928
2363
  #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
1929
2364
  private:
1930
2365
 
2366
+ void priv_move_assign(BOOST_RV_REF(deque) x, dtl::bool_<true> /*steal_resources*/)
2367
+ {
2368
+ //Destroy objects but retain memory in case x reuses it in the future
2369
+ this->clear();
2370
+ //Move allocator if needed
2371
+ dtl::bool_<allocator_traits_type::propagate_on_container_move_assignment::value> flag;
2372
+ dtl::move_alloc(this->alloc(), x.alloc(), flag);
2373
+ dtl::move_alloc(this->ptr_alloc(), x.ptr_alloc(), flag);
2374
+ //Nothrow swap
2375
+ this->swap_members(x);
2376
+ }
2377
+
2378
+ void priv_move_assign(BOOST_RV_REF(deque) x, dtl::bool_<false> /*steal_resources*/)
2379
+ {
2380
+ //We can't guarantee a compile-time equal allocator or propagation so fallback to runtime
2381
+ //Resources can be transferred if both allocators are equal
2382
+ if (this->alloc() == x.alloc()) {
2383
+ this->priv_move_assign(boost::move(x), dtl::true_());
2384
+ }
2385
+ else {
2386
+ this->assign(boost::make_move_iterator(x.begin()), boost::make_move_iterator(x.end()));
2387
+ }
2388
+ }
2389
+
1931
2390
  inline size_type priv_index_of(const_iterator p) const
1932
2391
  {
1933
2392
  BOOST_ASSERT(this->cbegin() <= p);
@@ -2016,7 +2475,7 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
2016
2475
  inline bool priv_push_back_simple_available() const
2017
2476
  {
2018
2477
  return this->members_.m_map &&
2019
- (this->members_.m_finish.m_cur != (this->members_.m_finish.m_last - 1));
2478
+ (this->members_.m_finish.m_cur != (this->members_.m_finish.get_last() - 1));
2020
2479
  }
2021
2480
 
2022
2481
  inline T *priv_push_back_simple_pos() const
@@ -2032,7 +2491,7 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
2032
2491
  inline bool priv_push_front_simple_available() const
2033
2492
  {
2034
2493
  return this->members_.m_map &&
2035
- (this->members_.m_start.m_cur != this->members_.m_start.m_first);
2494
+ (this->members_.m_start.m_cur != this->members_.m_start.get_first());
2036
2495
  }
2037
2496
 
2038
2497
  inline T *priv_push_front_simple_pos() const
@@ -2043,7 +2502,8 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
2043
2502
 
2044
2503
  void priv_destroy_range(iterator p, iterator p2)
2045
2504
  {
2046
- if(!Base::traits_t::trivial_dctr){
2505
+ (void)p; (void)p2;
2506
+ BOOST_IF_CONSTEXPR(!Base::traits_t::trivial_dctr){
2047
2507
  for(;p != p2; ++p){
2048
2508
  allocator_traits_type::destroy(this->alloc(), boost::movelib::iterator_to_raw_pointer(p));
2049
2509
  }
@@ -2052,7 +2512,8 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
2052
2512
 
2053
2513
  void priv_destroy_range(pointer p, pointer p2)
2054
2514
  {
2055
- if(!Base::traits_t::trivial_dctr){
2515
+ (void)p; (void)p2;
2516
+ BOOST_IF_CONSTEXPR(!Base::traits_t::trivial_dctr){
2056
2517
  for(;p != p2; ++p){
2057
2518
  allocator_traits_type::destroy(this->alloc(), boost::movelib::iterator_to_raw_pointer(p));
2058
2519
  }
@@ -2060,84 +2521,117 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
2060
2521
  }
2061
2522
 
2062
2523
  template<class InsertProxy>
2063
- iterator priv_insert_aux_impl(const_iterator p, size_type n, InsertProxy proxy)
2524
+ iterator priv_insert_middle_aux_impl(const_iterator p, const size_type elemsbefore, const size_type length, const size_type n, InsertProxy proxy)
2064
2525
  {
2065
- iterator pos(p.unconst());
2066
- const size_type pos_n = size_type(p - this->cbegin());
2067
- if(!this->members_.m_map){
2526
+ if (!this->members_.m_map) {
2068
2527
  this->priv_initialize_map(0);
2069
- pos = this->begin();
2528
+ p = this->cbegin();
2070
2529
  }
2071
2530
 
2072
- const size_type elemsbefore = static_cast<size_type>(pos - this->members_.m_start);
2073
- const size_type length = this->size();
2531
+ iterator pos(p.unconst());
2532
+ const size_type pos_n = size_type(p - this->cbegin());
2533
+
2074
2534
  if (elemsbefore < length / 2) {
2075
2535
  const iterator new_start = this->priv_reserve_elements_at_front(n);
2076
2536
  const iterator old_start = this->members_.m_start;
2077
- if(!elemsbefore){
2078
- proxy.uninitialized_copy_n_and_update(this->alloc(), new_start, n);
2079
- this->members_.m_start = new_start;
2080
- }
2081
- else{
2082
- pos = this->members_.m_start + difference_type(elemsbefore);
2083
- if (elemsbefore >= n) {
2084
- const iterator start_n = this->members_.m_start + difference_type(n);
2537
+ pos = this->members_.m_start + difference_type(elemsbefore);
2538
+ if (elemsbefore >= n) {
2539
+ const iterator start_n = this->members_.m_start + difference_type(n);
2540
+ BOOST_CONTAINER_TRY {
2085
2541
  ::boost::container::uninitialized_move_alloc
2086
2542
  (this->alloc(), this->members_.m_start, start_n, new_start);
2087
- this->members_.m_start = new_start;
2088
- boost::container::move(start_n, pos, old_start);
2089
- proxy.copy_n_and_update(this->alloc(), pos - difference_type(n), n);
2090
2543
  }
2091
- else {
2092
- const size_type mid_count = n - elemsbefore;
2093
- const iterator mid_start = old_start - difference_type(mid_count);
2544
+ BOOST_CONTAINER_CATCH(...) {
2545
+ this->priv_destroy_nodes(new_start.m_node, this->members_.m_start.m_node);
2546
+ BOOST_CONTAINER_RETHROW
2547
+ }
2548
+ BOOST_CONTAINER_CATCH_END
2549
+ this->members_.m_start = new_start;
2550
+ boost::container::move(start_n, pos, old_start);
2551
+ proxy.copy_n_and_update(this->alloc(), pos - difference_type(n), n);
2552
+ }
2553
+ else {
2554
+ const size_type mid_count = n - elemsbefore;
2555
+ const iterator mid_start = old_start - difference_type(mid_count);
2556
+ BOOST_CONTAINER_TRY {
2094
2557
  proxy.uninitialized_copy_n_and_update(this->alloc(), mid_start, mid_count);
2095
2558
  this->members_.m_start = mid_start;
2096
- ::boost::container::uninitialized_move_alloc
2097
- (this->alloc(), old_start, pos, new_start);
2098
- this->members_.m_start = new_start;
2099
- proxy.copy_n_and_update(this->alloc(), old_start, elemsbefore);
2559
+ ::boost::container::uninitialized_move_alloc(this->alloc(), old_start, pos, new_start);
2560
+ }
2561
+ BOOST_CONTAINER_CATCH(...) {
2562
+ this->priv_destroy_nodes(new_start.m_node, this->members_.m_start.m_node);
2563
+ BOOST_CONTAINER_RETHROW
2100
2564
  }
2565
+ BOOST_CONTAINER_CATCH_END
2566
+ this->members_.m_start = new_start;
2567
+ proxy.copy_n_and_update(this->alloc(), old_start, elemsbefore);
2101
2568
  }
2102
2569
  }
2103
2570
  else {
2104
2571
  const iterator new_finish = this->priv_reserve_elements_at_back(n);
2105
2572
  const iterator old_finish = this->members_.m_finish;
2106
2573
  const size_type elemsafter = length - elemsbefore;
2107
- if(!elemsafter){
2108
- proxy.uninitialized_copy_n_and_update(this->alloc(), old_finish, n);
2574
+
2575
+ pos = old_finish - difference_type(elemsafter);
2576
+ if (elemsafter >= n) {
2577
+ iterator finish_n = old_finish - difference_type(n);
2578
+ BOOST_CONTAINER_TRY {
2579
+ ::boost::container::uninitialized_move_alloc(this->alloc(), finish_n, old_finish, old_finish);
2580
+ }
2581
+ BOOST_CONTAINER_CATCH(...) {
2582
+ this->priv_destroy_nodes(this->members_.m_finish.m_node + 1, new_finish.m_node + 1);
2583
+ BOOST_CONTAINER_RETHROW
2584
+ }
2585
+ BOOST_CONTAINER_CATCH_END
2586
+
2109
2587
  this->members_.m_finish = new_finish;
2588
+ boost::container::move_backward(pos, finish_n, old_finish);
2589
+ proxy.copy_n_and_update(this->alloc(), pos, n);
2110
2590
  }
2111
- else{
2112
- pos = old_finish - difference_type(elemsafter);
2113
- if (elemsafter >= n) {
2114
- iterator finish_n = old_finish - difference_type(n);
2115
- ::boost::container::uninitialized_move_alloc
2116
- (this->alloc(), finish_n, old_finish, old_finish);
2117
- this->members_.m_finish = new_finish;
2118
- boost::container::move_backward(pos, finish_n, old_finish);
2119
- proxy.copy_n_and_update(this->alloc(), pos, n);
2120
- }
2121
- else {
2122
- const size_type raw_gap = n - elemsafter;
2591
+ else {
2592
+ const size_type raw_gap = n - elemsafter;
2593
+ BOOST_CONTAINER_TRY{
2123
2594
  ::boost::container::uninitialized_move_alloc
2124
2595
  (this->alloc(), pos, old_finish, old_finish + difference_type(raw_gap));
2125
2596
  BOOST_CONTAINER_TRY{
2126
2597
  proxy.copy_n_and_update(this->alloc(), pos, elemsafter);
2127
2598
  proxy.uninitialized_copy_n_and_update(this->alloc(), old_finish, raw_gap);
2128
2599
  }
2129
- BOOST_CONTAINER_CATCH(...){
2600
+ BOOST_CONTAINER_CATCH(...) {
2130
2601
  this->priv_destroy_range(old_finish, old_finish + difference_type(elemsafter));
2131
2602
  BOOST_CONTAINER_RETHROW
2132
2603
  }
2133
2604
  BOOST_CONTAINER_CATCH_END
2134
- this->members_.m_finish = new_finish;
2135
2605
  }
2606
+ BOOST_CONTAINER_CATCH(...) {
2607
+ this->priv_destroy_nodes(this->members_.m_finish.m_node + 1, new_finish.m_node + 1);
2608
+ BOOST_CONTAINER_RETHROW
2609
+ }
2610
+ BOOST_CONTAINER_CATCH_END
2611
+ this->members_.m_finish = new_finish;
2136
2612
  }
2137
2613
  }
2138
2614
  return this->begin() + difference_type(pos_n);
2139
2615
  }
2140
2616
 
2617
+ template<class InsertProxy>
2618
+ iterator priv_insert_aux_impl(const_iterator p, size_type n, InsertProxy proxy)
2619
+ {
2620
+ iterator pos(p.unconst());
2621
+ const size_type elemsbefore = static_cast<size_type>(pos - this->members_.m_start);
2622
+ const size_type length = this->size();
2623
+
2624
+ if (!elemsbefore) {
2625
+ return this->priv_insert_front_aux_impl(n, proxy);
2626
+ }
2627
+ else if (elemsbefore == length) {
2628
+ return this->priv_insert_back_aux_impl(n, proxy);
2629
+ }
2630
+ else {
2631
+ return this->priv_insert_middle_aux_impl(p, elemsbefore, length, n, proxy);
2632
+ }
2633
+ }
2634
+
2141
2635
  template <class InsertProxy>
2142
2636
  iterator priv_insert_back_aux_impl(size_type n, InsertProxy proxy)
2143
2637
  {
@@ -2146,8 +2640,14 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
2146
2640
  }
2147
2641
 
2148
2642
  iterator new_finish = this->priv_reserve_elements_at_back(n);
2149
- iterator old_finish = this->members_.m_finish;
2150
- proxy.uninitialized_copy_n_and_update(this->alloc(), old_finish, n);
2643
+ BOOST_CONTAINER_TRY{
2644
+ proxy.uninitialized_copy_n_and_update(this->alloc(), this->members_.m_finish, n);
2645
+ }
2646
+ BOOST_CONTAINER_CATCH(...) {
2647
+ this->priv_destroy_nodes(this->members_.m_finish.m_node + 1, new_finish.m_node + 1);
2648
+ BOOST_CONTAINER_RETHROW
2649
+ }
2650
+ BOOST_CONTAINER_CATCH_END
2151
2651
  this->members_.m_finish = new_finish;
2152
2652
  return iterator(this->members_.m_finish - difference_type(n));
2153
2653
  }
@@ -2160,7 +2660,15 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
2160
2660
  }
2161
2661
 
2162
2662
  iterator new_start = this->priv_reserve_elements_at_front(n);
2163
- proxy.uninitialized_copy_n_and_update(this->alloc(), new_start, n);
2663
+ BOOST_CONTAINER_TRY{
2664
+ proxy.uninitialized_copy_n_and_update(this->alloc(), new_start, n);
2665
+ }
2666
+ BOOST_CONTAINER_CATCH(...) {
2667
+ this->priv_destroy_nodes(new_start.m_node, this->members_.m_start.m_node);
2668
+ BOOST_CONTAINER_RETHROW
2669
+ }
2670
+ BOOST_CONTAINER_CATCH_END
2671
+
2164
2672
  this->members_.m_start = new_start;
2165
2673
  return new_start;
2166
2674
  }
@@ -2181,7 +2689,7 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
2181
2689
  (this->alloc(), *cur, *cur + get_block_ssize(), value);
2182
2690
  }
2183
2691
  boost::container::uninitialized_fill_alloc
2184
- (this->alloc(), this->members_.m_finish.m_first, this->members_.m_finish.m_cur, value);
2692
+ (this->alloc(), this->members_.m_finish.get_first(), this->members_.m_finish.m_cur, value);
2185
2693
  }
2186
2694
  BOOST_CONTAINER_CATCH(...){
2187
2695
  this->priv_destroy_range(this->members_.m_start, iterator(*cur, cur, get_block_size()));
@@ -2220,7 +2728,7 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
2220
2728
  ::boost::container::uninitialized_copy_alloc(this->alloc(), first, mid, *cur_node);
2221
2729
  first = mid;
2222
2730
  }
2223
- ::boost::container::uninitialized_copy_alloc(this->alloc(), first, last, this->members_.m_finish.m_first);
2731
+ ::boost::container::uninitialized_copy_alloc(this->alloc(), first, last, this->members_.m_finish.get_first());
2224
2732
  }
2225
2733
  BOOST_CONTAINER_CATCH(...){
2226
2734
  this->priv_destroy_range(this->members_.m_start, iterator(*cur_node, cur_node, get_block_size()));
@@ -2229,21 +2737,21 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
2229
2737
  BOOST_CONTAINER_CATCH_END
2230
2738
  }
2231
2739
 
2232
- // Called only if this->members_.m_finish.m_cur == this->members_.m_finish.m_first.
2740
+ // Called only if this->members_.m_finish.m_cur == this->members_.m_finish.get_first().
2233
2741
  void priv_pop_back_aux() BOOST_NOEXCEPT_OR_NOTHROW
2234
2742
  {
2235
- this->priv_deallocate_node(this->members_.m_finish.m_first);
2743
+ this->priv_deallocate_node(this->members_.m_finish.get_first());
2236
2744
  this->members_.m_finish.priv_set_node(this->members_.m_finish.m_node - 1, get_block_size());
2237
- this->members_.m_finish.m_cur = this->members_.m_finish.m_last - 1;
2745
+ this->members_.m_finish.m_cur = this->members_.m_finish.get_last() - 1;
2238
2746
  allocator_traits_type::destroy
2239
2747
  ( this->alloc()
2240
2748
  , boost::movelib::to_raw_pointer(this->members_.m_finish.m_cur)
2241
2749
  );
2242
2750
  }
2243
2751
 
2244
- // Called only if this->members_.m_start.m_cur == this->members_.m_start.m_last - 1. Note that
2752
+ // Called only if this->members_.m_start.m_cur == this->members_.m_start.get_last() - 1. Note that
2245
2753
  // if the deque has at least one element (a precondition for this member
2246
- // function), and if this->members_.m_start.m_cur == this->members_.m_start.m_last, then the deque
2754
+ // function), and if this->members_.m_start.m_cur == this->members_.m_start.get_last(), then the deque
2247
2755
  // must have at least two nodes.
2248
2756
  void priv_pop_front_aux() BOOST_NOEXCEPT_OR_NOTHROW
2249
2757
  {
@@ -2251,14 +2759,14 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
2251
2759
  ( this->alloc()
2252
2760
  , boost::movelib::to_raw_pointer(this->members_.m_start.m_cur)
2253
2761
  );
2254
- this->priv_deallocate_node(this->members_.m_start.m_first);
2762
+ this->priv_deallocate_node(this->members_.m_start.get_first());
2255
2763
  this->members_.m_start.priv_set_node(this->members_.m_start.m_node + 1, get_block_size());
2256
- this->members_.m_start.m_cur = this->members_.m_start.m_first;
2764
+ this->members_.m_start.m_cur = this->members_.m_start.get_first();
2257
2765
  }
2258
2766
 
2259
2767
  iterator priv_reserve_elements_at_front(size_type n)
2260
2768
  {
2261
- size_type vacancies = size_type(this->members_.m_start.m_cur - this->members_.m_start.m_first);
2769
+ size_type vacancies = size_type(this->members_.m_start.m_cur - this->members_.m_start.get_first());
2262
2770
  if (n > vacancies){
2263
2771
  size_type new_elems = n-vacancies;
2264
2772
  size_type new_nodes = (new_elems + get_block_size() - 1u) / get_block_size();
@@ -2283,7 +2791,7 @@ class deque : protected deque_base<typename real_allocator<T, Allocator>::type,
2283
2791
 
2284
2792
  iterator priv_reserve_elements_at_back(size_type n)
2285
2793
  {
2286
- size_type vacancies = size_type(this->members_.m_finish.m_last - this->members_.m_finish.m_cur - 1);
2794
+ size_type vacancies = size_type(this->members_.m_finish.get_last() - this->members_.m_finish.m_cur - 1);
2287
2795
  if (n > vacancies){
2288
2796
  size_type new_elems = size_type(n - vacancies);
2289
2797
  size_type new_nodes = size_type(new_elems + get_block_size() - 1u)/get_block_size();
@@ -2348,7 +2856,8 @@ template <typename InputIterator, typename Allocator>
2348
2856
  deque(InputIterator, InputIterator, Allocator const&) -> deque<typename iterator_traits<InputIterator>::value_type, Allocator>;
2349
2857
  #endif
2350
2858
 
2351
- }}
2859
+ } //namespace container
2860
+ } //namespace boost
2352
2861
 
2353
2862
  #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
2354
2863
 
@@ -2361,7 +2870,7 @@ struct has_trivial_destructor_after_move<boost::container::deque<T, Allocator, O
2361
2870
  {
2362
2871
  typedef typename boost::container::deque<T, Allocator, Options>::allocator_type allocator_type;
2363
2872
  typedef typename ::boost::container::allocator_traits<allocator_type>::pointer pointer;
2364
- static const bool value = ::boost::has_trivial_destructor_after_move<allocator_type>::value &&
2873
+ BOOST_STATIC_CONSTEXPR bool value = ::boost::has_trivial_destructor_after_move<allocator_type>::value &&
2365
2874
  ::boost::has_trivial_destructor_after_move<pointer>::value;
2366
2875
  };
2367
2876