passenger 5.3.3 → 5.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1070) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +8 -0
  3. data/build/support/cxx_dependency_map.rb +151 -83
  4. data/dev/configkit-schemas/index.json +3 -3
  5. data/src/agent/Core/AdminPanelConnector.h +5 -3
  6. data/src/agent/Core/ApplicationPool/Common.h +1 -2
  7. data/src/agent/Core/ApplicationPool/Context.h +1 -2
  8. data/src/agent/Core/ApplicationPool/Group/InternalUtils.cpp +2 -2
  9. data/src/agent/Core/ApplicationPool/Pool/InitializationAndShutdown.cpp +2 -2
  10. data/src/agent/Core/Config.h +1 -1
  11. data/src/agent/Core/Controller.h +2 -1
  12. data/src/agent/Core/Controller/Config.h +6 -5
  13. data/src/agent/Core/Controller/Hooks.cpp +11 -0
  14. data/src/agent/Core/Controller/SendRequest.cpp +7 -7
  15. data/src/agent/Core/CoreMain.cpp +0 -2
  16. data/src/agent/Core/SpawningKit/Context.h +1 -3
  17. data/src/agent/Core/SpawningKit/Handshake/BackgroundIOCapturer.h +2 -2
  18. data/src/agent/Core/SpawningKit/Handshake/Perform.h +2 -2
  19. data/src/agent/Core/SpawningKit/Handshake/Prepare.h +17 -38
  20. data/src/agent/Core/SpawningKit/PipeWatcher.h +5 -3
  21. data/src/agent/Core/SpawningKit/UserSwitchingRules.h +13 -5
  22. data/src/agent/Shared/ApiServerUtils.h +2 -2
  23. data/src/agent/SpawnEnvSetupper/SpawnEnvSetupperMain.cpp +33 -18
  24. data/src/agent/Watchdog/Config.h +1 -1
  25. data/src/agent/Watchdog/WatchdogMain.cpp +20 -20
  26. data/src/apache2_module/Config.cpp +7 -6
  27. data/src/cxx_supportlib/ConfigKit/Store.h +2 -2
  28. data/src/cxx_supportlib/Constants.h +1 -1
  29. data/src/cxx_supportlib/Exceptions.h +0 -1
  30. data/src/cxx_supportlib/FileTools/PathSecurityCheck.cpp +3 -2
  31. data/src/cxx_supportlib/ResourceLocator.h +3 -21
  32. data/src/cxx_supportlib/SafeLibev.h +6 -6
  33. data/src/cxx_supportlib/ServerKit/Channel.h +2 -2
  34. data/src/cxx_supportlib/ServerKit/FileBufferedChannel.h +3 -3
  35. data/src/cxx_supportlib/ServerKit/FileBufferedFdSinkChannel.h +2 -2
  36. data/src/cxx_supportlib/ServerKit/HttpServer.h +27 -15
  37. data/src/cxx_supportlib/ServerKit/Server.h +2 -2
  38. data/src/cxx_supportlib/SystemTools/README.md +1 -0
  39. data/src/cxx_supportlib/SystemTools/UserDatabase.cpp +222 -0
  40. data/src/cxx_supportlib/SystemTools/UserDatabase.h +151 -0
  41. data/src/cxx_supportlib/Utils.cpp +1 -113
  42. data/src/cxx_supportlib/Utils.h +1 -29
  43. data/src/cxx_supportlib/Utils/MessagePassing.h +3 -3
  44. data/src/cxx_supportlib/WatchdogLauncher.h +1 -2
  45. data/src/cxx_supportlib/vendor-modified/boost/algorithm/string/detail/case_conv.hpp +6 -2
  46. data/src/cxx_supportlib/vendor-modified/boost/algorithm/string/detail/find_iterator.hpp +1 -1
  47. data/src/cxx_supportlib/vendor-modified/boost/algorithm/string/detail/util.hpp +3 -2
  48. data/src/cxx_supportlib/vendor-modified/boost/asio.hpp +31 -1
  49. data/src/cxx_supportlib/vendor-modified/boost/asio/associated_allocator.hpp +133 -0
  50. data/src/cxx_supportlib/vendor-modified/boost/asio/associated_executor.hpp +151 -0
  51. data/src/cxx_supportlib/vendor-modified/boost/asio/async_result.hpp +149 -22
  52. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_datagram_socket.hpp +140 -49
  53. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_deadline_timer.hpp +145 -35
  54. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_io_object.hpp +75 -41
  55. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_raw_socket.hpp +139 -49
  56. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_seq_packet_socket.hpp +98 -45
  57. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_serial_port.hpp +42 -49
  58. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_signal_set.hpp +45 -38
  59. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket.hpp +349 -109
  60. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket_acceptor.hpp +959 -108
  61. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket_iostream.hpp +198 -54
  62. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket_streambuf.hpp +424 -284
  63. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_stream_socket.hpp +116 -47
  64. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_streambuf.hpp +99 -16
  65. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_streambuf_fwd.hpp +4 -1
  66. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_waitable_timer.hpp +235 -49
  67. data/src/cxx_supportlib/vendor-modified/boost/asio/bind_executor.hpp +613 -0
  68. data/src/cxx_supportlib/vendor-modified/boost/asio/buffer.hpp +1139 -1216
  69. data/src/cxx_supportlib/vendor-modified/boost/asio/buffered_read_stream.hpp +27 -14
  70. data/src/cxx_supportlib/vendor-modified/boost/asio/buffered_read_stream_fwd.hpp +1 -1
  71. data/src/cxx_supportlib/vendor-modified/boost/asio/buffered_stream.hpp +26 -6
  72. data/src/cxx_supportlib/vendor-modified/boost/asio/buffered_stream_fwd.hpp +1 -1
  73. data/src/cxx_supportlib/vendor-modified/boost/asio/buffered_write_stream.hpp +27 -14
  74. data/src/cxx_supportlib/vendor-modified/boost/asio/buffered_write_stream_fwd.hpp +1 -1
  75. data/src/cxx_supportlib/vendor-modified/boost/asio/buffers_iterator.hpp +61 -21
  76. data/src/cxx_supportlib/vendor-modified/boost/asio/completion_condition.hpp +1 -1
  77. data/src/cxx_supportlib/vendor-modified/boost/asio/connect.hpp +462 -226
  78. data/src/cxx_supportlib/vendor-modified/boost/asio/coroutine.hpp +7 -7
  79. data/src/cxx_supportlib/vendor-modified/boost/asio/datagram_socket_service.hpp +94 -64
  80. data/src/cxx_supportlib/vendor-modified/boost/asio/deadline_timer.hpp +1 -1
  81. data/src/cxx_supportlib/vendor-modified/boost/asio/deadline_timer_service.hpp +20 -18
  82. data/src/cxx_supportlib/vendor-modified/boost/asio/defer.hpp +109 -0
  83. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/array.hpp +1 -1
  84. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/array_fwd.hpp +1 -1
  85. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/assert.hpp +1 -1
  86. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/atomic_count.hpp +1 -1
  87. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/base_from_completion_cond.hpp +1 -1
  88. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/bind_handler.hpp +404 -77
  89. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/buffer_resize_guard.hpp +1 -1
  90. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/buffer_sequence_adapter.hpp +212 -51
  91. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/buffered_stream_storage.hpp +1 -1
  92. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/call_stack.hpp +2 -2
  93. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/chrono.hpp +68 -0
  94. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/chrono_time_traits.hpp +1 -1
  95. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/completion_handler.hpp +8 -6
  96. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/concurrency_hint.hpp +94 -0
  97. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/conditionally_enabled_event.hpp +114 -0
  98. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/conditionally_enabled_mutex.hpp +151 -0
  99. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/config.hpp +398 -13
  100. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/consuming_buffers.hpp +287 -165
  101. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/cstddef.hpp +33 -0
  102. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/cstdint.hpp +15 -1
  103. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/date_time_fwd.hpp +1 -1
  104. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/deadline_timer_service.hpp +65 -14
  105. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/dependent_type.hpp +1 -1
  106. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/descriptor_ops.hpp +5 -1
  107. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/descriptor_read_op.hpp +17 -8
  108. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/descriptor_write_op.hpp +17 -8
  109. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/dev_poll_reactor.hpp +27 -15
  110. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/epoll_reactor.hpp +41 -17
  111. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/event.hpp +1 -1
  112. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/eventfd_select_interrupter.hpp +1 -1
  113. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/executor_op.hpp +86 -0
  114. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/fd_set_adapter.hpp +1 -1
  115. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/fenced_block.hpp +1 -1
  116. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/{function.hpp → functional.hpp} +10 -10
  117. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/gcc_arm_fenced_block.hpp +3 -1
  118. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/gcc_hppa_fenced_block.hpp +3 -1
  119. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/gcc_sync_fenced_block.hpp +3 -1
  120. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/gcc_x86_fenced_block.hpp +3 -1
  121. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/global.hpp +54 -0
  122. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/handler_alloc_helpers.hpp +158 -3
  123. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/handler_cont_helpers.hpp +2 -2
  124. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/handler_invoke_helpers.hpp +2 -2
  125. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/handler_tracking.hpp +90 -9
  126. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/handler_type_requirements.hpp +117 -39
  127. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/handler_work.hpp +97 -0
  128. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/hash_map.hpp +1 -1
  129. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/buffer_sequence_adapter.ipp +6 -6
  130. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/descriptor_ops.ipp +24 -1
  131. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/dev_poll_reactor.hpp +17 -4
  132. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/dev_poll_reactor.ipp +34 -18
  133. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/epoll_reactor.hpp +17 -4
  134. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/epoll_reactor.ipp +152 -51
  135. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/eventfd_select_interrupter.ipp +1 -1
  136. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/handler_tracking.ipp +80 -27
  137. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/kqueue_reactor.hpp +19 -6
  138. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/kqueue_reactor.ipp +93 -23
  139. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/null_event.ipp +76 -0
  140. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/pipe_select_interrupter.ipp +1 -1
  141. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/posix_event.ipp +13 -1
  142. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/posix_mutex.ipp +1 -1
  143. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/posix_thread.ipp +11 -1
  144. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/posix_tss_ptr.ipp +1 -1
  145. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/reactive_descriptor_service.ipp +27 -13
  146. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/reactive_serial_port_service.ipp +7 -6
  147. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/reactive_socket_service_base.ipp +43 -10
  148. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/resolver_service_base.ipp +54 -30
  149. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/{task_io_service.ipp → scheduler.ipp} +167 -70
  150. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/select_reactor.hpp +17 -4
  151. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/select_reactor.ipp +46 -26
  152. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/service_registry.hpp +36 -30
  153. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/service_registry.ipp +39 -30
  154. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/signal_set_service.ipp +43 -21
  155. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/socket_ops.ipp +129 -26
  156. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/socket_select_interrupter.ipp +1 -1
  157. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/strand_executor_service.hpp +181 -0
  158. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/strand_executor_service.ipp +136 -0
  159. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/strand_service.hpp +13 -13
  160. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/strand_service.ipp +15 -14
  161. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/throw_error.ipp +1 -1
  162. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/timer_queue_ptime.ipp +12 -5
  163. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/timer_queue_set.ipp +1 -1
  164. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/io_control.hpp +1 -51
  165. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/is_buffer_sequence.hpp +241 -0
  166. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/is_executor.hpp +128 -0
  167. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/keyword_tss_ptr.hpp +1 -1
  168. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/kqueue_reactor.hpp +36 -14
  169. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/local_free_on_block_exit.hpp +1 -1
  170. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/macos_fenced_block.hpp +2 -1
  171. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/memory.hpp +42 -1
  172. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/mutex.hpp +1 -1
  173. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/noncopyable.hpp +1 -1
  174. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/null_event.hpp +17 -5
  175. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/null_fenced_block.hpp +3 -1
  176. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/null_global.hpp +61 -0
  177. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/null_mutex.hpp +1 -1
  178. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/null_reactor.hpp +10 -9
  179. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/null_signal_blocker.hpp +1 -1
  180. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/null_socket_service.hpp +29 -19
  181. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/null_static_mutex.hpp +1 -1
  182. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/null_thread.hpp +7 -1
  183. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/null_tss_ptr.hpp +1 -1
  184. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/object_pool.hpp +26 -1
  185. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/old_win_sdk_compat.hpp +1 -1
  186. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/op_queue.hpp +7 -1
  187. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/operation.hpp +3 -3
  188. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/pipe_select_interrupter.hpp +1 -1
  189. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/pop_options.hpp +5 -1
  190. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/posix_event.hpp +37 -1
  191. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/posix_fd_set_adapter.hpp +1 -1
  192. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/posix_global.hpp +82 -0
  193. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/posix_mutex.hpp +1 -1
  194. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/posix_signal_blocker.hpp +1 -1
  195. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/posix_static_mutex.hpp +1 -1
  196. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/posix_thread.hpp +5 -1
  197. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/posix_tss_ptr.hpp +1 -1
  198. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/push_options.hpp +10 -1
  199. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_descriptor_service.hpp +86 -20
  200. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_null_buffers_op.hpp +9 -7
  201. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_serial_port_service.hpp +10 -8
  202. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_socket_accept_op.hpp +101 -20
  203. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_socket_connect_op.hpp +14 -7
  204. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_socket_recv_op.hpp +20 -8
  205. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_socket_recvfrom_op.hpp +13 -8
  206. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_socket_recvmsg_op.hpp +15 -8
  207. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_socket_send_op.hpp +25 -11
  208. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_socket_sendto_op.hpp +15 -8
  209. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_socket_service.hpp +99 -31
  210. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_socket_service_base.hpp +96 -35
  211. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactive_wait_op.hpp +92 -0
  212. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactor.hpp +2 -2
  213. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactor_fwd.hpp +2 -2
  214. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactor_op.hpp +7 -3
  215. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/reactor_op_queue.hpp +1 -1
  216. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/recycling_allocator.hpp +106 -0
  217. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/regex_fwd.hpp +1 -1
  218. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/resolve_endpoint_op.hpp +25 -24
  219. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/resolve_op.hpp +6 -92
  220. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/resolve_query_op.hpp +136 -0
  221. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/resolver_service.hpp +38 -22
  222. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/resolver_service_base.hpp +30 -19
  223. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/{task_io_service.hpp → scheduler.hpp} +57 -45
  224. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/{task_io_service_operation.hpp → scheduler_operation.hpp} +19 -17
  225. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/{task_io_service_thread_info.hpp → scheduler_thread_info.hpp} +10 -10
  226. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/scoped_lock.hpp +1 -1
  227. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/scoped_ptr.hpp +9 -1
  228. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/select_interrupter.hpp +1 -1
  229. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/select_reactor.hpp +37 -18
  230. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/service_registry.hpp +54 -34
  231. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/signal_blocker.hpp +1 -1
  232. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/signal_handler.hpp +9 -5
  233. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/signal_init.hpp +1 -1
  234. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/signal_op.hpp +1 -1
  235. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/signal_set_service.hpp +14 -13
  236. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/socket_holder.hpp +1 -1
  237. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/socket_ops.hpp +9 -6
  238. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/socket_option.hpp +1 -1
  239. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/socket_select_interrupter.hpp +1 -1
  240. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/socket_types.hpp +10 -2
  241. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/solaris_fenced_block.hpp +2 -1
  242. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/static_mutex.hpp +1 -1
  243. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/std_event.hpp +1 -1
  244. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/std_fenced_block.hpp +1 -1
  245. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/std_global.hpp +72 -0
  246. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/std_mutex.hpp +1 -1
  247. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/std_static_mutex.hpp +1 -1
  248. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/std_thread.hpp +7 -1
  249. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/strand_executor_service.hpp +144 -0
  250. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/strand_service.hpp +10 -10
  251. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/string_view.hpp +49 -0
  252. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/thread.hpp +9 -5
  253. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/thread_context.hpp +44 -0
  254. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/thread_group.hpp +91 -0
  255. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/thread_info_base.hpp +45 -15
  256. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/throw_error.hpp +1 -1
  257. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/throw_exception.hpp +1 -1
  258. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/timer_queue.hpp +29 -2
  259. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/timer_queue_base.hpp +1 -1
  260. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/timer_queue_ptime.hpp +11 -5
  261. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/timer_queue_set.hpp +1 -1
  262. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/timer_scheduler.hpp +2 -2
  263. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/timer_scheduler_fwd.hpp +2 -2
  264. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/tss_ptr.hpp +1 -1
  265. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/type_traits.hpp +29 -1
  266. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/variadic_templates.hpp +74 -18
  267. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/wait_handler.hpp +8 -6
  268. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/wait_op.hpp +1 -1
  269. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/winsock_init.hpp +1 -1
  270. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/work_dispatcher.hpp +74 -0
  271. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/wrapped_handler.hpp +1 -1
  272. data/src/cxx_supportlib/vendor-modified/boost/asio/dispatch.hpp +110 -0
  273. data/src/cxx_supportlib/vendor-modified/boost/asio/error.hpp +17 -1
  274. data/src/cxx_supportlib/vendor-modified/boost/asio/execution_context.hpp +413 -0
  275. data/src/cxx_supportlib/vendor-modified/boost/asio/executor.hpp +343 -0
  276. data/src/cxx_supportlib/vendor-modified/boost/asio/executor_work_guard.hpp +172 -0
  277. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental.hpp +22 -0
  278. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/co_spawn.hpp +228 -0
  279. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detached.hpp +67 -0
  280. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/impl/co_spawn.hpp +878 -0
  281. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/impl/detached.hpp +93 -0
  282. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/impl/redirect_error.hpp +296 -0
  283. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/redirect_error.hpp +69 -0
  284. data/src/cxx_supportlib/vendor-modified/boost/asio/generic/basic_endpoint.hpp +1 -1
  285. data/src/cxx_supportlib/vendor-modified/boost/asio/generic/datagram_protocol.hpp +1 -1
  286. data/src/cxx_supportlib/vendor-modified/boost/asio/generic/detail/endpoint.hpp +1 -1
  287. data/src/cxx_supportlib/vendor-modified/boost/asio/generic/detail/impl/endpoint.ipp +3 -2
  288. data/src/cxx_supportlib/vendor-modified/boost/asio/generic/raw_protocol.hpp +1 -1
  289. data/src/cxx_supportlib/vendor-modified/boost/asio/generic/seq_packet_protocol.hpp +1 -1
  290. data/src/cxx_supportlib/vendor-modified/boost/asio/generic/stream_protocol.hpp +1 -1
  291. data/src/cxx_supportlib/vendor-modified/boost/asio/handler_alloc_hook.hpp +1 -1
  292. data/src/cxx_supportlib/vendor-modified/boost/asio/handler_continuation_hook.hpp +1 -1
  293. data/src/cxx_supportlib/vendor-modified/boost/asio/handler_invoke_hook.hpp +4 -4
  294. data/src/cxx_supportlib/vendor-modified/boost/asio/handler_type.hpp +11 -73
  295. data/src/cxx_supportlib/vendor-modified/boost/asio/high_resolution_timer.hpp +4 -23
  296. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/buffered_read_stream.hpp +86 -15
  297. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/buffered_write_stream.hpp +92 -19
  298. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/connect.hpp +549 -119
  299. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/defer.hpp +79 -0
  300. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/dispatch.hpp +80 -0
  301. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/error.ipp +1 -1
  302. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/execution_context.hpp +109 -0
  303. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/execution_context.ipp +84 -0
  304. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/executor.hpp +388 -0
  305. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/executor.ipp +40 -0
  306. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/handler_alloc_hook.ipp +7 -32
  307. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/io_context.hpp +347 -0
  308. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/io_context.ipp +176 -0
  309. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/post.hpp +79 -0
  310. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/read.hpp +341 -379
  311. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/read_at.hpp +173 -343
  312. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/read_until.hpp +559 -206
  313. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/serial_port_base.hpp +1 -1
  314. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/serial_port_base.ipp +30 -30
  315. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/spawn.hpp +254 -72
  316. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/src.cpp +1 -1
  317. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/src.hpp +12 -4
  318. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/system_context.hpp +36 -0
  319. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/system_context.ipp +75 -0
  320. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/system_executor.hpp +87 -0
  321. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/thread_pool.hpp +129 -0
  322. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/thread_pool.ipp +78 -0
  323. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/use_future.hpp +855 -94
  324. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/write.hpp +358 -449
  325. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/write_at.hpp +165 -418
  326. data/src/cxx_supportlib/vendor-modified/boost/asio/io_context.hpp +878 -0
  327. data/src/cxx_supportlib/vendor-modified/boost/asio/io_context_strand.hpp +386 -0
  328. data/src/cxx_supportlib/vendor-modified/boost/asio/io_service.hpp +6 -743
  329. data/src/cxx_supportlib/vendor-modified/boost/asio/io_service_strand.hpp +20 -0
  330. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/address.hpp +79 -19
  331. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/address_v4.hpp +111 -23
  332. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/address_v4_iterator.hpp +164 -0
  333. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/address_v4_range.hpp +136 -0
  334. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/address_v6.hpp +104 -14
  335. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/address_v6_iterator.hpp +185 -0
  336. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/address_v6_range.hpp +131 -0
  337. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/bad_address_cast.hpp +50 -0
  338. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/basic_endpoint.hpp +5 -5
  339. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/basic_resolver.hpp +821 -71
  340. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/basic_resolver_entry.hpp +23 -4
  341. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/basic_resolver_iterator.hpp +31 -99
  342. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/basic_resolver_query.hpp +1 -1
  343. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/basic_resolver_results.hpp +313 -0
  344. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/detail/endpoint.hpp +2 -2
  345. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/detail/impl/endpoint.ipp +5 -10
  346. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/detail/socket_option.hpp +16 -19
  347. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/host_name.hpp +1 -1
  348. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/icmp.hpp +1 -1
  349. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/address.hpp +28 -14
  350. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/address.ipp +55 -47
  351. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/address_v4.hpp +28 -14
  352. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/address_v4.ipp +76 -44
  353. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/address_v6.hpp +28 -14
  354. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/address_v6.ipp +85 -33
  355. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/basic_endpoint.hpp +2 -14
  356. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/host_name.ipp +1 -1
  357. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/network_v4.hpp +56 -0
  358. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/network_v4.ipp +218 -0
  359. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/network_v6.hpp +55 -0
  360. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/network_v6.ipp +187 -0
  361. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/multicast.hpp +8 -8
  362. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/network_v4.hpp +263 -0
  363. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/network_v6.hpp +237 -0
  364. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/resolver_base.hpp +131 -0
  365. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/resolver_query_base.hpp +3 -90
  366. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/resolver_service.hpp +48 -24
  367. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/tcp.hpp +3 -3
  368. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/udp.hpp +1 -1
  369. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/unicast.hpp +3 -3
  370. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/v6_only.hpp +3 -3
  371. data/src/cxx_supportlib/vendor-modified/boost/asio/is_executor.hpp +48 -0
  372. data/src/cxx_supportlib/vendor-modified/boost/asio/is_read_buffered.hpp +1 -1
  373. data/src/cxx_supportlib/vendor-modified/boost/asio/is_write_buffered.hpp +1 -1
  374. data/src/cxx_supportlib/vendor-modified/boost/asio/local/basic_endpoint.hpp +1 -1
  375. data/src/cxx_supportlib/vendor-modified/boost/asio/local/connect_pair.hpp +23 -21
  376. data/src/cxx_supportlib/vendor-modified/boost/asio/local/datagram_protocol.hpp +1 -1
  377. data/src/cxx_supportlib/vendor-modified/boost/asio/local/detail/endpoint.hpp +1 -1
  378. data/src/cxx_supportlib/vendor-modified/boost/asio/local/detail/impl/endpoint.ipp +3 -2
  379. data/src/cxx_supportlib/vendor-modified/boost/asio/local/stream_protocol.hpp +1 -1
  380. data/src/cxx_supportlib/vendor-modified/boost/asio/packaged_task.hpp +128 -0
  381. data/src/cxx_supportlib/vendor-modified/boost/asio/placeholders.hpp +30 -2
  382. data/src/cxx_supportlib/vendor-modified/boost/asio/posix/basic_descriptor.hpp +138 -46
  383. data/src/cxx_supportlib/vendor-modified/boost/asio/posix/basic_stream_descriptor.hpp +15 -15
  384. data/src/cxx_supportlib/vendor-modified/boost/asio/posix/descriptor.hpp +646 -0
  385. data/src/cxx_supportlib/vendor-modified/boost/asio/posix/descriptor_base.hpp +17 -24
  386. data/src/cxx_supportlib/vendor-modified/boost/asio/posix/stream_descriptor.hpp +326 -3
  387. data/src/cxx_supportlib/vendor-modified/boost/asio/posix/stream_descriptor_service.hpp +63 -44
  388. data/src/cxx_supportlib/vendor-modified/boost/asio/post.hpp +109 -0
  389. data/src/cxx_supportlib/vendor-modified/boost/asio/raw_socket_service.hpp +94 -64
  390. data/src/cxx_supportlib/vendor-modified/boost/asio/read.hpp +328 -12
  391. data/src/cxx_supportlib/vendor-modified/boost/asio/read_at.hpp +13 -6
  392. data/src/cxx_supportlib/vendor-modified/boost/asio/read_until.hpp +1148 -247
  393. data/src/cxx_supportlib/vendor-modified/boost/asio/seq_packet_socket_service.hpp +88 -56
  394. data/src/cxx_supportlib/vendor-modified/boost/asio/serial_port.hpp +736 -3
  395. data/src/cxx_supportlib/vendor-modified/boost/asio/serial_port_base.hpp +11 -11
  396. data/src/cxx_supportlib/vendor-modified/boost/asio/serial_port_service.hpp +41 -45
  397. data/src/cxx_supportlib/vendor-modified/boost/asio/signal_set.hpp +422 -3
  398. data/src/cxx_supportlib/vendor-modified/boost/asio/signal_set_service.hpp +32 -24
  399. data/src/cxx_supportlib/vendor-modified/boost/asio/socket_acceptor_service.hpp +114 -48
  400. data/src/cxx_supportlib/vendor-modified/boost/asio/socket_base.hpp +85 -46
  401. data/src/cxx_supportlib/vendor-modified/boost/asio/spawn.hpp +89 -18
  402. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl.hpp +1 -4
  403. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/context.hpp +33 -62
  404. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/context_base.hpp +1 -1
  405. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/buffered_handshake_op.hpp +27 -23
  406. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/engine.hpp +10 -14
  407. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/handshake_op.hpp +2 -8
  408. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/impl/engine.ipp +22 -25
  409. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/impl/openssl_init.ipp +5 -4
  410. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/io.hpp +40 -17
  411. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/openssl_init.hpp +2 -2
  412. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/openssl_types.hpp +1 -1
  413. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/password_callback.hpp +4 -10
  414. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/read_op.hpp +3 -9
  415. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/shutdown_op.hpp +2 -8
  416. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/stream_core.hpp +27 -19
  417. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/verify_callback.hpp +2 -8
  418. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/write_op.hpp +3 -9
  419. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/error.hpp +1 -1
  420. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/impl/context.hpp +8 -12
  421. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/impl/context.ipp +86 -102
  422. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/impl/error.ipp +1 -1
  423. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/impl/rfc2818_verification.ipp +7 -13
  424. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/impl/src.hpp +1 -1
  425. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/rfc2818_verification.hpp +7 -13
  426. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/stream.hpp +90 -85
  427. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/stream_base.hpp +1 -1
  428. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/verify_context.hpp +3 -9
  429. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/verify_mode.hpp +1 -1
  430. data/src/cxx_supportlib/vendor-modified/boost/asio/steady_timer.hpp +4 -23
  431. data/src/cxx_supportlib/vendor-modified/boost/asio/strand.hpp +209 -175
  432. data/src/cxx_supportlib/vendor-modified/boost/asio/stream_socket_service.hpp +88 -56
  433. data/src/cxx_supportlib/vendor-modified/boost/asio/streambuf.hpp +1 -1
  434. data/src/cxx_supportlib/vendor-modified/boost/asio/system_context.hpp +80 -0
  435. data/src/cxx_supportlib/vendor-modified/boost/asio/system_executor.hpp +131 -0
  436. data/src/cxx_supportlib/vendor-modified/boost/asio/system_timer.hpp +4 -19
  437. data/src/cxx_supportlib/vendor-modified/boost/asio/thread_pool.hpp +234 -0
  438. data/src/cxx_supportlib/vendor-modified/boost/asio/time_traits.hpp +1 -1
  439. data/src/cxx_supportlib/vendor-modified/boost/asio/ts/buffer.hpp +24 -0
  440. data/src/cxx_supportlib/vendor-modified/boost/asio/ts/executor.hpp +35 -0
  441. data/src/cxx_supportlib/vendor-modified/boost/asio/ts/internet.hpp +40 -0
  442. data/src/cxx_supportlib/vendor-modified/boost/asio/ts/io_context.hpp +20 -0
  443. data/src/cxx_supportlib/vendor-modified/boost/asio/ts/net.hpp +26 -0
  444. data/src/cxx_supportlib/vendor-modified/boost/asio/ts/netfwd.hpp +199 -0
  445. data/src/cxx_supportlib/vendor-modified/boost/asio/ts/socket.hpp +27 -0
  446. data/src/cxx_supportlib/vendor-modified/boost/asio/ts/timer.hpp +26 -0
  447. data/src/cxx_supportlib/vendor-modified/boost/asio/unyield.hpp +1 -1
  448. data/src/cxx_supportlib/vendor-modified/boost/asio/use_future.hpp +70 -3
  449. data/src/cxx_supportlib/vendor-modified/boost/asio/uses_executor.hpp +73 -0
  450. data/src/cxx_supportlib/vendor-modified/boost/asio/version.hpp +2 -2
  451. data/src/cxx_supportlib/vendor-modified/boost/asio/wait_traits.hpp +17 -2
  452. data/src/cxx_supportlib/vendor-modified/boost/asio/waitable_timer_service.hpp +62 -20
  453. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/basic_handle.hpp +22 -30
  454. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/basic_object_handle.hpp +14 -10
  455. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/basic_random_access_handle.hpp +15 -15
  456. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/basic_stream_handle.hpp +15 -15
  457. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/object_handle.hpp +346 -3
  458. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/object_handle_service.hpp +26 -20
  459. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/overlapped_handle.hpp +333 -0
  460. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/overlapped_ptr.hpp +6 -6
  461. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/random_access_handle.hpp +344 -3
  462. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/random_access_handle_service.hpp +31 -37
  463. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/stream_handle.hpp +328 -3
  464. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/stream_handle_service.hpp +29 -37
  465. data/src/cxx_supportlib/vendor-modified/boost/asio/write.hpp +321 -12
  466. data/src/cxx_supportlib/vendor-modified/boost/asio/write_at.hpp +13 -6
  467. data/src/cxx_supportlib/vendor-modified/boost/asio/yield.hpp +1 -1
  468. data/src/cxx_supportlib/vendor-modified/boost/atomic/atomic.hpp +11 -0
  469. data/src/cxx_supportlib/vendor-modified/boost/atomic/capabilities.hpp +50 -1
  470. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/addressof.hpp +58 -0
  471. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/atomic_flag.hpp +1 -0
  472. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/atomic_template.hpp +688 -220
  473. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/bitwise_cast.hpp +25 -21
  474. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/bitwise_fp_cast.hpp +86 -0
  475. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/caps_gcc_arm.hpp +1 -18
  476. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/caps_gcc_atomic.hpp +9 -10
  477. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/caps_gcc_ppc.hpp +2 -1
  478. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/caps_gcc_sync.hpp +7 -8
  479. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/caps_gcc_x86.hpp +1 -36
  480. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/config.hpp +108 -34
  481. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/extra_fp_operations.hpp +28 -0
  482. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/extra_fp_operations_fwd.hpp +35 -0
  483. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/extra_fp_ops_emulated.hpp +107 -0
  484. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/extra_fp_ops_generic.hpp +189 -0
  485. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/extra_operations.hpp +28 -0
  486. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/extra_operations_fwd.hpp +35 -0
  487. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/extra_ops_emulated.hpp +238 -0
  488. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/extra_ops_gcc_arm.hpp +1111 -0
  489. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/extra_ops_gcc_ppc.hpp +840 -0
  490. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/extra_ops_gcc_x86.hpp +1656 -0
  491. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/extra_ops_generic.hpp +402 -0
  492. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/extra_ops_msvc_arm.hpp +106 -0
  493. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/extra_ops_msvc_x86.hpp +1301 -0
  494. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/float_sizes.hpp +142 -0
  495. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/fp_operations.hpp +28 -0
  496. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/fp_operations_fwd.hpp +35 -0
  497. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/fp_ops_emulated.hpp +72 -0
  498. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/fp_ops_generic.hpp +83 -0
  499. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/hwcaps_gcc_arm.hpp +67 -0
  500. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/hwcaps_gcc_ppc.hpp +42 -0
  501. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/hwcaps_gcc_x86.hpp +58 -0
  502. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/int_sizes.hpp +3 -3
  503. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/integral_extend.hpp +105 -0
  504. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/interlocked.hpp +35 -1
  505. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/operations_lockfree.hpp +1 -1
  506. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/ops_cas_based.hpp +2 -0
  507. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/ops_emulated.hpp +8 -9
  508. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/ops_extending_cas_based.hpp +8 -7
  509. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/ops_gcc_alpha.hpp +14 -16
  510. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/ops_gcc_arm.hpp +548 -126
  511. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/ops_gcc_arm_common.hpp +134 -0
  512. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/ops_gcc_atomic.hpp +36 -44
  513. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/ops_gcc_ppc.hpp +524 -96
  514. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/ops_gcc_ppc_common.hpp +70 -0
  515. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/ops_gcc_sparc.hpp +14 -16
  516. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/ops_gcc_sync.hpp +27 -59
  517. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/ops_gcc_x86.hpp +104 -57
  518. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/ops_gcc_x86_dcas.hpp +268 -340
  519. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/ops_linux_arm.hpp +9 -9
  520. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/ops_msvc_arm.hpp +22 -24
  521. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/ops_msvc_x86.hpp +55 -80
  522. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/platform.hpp +88 -46
  523. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/storage_type.hpp +30 -103
  524. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/string_ops.hpp +61 -0
  525. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/type_traits/conditional.hpp +42 -0
  526. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/type_traits/integral_constant.hpp +46 -0
  527. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/type_traits/is_floating_point.hpp +42 -0
  528. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/type_traits/is_function.hpp +42 -0
  529. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/type_traits/is_iec559.hpp +47 -0
  530. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/type_traits/is_integral.hpp +43 -0
  531. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/type_traits/is_signed.hpp +43 -0
  532. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/type_traits/is_trivially_default_constructible.hpp +46 -0
  533. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/type_traits/make_signed.hpp +43 -0
  534. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/type_traits/make_unsigned.hpp +43 -0
  535. data/src/cxx_supportlib/vendor-modified/boost/bind/bind.hpp +37 -0
  536. data/src/cxx_supportlib/vendor-modified/boost/bind/bind_cc.hpp +30 -30
  537. data/src/cxx_supportlib/vendor-modified/boost/bind/bind_mf_cc.hpp +36 -36
  538. data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/system.hpp +0 -10
  539. data/src/cxx_supportlib/vendor-modified/boost/chrono/duration.hpp +28 -30
  540. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/duration_get.hpp +2 -4
  541. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/duration_io.hpp +1 -1
  542. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/time_point_io.hpp +14 -8
  543. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/time_point_units.hpp +1 -1
  544. data/src/cxx_supportlib/vendor-modified/boost/chrono/io_v1/chrono_io.hpp +2 -4
  545. data/src/cxx_supportlib/vendor-modified/boost/chrono/process_cpu_clocks.hpp +2 -2
  546. data/src/cxx_supportlib/vendor-modified/boost/chrono/time_point.hpp +0 -1
  547. data/src/cxx_supportlib/vendor-modified/boost/circular_buffer/base.hpp +9 -9
  548. data/src/cxx_supportlib/vendor-modified/boost/circular_buffer/details.hpp +7 -6
  549. data/src/cxx_supportlib/vendor-modified/boost/config.hpp +4 -4
  550. data/src/cxx_supportlib/vendor-modified/boost/config/auto_link.hpp +26 -4
  551. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/borland.hpp +12 -0
  552. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/clang.hpp +30 -2
  553. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/codegear.hpp +13 -0
  554. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/common_edg.hpp +11 -0
  555. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/cray.hpp +32 -2
  556. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/diab.hpp +26 -0
  557. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/digitalmars.hpp +11 -0
  558. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/gcc.hpp +33 -6
  559. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/gcc_xml.hpp +11 -0
  560. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/intel.hpp +8 -1
  561. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/metrowerks.hpp +11 -0
  562. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/mpw.hpp +11 -0
  563. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/nvcc.hpp +28 -2
  564. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/pathscale.hpp +17 -1
  565. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/pgi.hpp +8 -142
  566. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/sunpro_cc.hpp +14 -3
  567. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/vacpp.hpp +16 -0
  568. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/visualc.hpp +37 -9
  569. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/xlcpp.hpp +19 -0
  570. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/xlcpp_zos.hpp +169 -0
  571. data/src/cxx_supportlib/vendor-modified/boost/config/{posix_features.hpp → detail/posix_features.hpp} +0 -0
  572. data/src/cxx_supportlib/vendor-modified/boost/config/{select_compiler_config.hpp → detail/select_compiler_config.hpp} +15 -5
  573. data/src/cxx_supportlib/vendor-modified/boost/config/{select_platform_config.hpp → detail/select_platform_config.hpp} +8 -3
  574. data/src/cxx_supportlib/vendor-modified/boost/config/{select_stdlib_config.hpp → detail/select_stdlib_config.hpp} +5 -0
  575. data/src/cxx_supportlib/vendor-modified/boost/config/{suffix.hpp → detail/suffix.hpp} +27 -27
  576. data/src/cxx_supportlib/vendor-modified/boost/config/header_deprecated.hpp +26 -0
  577. data/src/cxx_supportlib/vendor-modified/boost/config/helper_macros.hpp +37 -0
  578. data/src/cxx_supportlib/vendor-modified/boost/config/platform/aix.hpp +1 -1
  579. data/src/cxx_supportlib/vendor-modified/boost/config/platform/beos.hpp +1 -1
  580. data/src/cxx_supportlib/vendor-modified/boost/config/platform/bsd.hpp +1 -1
  581. data/src/cxx_supportlib/vendor-modified/boost/config/platform/cray.hpp +1 -1
  582. data/src/cxx_supportlib/vendor-modified/boost/config/platform/cygwin.hpp +12 -1
  583. data/src/cxx_supportlib/vendor-modified/boost/config/platform/haiku.hpp +1 -1
  584. data/src/cxx_supportlib/vendor-modified/boost/config/platform/hpux.hpp +1 -1
  585. data/src/cxx_supportlib/vendor-modified/boost/config/platform/irix.hpp +1 -1
  586. data/src/cxx_supportlib/vendor-modified/boost/config/platform/linux.hpp +4 -3
  587. data/src/cxx_supportlib/vendor-modified/boost/config/platform/macos.hpp +1 -1
  588. data/src/cxx_supportlib/vendor-modified/boost/config/platform/qnxnto.hpp +1 -1
  589. data/src/cxx_supportlib/vendor-modified/boost/config/platform/solaris.hpp +1 -1
  590. data/src/cxx_supportlib/vendor-modified/boost/config/platform/symbian.hpp +1 -1
  591. data/src/cxx_supportlib/vendor-modified/boost/config/platform/vxworks.hpp +155 -91
  592. data/src/cxx_supportlib/vendor-modified/boost/config/platform/zos.hpp +32 -0
  593. data/src/cxx_supportlib/vendor-modified/boost/config/pragma_message.hpp +31 -0
  594. data/src/cxx_supportlib/vendor-modified/boost/config/stdlib/dinkumware.hpp +21 -2
  595. data/src/cxx_supportlib/vendor-modified/boost/config/stdlib/libcomo.hpp +2 -0
  596. data/src/cxx_supportlib/vendor-modified/boost/config/stdlib/libcpp.hpp +20 -0
  597. data/src/cxx_supportlib/vendor-modified/boost/config/stdlib/libstdcpp3.hpp +35 -0
  598. data/src/cxx_supportlib/vendor-modified/boost/config/stdlib/modena.hpp +2 -0
  599. data/src/cxx_supportlib/vendor-modified/boost/config/stdlib/msl.hpp +3 -1
  600. data/src/cxx_supportlib/vendor-modified/boost/config/stdlib/roguewave.hpp +2 -0
  601. data/src/cxx_supportlib/vendor-modified/boost/config/stdlib/sgi.hpp +2 -0
  602. data/src/cxx_supportlib/vendor-modified/boost/config/stdlib/stlport.hpp +2 -0
  603. data/src/cxx_supportlib/vendor-modified/boost/config/stdlib/vacpp.hpp +2 -0
  604. data/src/cxx_supportlib/vendor-modified/boost/config/stdlib/xlcpp_zos.hpp +60 -0
  605. data/src/cxx_supportlib/vendor-modified/boost/config/workaround.hpp +279 -0
  606. data/src/cxx_supportlib/vendor-modified/boost/container/adaptive_pool.hpp +19 -19
  607. data/src/cxx_supportlib/vendor-modified/boost/container/allocator.hpp +5 -5
  608. data/src/cxx_supportlib/vendor-modified/boost/container/allocator_traits.hpp +58 -58
  609. data/src/cxx_supportlib/vendor-modified/boost/container/container_fwd.hpp +7 -28
  610. data/src/cxx_supportlib/vendor-modified/boost/container/deque.hpp +57 -57
  611. data/src/cxx_supportlib/vendor-modified/boost/container/detail/adaptive_node_pool.hpp +3 -3
  612. data/src/cxx_supportlib/vendor-modified/boost/container/detail/adaptive_node_pool_impl.hpp +10 -10
  613. data/src/cxx_supportlib/vendor-modified/boost/container/detail/addressof.hpp +2 -2
  614. data/src/cxx_supportlib/vendor-modified/boost/container/detail/advanced_insert_int.hpp +18 -18
  615. data/src/cxx_supportlib/vendor-modified/boost/container/detail/algorithm.hpp +122 -0
  616. data/src/cxx_supportlib/vendor-modified/boost/container/detail/alloc_helpers.hpp +8 -8
  617. data/src/cxx_supportlib/vendor-modified/boost/container/detail/allocator_version_traits.hpp +7 -7
  618. data/src/cxx_supportlib/vendor-modified/boost/container/detail/construct_in_place.hpp +1 -1
  619. data/src/cxx_supportlib/vendor-modified/boost/container/detail/container_or_allocator_rebind.hpp +49 -0
  620. data/src/cxx_supportlib/vendor-modified/boost/container/detail/container_rebind.hpp +258 -0
  621. data/src/cxx_supportlib/vendor-modified/boost/container/detail/copy_move_algo.hpp +119 -134
  622. data/src/cxx_supportlib/vendor-modified/boost/container/detail/destroyers.hpp +15 -15
  623. data/src/cxx_supportlib/vendor-modified/boost/container/detail/dispatch_uses_allocator.hpp +55 -55
  624. data/src/cxx_supportlib/vendor-modified/boost/container/detail/flat_tree.hpp +714 -282
  625. data/src/cxx_supportlib/vendor-modified/boost/container/detail/is_container.hpp +55 -0
  626. data/src/cxx_supportlib/vendor-modified/boost/container/detail/is_contiguous_container.hpp +47 -0
  627. data/src/cxx_supportlib/vendor-modified/boost/container/detail/is_sorted.hpp +2 -2
  628. data/src/cxx_supportlib/vendor-modified/boost/container/detail/iterator.hpp +30 -0
  629. data/src/cxx_supportlib/vendor-modified/boost/container/detail/iterator_to_raw_pointer.hpp +4 -29
  630. data/src/cxx_supportlib/vendor-modified/boost/container/detail/iterators.hpp +9 -9
  631. data/src/cxx_supportlib/vendor-modified/boost/container/detail/math_functions.hpp +2 -2
  632. data/src/cxx_supportlib/vendor-modified/boost/container/detail/min_max.hpp +2 -2
  633. data/src/cxx_supportlib/vendor-modified/boost/container/detail/mpl.hpp +2 -2
  634. data/src/cxx_supportlib/vendor-modified/boost/container/detail/multiallocation_chain.hpp +8 -8
  635. data/src/cxx_supportlib/vendor-modified/boost/container/detail/mutex.hpp +2 -2
  636. data/src/cxx_supportlib/vendor-modified/boost/container/detail/next_capacity.hpp +37 -35
  637. data/src/cxx_supportlib/vendor-modified/boost/container/detail/node_alloc_holder.hpp +41 -41
  638. data/src/cxx_supportlib/vendor-modified/boost/container/detail/node_pool.hpp +4 -4
  639. data/src/cxx_supportlib/vendor-modified/boost/container/detail/node_pool_impl.hpp +4 -4
  640. data/src/cxx_supportlib/vendor-modified/boost/container/detail/pair.hpp +69 -16
  641. data/src/cxx_supportlib/vendor-modified/boost/container/detail/pair_key_mapped_of_value.hpp +55 -0
  642. data/src/cxx_supportlib/vendor-modified/boost/container/detail/pool_common.hpp +2 -2
  643. data/src/cxx_supportlib/vendor-modified/boost/container/detail/pool_common_alloc.hpp +7 -7
  644. data/src/cxx_supportlib/vendor-modified/boost/container/detail/singleton.hpp +2 -2
  645. data/src/cxx_supportlib/vendor-modified/boost/container/detail/transform_iterator.hpp +1 -1
  646. data/src/cxx_supportlib/vendor-modified/boost/container/detail/tree.hpp +180 -116
  647. data/src/cxx_supportlib/vendor-modified/boost/container/detail/type_traits.hpp +2 -2
  648. data/src/cxx_supportlib/vendor-modified/boost/container/detail/value_functors.hpp +36 -0
  649. data/src/cxx_supportlib/vendor-modified/boost/container/detail/value_init.hpp +2 -2
  650. data/src/cxx_supportlib/vendor-modified/boost/container/detail/variadic_templates_tools.hpp +2 -2
  651. data/src/cxx_supportlib/vendor-modified/boost/container/detail/version_type.hpp +8 -8
  652. data/src/cxx_supportlib/vendor-modified/boost/container/detail/workaround.hpp +0 -6
  653. data/src/cxx_supportlib/vendor-modified/boost/container/flat_map.hpp +874 -572
  654. data/src/cxx_supportlib/vendor-modified/boost/container/flat_set.hpp +497 -248
  655. data/src/cxx_supportlib/vendor-modified/boost/container/list.hpp +33 -42
  656. data/src/cxx_supportlib/vendor-modified/boost/container/map.hpp +326 -246
  657. data/src/cxx_supportlib/vendor-modified/boost/container/node_allocator.hpp +19 -19
  658. data/src/cxx_supportlib/vendor-modified/boost/container/node_handle.hpp +122 -78
  659. data/src/cxx_supportlib/vendor-modified/boost/container/options.hpp +165 -0
  660. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/flat_map.hpp +4 -8
  661. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/flat_set.hpp +4 -8
  662. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/map.hpp +4 -4
  663. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/polymorphic_allocator.hpp +6 -6
  664. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/resource_adaptor.hpp +1 -1
  665. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/set.hpp +4 -4
  666. data/src/cxx_supportlib/vendor-modified/boost/container/scoped_allocator.hpp +19 -19
  667. data/src/cxx_supportlib/vendor-modified/boost/container/set.hpp +285 -110
  668. data/src/cxx_supportlib/vendor-modified/boost/container/slist.hpp +35 -53
  669. data/src/cxx_supportlib/vendor-modified/boost/container/small_vector.hpp +18 -19
  670. data/src/cxx_supportlib/vendor-modified/boost/container/stable_vector.hpp +25 -25
  671. data/src/cxx_supportlib/vendor-modified/boost/container/static_vector.hpp +24 -9
  672. data/src/cxx_supportlib/vendor-modified/boost/container/string.hpp +194 -142
  673. data/src/cxx_supportlib/vendor-modified/boost/container/throw_exception.hpp +15 -5
  674. data/src/cxx_supportlib/vendor-modified/boost/container/uses_allocator.hpp +5 -5
  675. data/src/cxx_supportlib/vendor-modified/boost/container/vector.hpp +395 -421
  676. data/src/cxx_supportlib/vendor-modified/boost/{functional/hash → container_hash}/detail/float_functions.hpp +0 -0
  677. data/src/cxx_supportlib/vendor-modified/boost/{functional/hash → container_hash}/detail/hash_float.hpp +4 -4
  678. data/src/cxx_supportlib/vendor-modified/boost/{functional/hash → container_hash}/detail/limits.hpp +0 -0
  679. data/src/cxx_supportlib/vendor-modified/boost/{functional/hash → container_hash}/extensions.hpp +112 -16
  680. data/src/cxx_supportlib/vendor-modified/boost/{functional/hash → container_hash}/hash.hpp +195 -7
  681. data/src/cxx_supportlib/vendor-modified/boost/{functional/hash → container_hash}/hash_fwd.hpp +3 -3
  682. data/src/cxx_supportlib/vendor-modified/boost/core/addressof.hpp +53 -44
  683. data/src/cxx_supportlib/vendor-modified/boost/core/lightweight_test.hpp +80 -2
  684. data/src/cxx_supportlib/vendor-modified/boost/core/no_exceptions_support.hpp +1 -1
  685. data/src/cxx_supportlib/vendor-modified/boost/core/pointer_traits.hpp +233 -0
  686. data/src/cxx_supportlib/vendor-modified/boost/core/ref.hpp +2 -2
  687. data/src/cxx_supportlib/vendor-modified/boost/cstdint.hpp +26 -16
  688. data/src/cxx_supportlib/vendor-modified/boost/date_time/adjust_functors.hpp +20 -34
  689. data/src/cxx_supportlib/vendor-modified/boost/date_time/c_local_time_adjustor.hpp +8 -5
  690. data/src/cxx_supportlib/vendor-modified/boost/date_time/date_duration.hpp +4 -0
  691. data/src/cxx_supportlib/vendor-modified/boost/date_time/date_formatting.hpp +2 -0
  692. data/src/cxx_supportlib/vendor-modified/boost/date_time/date_formatting_locales.hpp +7 -6
  693. data/src/cxx_supportlib/vendor-modified/boost/date_time/dst_rules.hpp +6 -6
  694. data/src/cxx_supportlib/vendor-modified/boost/date_time/filetime_functions.hpp +8 -94
  695. data/src/cxx_supportlib/vendor-modified/boost/date_time/format_date_parser.hpp +1 -8
  696. data/src/cxx_supportlib/vendor-modified/boost/date_time/gregorian/greg_day.hpp +3 -3
  697. data/src/cxx_supportlib/vendor-modified/boost/date_time/gregorian/greg_facet.hpp +6 -4
  698. data/src/cxx_supportlib/vendor-modified/boost/date_time/gregorian/greg_month.hpp +3 -3
  699. data/src/cxx_supportlib/vendor-modified/boost/date_time/gregorian/greg_weekday.hpp +2 -2
  700. data/src/cxx_supportlib/vendor-modified/boost/date_time/gregorian/greg_year.hpp +6 -6
  701. data/src/cxx_supportlib/vendor-modified/boost/date_time/gregorian/gregorian_io.hpp +52 -52
  702. data/src/cxx_supportlib/vendor-modified/boost/date_time/int_adapter.hpp +14 -27
  703. data/src/cxx_supportlib/vendor-modified/boost/date_time/local_time/custom_time_zone.hpp +0 -1
  704. data/src/cxx_supportlib/vendor-modified/boost/date_time/locale_config.hpp +3 -1
  705. data/src/cxx_supportlib/vendor-modified/boost/date_time/microsec_time_clock.hpp +36 -5
  706. data/src/cxx_supportlib/vendor-modified/boost/date_time/period_formatter.hpp +10 -9
  707. data/src/cxx_supportlib/vendor-modified/boost/date_time/posix_time/conversion.hpp +10 -12
  708. data/src/cxx_supportlib/vendor-modified/boost/date_time/posix_time/posix_time_duration.hpp +18 -10
  709. data/src/cxx_supportlib/vendor-modified/boost/date_time/posix_time/posix_time_io.hpp +12 -12
  710. data/src/cxx_supportlib/vendor-modified/boost/date_time/posix_time/time_serialize.hpp +65 -20
  711. data/src/cxx_supportlib/vendor-modified/boost/date_time/special_values_parser.hpp +32 -23
  712. data/src/cxx_supportlib/vendor-modified/boost/date_time/string_parse_tree.hpp +6 -5
  713. data/src/cxx_supportlib/vendor-modified/boost/date_time/time_duration.hpp +10 -7
  714. data/src/cxx_supportlib/vendor-modified/boost/date_time/time_facet.hpp +8 -3
  715. data/src/cxx_supportlib/vendor-modified/boost/date_time/time_parsing.hpp +20 -0
  716. data/src/cxx_supportlib/vendor-modified/boost/date_time/time_resolution_traits.hpp +31 -8
  717. data/src/cxx_supportlib/vendor-modified/boost/date_time/time_system_split.hpp +10 -4
  718. data/src/cxx_supportlib/vendor-modified/boost/date_time/tz_db_base.hpp +3 -1
  719. data/src/cxx_supportlib/vendor-modified/boost/detail/workaround.hpp +2 -264
  720. data/src/cxx_supportlib/vendor-modified/boost/enable_shared_from_this.hpp +1 -1
  721. data/src/cxx_supportlib/vendor-modified/boost/exception/detail/error_info_impl.hpp +38 -21
  722. data/src/cxx_supportlib/vendor-modified/boost/exception/detail/exception_ptr.hpp +10 -9
  723. data/src/cxx_supportlib/vendor-modified/boost/exception/detail/is_output_streamable.hpp +3 -2
  724. data/src/cxx_supportlib/vendor-modified/boost/exception/detail/object_hex_dump.hpp +7 -6
  725. data/src/cxx_supportlib/vendor-modified/boost/exception/detail/type_info.hpp +7 -6
  726. data/src/cxx_supportlib/vendor-modified/boost/exception/diagnostic_information.hpp +10 -7
  727. data/src/cxx_supportlib/vendor-modified/boost/exception/get_error_info.hpp +8 -6
  728. data/src/cxx_supportlib/vendor-modified/boost/exception/info.hpp +13 -47
  729. data/src/cxx_supportlib/vendor-modified/boost/exception/to_string.hpp +5 -4
  730. data/src/cxx_supportlib/vendor-modified/boost/exception/to_string_stub.hpp +5 -4
  731. data/src/cxx_supportlib/vendor-modified/boost/function.hpp +12 -4
  732. data/src/cxx_supportlib/vendor-modified/boost/function/detail/gen_maybe_include.pl +2 -0
  733. data/src/cxx_supportlib/vendor-modified/boost/function/detail/maybe_include.hpp +102 -0
  734. data/src/cxx_supportlib/vendor-modified/boost/function/function_base.hpp +20 -0
  735. data/src/cxx_supportlib/vendor-modified/boost/function/function_template.hpp +9 -0
  736. data/src/cxx_supportlib/vendor-modified/boost/functional/hash.hpp +1 -2
  737. data/src/cxx_supportlib/vendor-modified/boost/functional/hash_fwd.hpp +1 -6
  738. data/src/cxx_supportlib/vendor-modified/boost/integer/common_factor_rt.hpp +508 -390
  739. data/src/cxx_supportlib/vendor-modified/boost/integer/integer_mask.hpp +9 -1
  740. data/src/cxx_supportlib/vendor-modified/boost/integer_fwd.hpp +3 -0
  741. data/src/cxx_supportlib/vendor-modified/boost/intrusive/bstree.hpp +11 -3
  742. data/src/cxx_supportlib/vendor-modified/boost/intrusive/circular_list_algorithms.hpp +1 -1
  743. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/config_begin.hpp +7 -20
  744. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/default_header_holder.hpp +2 -2
  745. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/ebo_functor_holder.hpp +1 -1
  746. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/hashtable_node.hpp +1 -1
  747. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/hook_traits.hpp +5 -5
  748. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/iterator.hpp +108 -2
  749. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/mpl.hpp +15 -5
  750. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/node_to_value.hpp +1 -1
  751. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/tree_value_compare.hpp +8 -4
  752. data/src/cxx_supportlib/vendor-modified/boost/intrusive/hashtable.hpp +147 -64
  753. data/src/cxx_supportlib/vendor-modified/boost/intrusive/list.hpp +9 -2
  754. data/src/cxx_supportlib/vendor-modified/boost/intrusive/member_value_traits.hpp +3 -3
  755. data/src/cxx_supportlib/vendor-modified/boost/intrusive/pointer_plus_bits.hpp +15 -0
  756. data/src/cxx_supportlib/vendor-modified/boost/intrusive/pointer_traits.hpp +2 -2
  757. data/src/cxx_supportlib/vendor-modified/boost/intrusive/slist.hpp +9 -2
  758. data/src/cxx_supportlib/vendor-modified/boost/intrusive_ptr.hpp +1 -1
  759. data/src/cxx_supportlib/vendor-modified/boost/iterator/advance.hpp +84 -0
  760. data/src/cxx_supportlib/vendor-modified/boost/iterator/iterator_adaptor.hpp +0 -2
  761. data/src/cxx_supportlib/vendor-modified/boost/iterator/iterator_categories.hpp +3 -2
  762. data/src/cxx_supportlib/vendor-modified/boost/iterator/iterator_concepts.hpp +8 -10
  763. data/src/cxx_supportlib/vendor-modified/boost/iterator/iterator_facade.hpp +2 -1
  764. data/src/cxx_supportlib/vendor-modified/boost/iterator/iterator_traits.hpp +7 -6
  765. data/src/cxx_supportlib/vendor-modified/boost/iterator/reverse_iterator.hpp +7 -4
  766. data/src/cxx_supportlib/vendor-modified/boost/iterator/transform_iterator.hpp +6 -2
  767. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/converter_lexical_streams.hpp +7 -7
  768. data/src/cxx_supportlib/vendor-modified/boost/libs/thread/src/pthread/once_atomic.cpp +1 -1
  769. data/src/cxx_supportlib/vendor-modified/boost/libs/thread/src/pthread/thread.cpp +36 -92
  770. data/src/cxx_supportlib/vendor-modified/boost/make_shared.hpp +1 -2
  771. data/src/cxx_supportlib/vendor-modified/boost/math/special_functions/detail/fp_traits.hpp +2 -1
  772. data/src/cxx_supportlib/vendor-modified/boost/math/special_functions/math_fwd.hpp +57 -3
  773. data/src/cxx_supportlib/vendor-modified/boost/math/special_functions/sign.hpp +1 -1
  774. data/src/cxx_supportlib/vendor-modified/boost/math/tools/config.hpp +12 -1
  775. data/src/cxx_supportlib/vendor-modified/boost/memory_order.hpp +40 -9
  776. data/src/cxx_supportlib/vendor-modified/boost/move/adl_move_swap.hpp +6 -0
  777. data/src/cxx_supportlib/vendor-modified/boost/move/algo/adaptive_merge.hpp +253 -0
  778. data/src/cxx_supportlib/vendor-modified/boost/move/algo/adaptive_sort.hpp +563 -4
  779. data/src/cxx_supportlib/vendor-modified/boost/move/algo/detail/adaptive_sort_merge.hpp +324 -1071
  780. data/src/cxx_supportlib/vendor-modified/boost/move/algo/detail/basic_op.hpp +10 -10
  781. data/src/cxx_supportlib/vendor-modified/boost/move/algo/detail/heap_sort.hpp +111 -0
  782. data/src/cxx_supportlib/vendor-modified/boost/move/algo/detail/insertion_sort.hpp +12 -11
  783. data/src/cxx_supportlib/vendor-modified/boost/move/algo/detail/is_sorted.hpp +55 -0
  784. data/src/cxx_supportlib/vendor-modified/boost/move/algo/detail/merge.hpp +59 -143
  785. data/src/cxx_supportlib/vendor-modified/boost/move/algo/detail/merge_sort.hpp +6 -6
  786. data/src/cxx_supportlib/vendor-modified/boost/move/algo/detail/pdqsort.hpp +334 -0
  787. data/src/cxx_supportlib/vendor-modified/boost/move/algo/detail/set_difference.hpp +207 -0
  788. data/src/cxx_supportlib/vendor-modified/boost/move/algo/move.hpp +2 -1
  789. data/src/cxx_supportlib/vendor-modified/boost/move/algo/predicate.hpp +86 -0
  790. data/src/cxx_supportlib/vendor-modified/boost/move/algo/unique.hpp +55 -0
  791. data/src/cxx_supportlib/vendor-modified/boost/move/core.hpp +1 -9
  792. data/src/cxx_supportlib/vendor-modified/boost/move/detail/destruct_n.hpp +3 -4
  793. data/src/cxx_supportlib/vendor-modified/boost/move/detail/fwd_macros.hpp +25 -0
  794. data/src/cxx_supportlib/vendor-modified/boost/move/detail/iterator_to_raw_pointer.hpp +59 -0
  795. data/src/cxx_supportlib/vendor-modified/boost/{intrusive → move}/detail/pointer_element.hpp +12 -12
  796. data/src/cxx_supportlib/vendor-modified/boost/move/detail/to_raw_pointer.hpp +45 -0
  797. data/src/cxx_supportlib/vendor-modified/boost/move/detail/type_traits.hpp +19 -5
  798. data/src/cxx_supportlib/vendor-modified/boost/move/detail/unique_ptr_meta_utils.hpp +1 -1
  799. data/src/cxx_supportlib/vendor-modified/boost/mpl/assert.hpp +1 -1
  800. data/src/cxx_supportlib/vendor-modified/boost/mpl/get_tag.hpp +26 -0
  801. data/src/cxx_supportlib/vendor-modified/boost/next_prior.hpp +85 -55
  802. data/src/cxx_supportlib/vendor-modified/boost/numeric/conversion/cast.hpp +1 -1
  803. data/src/cxx_supportlib/vendor-modified/boost/numeric/conversion/conversion_traits.hpp +0 -7
  804. data/src/cxx_supportlib/vendor-modified/boost/numeric/conversion/detail/converter.hpp +4 -13
  805. data/src/cxx_supportlib/vendor-modified/boost/operators.hpp +26 -7
  806. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/experimental_traits.hpp +98 -0
  807. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/old_optional_implementation.hpp +10 -10
  808. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_aligned_storage.hpp +17 -21
  809. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_config.hpp +25 -6
  810. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_reference_spec.hpp +15 -15
  811. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_relops.hpp +1 -1
  812. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_trivially_copyable_base.hpp +499 -0
  813. data/src/cxx_supportlib/vendor-modified/boost/optional/optional.hpp +126 -21
  814. data/src/cxx_supportlib/vendor-modified/boost/parameter/aux_/arg_list.hpp +1 -0
  815. data/src/cxx_supportlib/vendor-modified/boost/pointer_cast.hpp +10 -9
  816. data/src/cxx_supportlib/vendor-modified/boost/pointer_to_other.hpp +1 -1
  817. data/src/cxx_supportlib/vendor-modified/boost/predef/architecture/arm.h +6 -1
  818. data/src/cxx_supportlib/vendor-modified/boost/predef/architecture/parisc.h +1 -1
  819. data/src/cxx_supportlib/vendor-modified/boost/predef/compiler/intel.h +8 -1
  820. data/src/cxx_supportlib/vendor-modified/boost/predef/hardware/simd/arm.h +3 -1
  821. data/src/cxx_supportlib/vendor-modified/boost/predef/library/c.h +1 -0
  822. data/src/cxx_supportlib/vendor-modified/boost/predef/library/c/cloudabi.h +53 -0
  823. data/src/cxx_supportlib/vendor-modified/boost/predef/make.h +4 -0
  824. data/src/cxx_supportlib/vendor-modified/boost/predef/os/android.h +2 -2
  825. data/src/cxx_supportlib/vendor-modified/boost/predef/os/bsd/free.h +10 -3
  826. data/src/cxx_supportlib/vendor-modified/boost/predef/os/bsd/open.h +80 -0
  827. data/src/cxx_supportlib/vendor-modified/boost/predef/other/workaround.h +87 -0
  828. data/src/cxx_supportlib/vendor-modified/boost/predef/platform.h +9 -2
  829. data/src/cxx_supportlib/vendor-modified/boost/predef/platform/cloudabi.h +43 -0
  830. data/src/cxx_supportlib/vendor-modified/boost/predef/platform/ios.h +58 -0
  831. data/src/cxx_supportlib/vendor-modified/boost/predef/platform/mingw.h +4 -4
  832. data/src/cxx_supportlib/vendor-modified/boost/predef/platform/mingw32.h +63 -0
  833. data/src/cxx_supportlib/vendor-modified/boost/predef/platform/mingw64.h +63 -0
  834. data/src/cxx_supportlib/vendor-modified/boost/predef/platform/windows_desktop.h +9 -3
  835. data/src/cxx_supportlib/vendor-modified/boost/predef/platform/windows_phone.h +7 -2
  836. data/src/cxx_supportlib/vendor-modified/boost/predef/platform/windows_runtime.h +13 -5
  837. data/src/cxx_supportlib/vendor-modified/boost/predef/platform/windows_server.h +47 -0
  838. data/src/cxx_supportlib/vendor-modified/boost/predef/platform/windows_store.h +11 -4
  839. data/src/cxx_supportlib/vendor-modified/boost/predef/platform/windows_system.h +47 -0
  840. data/src/cxx_supportlib/vendor-modified/boost/predef/platform/windows_uwp.h +60 -0
  841. data/src/cxx_supportlib/vendor-modified/boost/predef/version.h +1 -1
  842. data/src/cxx_supportlib/vendor-modified/boost/preprocessor/config/config.hpp +11 -9
  843. data/src/cxx_supportlib/vendor-modified/boost/random/binomial_distribution.hpp +27 -27
  844. data/src/cxx_supportlib/vendor-modified/boost/random/detail/vector_io.hpp +3 -0
  845. data/src/cxx_supportlib/vendor-modified/boost/random/discrete_distribution.hpp +2 -2
  846. data/src/cxx_supportlib/vendor-modified/boost/random/hyperexponential_distribution.hpp +0 -11
  847. data/src/cxx_supportlib/vendor-modified/boost/random/independent_bits.hpp +12 -0
  848. data/src/cxx_supportlib/vendor-modified/boost/random/linear_congruential.hpp +5 -1
  849. data/src/cxx_supportlib/vendor-modified/boost/random/poisson_distribution.hpp +17 -17
  850. data/src/cxx_supportlib/vendor-modified/boost/random/seed_seq.hpp +1 -1
  851. data/src/cxx_supportlib/vendor-modified/boost/random/uniform_on_sphere.hpp +6 -2
  852. data/src/cxx_supportlib/vendor-modified/boost/range/concepts.hpp +6 -4
  853. data/src/cxx_supportlib/vendor-modified/boost/range/iterator_range_core.hpp +1 -0
  854. data/src/cxx_supportlib/vendor-modified/boost/regex/config.hpp +1 -1
  855. data/src/cxx_supportlib/vendor-modified/boost/regex/pending/object_cache.hpp +2 -2
  856. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/basic_regex_creator.hpp +2 -2
  857. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/basic_regex_parser.hpp +56 -11
  858. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/instances.hpp +10 -10
  859. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/perl_matcher.hpp +7 -2
  860. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/perl_matcher_common.hpp +6 -1
  861. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/perl_matcher_non_recursive.hpp +37 -13
  862. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/perl_matcher_recursive.hpp +4 -4
  863. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/regex_traits_defaults.hpp +9 -6
  864. data/src/cxx_supportlib/vendor-modified/boost/regex/v4/regex_workaround.hpp +1 -1
  865. data/src/cxx_supportlib/vendor-modified/boost/scoped_array.hpp +1 -2
  866. data/src/cxx_supportlib/vendor-modified/boost/scoped_ptr.hpp +1 -2
  867. data/src/cxx_supportlib/vendor-modified/boost/shared_array.hpp +1 -1
  868. data/src/cxx_supportlib/vendor-modified/boost/shared_ptr.hpp +1 -1
  869. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/allocate_shared_array.hpp +333 -656
  870. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/bad_weak_ptr.hpp +4 -2
  871. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/atomic_count_gcc.hpp +1 -1
  872. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/local_counted_base.hpp +148 -0
  873. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/local_sp_deleter.hpp +91 -0
  874. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/operator_bool.hpp +6 -6
  875. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/shared_count.hpp +15 -3
  876. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp +1 -0
  877. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_aix.hpp +1 -0
  878. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_clang.hpp +3 -2
  879. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp +1 -0
  880. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_cw_x86.hpp +1 -0
  881. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp +1 -0
  882. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp +7 -0
  883. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp +1 -0
  884. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp +1 -0
  885. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp +1 -0
  886. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_nt.hpp +1 -0
  887. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_pt.hpp +1 -0
  888. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp +1 -0
  889. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_solaris.hpp +1 -0
  890. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_spin.hpp +1 -0
  891. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp +3 -2
  892. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_sync.hpp +1 -0
  893. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp +1 -0
  894. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_counted_impl.hpp +29 -0
  895. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/sp_noexcept.hpp +21 -3
  896. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/yield_k.hpp +1 -1
  897. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/enable_shared_from_this.hpp +6 -6
  898. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/intrusive_ptr.hpp +26 -26
  899. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/intrusive_ref_counter.hpp +17 -16
  900. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/make_shared.hpp +1 -2
  901. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/make_shared_object.hpp +19 -19
  902. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/scoped_array.hpp +11 -12
  903. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/scoped_ptr.hpp +15 -16
  904. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/shared_array.hpp +22 -22
  905. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/shared_ptr.hpp +135 -90
  906. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/weak_ptr.hpp +23 -23
  907. data/src/cxx_supportlib/vendor-modified/boost/system/detail/error_code.ipp +140 -111
  908. data/src/cxx_supportlib/vendor-modified/boost/system/error_code.hpp +297 -49
  909. data/src/cxx_supportlib/vendor-modified/boost/system/system_error.hpp +4 -4
  910. data/src/cxx_supportlib/vendor-modified/boost/thread/concurrent_queues/detail/sync_deque_base.hpp +30 -30
  911. data/src/cxx_supportlib/vendor-modified/boost/thread/concurrent_queues/detail/sync_queue_base.hpp +30 -30
  912. data/src/cxx_supportlib/vendor-modified/boost/thread/concurrent_queues/sync_bounded_queue.hpp +4 -2
  913. data/src/cxx_supportlib/vendor-modified/boost/thread/concurrent_queues/sync_deque.hpp +5 -7
  914. data/src/cxx_supportlib/vendor-modified/boost/thread/concurrent_queues/sync_priority_queue.hpp +19 -19
  915. data/src/cxx_supportlib/vendor-modified/boost/thread/concurrent_queues/sync_queue.hpp +5 -15
  916. data/src/cxx_supportlib/vendor-modified/boost/thread/concurrent_queues/sync_timed_queue.hpp +118 -183
  917. data/src/cxx_supportlib/vendor-modified/boost/{detail → thread/detail}/atomic_redef_macros.hpp +0 -0
  918. data/src/cxx_supportlib/vendor-modified/boost/{detail → thread/detail}/atomic_undef_macros.hpp +0 -0
  919. data/src/cxx_supportlib/vendor-modified/boost/thread/detail/config.hpp +62 -11
  920. data/src/cxx_supportlib/vendor-modified/boost/thread/detail/log.hpp +15 -0
  921. data/src/cxx_supportlib/vendor-modified/boost/thread/detail/move.hpp +0 -2
  922. data/src/cxx_supportlib/vendor-modified/boost/thread/detail/platform.hpp +2 -0
  923. data/src/cxx_supportlib/vendor-modified/boost/thread/detail/platform_time.hpp +478 -0
  924. data/src/cxx_supportlib/vendor-modified/boost/thread/detail/thread.hpp +51 -85
  925. data/src/cxx_supportlib/vendor-modified/boost/thread/executors/basic_thread_pool.hpp +11 -3
  926. data/src/cxx_supportlib/vendor-modified/boost/thread/executors/detail/priority_executor_base.hpp +10 -4
  927. data/src/cxx_supportlib/vendor-modified/boost/thread/executors/scheduled_thread_pool.hpp +1 -0
  928. data/src/cxx_supportlib/vendor-modified/boost/thread/executors/scheduler.hpp +10 -0
  929. data/src/cxx_supportlib/vendor-modified/boost/thread/executors/scheduling_adaptor.hpp +15 -4
  930. data/src/cxx_supportlib/vendor-modified/boost/thread/executors/serial_executor.hpp +9 -0
  931. data/src/cxx_supportlib/vendor-modified/boost/thread/future.hpp +320 -92
  932. data/src/cxx_supportlib/vendor-modified/boost/thread/once.hpp +10 -0
  933. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/condition_variable.hpp +187 -112
  934. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/condition_variable_fwd.hpp +137 -164
  935. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/mutex.hpp +67 -37
  936. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/pthread_helpers.hpp +42 -0
  937. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/pthread_mutex_scoped_lock.hpp +15 -9
  938. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/recursive_mutex.hpp +65 -33
  939. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/shared_mutex.hpp +84 -158
  940. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/thread_data.hpp +143 -35
  941. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/thread_heap_alloc.hpp +32 -2
  942. data/src/cxx_supportlib/vendor-modified/boost/thread/shared_mutex.hpp +8 -1
  943. data/src/cxx_supportlib/vendor-modified/boost/thread/thread_only.hpp +1 -1
  944. data/src/cxx_supportlib/vendor-modified/boost/thread/v2/shared_mutex.hpp +579 -589
  945. data/src/cxx_supportlib/vendor-modified/boost/token_functions.hpp +2 -1
  946. data/src/cxx_supportlib/vendor-modified/boost/token_iterator.hpp +5 -2
  947. data/src/cxx_supportlib/vendor-modified/boost/tuple/detail/tuple_basic.hpp +7 -9
  948. data/src/cxx_supportlib/vendor-modified/boost/tuple/tuple.hpp +8 -8
  949. data/src/cxx_supportlib/vendor-modified/boost/type_index.hpp +1 -1
  950. data/src/cxx_supportlib/vendor-modified/boost/type_index/stl_type_index.hpp +6 -2
  951. data/src/cxx_supportlib/vendor-modified/boost/type_index/type_index_facade.hpp +5 -8
  952. data/src/cxx_supportlib/vendor-modified/boost/type_traits/add_const.hpp +6 -0
  953. data/src/cxx_supportlib/vendor-modified/boost/type_traits/add_cv.hpp +6 -0
  954. data/src/cxx_supportlib/vendor-modified/boost/type_traits/add_lvalue_reference.hpp +6 -0
  955. data/src/cxx_supportlib/vendor-modified/boost/type_traits/add_pointer.hpp +6 -0
  956. data/src/cxx_supportlib/vendor-modified/boost/type_traits/add_reference.hpp +7 -0
  957. data/src/cxx_supportlib/vendor-modified/boost/type_traits/add_rvalue_reference.hpp +6 -0
  958. data/src/cxx_supportlib/vendor-modified/boost/type_traits/add_volatile.hpp +6 -0
  959. data/src/cxx_supportlib/vendor-modified/boost/type_traits/common_type.hpp +7 -0
  960. data/src/cxx_supportlib/vendor-modified/boost/type_traits/conditional.hpp +8 -0
  961. data/src/cxx_supportlib/vendor-modified/boost/type_traits/copy_cv.hpp +6 -0
  962. data/src/cxx_supportlib/vendor-modified/boost/type_traits/decay.hpp +6 -0
  963. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/config.hpp +12 -1
  964. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/detector.hpp +37 -0
  965. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/has_binary_operator.hpp +71 -14
  966. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/has_postfix_operator.hpp +1 -1
  967. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/has_prefix_operator.hpp +4 -1
  968. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/is_function_ptr_helper.hpp +370 -102
  969. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/is_likely_lambda.hpp +94 -0
  970. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp +1177 -572
  971. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/is_mem_fun_pointer_tester.hpp +2 -2
  972. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detected.hpp +24 -0
  973. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detected_or.hpp +25 -0
  974. data/src/cxx_supportlib/vendor-modified/boost/type_traits/floating_point_promotion.hpp +8 -0
  975. data/src/cxx_supportlib/vendor-modified/boost/type_traits/has_equal_to.hpp +3 -0
  976. data/src/cxx_supportlib/vendor-modified/boost/type_traits/has_greater.hpp +3 -0
  977. data/src/cxx_supportlib/vendor-modified/boost/type_traits/has_greater_equal.hpp +3 -0
  978. data/src/cxx_supportlib/vendor-modified/boost/type_traits/has_less.hpp +3 -0
  979. data/src/cxx_supportlib/vendor-modified/boost/type_traits/has_less_equal.hpp +3 -0
  980. data/src/cxx_supportlib/vendor-modified/boost/type_traits/has_minus.hpp +93 -0
  981. data/src/cxx_supportlib/vendor-modified/boost/type_traits/has_minus_assign.hpp +95 -2
  982. data/src/cxx_supportlib/vendor-modified/boost/type_traits/has_not_equal_to.hpp +3 -0
  983. data/src/cxx_supportlib/vendor-modified/boost/type_traits/has_nothrow_destructor.hpp +11 -2
  984. data/src/cxx_supportlib/vendor-modified/boost/type_traits/has_plus_assign.hpp +90 -0
  985. data/src/cxx_supportlib/vendor-modified/boost/type_traits/integral_constant.hpp +2 -1
  986. data/src/cxx_supportlib/vendor-modified/boost/type_traits/integral_promotion.hpp +6 -0
  987. data/src/cxx_supportlib/vendor-modified/boost/type_traits/intrinsics.hpp +2 -1
  988. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_assignable.hpp +10 -2
  989. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_complete.hpp +90 -0
  990. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_complex.hpp +1 -0
  991. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_constructible.hpp +12 -2
  992. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_convertible.hpp +20 -2
  993. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_default_constructible.hpp +16 -2
  994. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_destructible.hpp +10 -2
  995. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_detected.hpp +29 -0
  996. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_detected_convertible.hpp +29 -0
  997. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_detected_exact.hpp +29 -0
  998. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_list_constructible.hpp +48 -0
  999. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_nothrow_move_assignable.hpp +14 -3
  1000. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_nothrow_move_constructible.hpp +14 -4
  1001. data/src/cxx_supportlib/vendor-modified/boost/type_traits/is_nothrow_swappable.hpp +67 -0
  1002. data/src/cxx_supportlib/vendor-modified/boost/type_traits/make_signed.hpp +6 -0
  1003. data/src/cxx_supportlib/vendor-modified/boost/type_traits/make_unsigned.hpp +6 -0
  1004. data/src/cxx_supportlib/vendor-modified/boost/type_traits/nonesuch.hpp +35 -0
  1005. data/src/cxx_supportlib/vendor-modified/boost/type_traits/promote.hpp +6 -0
  1006. data/src/cxx_supportlib/vendor-modified/boost/type_traits/remove_all_extents.hpp +6 -0
  1007. data/src/cxx_supportlib/vendor-modified/boost/type_traits/remove_bounds.hpp +7 -0
  1008. data/src/cxx_supportlib/vendor-modified/boost/type_traits/remove_const.hpp +6 -0
  1009. data/src/cxx_supportlib/vendor-modified/boost/type_traits/remove_cv.hpp +5 -0
  1010. data/src/cxx_supportlib/vendor-modified/boost/type_traits/remove_cv_ref.hpp +30 -0
  1011. data/src/cxx_supportlib/vendor-modified/boost/type_traits/remove_extent.hpp +6 -0
  1012. data/src/cxx_supportlib/vendor-modified/boost/type_traits/remove_pointer.hpp +7 -0
  1013. data/src/cxx_supportlib/vendor-modified/boost/type_traits/remove_reference.hpp +5 -0
  1014. data/src/cxx_supportlib/vendor-modified/boost/type_traits/remove_volatile.hpp +5 -0
  1015. data/src/cxx_supportlib/vendor-modified/boost/type_traits/type_identity.hpp +9 -0
  1016. data/src/cxx_supportlib/vendor-modified/boost/type_traits/type_with_alignment.hpp +2 -3
  1017. data/src/cxx_supportlib/vendor-modified/boost/typeof/decltype.hpp +34 -0
  1018. data/src/cxx_supportlib/vendor-modified/boost/typeof/msvc/typeof_impl.hpp +5 -85
  1019. data/src/cxx_supportlib/vendor-modified/boost/typeof/register_fundamental.hpp +1 -2
  1020. data/src/cxx_supportlib/vendor-modified/boost/typeof/std/functional.hpp +6 -0
  1021. data/src/cxx_supportlib/vendor-modified/boost/typeof/std/memory.hpp +2 -0
  1022. data/src/cxx_supportlib/vendor-modified/boost/typeof/typeof.hpp +24 -14
  1023. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/fwd.hpp +18 -12
  1024. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/implementation.hpp +4018 -4052
  1025. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/map.hpp +57 -97
  1026. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/set.hpp +56 -95
  1027. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_map.hpp +2150 -1777
  1028. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_map_fwd.hpp +41 -38
  1029. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_set.hpp +1630 -1420
  1030. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_set_fwd.hpp +40 -37
  1031. data/src/cxx_supportlib/vendor-modified/boost/utility.hpp +6 -3
  1032. data/src/cxx_supportlib/vendor-modified/boost/utility/detail/minstd_rand.hpp +55 -0
  1033. data/src/cxx_supportlib/vendor-modified/boost/utility/detail/result_of_iterate.hpp +14 -17
  1034. data/src/cxx_supportlib/vendor-modified/boost/utility/result_of.hpp +44 -20
  1035. data/src/cxx_supportlib/vendor-modified/boost/utility/string_view.hpp +30 -30
  1036. data/src/cxx_supportlib/vendor-modified/boost/version.hpp +2 -2
  1037. data/src/cxx_supportlib/vendor-modified/boost/weak_ptr.hpp +1 -1
  1038. data/src/ruby_supportlib/phusion_passenger.rb +1 -1
  1039. data/src/ruby_supportlib/phusion_passenger/common_library.rb +3 -0
  1040. data/src/ruby_supportlib/phusion_passenger/platform_info/compiler.rb +8 -1
  1041. data/src/ruby_supportlib/phusion_passenger/platform_info/cxx_portability.rb +7 -1
  1042. data/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb +2 -2
  1043. data/src/ruby_supportlib/phusion_passenger/utils/tee_input.rb +4 -4
  1044. metadata +201 -47
  1045. data/src/cxx_supportlib/ConfigKit/VariantMapUtils.h +0 -96
  1046. data/src/cxx_supportlib/MessageClient.h +0 -309
  1047. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/addressof.hpp +0 -40
  1048. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/task_io_service.hpp +0 -80
  1049. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/shared_ptr.hpp +0 -40
  1050. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/weak_ptr.hpp +0 -40
  1051. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/win_iocp_serial_port_service.hpp +0 -230
  1052. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/io_service.hpp +0 -156
  1053. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/io_service.ipp +0 -157
  1054. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/basic_context.hpp +0 -42
  1055. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/context_service.hpp +0 -42
  1056. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/old/basic_context.hpp +0 -436
  1057. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/old/context_service.hpp +0 -176
  1058. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/old/detail/openssl_context_service.hpp +0 -396
  1059. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/old/detail/openssl_operation.hpp +0 -526
  1060. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/old/detail/openssl_stream_service.hpp +0 -573
  1061. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/old/stream.hpp +0 -503
  1062. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/old/stream_service.hpp +0 -186
  1063. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/stream_service.hpp +0 -42
  1064. data/src/cxx_supportlib/vendor-modified/boost/container/detail/to_raw_pointer.hpp +0 -33
  1065. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/to_raw_pointer.hpp +0 -47
  1066. data/src/cxx_supportlib/vendor-modified/boost/iterator.hpp +0 -20
  1067. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/shared_mutex_assert.hpp +0 -724
  1068. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/timespec.hpp +0 -149
  1069. data/src/cxx_supportlib/vendor-modified/boost/thread/v2/thread.hpp +0 -155
  1070. data/src/cxx_supportlib/vendor-modified/boost/utility/empty_deleter.hpp +0 -43
@@ -49,16 +49,35 @@
49
49
  #include <boost/move/adl_move_swap.hpp>
50
50
  #include <boost/move/algo/detail/insertion_sort.hpp>
51
51
  #include <boost/move/algo/detail/merge_sort.hpp>
52
+ #include <boost/move/algo/detail/heap_sort.hpp>
52
53
  #include <boost/move/algo/detail/merge.hpp>
54
+ #include <boost/move/algo/detail/is_sorted.hpp>
53
55
  #include <boost/assert.hpp>
54
56
  #include <boost/cstdint.hpp>
55
57
 
58
+ #ifndef BOOST_MOVE_ADAPTIVE_SORT_STATS_LEVEL
59
+ #define BOOST_MOVE_ADAPTIVE_SORT_STATS_LEVEL 1
60
+ #endif
61
+
56
62
  #ifdef BOOST_MOVE_ADAPTIVE_SORT_STATS
57
- #define BOOST_MOVE_ADAPTIVE_SORT_PRINT(STR, L) \
58
- print_stats(STR, L)\
59
- //
63
+ #if BOOST_MOVE_ADAPTIVE_SORT_STATS_LEVEL == 2
64
+ #define BOOST_MOVE_ADAPTIVE_SORT_PRINT_L1(STR, L) \
65
+ print_stats(STR, L)\
66
+ //
67
+
68
+ #define BOOST_MOVE_ADAPTIVE_SORT_PRINT_L2(STR, L) \
69
+ print_stats(STR, L)\
70
+ //
71
+ #else
72
+ #define BOOST_MOVE_ADAPTIVE_SORT_PRINT_L1(STR, L) \
73
+ print_stats(STR, L)\
74
+ //
75
+
76
+ #define BOOST_MOVE_ADAPTIVE_SORT_PRINT_L2(STR, L)
77
+ #endif
60
78
  #else
61
- #define BOOST_MOVE_ADAPTIVE_SORT_PRINT(STR, L)
79
+ #define BOOST_MOVE_ADAPTIVE_SORT_PRINT_L1(STR, L)
80
+ #define BOOST_MOVE_ADAPTIVE_SORT_PRINT_L2(STR, L)
62
81
  #endif
63
82
 
64
83
  #ifdef BOOST_MOVE_ADAPTIVE_SORT_INVARIANTS
@@ -67,11 +86,26 @@
67
86
  #define BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(L)
68
87
  #endif
69
88
 
70
-
71
-
72
89
  namespace boost {
73
90
  namespace movelib {
74
91
 
92
+ #if defined(BOOST_MOVE_ADAPTIVE_SORT_INVARIANTS)
93
+
94
+ bool is_sorted(::order_perf_type *first, ::order_perf_type *last, ::order_type_less)
95
+ {
96
+ if (first != last) {
97
+ const order_perf_type *next = first, *cur(first);
98
+ while (++next != last) {
99
+ if (!(cur->key < next->key || (cur->key == next->key && cur->val < next->val)))
100
+ return false;
101
+ cur = next;
102
+ }
103
+ }
104
+ return true;
105
+ }
106
+
107
+ #endif //BOOST_MOVE_ADAPTIVE_SORT_INVARIANTS
108
+
75
109
  namespace detail_adaptive {
76
110
 
77
111
  static const std::size_t AdaptiveSortInsertionSortThreshold = 16;
@@ -96,51 +130,6 @@ const T &max_value(const T &a, const T &b)
96
130
  return a > b ? a : b;
97
131
  }
98
132
 
99
- template<class ForwardIt, class Pred>
100
- bool is_sorted(ForwardIt const first, ForwardIt last, Pred pred)
101
- {
102
- if (first != last) {
103
- ForwardIt next = first, cur(first);
104
- while (++next != last) {
105
- if (pred(*next, *cur))
106
- return false;
107
- cur = next;
108
- }
109
- }
110
- return true;
111
- }
112
-
113
- #if defined(BOOST_MOVE_ADAPTIVE_SORT_INVARIANTS)
114
-
115
- bool is_sorted(::order_perf_type *first, ::order_perf_type *last, ::order_type_less)
116
- {
117
- if (first != last) {
118
- const order_perf_type *next = first, *cur(first);
119
- while (++next != last) {
120
- if (!(cur->key < next->key || (cur->key == next->key && cur->val < next->val)))
121
- return false;
122
- cur = next;
123
- }
124
- }
125
- return true;
126
- }
127
-
128
- #endif //BOOST_MOVE_ADAPTIVE_SORT_INVARIANTS
129
-
130
- template<class ForwardIt, class Pred>
131
- bool is_sorted_and_unique(ForwardIt first, ForwardIt last, Pred pred)
132
- {
133
- if (first != last) {
134
- ForwardIt next = first;
135
- while (++next != last) {
136
- if (!pred(*first, *next))
137
- return false;
138
- first = next;
139
- }
140
- }
141
- return true;
142
- }
143
-
144
133
  template<class ForwardIt, class Pred, class V>
145
134
  typename iterator_traits<ForwardIt>::size_type
146
135
  count_if_with(ForwardIt first, ForwardIt last, Pred pred, const V &v)
@@ -154,20 +143,20 @@ typename iterator_traits<ForwardIt>::size_type
154
143
  return count;
155
144
  }
156
145
 
157
- template<class T>
146
+ template<class T, class RandRawIt = T*>
158
147
  class adaptive_xbuf
159
148
  {
160
149
  adaptive_xbuf(const adaptive_xbuf &);
161
150
  adaptive_xbuf & operator=(const adaptive_xbuf &);
162
151
 
163
152
  public:
164
- typedef T* iterator;
153
+ typedef RandRawIt iterator;
165
154
 
166
155
  adaptive_xbuf()
167
- : m_ptr(0), m_size(0), m_capacity(0)
156
+ : m_ptr(), m_size(0), m_capacity(0)
168
157
  {}
169
158
 
170
- adaptive_xbuf(T *raw_memory, std::size_t capacity)
159
+ adaptive_xbuf(RandRawIt raw_memory, std::size_t capacity)
171
160
  : m_ptr(raw_memory), m_size(0), m_capacity(capacity)
172
161
  {}
173
162
 
@@ -183,7 +172,7 @@ class adaptive_xbuf
183
172
  m_size = n;
184
173
  }
185
174
  else{
186
- T *result = boost::move(first, first+m_size, m_ptr);
175
+ RandRawIt result = boost::move(first, first+m_size, m_ptr);
187
176
  boost::uninitialized_move(first+m_size, first+n, result);
188
177
  m_size = n;
189
178
  }
@@ -201,8 +190,8 @@ class adaptive_xbuf
201
190
  iterator add(RandIt it)
202
191
  {
203
192
  BOOST_ASSERT(m_size < m_capacity);
204
- T * p_ret = m_ptr + m_size;
205
- ::new(p_ret) T(::boost::move(*it));
193
+ RandRawIt p_ret = m_ptr + m_size;
194
+ ::new(&*p_ret) T(::boost::move(*it));
206
195
  ++m_size;
207
196
  return p_ret;
208
197
  }
@@ -249,14 +238,26 @@ class adaptive_xbuf
249
238
  }
250
239
  }
251
240
 
241
+ private:
242
+ template<class RIt>
243
+ static bool is_raw_ptr(RIt)
244
+ {
245
+ return false;
246
+ }
247
+
248
+ static bool is_raw_ptr(T*)
249
+ {
250
+ return true;
251
+ }
252
+
253
+ public:
252
254
  template<class U>
253
255
  bool supports_aligned_trailing(std::size_t size, std::size_t trail_count) const
254
256
  {
255
- if(this->data()){
256
- uintptr_t u_addr_sz = uintptr_t(this->data()+size);
257
- uintptr_t u_addr_cp = uintptr_t(this->data()+this->capacity());
257
+ if(this->is_raw_ptr(this->data()) && m_capacity){
258
+ uintptr_t u_addr_sz = uintptr_t(&*(this->data()+size));
259
+ uintptr_t u_addr_cp = uintptr_t(&*(this->data()+this->capacity()));
258
260
  u_addr_sz = ((u_addr_sz + sizeof(U)-1)/sizeof(U))*sizeof(U);
259
-
260
261
  return (u_addr_cp >= u_addr_sz) && ((u_addr_cp - u_addr_sz)/sizeof(U) >= trail_count);
261
262
  }
262
263
  return false;
@@ -271,7 +272,7 @@ class adaptive_xbuf
271
272
  template<class U>
272
273
  U *aligned_trailing(std::size_t pos) const
273
274
  {
274
- uintptr_t u_addr = uintptr_t(this->data()+pos);
275
+ uintptr_t u_addr = uintptr_t(&*(this->data()+pos));
275
276
  u_addr = ((u_addr + sizeof(U)-1)/sizeof(U))*sizeof(U);
276
277
  return (U*)u_addr;
277
278
  }
@@ -302,7 +303,7 @@ class adaptive_xbuf
302
303
  }
303
304
 
304
305
  private:
305
- T *m_ptr;
306
+ RandRawIt m_ptr;
306
307
  std::size_t m_size;
307
308
  std::size_t m_capacity;
308
309
  };
@@ -385,50 +386,16 @@ RandIt skip_until_merge
385
386
  }
386
387
 
387
388
 
388
- template<class RandIt1, class RandIt2, class RandItB, class Compare, class Op>
389
- RandItB op_buffered_partial_merge_to_range1_and_buffer
390
- ( RandIt1 first1, RandIt1 const last1
391
- , RandIt2 &rfirst2, RandIt2 const last2
392
- , RandItB &rfirstb, Compare comp, Op op )
393
- {
394
- RandItB firstb = rfirstb;
395
- RandItB lastb = firstb;
396
- RandIt2 first2 = rfirst2;
397
-
398
- //Move to buffer while merging
399
- //Three way moves need less moves when op is swap_op so use it
400
- //when merging elements from range2 to the destination occupied by range1
401
- if(first1 != last1 && first2 != last2){
402
- op(three_way_t(), first2++, first1++, lastb++);
403
-
404
- while(true){
405
- if(first1 == last1){
406
- break;
407
- }
408
- if(first2 == last2){
409
- lastb = op(forward_t(), first1, last1, firstb);
410
- break;
411
- }
412
- op(three_way_t(), comp(*first2, *firstb) ? first2++ : firstb++, first1++, lastb++);
413
- }
414
- rfirst2 = first2;
415
- rfirstb = firstb;
416
- }
417
-
418
- return lastb;
419
- }
420
-
421
389
  template<class RandItKeys, class RandIt>
422
390
  void swap_and_update_key
423
- ( bool is_next_far_away
424
- , RandItKeys const key_next
391
+ ( RandItKeys const key_next
425
392
  , RandItKeys const key_range2
426
393
  , RandItKeys &key_mid
427
394
  , RandIt const begin
428
395
  , RandIt const end
429
396
  , RandIt const with)
430
397
  {
431
- if(is_next_far_away){
398
+ if(begin != with){
432
399
  ::boost::adl_move_swap_ranges(begin, end, with);
433
400
  ::boost::adl_move_swap(*key_next, *key_range2);
434
401
  if(key_next == key_mid){
@@ -458,7 +425,7 @@ RandIt partial_merge_bufferless_impl
458
425
  if(first1 != last1 && comp(*last1, last1[-1])){
459
426
  do{
460
427
  RandIt const old_last1 = last1;
461
- last1 = lower_bound(last1, last2, *first1, comp);
428
+ last1 = boost::movelib::lower_bound(last1, last2, *first1, comp);
462
429
  first1 = rotate_gcd(first1, old_last1, last1);//old_last1 == last1 supported
463
430
  if(last1 == last2){
464
431
  return first1;
@@ -534,7 +501,7 @@ void merge_blocks_bufferless
534
501
  typedef typename iterator_traits<RandIt>::size_type size_type;
535
502
  size_type const key_count = needed_keys_count(n_block_a, n_block_b); (void)key_count;
536
503
  //BOOST_ASSERT(n_block_a || n_block_b);
537
- BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(is_sorted_and_unique(key_first, key_first + key_count, key_comp));
504
+ BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(boost::movelib::is_sorted_and_unique(key_first, key_first + key_count, key_comp));
538
505
  BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(!n_block_b || n_block_a == count_if_with(key_first, key_first + key_count, key_comp, key_first[n_block_a]));
539
506
 
540
507
  size_type n_bef_irreg2 = 0;
@@ -563,7 +530,7 @@ void merge_blocks_bufferless
563
530
  }
564
531
  n_bef_irreg2 += l_irreg_pos_count;
565
532
 
566
- swap_and_update_key(next_key_idx != 0, key_next, key_range2, key_mid, f, f + l_block, first_min);
533
+ swap_and_update_key(key_next, key_range2, key_mid, f, f + l_block, first_min);
567
534
  BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(is_sorted(f, f+l_block, comp));
568
535
  BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(is_sorted(first_min, first_min + l_block, comp));
569
536
  BOOST_MOVE_ADAPTIVE_SORT_INVARIANT((f == (first+l_irreg1)) || !comp(*f, *(f-l_block)));
@@ -604,13 +571,13 @@ void op_buffered_merge
604
571
  size_type const len1 = size_type(middle-first);
605
572
  size_type const len2 = size_type(last-middle);
606
573
  if(len1 <= len2){
607
- first = upper_bound(first, middle, *middle, comp);
574
+ first = boost::movelib::upper_bound(first, middle, *middle, comp);
608
575
  xbuf.move_assign(first, size_type(middle-first));
609
576
  op_merge_with_right_placed
610
577
  (xbuf.data(), xbuf.end(), first, middle, last, comp, op);
611
578
  }
612
579
  else{
613
- last = lower_bound(middle, last, middle[-1], comp);
580
+ last = boost::movelib::lower_bound(middle, last, middle[-1], comp);
614
581
  xbuf.move_assign(middle, size_type(last-middle));
615
582
  op_merge_with_left_placed
616
583
  (first, middle, last, xbuf.data(), xbuf.end(), comp, op);
@@ -618,11 +585,11 @@ void op_buffered_merge
618
585
  }
619
586
  }
620
587
 
621
- template<class RandIt, class Compare>
588
+ template<class RandIt, class Compare, class XBuf>
622
589
  void buffered_merge
623
590
  ( RandIt first, RandIt const middle, RandIt last
624
591
  , Compare comp
625
- , adaptive_xbuf<typename iterator_traits<RandIt>::value_type> &xbuf)
592
+ , XBuf &xbuf)
626
593
  {
627
594
  op_buffered_merge(first, middle, last, comp, move_op(), xbuf);
628
595
  }
@@ -633,15 +600,14 @@ void buffered_merge
633
600
  // in the begining of the range, and ordered according to comp
634
601
  //
635
602
  // Returns the number of collected keys
636
- template<class RandIt, class Compare>
603
+ template<class RandIt, class Compare, class XBuf>
637
604
  typename iterator_traits<RandIt>::size_type
638
605
  collect_unique
639
606
  ( RandIt const first, RandIt const last
640
607
  , typename iterator_traits<RandIt>::size_type const max_collected, Compare comp
641
- , adaptive_xbuf<typename iterator_traits<RandIt>::value_type> & xbuf)
608
+ , XBuf & xbuf)
642
609
  {
643
610
  typedef typename iterator_traits<RandIt>::size_type size_type;
644
- typedef typename iterator_traits<RandIt>::value_type value_type;
645
611
  size_type h = 0;
646
612
  if(max_collected){
647
613
  ++h; // first key is always here
@@ -650,9 +616,9 @@ typename iterator_traits<RandIt>::size_type
650
616
  RandIt search_end = u;
651
617
 
652
618
  if(xbuf.capacity() >= max_collected){
653
- value_type *const ph0 = xbuf.add(first);
619
+ typename XBuf::iterator const ph0 = xbuf.add(first);
654
620
  while(u != last && h < max_collected){
655
- value_type * const r = lower_bound(ph0, xbuf.end(), *u, comp);
621
+ typename XBuf::iterator const r = boost::movelib::lower_bound(ph0, xbuf.end(), *u, comp);
656
622
  //If key not found add it to [h, h+h0)
657
623
  if(r == xbuf.end() || comp(*u, *r) ){
658
624
  RandIt const new_h0 = boost::move(search_end, u, h0);
@@ -669,7 +635,7 @@ typename iterator_traits<RandIt>::size_type
669
635
  }
670
636
  else{
671
637
  while(u != last && h < max_collected){
672
- RandIt const r = lower_bound(h0, search_end, *u, comp);
638
+ RandIt const r = boost::movelib::lower_bound(h0, search_end, *u, comp);
673
639
  //If key not found add it to [h, h+h0)
674
640
  if(r == search_end || comp(*u, *r) ){
675
641
  RandIt const new_h0 = rotate_gcd(h0, search_end, u);
@@ -857,12 +823,41 @@ void stable_sort( RandIt first, RandIt last, Compare comp, XBuf & xbuf)
857
823
  }
858
824
  }
859
825
 
826
+ template<class RandIt, class Comp, class XBuf>
827
+ void unstable_sort( RandIt first, RandIt last
828
+ , Comp comp
829
+ , XBuf & xbuf)
830
+ {
831
+ heap_sort(first, last, comp);(void)xbuf;
832
+ }
833
+
834
+ template<class RandIt, class Compare, class XBuf>
835
+ void stable_merge
836
+ ( RandIt first, RandIt const middle, RandIt last
837
+ , Compare comp
838
+ , XBuf &xbuf)
839
+ {
840
+ BOOST_ASSERT(xbuf.empty());
841
+ typedef typename iterator_traits<RandIt>::size_type size_type;
842
+ size_type const len1 = size_type(middle-first);
843
+ size_type const len2 = size_type(last-middle);
844
+ size_type const l_min = min_value(len1, len2);
845
+ if(xbuf.capacity() >= l_min){
846
+ buffered_merge(first, middle, last, comp, xbuf);
847
+ xbuf.clear();
848
+ }
849
+ else{
850
+ merge_bufferless(first, middle, last, comp);
851
+ }
852
+ }
853
+
860
854
  template<class RandIt, class Comp, class XBuf>
861
855
  void initialize_keys( RandIt first, RandIt last
862
856
  , Comp comp
863
857
  , XBuf & xbuf)
864
858
  {
865
- stable_sort(first, last, comp, xbuf);
859
+ unstable_sort(first, last, comp, xbuf);
860
+ BOOST_ASSERT(boost::movelib::is_sorted_and_unique(first, last, comp));
866
861
  }
867
862
 
868
863
  template<class RandIt, class U>
@@ -878,40 +873,6 @@ void initialize_keys( RandIt first, RandIt last
878
873
  }
879
874
  }
880
875
 
881
- template<class RandIt>
882
- void move_data_backward( RandIt cur_pos
883
- , typename iterator_traits<RandIt>::size_type const l_data
884
- , RandIt new_pos
885
- , bool const xbuf_used)
886
- {
887
- //Move buffer to the total combination right
888
- if(xbuf_used){
889
- boost::move_backward(cur_pos, cur_pos+l_data, new_pos+l_data);
890
- }
891
- else{
892
- boost::adl_move_swap_ranges_backward(cur_pos, cur_pos+l_data, new_pos+l_data);
893
- //Rotate does less moves but it seems slower due to cache issues
894
- //rotate_gcd(first-l_block, first+len-l_block, first+len);
895
- }
896
- }
897
-
898
- template<class RandIt>
899
- void move_data_forward( RandIt cur_pos
900
- , typename iterator_traits<RandIt>::size_type const l_data
901
- , RandIt new_pos
902
- , bool const xbuf_used)
903
- {
904
- //Move buffer to the total combination right
905
- if(xbuf_used){
906
- boost::move(cur_pos, cur_pos+l_data, new_pos);
907
- }
908
- else{
909
- boost::adl_move_swap_ranges(cur_pos, cur_pos+l_data, new_pos);
910
- //Rotate does less moves but it seems slower due to cache issues
911
- //rotate_gcd(first-l_block, first+len-l_block, first+len);
912
- }
913
- }
914
-
915
876
  template <class Unsigned>
916
877
  Unsigned calculate_total_combined(Unsigned const len, Unsigned const l_prev_merged, Unsigned *pl_irreg_combined = 0)
917
878
  {
@@ -962,44 +923,7 @@ void combine_params
962
923
  }
963
924
  }
964
925
 
965
- template<class RandIt1, class RandIt2, class RandItB, class Compare, class Op>
966
- RandItB op_buffered_partial_merge_and_swap_to_range1_and_buffer
967
- ( RandIt1 first1, RandIt1 const last1
968
- , RandIt2 &rfirst2, RandIt2 const last2, RandIt2 &rfirst_min
969
- , RandItB &rfirstb, Compare comp, Op op )
970
- {
971
- RandItB firstb = rfirstb;
972
- RandItB lastb = firstb;
973
- RandIt2 first2 = rfirst2;
974
-
975
- //Move to buffer while merging
976
- //Three way moves need less moves when op is swap_op so use it
977
- //when merging elements from range2 to the destination occupied by range1
978
- if(first1 != last1 && first2 != last2){
979
- RandIt2 first_min = rfirst_min;
980
- op(four_way_t(), first2++, first_min++, first1++, lastb++);
981
-
982
- while(first1 != last1){
983
- if(first2 == last2){
984
- lastb = op(forward_t(), first1, last1, firstb);
985
- break;
986
- }
987
- bool const min_less = comp(*first_min, *firstb);
988
-
989
- if(min_less){
990
- op( four_way_t(), first2++, first_min++, first1++, lastb++);
991
- }
992
- else{
993
- op(three_way_t(), firstb++, first1++, lastb++);
994
- }
995
- }
996
- rfirst2 = first2;
997
- rfirstb = firstb;
998
- rfirst_min = first_min;
999
- }
1000
926
 
1001
- return lastb;
1002
- }
1003
927
 
1004
928
  //////////////////////////////////
1005
929
  //
@@ -1040,11 +964,15 @@ OutputIt op_partial_merge
1040
964
  : op_partial_merge_impl(r_first1, last1, r_first2, last2, d_first, antistable<Compare>(comp), op);
1041
965
  }
1042
966
 
967
+ //////////////////////////////////
968
+ //////////////////////////////////
1043
969
  //////////////////////////////////
1044
970
  //
1045
- // partial_merge_and_swap
971
+ // op_partial_merge_and_save
1046
972
  //
1047
973
  //////////////////////////////////
974
+ //////////////////////////////////
975
+ //////////////////////////////////
1048
976
  template<class InputIt1, class InputIt2, class OutputIt, class Compare, class Op>
1049
977
  OutputIt op_partial_merge_and_swap_impl
1050
978
  (InputIt1 &r_first1, InputIt1 const last1, InputIt2 &r_first2, InputIt2 const last2, InputIt2 &r_first_min, OutputIt d_first, Compare comp, Op op)
@@ -1073,57 +1001,133 @@ OutputIt op_partial_merge_and_swap_impl
1073
1001
  }
1074
1002
 
1075
1003
  template<class RandIt, class InputIt2, class OutputIt, class Compare, class Op>
1076
- RandIt op_partial_merge_and_swap
1077
- (RandIt &r_first1, RandIt const last1, RandIt &r_first2, RandIt const last2, InputIt2 &r_first_min, OutputIt d_first, Compare comp, Op op, bool is_stable)
1004
+ OutputIt op_partial_merge_and_swap
1005
+ (RandIt &r_first1, RandIt const last1, InputIt2 &r_first2, InputIt2 const last2, InputIt2 &r_first_min, OutputIt d_first, Compare comp, Op op, bool is_stable)
1078
1006
  {
1079
1007
  return is_stable ? op_partial_merge_and_swap_impl(r_first1, last1, r_first2, last2, r_first_min, d_first, comp, op)
1080
1008
  : op_partial_merge_and_swap_impl(r_first1, last1, r_first2, last2, r_first_min, d_first, antistable<Compare>(comp), op);
1081
1009
  }
1082
1010
 
1083
- template<class RandIt, class RandItBuf, class Compare, class Op>
1084
- RandIt op_partial_merge_and_save_impl
1085
- ( RandIt first1, RandIt const last1, RandIt &rfirst2, RandIt last2, RandIt first_min
1086
- , RandItBuf &buf_first1_in_out, RandItBuf &buf_last1_in_out
1087
- , Compare comp, Op op
1088
- )
1011
+ template<class RandIt1, class RandIt2, class RandItB, class Compare, class Op>
1012
+ RandItB op_buffered_partial_merge_and_swap_to_range1_and_buffer
1013
+ ( RandIt1 first1, RandIt1 const last1
1014
+ , RandIt2 &rfirst2, RandIt2 const last2, RandIt2 &rfirst_min
1015
+ , RandItB &rfirstb, Compare comp, Op op )
1089
1016
  {
1090
- RandItBuf buf_first1 = buf_first1_in_out;
1091
- RandItBuf buf_last1 = buf_last1_in_out;
1092
- RandIt first2(rfirst2);
1017
+ RandItB firstb = rfirstb;
1018
+ RandItB lastb = firstb;
1019
+ RandIt2 first2 = rfirst2;
1093
1020
 
1094
- bool const do_swap = first2 != first_min;
1095
- if(buf_first1 == buf_last1){
1096
- //Skip any element that does not need to be moved
1097
- RandIt new_first1 = skip_until_merge(first1, last1, *first_min, comp);
1098
- buf_first1 += (new_first1-first1);
1099
- first1 = new_first1;
1100
- buf_last1 = do_swap ? op_buffered_partial_merge_and_swap_to_range1_and_buffer(first1, last1, first2, last2, first_min, buf_first1, comp, op)
1101
- : op_buffered_partial_merge_to_range1_and_buffer (first1, last1, first2, last2, buf_first1, comp, op);
1102
- first1 = last1;
1103
- }
1104
- else{
1105
- BOOST_ASSERT((last1-first1) == (buf_last1 - buf_first1));
1021
+ //Move to buffer while merging
1022
+ //Three way moves need less moves when op is swap_op so use it
1023
+ //when merging elements from range2 to the destination occupied by range1
1024
+ if(first1 != last1 && first2 != last2){
1025
+ RandIt2 first_min = rfirst_min;
1026
+ op(four_way_t(), first2++, first_min++, first1++, lastb++);
1027
+
1028
+ while(first1 != last1){
1029
+ if(first2 == last2){
1030
+ lastb = op(forward_t(), first1, last1, firstb);
1031
+ break;
1032
+ }
1033
+
1034
+ if(comp(*first_min, *firstb)){
1035
+ op( four_way_t(), first2++, first_min++, first1++, lastb++);
1036
+ }
1037
+ else{
1038
+ op(three_way_t(), firstb++, first1++, lastb++);
1039
+ }
1040
+ }
1041
+ rfirst2 = first2;
1042
+ rfirstb = firstb;
1043
+ rfirst_min = first_min;
1106
1044
  }
1107
1045
 
1108
- //Now merge from buffer
1109
- first1 = do_swap ? op_partial_merge_and_swap_impl(buf_first1, buf_last1, first2, last2, first_min, first1, comp, op)
1110
- : op_partial_merge_impl (buf_first1, buf_last1, first2, last2, first1, comp, op);
1111
- buf_first1_in_out = buf_first1;
1112
- buf_last1_in_out = buf_last1;
1113
- rfirst2 = first2;
1114
- return first1;
1046
+ return lastb;
1115
1047
  }
1116
1048
 
1117
- template<class RandIt, class RandItBuf, class Compare, class Op>
1118
- RandIt op_partial_merge_and_save
1119
- ( RandIt first1, RandIt const last1, RandIt &rfirst2, RandIt last2, RandIt first_min
1120
- , RandItBuf &buf_first1_in_out
1121
- , RandItBuf &buf_last1_in_out
1122
- , Compare comp
1123
- , Op op
1124
- , bool is_stable)
1125
- {
1126
- return is_stable
1049
+ template<class RandIt1, class RandIt2, class RandItB, class Compare, class Op>
1050
+ RandItB op_buffered_partial_merge_to_range1_and_buffer
1051
+ ( RandIt1 first1, RandIt1 const last1
1052
+ , RandIt2 &rfirst2, RandIt2 const last2
1053
+ , RandItB &rfirstb, Compare comp, Op op )
1054
+ {
1055
+ RandItB firstb = rfirstb;
1056
+ RandItB lastb = firstb;
1057
+ RandIt2 first2 = rfirst2;
1058
+
1059
+ //Move to buffer while merging
1060
+ //Three way moves need less moves when op is swap_op so use it
1061
+ //when merging elements from range2 to the destination occupied by range1
1062
+ if(first1 != last1 && first2 != last2){
1063
+ op(three_way_t(), first2++, first1++, lastb++);
1064
+
1065
+ while(true){
1066
+ if(first1 == last1){
1067
+ break;
1068
+ }
1069
+ if(first2 == last2){
1070
+ lastb = op(forward_t(), first1, last1, firstb);
1071
+ break;
1072
+ }
1073
+ if (comp(*first2, *firstb)) {
1074
+ op(three_way_t(), first2++, first1++, lastb++);
1075
+ }
1076
+ else {
1077
+ op(three_way_t(), firstb++, first1++, lastb++);
1078
+ }
1079
+ }
1080
+ rfirst2 = first2;
1081
+ rfirstb = firstb;
1082
+ }
1083
+
1084
+ return lastb;
1085
+ }
1086
+
1087
+ template<class RandIt, class RandItBuf, class Compare, class Op>
1088
+ RandIt op_partial_merge_and_save_impl
1089
+ ( RandIt first1, RandIt const last1, RandIt &rfirst2, RandIt last2, RandIt first_min
1090
+ , RandItBuf &buf_first1_in_out, RandItBuf &buf_last1_in_out
1091
+ , Compare comp, Op op
1092
+ )
1093
+ {
1094
+ RandItBuf buf_first1 = buf_first1_in_out;
1095
+ RandItBuf buf_last1 = buf_last1_in_out;
1096
+ RandIt first2(rfirst2);
1097
+
1098
+ bool const do_swap = first2 != first_min;
1099
+ if(buf_first1 == buf_last1){
1100
+ //Skip any element that does not need to be moved
1101
+ RandIt new_first1 = skip_until_merge(first1, last1, *first_min, comp);
1102
+ buf_first1 += (new_first1-first1);
1103
+ first1 = new_first1;
1104
+ buf_last1 = do_swap ? op_buffered_partial_merge_and_swap_to_range1_and_buffer(first1, last1, first2, last2, first_min, buf_first1, comp, op)
1105
+ : op_buffered_partial_merge_to_range1_and_buffer (first1, last1, first2, last2, buf_first1, comp, op);
1106
+ first1 = last1;
1107
+ }
1108
+ else{
1109
+ BOOST_ASSERT((last1-first1) == (buf_last1 - buf_first1));
1110
+ }
1111
+
1112
+ //Now merge from buffer
1113
+ first1 = do_swap ? op_partial_merge_and_swap_impl(buf_first1, buf_last1, first2, last2, first_min, first1, comp, op)
1114
+ : op_partial_merge_impl (buf_first1, buf_last1, first2, last2, first1, comp, op);
1115
+ buf_first1_in_out = buf_first1;
1116
+ buf_last1_in_out = buf_last1;
1117
+ rfirst2 = first2;
1118
+ return first1;
1119
+ }
1120
+
1121
+ template<class RandIt, class RandItBuf, class Compare, class Op>
1122
+ RandIt op_partial_merge_and_save
1123
+ ( RandIt first1, RandIt const last1, RandIt &rfirst2, RandIt last2, RandIt first_min
1124
+ , RandItBuf &buf_first1_in_out
1125
+ , RandItBuf &buf_last1_in_out
1126
+ , Compare comp
1127
+ , Op op
1128
+ , bool is_stable)
1129
+ {
1130
+ return is_stable
1127
1131
  ? op_partial_merge_and_save_impl
1128
1132
  (first1, last1, rfirst2, last2, first_min, buf_first1_in_out, buf_last1_in_out, comp, op)
1129
1133
  : op_partial_merge_and_save_impl
@@ -1131,7 +1135,15 @@ RandIt op_partial_merge_and_save
1131
1135
  ;
1132
1136
  }
1133
1137
 
1134
-
1138
+ //////////////////////////////////
1139
+ //////////////////////////////////
1140
+ //////////////////////////////////
1141
+ //
1142
+ // op_merge_blocks_with_irreg
1143
+ //
1144
+ //////////////////////////////////
1145
+ //////////////////////////////////
1146
+ //////////////////////////////////
1135
1147
 
1136
1148
  template<class RandItKeys, class KeyCompare, class RandIt, class RandIt2, class OutputIt, class Compare, class Op>
1137
1149
  OutputIt op_merge_blocks_with_irreg
@@ -1163,7 +1175,7 @@ OutputIt op_merge_blocks_with_irreg
1163
1175
 
1164
1176
  OutputIt orig_dest = dest; (void)orig_dest;
1165
1177
  dest = next_key_idx ? op_partial_merge_and_swap(first_irr, last_irr, first_reg, last_reg, first_min, dest, comp, op, is_stable)
1166
- : op_partial_merge (first_irr, last_irr, first_reg, last_reg, dest, comp, op, is_stable);
1178
+ : op_partial_merge (first_irr, last_irr, first_reg, last_reg, dest, comp, op, is_stable);
1167
1179
  BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(is_sorted(orig_dest, dest, comp));
1168
1180
 
1169
1181
  if(first_reg == dest){
@@ -1176,7 +1188,7 @@ OutputIt op_merge_blocks_with_irreg
1176
1188
  }
1177
1189
 
1178
1190
  RandItKeys const key_next(key_first + next_key_idx);
1179
- swap_and_update_key(next_key_idx != 0, key_next, key_first, key_mid, last_reg, last_reg, first_min);
1191
+ swap_and_update_key(key_next, key_first, key_mid, last_reg, last_reg, first_min);
1180
1192
 
1181
1193
  BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(is_sorted(orig_dest, dest, comp));
1182
1194
  first_reg = last_reg;
@@ -1184,6 +1196,16 @@ OutputIt op_merge_blocks_with_irreg
1184
1196
  return dest;
1185
1197
  }
1186
1198
 
1199
+ //////////////////////////////////
1200
+ //////////////////////////////////
1201
+ //////////////////////////////////
1202
+ //
1203
+ // op_merge_blocks_left/right
1204
+ //
1205
+ //////////////////////////////////
1206
+ //////////////////////////////////
1207
+ //////////////////////////////////
1208
+
1187
1209
  template<class RandItKeys, class KeyCompare, class RandIt, class Compare, class Op>
1188
1210
  void op_merge_blocks_left
1189
1211
  ( RandItKeys const key_first
@@ -1199,7 +1221,7 @@ void op_merge_blocks_left
1199
1221
  typedef typename iterator_traits<RandIt>::size_type size_type;
1200
1222
  size_type const key_count = needed_keys_count(n_block_a, n_block_b); (void)key_count;
1201
1223
  // BOOST_ASSERT(n_block_a || n_block_b);
1202
- BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(is_sorted_and_unique(key_first, key_first + key_count, key_comp));
1224
+ BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(boost::movelib::is_sorted_and_unique(key_first, key_first + key_count, key_comp));
1203
1225
  BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(!n_block_b || n_block_a == count_if_with(key_first, key_first + key_count, key_comp, key_first[n_block_a]));
1204
1226
 
1205
1227
  size_type n_block_b_left = n_block_b;
@@ -1251,7 +1273,7 @@ void op_merge_blocks_left
1251
1273
  if(!is_buffer_middle){
1252
1274
  buffer = op(forward_t(), first1, last1, buffer);
1253
1275
  }
1254
- swap_and_update_key(next_key_idx != 0, key_next, key_range2, key_mid, first2, last2, first_min);
1276
+ swap_and_update_key(key_next, key_range2, key_mid, first2, last2, first_min);
1255
1277
  first1 = first2;
1256
1278
  last1 = last2;
1257
1279
  }
@@ -1273,7 +1295,7 @@ void op_merge_blocks_left
1273
1295
  (void)unmerged;
1274
1296
  BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(is_sorted(first-l_block, unmerged, comp));
1275
1297
 
1276
- swap_and_update_key( next_key_idx != 0, key_next, key_range2, key_mid, first2, last2
1298
+ swap_and_update_key( key_next, key_range2, key_mid, first2, last2
1277
1299
  , last_min - size_type(last2 - first2));
1278
1300
 
1279
1301
  if(buf_beg != buf_end){ //range2 exhausted: is_buffer_middle for the next iteration
@@ -1363,7 +1385,6 @@ void merge_blocks_left
1363
1385
  }
1364
1386
  }
1365
1387
 
1366
-
1367
1388
  // first - first element to merge.
1368
1389
  // [first+l_block*(n_bef_irreg2+n_aft_irreg2)+l_irreg2, first+l_block*(n_bef_irreg2+n_aft_irreg2+1)+l_irreg2) - buffer
1369
1390
  // l_block - length of regular blocks. First nblocks are stable sorted by 1st elements and key-coded
@@ -1384,9 +1405,9 @@ void merge_blocks_right
1384
1405
  , bool const xbuf_used)
1385
1406
  {
1386
1407
  merge_blocks_left
1387
- ( make_reverse_iterator(key_first + needed_keys_count(n_block_a, n_block_b))
1408
+ ( (make_reverse_iterator)(key_first + needed_keys_count(n_block_a, n_block_b))
1388
1409
  , inverse<KeyCompare>(key_comp)
1389
- , make_reverse_iterator(first + ((n_block_a+n_block_b)*l_block+l_irreg2))
1410
+ , (make_reverse_iterator)(first + ((n_block_a+n_block_b)*l_block+l_irreg2))
1390
1411
  , l_block
1391
1412
  , l_irreg2
1392
1413
  , n_block_b
@@ -1395,6 +1416,15 @@ void merge_blocks_right
1395
1416
  , inverse<Compare>(comp), xbuf_used);
1396
1417
  }
1397
1418
 
1419
+ //////////////////////////////////
1420
+ //////////////////////////////////
1421
+ //////////////////////////////////
1422
+ //
1423
+ // op_merge_blocks_with_buf
1424
+ //
1425
+ //////////////////////////////////
1426
+ //////////////////////////////////
1427
+ //////////////////////////////////
1398
1428
  template<class RandItKeys, class KeyCompare, class RandIt, class Compare, class Op, class RandItBuf>
1399
1429
  void op_merge_blocks_with_buf
1400
1430
  ( RandItKeys key_first
@@ -1412,7 +1442,7 @@ void op_merge_blocks_with_buf
1412
1442
  typedef typename iterator_traits<RandIt>::size_type size_type;
1413
1443
  size_type const key_count = needed_keys_count(n_block_a, n_block_b); (void)key_count;
1414
1444
  //BOOST_ASSERT(n_block_a || n_block_b);
1415
- BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(is_sorted_and_unique(key_first, key_first + key_count, key_comp));
1445
+ BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(boost::movelib::is_sorted_and_unique(key_first, key_first + key_count, key_comp));
1416
1446
  BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(!n_block_b || n_block_a == count_if_with(key_first, key_first + key_count, key_comp, key_first[n_block_a]));
1417
1447
 
1418
1448
  size_type n_block_b_left = n_block_b;
@@ -1463,7 +1493,7 @@ void op_merge_blocks_with_buf
1463
1493
  RandIt res = op(forward_t(), buffer, buffer_end, first1);
1464
1494
  buffer = buffer_end = buf_first;
1465
1495
  BOOST_ASSERT(buffer_empty || res == last1); (void)res;
1466
- swap_and_update_key(next_key_idx != 0, key_next, key_range2, key_mid, first2, last2, first_min);
1496
+ swap_and_update_key(key_next, key_range2, key_mid, first2, last2, first_min);
1467
1497
  BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(is_sorted(first2, last2, comp));
1468
1498
  BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(is_sorted(first_min, last_min, comp));
1469
1499
  first1 = first2;
@@ -1481,7 +1511,7 @@ void op_merge_blocks_with_buf
1481
1511
  first_min = last_min;
1482
1512
  }
1483
1513
  BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(!is_range_1_empty || (last_min-first_min) == (last2-unmerged));
1484
- swap_and_update_key(next_key_idx != 0, key_next, key_range2, key_mid, first2, last2, first_min);
1514
+ swap_and_update_key(key_next, key_range2, key_mid, first2, last2, first_min);
1485
1515
 
1486
1516
  BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(is_sorted(first_min, last_min, comp));
1487
1517
  is_range1_A ^= is_range_1_empty;
@@ -1507,9 +1537,9 @@ void op_merge_blocks_with_buf
1507
1537
 
1508
1538
  reverse_iterator<RandItBuf> rbuf_beg(buffer_end);
1509
1539
  RandIt dest = op_merge_blocks_with_irreg
1510
- ( make_reverse_iterator(key_first + n_block_b + n_block_a), make_reverse_iterator(key_mid), inverse<KeyCompare>(key_comp)
1511
- , make_reverse_iterator(first_irr2), rbuf_beg
1512
- , make_reverse_iterator(buffer), make_reverse_iterator(last_irr2)
1540
+ ((make_reverse_iterator)(key_first + n_block_b + n_block_a), (make_reverse_iterator)(key_mid), inverse<KeyCompare>(key_comp)
1541
+ , (make_reverse_iterator)(first_irr2), rbuf_beg
1542
+ , (make_reverse_iterator)(buffer), (make_reverse_iterator)(last_irr2)
1513
1543
  , l_block, n_block_left, 0, n_block_left
1514
1544
  , inverse<Compare>(comp), true, op).base();
1515
1545
  BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(is_sorted(dest, last_irr2, comp));
@@ -1521,29 +1551,15 @@ void op_merge_blocks_with_buf
1521
1551
  BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(is_sorted(first, last_irr2, comp));
1522
1552
  }
1523
1553
 
1524
- template<class RandItKeys, class KeyCompare, class RandIt, class Compare, class RandItBuf>
1525
- void merge_blocks_with_buf
1526
- ( RandItKeys key_first
1527
- , KeyCompare key_comp
1528
- , RandIt const first
1529
- , typename iterator_traits<RandIt>::size_type const l_block
1530
- , typename iterator_traits<RandIt>::size_type const l_irreg1
1531
- , typename iterator_traits<RandIt>::size_type const n_block_a
1532
- , typename iterator_traits<RandIt>::size_type const n_block_b
1533
- , typename iterator_traits<RandIt>::size_type const l_irreg2
1534
- , Compare comp
1535
- , RandItBuf const buf_first
1536
- , bool const xbuf_used)
1537
- {
1538
- if(xbuf_used){
1539
- op_merge_blocks_with_buf
1540
- (key_first, key_comp, first, l_block, l_irreg1, n_block_a, n_block_b, l_irreg2, comp, move_op(), buf_first);
1541
- }
1542
- else{
1543
- op_merge_blocks_with_buf
1544
- (key_first, key_comp, first, l_block, l_irreg1, n_block_a, n_block_b, l_irreg2, comp, swap_op(), buf_first);
1545
- }
1546
- }
1554
+ //////////////////////////////////
1555
+ //////////////////////////////////
1556
+ //////////////////////////////////
1557
+ //
1558
+ // op_insertion_sort_step_left/right
1559
+ //
1560
+ //////////////////////////////////
1561
+ //////////////////////////////////
1562
+ //////////////////////////////////
1547
1563
 
1548
1564
  template<class RandIt, class Compare, class Op>
1549
1565
  typename iterator_traits<RandIt>::size_type
@@ -1565,6 +1581,41 @@ typename iterator_traits<RandIt>::size_type
1565
1581
  return s;
1566
1582
  }
1567
1583
 
1584
+ template<class RandIt, class Compare, class Op>
1585
+ void op_merge_right_step_once
1586
+ ( RandIt first_block
1587
+ , typename iterator_traits<RandIt>::size_type const elements_in_blocks
1588
+ , typename iterator_traits<RandIt>::size_type const l_build_buf
1589
+ , Compare comp
1590
+ , Op op)
1591
+ {
1592
+ typedef typename iterator_traits<RandIt>::size_type size_type;
1593
+ size_type restk = elements_in_blocks%(2*l_build_buf);
1594
+ size_type p = elements_in_blocks - restk;
1595
+ BOOST_ASSERT(0 == (p%(2*l_build_buf)));
1596
+
1597
+ if(restk <= l_build_buf){
1598
+ op(backward_t(),first_block+p, first_block+p+restk, first_block+p+restk+l_build_buf);
1599
+ }
1600
+ else{
1601
+ op_merge_right(first_block+p, first_block+p+l_build_buf, first_block+p+restk, first_block+p+restk+l_build_buf, comp, op);
1602
+ }
1603
+ while(p>0){
1604
+ p -= 2*l_build_buf;
1605
+ op_merge_right(first_block+p, first_block+p+l_build_buf, first_block+p+2*l_build_buf, first_block+p+3*l_build_buf, comp, op);
1606
+ }
1607
+ }
1608
+
1609
+
1610
+ //////////////////////////////////
1611
+ //////////////////////////////////
1612
+ //////////////////////////////////
1613
+ //
1614
+ // insertion_sort_step
1615
+ //
1616
+ //////////////////////////////////
1617
+ //////////////////////////////////
1618
+ //////////////////////////////////
1568
1619
  template<class RandIt, class Compare>
1569
1620
  typename iterator_traits<RandIt>::size_type
1570
1621
  insertion_sort_step
@@ -1585,6 +1636,15 @@ typename iterator_traits<RandIt>::size_type
1585
1636
  return s;
1586
1637
  }
1587
1638
 
1639
+ //////////////////////////////////
1640
+ //////////////////////////////////
1641
+ //////////////////////////////////
1642
+ //
1643
+ // op_merge_left_step_multiple
1644
+ //
1645
+ //////////////////////////////////
1646
+ //////////////////////////////////
1647
+ //////////////////////////////////
1588
1648
  template<class RandIt, class Compare, class Op>
1589
1649
  typename iterator_traits<RandIt>::size_type
1590
1650
  op_merge_left_step_multiple
@@ -1620,813 +1680,6 @@ typename iterator_traits<RandIt>::size_type
1620
1680
  return l_merged;
1621
1681
  }
1622
1682
 
1623
- template<class RandIt, class Compare, class Op>
1624
- void op_merge_right_step_once
1625
- ( RandIt first_block
1626
- , typename iterator_traits<RandIt>::size_type const elements_in_blocks
1627
- , typename iterator_traits<RandIt>::size_type const l_build_buf
1628
- , Compare comp
1629
- , Op op)
1630
- {
1631
- typedef typename iterator_traits<RandIt>::size_type size_type;
1632
- size_type restk = elements_in_blocks%(2*l_build_buf);
1633
- size_type p = elements_in_blocks - restk;
1634
- BOOST_ASSERT(0 == (p%(2*l_build_buf)));
1635
-
1636
- if(restk <= l_build_buf){
1637
- op(backward_t(),first_block+p, first_block+p+restk, first_block+p+restk+l_build_buf);
1638
- }
1639
- else{
1640
- op_merge_right(first_block+p, first_block+p+l_build_buf, first_block+p+restk, first_block+p+restk+l_build_buf, comp, op);
1641
- }
1642
- while(p>0){
1643
- p -= 2*l_build_buf;
1644
- op_merge_right(first_block+p, first_block+p+l_build_buf, first_block+p+2*l_build_buf, first_block+p+3*l_build_buf, comp, op);
1645
- }
1646
- }
1647
-
1648
-
1649
- // build blocks of length 2*l_build_buf. l_build_buf is power of two
1650
- // input: [0, l_build_buf) elements are buffer, rest unsorted elements
1651
- // output: [0, l_build_buf) elements are buffer, blocks 2*l_build_buf and last subblock sorted
1652
- //
1653
- // First elements are merged from right to left until elements start
1654
- // at first. All old elements [first, first + l_build_buf) are placed at the end
1655
- // [first+len-l_build_buf, first+len). To achieve this:
1656
- // - If we have external memory to merge, we save elements from the buffer
1657
- // so that a non-swapping merge is used. Buffer elements are restored
1658
- // at the end of the buffer from the external memory.
1659
- //
1660
- // - When the external memory is not available or it is insufficient
1661
- // for a merge operation, left swap merging is used.
1662
- //
1663
- // Once elements are merged left to right in blocks of l_build_buf, then a single left
1664
- // to right merge step is performed to achieve merged blocks of size 2K.
1665
- // If external memory is available, usual merge is used, swap merging otherwise.
1666
- //
1667
- // As a last step, if auxiliary memory is available in-place merge is performed.
1668
- // until all is merged or auxiliary memory is not large enough.
1669
- template<class RandIt, class Compare>
1670
- typename iterator_traits<RandIt>::size_type
1671
- adaptive_sort_build_blocks
1672
- ( RandIt const first
1673
- , typename iterator_traits<RandIt>::size_type const len
1674
- , typename iterator_traits<RandIt>::size_type const l_base
1675
- , typename iterator_traits<RandIt>::size_type const l_build_buf
1676
- , adaptive_xbuf<typename iterator_traits<RandIt>::value_type> & xbuf
1677
- , Compare comp)
1678
- {
1679
- typedef typename iterator_traits<RandIt>::size_type size_type;
1680
- BOOST_ASSERT(l_build_buf <= len);
1681
- BOOST_ASSERT(0 == ((l_build_buf / l_base)&(l_build_buf/l_base-1)));
1682
-
1683
- //Place the start pointer after the buffer
1684
- RandIt first_block = first + l_build_buf;
1685
- size_type const elements_in_blocks = len - l_build_buf;
1686
-
1687
- //////////////////////////////////
1688
- // Start of merge to left step
1689
- //////////////////////////////////
1690
- size_type l_merged = 0u;
1691
-
1692
- BOOST_ASSERT(l_build_buf);
1693
- //If there is no enough buffer for the insertion sort step, just avoid the external buffer
1694
- size_type kbuf = min_value<size_type>(l_build_buf, size_type(xbuf.capacity()));
1695
- kbuf = kbuf < l_base ? 0 : kbuf;
1696
-
1697
- if(kbuf){
1698
- //Backup internal buffer values in external buffer so they can be overwritten
1699
- xbuf.move_assign(first+l_build_buf-kbuf, kbuf);
1700
- l_merged = op_insertion_sort_step_left(first_block, elements_in_blocks, l_base, comp, move_op());
1701
-
1702
- //Now combine them using the buffer. Elements from buffer can be
1703
- //overwritten since they've been saved to xbuf
1704
- l_merged = op_merge_left_step_multiple
1705
- ( first_block - l_merged, elements_in_blocks, l_merged, l_build_buf, kbuf - l_merged, comp, move_op());
1706
-
1707
- //Restore internal buffer from external buffer unless kbuf was l_build_buf,
1708
- //in that case restoration will happen later
1709
- if(kbuf != l_build_buf){
1710
- boost::move(xbuf.data()+kbuf-l_merged, xbuf.data() + kbuf, first_block-l_merged+elements_in_blocks);
1711
- }
1712
- }
1713
- else{
1714
- l_merged = insertion_sort_step(first_block, elements_in_blocks, l_base, comp);
1715
- rotate_gcd(first_block - l_merged, first_block, first_block+elements_in_blocks);
1716
- }
1717
-
1718
- //Now combine elements using the buffer. Elements from buffer can't be
1719
- //overwritten since xbuf was not big enough, so merge swapping elements.
1720
- l_merged = op_merge_left_step_multiple
1721
- (first_block - l_merged, elements_in_blocks, l_merged, l_build_buf, l_build_buf - l_merged, comp, swap_op());
1722
-
1723
- BOOST_ASSERT(l_merged == l_build_buf);
1724
-
1725
- //////////////////////////////////
1726
- // Start of merge to right step
1727
- //////////////////////////////////
1728
-
1729
- //If kbuf is l_build_buf then we can merge right without swapping
1730
- //Saved data is still in xbuf
1731
- if(kbuf && kbuf == l_build_buf){
1732
- op_merge_right_step_once(first, elements_in_blocks, l_build_buf, comp, move_op());
1733
- //Restore internal buffer from external buffer if kbuf was l_build_buf.
1734
- //as this operation was previously delayed.
1735
- boost::move(xbuf.data(), xbuf.data() + kbuf, first);
1736
- }
1737
- else{
1738
- op_merge_right_step_once(first, elements_in_blocks, l_build_buf, comp, swap_op());
1739
- }
1740
- xbuf.clear();
1741
- //2*l_build_buf or total already merged
1742
- return min_value(elements_in_blocks, 2*l_build_buf);
1743
- }
1744
-
1745
- template<class RandItKeys, class KeyCompare, class RandIt, class Compare, class XBuf>
1746
- void adaptive_sort_combine_blocks
1747
- ( RandItKeys const keys
1748
- , KeyCompare key_comp
1749
- , RandIt const first
1750
- , typename iterator_traits<RandIt>::size_type const len
1751
- , typename iterator_traits<RandIt>::size_type const l_prev_merged
1752
- , typename iterator_traits<RandIt>::size_type const l_block
1753
- , bool const use_buf
1754
- , bool const xbuf_used
1755
- , XBuf & xbuf
1756
- , Compare comp
1757
- , bool merge_left)
1758
- {
1759
- (void)xbuf;
1760
- typedef typename iterator_traits<RandIt>::size_type size_type;
1761
-
1762
- size_type const l_reg_combined = 2*l_prev_merged;
1763
- size_type l_irreg_combined = 0;
1764
- size_type const l_total_combined = calculate_total_combined(len, l_prev_merged, &l_irreg_combined);
1765
- size_type const n_reg_combined = len/l_reg_combined;
1766
- RandIt combined_first = first;
1767
-
1768
- (void)l_total_combined;
1769
- BOOST_ASSERT(l_total_combined <= len);
1770
-
1771
- size_type const max_i = n_reg_combined + (l_irreg_combined != 0);
1772
-
1773
- if(merge_left || !use_buf) {
1774
- for( size_type combined_i = 0; combined_i != max_i; ++combined_i, combined_first += l_reg_combined) {
1775
- //Now merge blocks
1776
- bool const is_last = combined_i==n_reg_combined;
1777
- size_type const l_cur_combined = is_last ? l_irreg_combined : l_reg_combined;
1778
-
1779
- range_xbuf<RandIt, move_op> rbuf( (use_buf && xbuf_used) ? (combined_first-l_block) : combined_first, combined_first);
1780
- size_type n_block_a, n_block_b, l_irreg1, l_irreg2;
1781
- combine_params( keys, key_comp, l_cur_combined
1782
- , l_prev_merged, l_block, rbuf
1783
- , n_block_a, n_block_b, l_irreg1, l_irreg2); //Outputs
1784
- BOOST_MOVE_ADAPTIVE_SORT_PRINT(" A combpar: ", len + l_block);
1785
- BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(is_sorted(combined_first, combined_first + n_block_a*l_block+l_irreg1, comp));
1786
- BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(is_sorted(combined_first + n_block_a*l_block+l_irreg1, combined_first + n_block_a*l_block+l_irreg1+n_block_b*l_block+l_irreg2, comp));
1787
- if(!use_buf){
1788
- merge_blocks_bufferless
1789
- (keys, key_comp, combined_first, l_block, 0u, n_block_a, n_block_b, l_irreg2, comp);
1790
- }
1791
- else{
1792
- merge_blocks_left
1793
- (keys, key_comp, combined_first, l_block, 0u, n_block_a, n_block_b, l_irreg2, comp, xbuf_used);
1794
- }
1795
- BOOST_MOVE_ADAPTIVE_SORT_PRINT(" After merge_blocks_l: ", len + l_block);
1796
- }
1797
- }
1798
- else{
1799
- combined_first += l_reg_combined*(max_i-1);
1800
- for( size_type combined_i = max_i; combined_i--; combined_first -= l_reg_combined) {
1801
- bool const is_last = combined_i==n_reg_combined;
1802
- size_type const l_cur_combined = is_last ? l_irreg_combined : l_reg_combined;
1803
-
1804
- RandIt const combined_last(combined_first+l_cur_combined);
1805
- range_xbuf<RandIt, move_op> rbuf(combined_last, xbuf_used ? (combined_last+l_block) : combined_last);
1806
- size_type n_block_a, n_block_b, l_irreg1, l_irreg2;
1807
- combine_params( keys, key_comp, l_cur_combined
1808
- , l_prev_merged, l_block, rbuf
1809
- , n_block_a, n_block_b, l_irreg1, l_irreg2); //Outputs
1810
- BOOST_MOVE_ADAPTIVE_SORT_PRINT(" A combpar: ", len + l_block);
1811
- BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(is_sorted(combined_first, combined_first + n_block_a*l_block+l_irreg1, comp));
1812
- BOOST_MOVE_ADAPTIVE_SORT_INVARIANT(is_sorted(combined_first + n_block_a*l_block+l_irreg1, combined_first + n_block_a*l_block+l_irreg1+n_block_b*l_block+l_irreg2, comp));
1813
- merge_blocks_right
1814
- (keys, key_comp, combined_first, l_block, n_block_a, n_block_b, l_irreg2, comp, xbuf_used);
1815
- BOOST_MOVE_ADAPTIVE_SORT_PRINT(" After merge_blocks_r: ", len + l_block);
1816
- }
1817
- }
1818
- }
1819
-
1820
- //Returns true if buffer is placed in
1821
- //[buffer+len-l_intbuf, buffer+len). Otherwise, buffer is
1822
- //[buffer,buffer+l_intbuf)
1823
- template<class RandIt, class Compare>
1824
- bool adaptive_sort_combine_all_blocks
1825
- ( RandIt keys
1826
- , typename iterator_traits<RandIt>::size_type &n_keys
1827
- , RandIt const buffer
1828
- , typename iterator_traits<RandIt>::size_type const l_buf_plus_data
1829
- , typename iterator_traits<RandIt>::size_type l_merged
1830
- , typename iterator_traits<RandIt>::size_type &l_intbuf
1831
- , adaptive_xbuf<typename iterator_traits<RandIt>::value_type> & xbuf
1832
- , Compare comp)
1833
- {
1834
- typedef typename iterator_traits<RandIt>::size_type size_type;
1835
- RandIt const first = buffer + l_intbuf;
1836
- size_type const l_data = l_buf_plus_data - l_intbuf;
1837
- size_type const l_unique = l_intbuf+n_keys;
1838
- //Backup data to external buffer once if possible
1839
- bool const common_xbuf = l_data > l_merged && l_intbuf && l_intbuf <= xbuf.capacity();
1840
- if(common_xbuf){
1841
- xbuf.move_assign(buffer, l_intbuf);
1842
- }
1843
-
1844
- bool prev_merge_left = true;
1845
- size_type l_prev_total_combined = l_merged, l_prev_block = 0;
1846
- bool prev_use_internal_buf = true;
1847
-
1848
- for( size_type n = 0; l_data > l_merged
1849
- ; l_merged*=2
1850
- , ++n){
1851
- //If l_intbuf is non-zero, use that internal buffer.
1852
- // Implies l_block == l_intbuf && use_internal_buf == true
1853
- //If l_intbuf is zero, see if half keys can be reused as a reduced emergency buffer,
1854
- // Implies l_block == n_keys/2 && use_internal_buf == true
1855
- //Otherwise, just give up and and use all keys to merge using rotations (use_internal_buf = false)
1856
- bool use_internal_buf = false;
1857
- size_type const l_block = lblock_for_combine(l_intbuf, n_keys, 2*l_merged, use_internal_buf);
1858
- BOOST_ASSERT(!l_intbuf || (l_block == l_intbuf));
1859
- BOOST_ASSERT(n == 0 || (!use_internal_buf || prev_use_internal_buf) );
1860
- BOOST_ASSERT(n == 0 || (!use_internal_buf || l_prev_block == l_block) );
1861
-
1862
- bool const is_merge_left = (n&1) == 0;
1863
- size_type const l_total_combined = calculate_total_combined(l_data, l_merged);
1864
- if(n && prev_use_internal_buf && prev_merge_left){
1865
- if(is_merge_left || !use_internal_buf){
1866
- move_data_backward(first-l_prev_block, l_prev_total_combined, first, common_xbuf);
1867
- }
1868
- else{
1869
- //Put the buffer just after l_total_combined
1870
- RandIt const buf_end = first+l_prev_total_combined;
1871
- RandIt const buf_beg = buf_end-l_block;
1872
- if(l_prev_total_combined > l_total_combined){
1873
- size_type const l_diff = l_prev_total_combined - l_total_combined;
1874
- move_data_backward(buf_beg-l_diff, l_diff, buf_end-l_diff, common_xbuf);
1875
- }
1876
- else if(l_prev_total_combined < l_total_combined){
1877
- size_type const l_diff = l_total_combined - l_prev_total_combined;
1878
- move_data_forward(buf_end, l_diff, buf_beg, common_xbuf);
1879
- }
1880
- }
1881
- BOOST_MOVE_ADAPTIVE_SORT_PRINT(" After move_data : ", l_data + l_intbuf);
1882
- }
1883
-
1884
- //Combine to form l_merged*2 segments
1885
- if(n_keys){
1886
- adaptive_sort_combine_blocks
1887
- ( keys, comp, !use_internal_buf || is_merge_left ? first : first-l_block
1888
- , l_data, l_merged, l_block, use_internal_buf, common_xbuf, xbuf, comp, is_merge_left);
1889
- }
1890
- else{
1891
- size_type *const uint_keys = xbuf.template aligned_trailing<size_type>();
1892
- adaptive_sort_combine_blocks
1893
- ( uint_keys, less(), !use_internal_buf || is_merge_left ? first : first-l_block
1894
- , l_data, l_merged, l_block, use_internal_buf, common_xbuf, xbuf, comp, is_merge_left);
1895
- }
1896
- BOOST_MOVE_ADAPTIVE_SORT_PRINT(" After combine_blocks: ", l_data + l_intbuf);
1897
- prev_merge_left = is_merge_left;
1898
- l_prev_total_combined = l_total_combined;
1899
- l_prev_block = l_block;
1900
- prev_use_internal_buf = use_internal_buf;
1901
- }
1902
- BOOST_ASSERT(l_prev_total_combined == l_data);
1903
- bool const buffer_right = prev_use_internal_buf && prev_merge_left;
1904
-
1905
- l_intbuf = prev_use_internal_buf ? l_prev_block : 0u;
1906
- n_keys = l_unique - l_intbuf;
1907
- //Restore data from to external common buffer if used
1908
- if(common_xbuf){
1909
- if(buffer_right){
1910
- boost::move(xbuf.data(), xbuf.data() + l_intbuf, buffer+l_data);
1911
- }
1912
- else{
1913
- boost::move(xbuf.data(), xbuf.data() + l_intbuf, buffer);
1914
- }
1915
- }
1916
- return buffer_right;
1917
- }
1918
-
1919
- template<class RandIt, class Compare>
1920
- void stable_merge
1921
- ( RandIt first, RandIt const middle, RandIt last
1922
- , Compare comp
1923
- , adaptive_xbuf<typename iterator_traits<RandIt>::value_type> &xbuf)
1924
- {
1925
- BOOST_ASSERT(xbuf.empty());
1926
- typedef typename iterator_traits<RandIt>::size_type size_type;
1927
- size_type const len1 = size_type(middle-first);
1928
- size_type const len2 = size_type(last-middle);
1929
- size_type const l_min = min_value(len1, len2);
1930
- if(xbuf.capacity() >= l_min){
1931
- buffered_merge(first, middle, last, comp, xbuf);
1932
- xbuf.clear();
1933
- }
1934
- else{
1935
- merge_bufferless(first, middle, last, comp);
1936
- }
1937
- }
1938
-
1939
-
1940
- template<class RandIt, class Compare>
1941
- void adaptive_sort_final_merge( bool buffer_right
1942
- , RandIt const first
1943
- , typename iterator_traits<RandIt>::size_type const l_intbuf
1944
- , typename iterator_traits<RandIt>::size_type const n_keys
1945
- , typename iterator_traits<RandIt>::size_type const len
1946
- , adaptive_xbuf<typename iterator_traits<RandIt>::value_type> & xbuf
1947
- , Compare comp)
1948
- {
1949
- //BOOST_ASSERT(n_keys || xbuf.size() == l_intbuf);
1950
- xbuf.clear();
1951
-
1952
- typedef typename iterator_traits<RandIt>::size_type size_type;
1953
- size_type const n_key_plus_buf = l_intbuf+n_keys;
1954
- if(buffer_right){
1955
- stable_sort(first+len-l_intbuf, first+len, comp, xbuf);
1956
- stable_merge(first+n_keys, first+len-l_intbuf, first+len, antistable<Compare>(comp), xbuf);
1957
- stable_sort(first, first+n_keys, comp, xbuf);
1958
- stable_merge(first, first+n_keys, first+len, comp, xbuf);
1959
- }
1960
- else{
1961
- stable_sort(first, first+n_key_plus_buf, comp, xbuf);
1962
- if(xbuf.capacity() >= n_key_plus_buf){
1963
- buffered_merge(first, first+n_key_plus_buf, first+len, comp, xbuf);
1964
- }
1965
- else if(xbuf.capacity() >= min_value<size_type>(l_intbuf, n_keys)){
1966
- stable_merge(first+n_keys, first+n_key_plus_buf, first+len, comp, xbuf);
1967
- stable_merge(first, first+n_keys, first+len, comp, xbuf);
1968
- }
1969
- else{
1970
- merge_bufferless(first, first+n_key_plus_buf, first+len, comp);
1971
- }
1972
- }
1973
- BOOST_MOVE_ADAPTIVE_SORT_PRINT(" After final_merge : ", len);
1974
- }
1975
-
1976
- template<class RandIt, class Compare, class Unsigned, class T>
1977
- bool adaptive_sort_build_params
1978
- (RandIt first, Unsigned const len, Compare comp
1979
- , Unsigned &n_keys, Unsigned &l_intbuf, Unsigned &l_base, Unsigned &l_build_buf
1980
- , adaptive_xbuf<T> & xbuf
1981
- )
1982
- {
1983
- typedef Unsigned size_type;
1984
-
1985
- //Calculate ideal parameters and try to collect needed unique keys
1986
- l_base = 0u;
1987
-
1988
- //Try to find a value near sqrt(len) that is 2^N*l_base where
1989
- //l_base <= AdaptiveSortInsertionSortThreshold. This property is important
1990
- //as build_blocks merges to the left iteratively duplicating the
1991
- //merged size and all the buffer must be used just before the final
1992
- //merge to right step. This guarantees "build_blocks" produces
1993
- //segments of size l_build_buf*2, maximizing the classic merge phase.
1994
- l_intbuf = size_type(ceil_sqrt_multiple(len, &l_base));
1995
-
1996
- //The internal buffer can be expanded if there is enough external memory
1997
- while(xbuf.capacity() >= l_intbuf*2){
1998
- l_intbuf *= 2;
1999
- }
2000
-
2001
- //This is the minimum number of keys to implement the ideal algorithm
2002
- //
2003
- //l_intbuf is used as buffer plus the key count
2004
- size_type n_min_ideal_keys = l_intbuf-1;
2005
- while(n_min_ideal_keys >= (len-l_intbuf-n_min_ideal_keys)/l_intbuf){
2006
- --n_min_ideal_keys;
2007
- }
2008
- n_min_ideal_keys += 1;
2009
- BOOST_ASSERT(n_min_ideal_keys <= l_intbuf);
2010
-
2011
- if(xbuf.template supports_aligned_trailing<size_type>(l_intbuf, (len-l_intbuf-1)/l_intbuf+1)){
2012
- n_keys = 0u;
2013
- l_build_buf = l_intbuf;
2014
- }
2015
- else{
2016
- //Try to achieve a l_build_buf of length l_intbuf*2, so that we can merge with that
2017
- //l_intbuf*2 buffer in "build_blocks" and use half of them as buffer and the other half
2018
- //as keys in combine_all_blocks. In that case n_keys >= n_min_ideal_keys but by a small margin.
2019
- //
2020
- //If available memory is 2*sqrt(l), then only sqrt(l) unique keys are needed,
2021
- //(to be used for keys in combine_all_blocks) as the whole l_build_buf
2022
- //will be backuped in the buffer during build_blocks.
2023
- bool const non_unique_buf = xbuf.capacity() >= l_intbuf;
2024
- size_type const to_collect = non_unique_buf ? n_min_ideal_keys : l_intbuf*2;
2025
- size_type collected = collect_unique(first, first+len, to_collect, comp, xbuf);
2026
-
2027
- //If available memory is 2*sqrt(l), then for "build_params"
2028
- //the situation is the same as if 2*l_intbuf were collected.
2029
- if(non_unique_buf && collected == n_min_ideal_keys){
2030
- l_build_buf = l_intbuf;
2031
- n_keys = n_min_ideal_keys;
2032
- }
2033
- else if(collected == 2*l_intbuf){
2034
- //l_intbuf*2 elements found. Use all of them in the build phase
2035
- l_build_buf = l_intbuf*2;
2036
- n_keys = l_intbuf;
2037
- }
2038
- else if(collected == (n_min_ideal_keys+l_intbuf)){
2039
- l_build_buf = l_intbuf;
2040
- n_keys = n_min_ideal_keys;
2041
- }
2042
- //If collected keys are not enough, try to fix n_keys and l_intbuf. If no fix
2043
- //is possible (due to very low unique keys), then go to a slow sort based on rotations.
2044
- else{
2045
- BOOST_ASSERT(collected < (n_min_ideal_keys+l_intbuf));
2046
- if(collected < 4){ //No combination possible with less that 4 keys
2047
- return false;
2048
- }
2049
- n_keys = l_intbuf;
2050
- while(n_keys&(n_keys-1)){
2051
- n_keys &= n_keys-1; // make it power or 2
2052
- }
2053
- while(n_keys > collected){
2054
- n_keys/=2;
2055
- }
2056
- //AdaptiveSortInsertionSortThreshold is always power of two so the minimum is power of two
2057
- l_base = min_value<Unsigned>(n_keys, AdaptiveSortInsertionSortThreshold);
2058
- l_intbuf = 0;
2059
- l_build_buf = n_keys;
2060
- }
2061
- BOOST_ASSERT((n_keys+l_intbuf) >= l_build_buf);
2062
- }
2063
-
2064
- return true;
2065
- }
2066
-
2067
- template<class RandIt, class Compare>
2068
- inline void adaptive_merge_combine_blocks( RandIt first
2069
- , typename iterator_traits<RandIt>::size_type len1
2070
- , typename iterator_traits<RandIt>::size_type len2
2071
- , typename iterator_traits<RandIt>::size_type collected
2072
- , typename iterator_traits<RandIt>::size_type n_keys
2073
- , typename iterator_traits<RandIt>::size_type l_block
2074
- , bool use_internal_buf
2075
- , bool xbuf_used
2076
- , Compare comp
2077
- , adaptive_xbuf<typename iterator_traits<RandIt>::value_type> & xbuf
2078
- )
2079
- {
2080
- typedef typename iterator_traits<RandIt>::size_type size_type;
2081
- size_type const len = len1+len2;
2082
- size_type const l_combine = len-collected;
2083
- size_type const l_combine1 = len1-collected;
2084
-
2085
- if(n_keys){
2086
- RandIt const first_data = first+collected;
2087
- RandIt const keys = first;
2088
- BOOST_MOVE_ADAPTIVE_SORT_PRINT(" A combine: ", len);
2089
- if(xbuf_used){
2090
- if(xbuf.size() < l_block){
2091
- xbuf.initialize_until(l_block, *first);
2092
- }
2093
- BOOST_ASSERT(xbuf.size() >= l_block);
2094
- size_type n_block_a, n_block_b, l_irreg1, l_irreg2;
2095
- combine_params( keys, comp, l_combine
2096
- , l_combine1, l_block, xbuf
2097
- , n_block_a, n_block_b, l_irreg1, l_irreg2); //Outputs
2098
- merge_blocks_with_buf
2099
- (keys, comp, first_data, l_block, l_irreg1, n_block_a, n_block_b, l_irreg2, comp, xbuf.data(), xbuf_used);
2100
- BOOST_MOVE_ADAPTIVE_SORT_PRINT(" A mrg xbf: ", len);
2101
- }
2102
- else{
2103
- size_type n_block_a, n_block_b, l_irreg1, l_irreg2;
2104
- combine_params( keys, comp, l_combine
2105
- , l_combine1, l_block, xbuf
2106
- , n_block_a, n_block_b, l_irreg1, l_irreg2); //Outputs
2107
- if(use_internal_buf){
2108
- merge_blocks_with_buf
2109
- (keys, comp, first_data, l_block, l_irreg1, n_block_a, n_block_b, l_irreg2, comp, first_data-l_block, xbuf_used);
2110
- BOOST_MOVE_ADAPTIVE_SORT_PRINT(" A mrg buf: ", len);
2111
- }
2112
- else{
2113
- merge_blocks_bufferless
2114
- (keys, comp, first_data, l_block, l_irreg1, n_block_a, n_block_b, l_irreg2, comp);
2115
- BOOST_MOVE_ADAPTIVE_SORT_PRINT(" A mrg nbf: ", len);
2116
- }
2117
- }
2118
- }
2119
- else{
2120
- xbuf.shrink_to_fit(l_block);
2121
- if(xbuf.size() < l_block){
2122
- xbuf.initialize_until(l_block, *first);
2123
- }
2124
- size_type *const uint_keys = xbuf.template aligned_trailing<size_type>(l_block);
2125
- size_type n_block_a, n_block_b, l_irreg1, l_irreg2;
2126
- combine_params( uint_keys, less(), l_combine
2127
- , l_combine1, l_block, xbuf
2128
- , n_block_a, n_block_b, l_irreg1, l_irreg2, true); //Outputs
2129
- BOOST_MOVE_ADAPTIVE_SORT_PRINT(" A combine: ", len);
2130
- BOOST_ASSERT(xbuf.size() >= l_block);
2131
- merge_blocks_with_buf
2132
- (uint_keys, less(), first, l_block, l_irreg1, n_block_a, n_block_b, l_irreg2, comp, xbuf.data(), true);
2133
- xbuf.clear();
2134
- BOOST_MOVE_ADAPTIVE_SORT_PRINT(" A mrg buf: ", len);
2135
- }
2136
- }
2137
-
2138
- template<class RandIt, class Compare>
2139
- inline void adaptive_merge_final_merge( RandIt first
2140
- , typename iterator_traits<RandIt>::size_type len1
2141
- , typename iterator_traits<RandIt>::size_type len2
2142
- , typename iterator_traits<RandIt>::size_type collected
2143
- , typename iterator_traits<RandIt>::size_type l_intbuf
2144
- , typename iterator_traits<RandIt>::size_type l_block
2145
- , bool use_internal_buf
2146
- , bool xbuf_used
2147
- , Compare comp
2148
- , adaptive_xbuf<typename iterator_traits<RandIt>::value_type> & xbuf
2149
- )
2150
- {
2151
- typedef typename iterator_traits<RandIt>::size_type size_type;
2152
- (void)l_block;
2153
- size_type n_keys = collected-l_intbuf;
2154
- size_type len = len1+len2;
2155
- if(use_internal_buf){
2156
- if(xbuf_used){
2157
- xbuf.clear();
2158
- //Nothing to do
2159
- if(n_keys){
2160
- stable_sort(first, first+n_keys, comp, xbuf);
2161
- stable_merge(first, first+n_keys, first+len, comp, xbuf);
2162
- BOOST_MOVE_ADAPTIVE_SORT_PRINT(" A key mrg: ", len);
2163
- }
2164
- }
2165
- else{
2166
- xbuf.clear();
2167
- stable_sort(first, first+collected, comp, xbuf);
2168
- BOOST_MOVE_ADAPTIVE_SORT_PRINT(" A k/b srt: ", len);
2169
- stable_merge(first, first+collected, first+len, comp, xbuf);
2170
- BOOST_MOVE_ADAPTIVE_SORT_PRINT(" A k/b mrg: ", len);
2171
- }
2172
- }
2173
- else{
2174
- xbuf.clear();
2175
- stable_sort(first, first+collected, comp, xbuf);
2176
- BOOST_MOVE_ADAPTIVE_SORT_PRINT(" A k/b srt: ", len);
2177
- stable_merge(first, first+collected, first+len1+len2, comp, xbuf);
2178
- BOOST_MOVE_ADAPTIVE_SORT_PRINT(" A k/b mrg: ", len);
2179
- }
2180
- }
2181
-
2182
- template<class SizeType, class Xbuf>
2183
- inline SizeType adaptive_merge_n_keys_intbuf(SizeType &rl_block, SizeType len1, SizeType len2, Xbuf & xbuf, SizeType &l_intbuf_inout)
2184
- {
2185
- typedef SizeType size_type;
2186
- size_type l_block = rl_block;
2187
- size_type l_intbuf = xbuf.capacity() >= l_block ? 0u : l_block;
2188
-
2189
- while(xbuf.capacity() >= l_block*2){
2190
- l_block *= 2;
2191
- }
2192
-
2193
- //This is the minimum number of keys to implement the ideal algorithm
2194
- size_type n_keys = len1/l_block+len2/l_block;
2195
- while(n_keys >= ((len1-l_intbuf-n_keys)/l_block + len2/l_block)){
2196
- --n_keys;
2197
- }
2198
- ++n_keys;
2199
- BOOST_ASSERT(n_keys >= ((len1-l_intbuf-n_keys)/l_block + len2/l_block));
2200
-
2201
- if(xbuf.template supports_aligned_trailing<size_type>(l_block, n_keys)){
2202
- n_keys = 0u;
2203
- }
2204
- l_intbuf_inout = l_intbuf;
2205
- rl_block = l_block;
2206
- return n_keys;
2207
- }
2208
-
2209
- ///////////////////////////////////////////////////////////////////////////////////////////
2210
- ///////////////////////////////////////////////////////////////////////////////////////////
2211
- ///////////////////////////////////////////////////////////////////////////////////////////
2212
- ///////////////////////////////////////////////////////////////////////////////////////////
2213
- ///////////////////////////////////////////////////////////////////////////////////////////
2214
- ///////////////////////////////////////////////////////////////////////////////////////////
2215
- ///////////////////////////////////////////////////////////////////////////////////////////
2216
-
2217
- // Main explanation of the sort algorithm.
2218
- //
2219
- // csqrtlen = ceil(sqrt(len));
2220
- //
2221
- // * First, 2*csqrtlen unique elements elements are extracted from elements to be
2222
- // sorted and placed in the beginning of the range.
2223
- //
2224
- // * Step "build_blocks": In this nearly-classic merge step, 2*csqrtlen unique elements
2225
- // will be used as auxiliary memory, so trailing len-2*csqrtlen elements are
2226
- // are grouped in blocks of sorted 4*csqrtlen elements. At the end of the step
2227
- // 2*csqrtlen unique elements are again the leading elements of the whole range.
2228
- //
2229
- // * Step "combine_blocks": pairs of previously formed blocks are merged with a different
2230
- // ("smart") algorithm to form blocks of 8*csqrtlen elements. This step is slower than the
2231
- // "build_blocks" step and repeated iteratively (forming blocks of 16*csqrtlen, 32*csqrtlen
2232
- // elements, etc) of until all trailing (len-2*csqrtlen) elements are merged.
2233
- //
2234
- // In "combine_blocks" len/csqrtlen elements used are as "keys" (markers) to
2235
- // know if elements belong to the first or second block to be merged and another
2236
- // leading csqrtlen elements are used as buffer. Explanation of the "combine_blocks" step:
2237
- //
2238
- // Iteratively until all trailing (len-2*csqrtlen) elements are merged:
2239
- // Iteratively for each pair of previously merged block:
2240
- // * Blocks are divided groups of csqrtlen elements and
2241
- // 2*merged_block/csqrtlen keys are sorted to be used as markers
2242
- // * Groups are selection-sorted by first or last element (depending wheter they
2243
- // merged to left or right) and keys are reordered accordingly as an imitation-buffer.
2244
- // * Elements of each block pair are merged using the csqrtlen buffer taking into account
2245
- // if they belong to the first half or second half (marked by the key).
2246
- //
2247
- // * In the final merge step leading elements (2*csqrtlen) are sorted and merged with
2248
- // rotations with the rest of sorted elements in the "combine_blocks" step.
2249
- //
2250
- // Corner cases:
2251
- //
2252
- // * If no 2*csqrtlen elements can be extracted:
2253
- //
2254
- // * If csqrtlen+len/csqrtlen are extracted, then only csqrtlen elements are used
2255
- // as buffer in the "build_blocks" step forming blocks of 2*csqrtlen elements. This
2256
- // means that an additional "combine_blocks" step will be needed to merge all elements.
2257
- //
2258
- // * If no csqrtlen+len/csqrtlen elements can be extracted, but still more than a minimum,
2259
- // then reduces the number of elements used as buffer and keys in the "build_blocks"
2260
- // and "combine_blocks" steps. If "combine_blocks" has no enough keys due to this reduction
2261
- // then uses a rotation based smart merge.
2262
- //
2263
- // * If the minimum number of keys can't be extracted, a rotation-based sorting is performed.
2264
- //
2265
- // * If auxiliary memory is more or equal than ceil(len/2), half-copying mergesort is used.
2266
- //
2267
- // * If auxiliary memory is more than csqrtlen+n_keys*sizeof(std::size_t),
2268
- // then only csqrtlen elements need to be extracted and "combine_blocks" will use integral
2269
- // keys to combine blocks.
2270
- //
2271
- // * If auxiliary memory is available, the "build_blocks" will be extended to build bigger blocks
2272
- // using classic merge.
2273
- template<class RandIt, class Compare>
2274
- void adaptive_sort_impl
2275
- ( RandIt first
2276
- , typename iterator_traits<RandIt>::size_type const len
2277
- , Compare comp
2278
- , adaptive_xbuf<typename iterator_traits<RandIt>::value_type> & xbuf
2279
- )
2280
- {
2281
- typedef typename iterator_traits<RandIt>::size_type size_type;
2282
-
2283
- //Small sorts go directly to insertion sort
2284
- if(len <= size_type(AdaptiveSortInsertionSortThreshold)){
2285
- insertion_sort(first, first + len, comp);
2286
- return;
2287
- }
2288
-
2289
- if((len-len/2) <= xbuf.capacity()){
2290
- merge_sort(first, first+len, comp, xbuf.data());
2291
- return;
2292
- }
2293
-
2294
- //Make sure it is at least four
2295
- BOOST_STATIC_ASSERT(AdaptiveSortInsertionSortThreshold >= 4);
2296
-
2297
- size_type l_base = 0;
2298
- size_type l_intbuf = 0;
2299
- size_type n_keys = 0;
2300
- size_type l_build_buf = 0;
2301
-
2302
- //Calculate and extract needed unique elements. If a minimum is not achieved
2303
- //fallback to rotation-based merge
2304
- if(!adaptive_sort_build_params(first, len, comp, n_keys, l_intbuf, l_base, l_build_buf, xbuf)){
2305
- stable_sort(first, first+len, comp, xbuf);
2306
- return;
2307
- }
2308
- BOOST_ASSERT(l_build_buf);
2309
- //Otherwise, continue the adaptive_sort
2310
- BOOST_MOVE_ADAPTIVE_SORT_PRINT("\n After collect_unique: ", len);
2311
- size_type const n_key_plus_buf = l_intbuf+n_keys;
2312
- //l_build_buf is always power of two if l_intbuf is zero
2313
- BOOST_ASSERT(l_intbuf || (0 == (l_build_buf & (l_build_buf-1))));
2314
-
2315
- //Classic merge sort until internal buffer and xbuf are exhausted
2316
- size_type const l_merged = adaptive_sort_build_blocks
2317
- (first+n_key_plus_buf-l_build_buf, len-n_key_plus_buf+l_build_buf, l_base, l_build_buf, xbuf, comp);
2318
- BOOST_MOVE_ADAPTIVE_SORT_PRINT(" After build_blocks: ", len);
2319
-
2320
- //Non-trivial merge
2321
- bool const buffer_right = adaptive_sort_combine_all_blocks
2322
- (first, n_keys, first+n_keys, len-n_keys, l_merged, l_intbuf, xbuf, comp);
2323
-
2324
- //Sort keys and buffer and merge the whole sequence
2325
- adaptive_sort_final_merge(buffer_right, first, l_intbuf, n_keys, len, xbuf, comp);
2326
- }
2327
-
2328
- // Main explanation of the merge algorithm.
2329
- //
2330
- // csqrtlen = ceil(sqrt(len));
2331
- //
2332
- // * First, csqrtlen [to be used as buffer] + (len/csqrtlen - 1) [to be used as keys] => to_collect
2333
- // unique elements are extracted from elements to be sorted and placed in the beginning of the range.
2334
- //
2335
- // * Step "combine_blocks": the leading (len1-to_collect) elements plus trailing len2 elements
2336
- // are merged with a non-trivial ("smart") algorithm to form an ordered range trailing "len-to_collect" elements.
2337
- //
2338
- // Explanation of the "combine_blocks" step:
2339
- //
2340
- // * Trailing [first+to_collect, first+len1) elements are divided in groups of cqrtlen elements.
2341
- // Remaining elements that can't form a group are grouped in front of those elements.
2342
- // * Trailing [first+len1, first+len1+len2) elements are divided in groups of cqrtlen elements.
2343
- // Remaining elements that can't form a group are grouped in the back of those elements.
2344
- // * In parallel the following two steps are performed:
2345
- // * Groups are selection-sorted by first or last element (depending wheter they
2346
- // merged to left or right) and keys are reordered accordingly as an imitation-buffer.
2347
- // * Elements of each block pair are merged using the csqrtlen buffer taking into account
2348
- // if they belong to the first half or second half (marked by the key).
2349
- //
2350
- // * In the final merge step leading "to_collect" elements are merged with rotations
2351
- // with the rest of merged elements in the "combine_blocks" step.
2352
- //
2353
- // Corner cases:
2354
- //
2355
- // * If no "to_collect" elements can be extracted:
2356
- //
2357
- // * If more than a minimum number of elements is extracted
2358
- // then reduces the number of elements used as buffer and keys in the
2359
- // and "combine_blocks" steps. If "combine_blocks" has no enough keys due to this reduction
2360
- // then uses a rotation based smart merge.
2361
- //
2362
- // * If the minimum number of keys can't be extracted, a rotation-based merge is performed.
2363
- //
2364
- // * If auxiliary memory is more or equal than min(len1, len2), a buffered merge is performed.
2365
- //
2366
- // * If the len1 or len2 are less than 2*csqrtlen then a rotation-based merge is performed.
2367
- //
2368
- // * If auxiliary memory is more than csqrtlen+n_keys*sizeof(std::size_t),
2369
- // then no csqrtlen need to be extracted and "combine_blocks" will use integral
2370
- // keys to combine blocks.
2371
- template<class RandIt, class Compare>
2372
- void adaptive_merge_impl
2373
- ( RandIt first
2374
- , typename iterator_traits<RandIt>::size_type const len1
2375
- , typename iterator_traits<RandIt>::size_type const len2
2376
- , Compare comp
2377
- , adaptive_xbuf<typename iterator_traits<RandIt>::value_type> & xbuf
2378
- )
2379
- {
2380
- typedef typename iterator_traits<RandIt>::size_type size_type;
2381
-
2382
- if(xbuf.capacity() >= min_value<size_type>(len1, len2)){
2383
- buffered_merge(first, first+len1, first+(len1+len2), comp, xbuf);
2384
- }
2385
- else{
2386
- const size_type len = len1+len2;
2387
- //Calculate ideal parameters and try to collect needed unique keys
2388
- size_type l_block = size_type(ceil_sqrt(len));
2389
-
2390
- //One range is not big enough to extract keys and the internal buffer so a
2391
- //rotation-based based merge will do just fine
2392
- if(len1 <= l_block*2 || len2 <= l_block*2){
2393
- merge_bufferless(first, first+len1, first+len1+len2, comp);
2394
- return;
2395
- }
2396
-
2397
- //Detail the number of keys and internal buffer. If xbuf has enough memory, no
2398
- //internal buffer is needed so l_intbuf will remain 0.
2399
- size_type l_intbuf = 0;
2400
- size_type n_keys = adaptive_merge_n_keys_intbuf(l_block, len1, len2, xbuf, l_intbuf);
2401
- size_type const to_collect = l_intbuf+n_keys;
2402
- //Try to extract needed unique values from the first range
2403
- size_type const collected = collect_unique(first, first+len1, to_collect, comp, xbuf);
2404
- BOOST_MOVE_ADAPTIVE_SORT_PRINT("\n A collect: ", len);
2405
-
2406
- //Not the minimum number of keys is not available on the first range, so fallback to rotations
2407
- if(collected != to_collect && collected < 4){
2408
- merge_bufferless(first, first+len1, first+len1+len2, comp);
2409
- return;
2410
- }
2411
-
2412
- //If not enough keys but more than minimum, adjust the internal buffer and key count
2413
- bool use_internal_buf = collected == to_collect;
2414
- if (!use_internal_buf){
2415
- l_intbuf = 0u;
2416
- n_keys = collected;
2417
- l_block = lblock_for_combine(l_intbuf, n_keys, len, use_internal_buf);
2418
- //If use_internal_buf is false, then then internal buffer will be zero and rotation-based combination will be used
2419
- l_intbuf = use_internal_buf ? l_block : 0u;
2420
- }
2421
-
2422
- bool const xbuf_used = collected == to_collect && xbuf.capacity() >= l_block;
2423
- //Merge trailing elements using smart merges
2424
- adaptive_merge_combine_blocks(first, len1, len2, collected, n_keys, l_block, use_internal_buf, xbuf_used, comp, xbuf);
2425
- //Merge buffer and keys with the rest of the values
2426
- adaptive_merge_final_merge (first, len1, len2, collected, l_intbuf, l_block, use_internal_buf, xbuf_used, comp, xbuf);
2427
- }
2428
- }
2429
-
2430
1683
 
2431
1684
  } //namespace detail_adaptive {
2432
1685
  } //namespace movelib {