passenger 6.2.1 → 6.2.2

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 (270) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +37 -15
  3. data/build/cxx_tests.rb +2 -0
  4. data/build/support/cxx_dependency_map.rb +3 -63
  5. data/src/agent/Core/Config.h +1 -1
  6. data/src/agent/Core/Controller/Config.h +1 -1
  7. data/src/agent/Shared/ApiServerUtils.h +1 -1
  8. data/src/agent/Watchdog/Config.h +1 -1
  9. data/src/apache2_module/Hooks.cpp +13 -0
  10. data/src/apache2_module/Utils.h +14 -0
  11. data/src/cxx_supportlib/Constants.h +1 -1
  12. data/src/cxx_supportlib/FileTools/FileManip.cpp +27 -3
  13. data/src/cxx_supportlib/InstanceDirectory.h +30 -3
  14. data/src/cxx_supportlib/ServerKit/Errors.h +1 -1
  15. data/src/cxx_supportlib/ServerKit/HttpHeaderParser.h +1 -1
  16. data/src/cxx_supportlib/ServerKit/HttpHeaderParserState.h +1 -1
  17. data/src/cxx_supportlib/ServerKit/HttpRequest.h +1 -1
  18. data/src/cxx_supportlib/ServerKit/llerrors.h +3 -3
  19. data/src/cxx_supportlib/ServerKit/llversion.h +1 -1
  20. data/src/cxx_supportlib/{ServerKit/llhttp_api.c → vendor-copy/llhttp/api.c} +30 -23
  21. data/src/cxx_supportlib/{ServerKit → vendor-copy/llhttp}/llhttp.c +1756 -1645
  22. data/src/cxx_supportlib/{ServerKit → vendor-copy/llhttp}/llhttp.h +35 -13
  23. data/src/cxx_supportlib/vendor-modified/boost/algorithm/string/classification.hpp +19 -0
  24. data/src/cxx_supportlib/vendor-modified/boost/algorithm/string/formatter.hpp +1 -1
  25. data/src/cxx_supportlib/vendor-modified/boost/algorithm/string/trim_all.hpp +0 -2
  26. data/src/cxx_supportlib/vendor-modified/boost/assert.hpp +20 -13
  27. data/src/cxx_supportlib/vendor-modified/boost/atomic/detail/core_arch_ops_gcc_x86.hpp +2 -2
  28. data/src/cxx_supportlib/vendor-modified/boost/atomic/thread_pause.hpp +4 -0
  29. data/src/cxx_supportlib/vendor-modified/boost/bind/mem_fn.hpp +1 -1
  30. data/src/cxx_supportlib/vendor-modified/boost/circular_buffer/debug.hpp +4 -0
  31. data/src/cxx_supportlib/vendor-modified/boost/config/assert_cxx03.hpp +1 -1
  32. data/src/cxx_supportlib/vendor-modified/boost/config/assert_cxx11.hpp +1 -1
  33. data/src/cxx_supportlib/vendor-modified/boost/config/assert_cxx14.hpp +1 -1
  34. data/src/cxx_supportlib/vendor-modified/boost/config/assert_cxx17.hpp +1 -1
  35. data/src/cxx_supportlib/vendor-modified/boost/config/assert_cxx20.hpp +1 -1
  36. data/src/cxx_supportlib/vendor-modified/boost/config/assert_cxx23.hpp +1 -1
  37. data/src/cxx_supportlib/vendor-modified/boost/config/auto_link.hpp +6 -1
  38. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/clang_version.hpp +10 -1
  39. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/visualc.hpp +5 -3
  40. data/src/cxx_supportlib/vendor-modified/boost/config/detail/cxx_composite.hpp +1 -1
  41. data/src/cxx_supportlib/vendor-modified/boost/config/workaround.hpp +5 -0
  42. data/src/cxx_supportlib/vendor-modified/boost/container/adaptive_pool.hpp +57 -53
  43. data/src/cxx_supportlib/vendor-modified/boost/container/allocator.hpp +10 -10
  44. data/src/cxx_supportlib/vendor-modified/boost/container/allocator_traits.hpp +34 -2
  45. data/src/cxx_supportlib/vendor-modified/boost/container/container_fwd.hpp +14 -2
  46. data/src/cxx_supportlib/vendor-modified/boost/container/deque.hpp +176 -2287
  47. data/src/cxx_supportlib/vendor-modified/boost/container/detail/adaptive_node_pool.hpp +13 -9
  48. data/src/cxx_supportlib/vendor-modified/boost/container/detail/adaptive_node_pool_impl.hpp +186 -70
  49. data/src/cxx_supportlib/vendor-modified/boost/container/detail/algorithm.hpp +2 -2
  50. data/src/cxx_supportlib/vendor-modified/boost/container/detail/aligned_allocation.hpp +149 -0
  51. data/src/cxx_supportlib/vendor-modified/boost/container/detail/alloc_helpers.hpp +35 -0
  52. data/src/cxx_supportlib/vendor-modified/boost/container/detail/alloc_lib.h +1 -0
  53. data/src/cxx_supportlib/vendor-modified/boost/container/detail/bit_utilities.hpp +133 -0
  54. data/src/cxx_supportlib/vendor-modified/boost/container/detail/compare_functors.hpp +18 -3
  55. data/src/cxx_supportlib/vendor-modified/boost/container/detail/config_begin.hpp +5 -0
  56. data/src/cxx_supportlib/vendor-modified/boost/container/detail/config_end.hpp +4 -0
  57. data/src/cxx_supportlib/vendor-modified/boost/container/detail/container_rebind.hpp +1 -1
  58. data/src/cxx_supportlib/vendor-modified/boost/container/detail/copy_move_algo.hpp +20 -10
  59. data/src/cxx_supportlib/vendor-modified/boost/container/detail/deque_impl.hpp +2744 -0
  60. data/src/cxx_supportlib/vendor-modified/boost/container/detail/dispatch_uses_allocator.hpp +202 -104
  61. data/src/cxx_supportlib/vendor-modified/boost/container/detail/dlmalloc.hpp +5 -4
  62. data/src/cxx_supportlib/vendor-modified/boost/container/detail/flat_tree.hpp +161 -85
  63. data/src/cxx_supportlib/vendor-modified/boost/container/detail/is_constructible.hpp +180 -0
  64. data/src/cxx_supportlib/vendor-modified/boost/container/detail/iterators.hpp +3 -2
  65. data/src/cxx_supportlib/vendor-modified/boost/container/detail/math_functions.hpp +12 -0
  66. data/src/cxx_supportlib/vendor-modified/boost/container/detail/mpl.hpp +16 -0
  67. data/src/cxx_supportlib/vendor-modified/boost/container/detail/mutex.hpp +1 -1
  68. data/src/cxx_supportlib/vendor-modified/boost/container/detail/next_capacity.hpp +9 -1
  69. data/src/cxx_supportlib/vendor-modified/boost/container/detail/node_pool.hpp +18 -14
  70. data/src/cxx_supportlib/vendor-modified/boost/container/detail/node_pool_impl.hpp +256 -41
  71. data/src/cxx_supportlib/vendor-modified/boost/container/detail/operator_new_helpers.hpp +75 -24
  72. data/src/cxx_supportlib/vendor-modified/boost/container/detail/pair.hpp +1 -56
  73. data/src/cxx_supportlib/vendor-modified/boost/container/detail/placement_new.hpp +16 -3
  74. data/src/cxx_supportlib/vendor-modified/boost/container/detail/pool_common_alloc.hpp +1 -7
  75. data/src/cxx_supportlib/vendor-modified/boost/container/detail/range_utils.hpp +196 -0
  76. data/src/cxx_supportlib/vendor-modified/boost/container/detail/std_fwd.hpp +33 -1
  77. data/src/cxx_supportlib/vendor-modified/boost/container/detail/tree.hpp +124 -69
  78. data/src/cxx_supportlib/vendor-modified/boost/container/detail/workaround.hpp +109 -7
  79. data/src/cxx_supportlib/vendor-modified/boost/container/devector.hpp +168 -162
  80. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/nest.hpp +2978 -0
  81. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/pmr/nest.hpp +45 -0
  82. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_all_of.hpp +43 -0
  83. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_any_of.hpp +42 -0
  84. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_copy.hpp +229 -0
  85. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_copy_if.hpp +270 -0
  86. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_copy_n.hpp +308 -0
  87. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_count.hpp +101 -0
  88. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_count_if.hpp +100 -0
  89. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_equal.hpp +268 -0
  90. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_fill.hpp +101 -0
  91. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_fill_n.hpp +171 -0
  92. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_find.hpp +110 -0
  93. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_find_if.hpp +110 -0
  94. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_find_if_not.hpp +43 -0
  95. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_find_last.hpp +179 -0
  96. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_find_last_if.hpp +179 -0
  97. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_find_last_if_not.hpp +43 -0
  98. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_for_each.hpp +92 -0
  99. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_generate.hpp +90 -0
  100. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_generate_n.hpp +162 -0
  101. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_is_partitioned.hpp +46 -0
  102. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_is_sorted.hpp +49 -0
  103. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_is_sorted_until.hpp +169 -0
  104. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_iterator_traits.hpp +382 -0
  105. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_merge.hpp +428 -0
  106. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_mismatch.hpp +350 -0
  107. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_none_of.hpp +98 -0
  108. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_partition.hpp +296 -0
  109. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_partition_copy.hpp +105 -0
  110. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_partition_point.hpp +116 -0
  111. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_remove.hpp +57 -0
  112. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_remove_copy.hpp +207 -0
  113. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_remove_copy_if.hpp +223 -0
  114. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_remove_if.hpp +57 -0
  115. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_replace.hpp +90 -0
  116. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_replace_if.hpp +90 -0
  117. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_reverse.hpp +245 -0
  118. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_reverse_copy.hpp +229 -0
  119. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_search.hpp +211 -0
  120. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_search_n.hpp +476 -0
  121. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_set_difference.hpp +300 -0
  122. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_set_intersection.hpp +287 -0
  123. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_set_symmetric_difference.hpp +306 -0
  124. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_set_union.hpp +294 -0
  125. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_stable_partition.hpp +153 -0
  126. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_swap_ranges.hpp +92 -0
  127. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/segmented_transform.hpp +93 -0
  128. data/src/cxx_supportlib/vendor-modified/boost/container/experimental/wrapped_iterator.hpp +142 -0
  129. data/src/cxx_supportlib/vendor-modified/boost/container/flat_map.hpp +642 -417
  130. data/src/cxx_supportlib/vendor-modified/boost/container/flat_set.hpp +141 -30
  131. data/src/cxx_supportlib/vendor-modified/boost/container/hub.hpp +2426 -0
  132. data/src/cxx_supportlib/vendor-modified/boost/container/list.hpp +65 -57
  133. data/src/cxx_supportlib/vendor-modified/boost/container/map.hpp +247 -68
  134. data/src/cxx_supportlib/vendor-modified/boost/container/new_allocator.hpp +7 -0
  135. data/src/cxx_supportlib/vendor-modified/boost/container/node_allocator.hpp +39 -33
  136. data/src/cxx_supportlib/vendor-modified/boost/container/options.hpp +156 -23
  137. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/global_resource.hpp +3 -3
  138. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/hub.hpp +43 -0
  139. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/memory_resource.hpp +5 -3
  140. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/monotonic_buffer_resource.hpp +1 -0
  141. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/polymorphic_allocator.hpp +1 -1
  142. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/resource_adaptor.hpp +4 -0
  143. data/src/cxx_supportlib/vendor-modified/boost/container/pmr/segtor.hpp +45 -0
  144. data/src/cxx_supportlib/vendor-modified/boost/container/scoped_allocator.hpp +5 -4
  145. data/src/cxx_supportlib/vendor-modified/boost/container/segtor.hpp +905 -0
  146. data/src/cxx_supportlib/vendor-modified/boost/container/set.hpp +148 -35
  147. data/src/cxx_supportlib/vendor-modified/boost/container/slist.hpp +59 -52
  148. data/src/cxx_supportlib/vendor-modified/boost/container/small_vector.hpp +632 -5
  149. data/src/cxx_supportlib/vendor-modified/boost/container/stable_vector.hpp +66 -60
  150. data/src/cxx_supportlib/vendor-modified/boost/container/static_vector.hpp +46 -1
  151. data/src/cxx_supportlib/vendor-modified/boost/container/string.hpp +612 -317
  152. data/src/cxx_supportlib/vendor-modified/boost/container/uses_allocator.hpp +54 -111
  153. data/src/cxx_supportlib/vendor-modified/boost/container/uses_allocator_construction.hpp +100 -0
  154. data/src/cxx_supportlib/vendor-modified/boost/container/uses_allocator_fwd.hpp +1 -3
  155. data/src/cxx_supportlib/vendor-modified/boost/container/vector.hpp +233 -116
  156. data/src/cxx_supportlib/vendor-modified/boost/container_hash/hash.hpp +5 -1
  157. data/src/cxx_supportlib/vendor-modified/boost/core/lightweight_test.hpp +17 -10
  158. data/src/cxx_supportlib/vendor-modified/boost/date_time/period.hpp +1 -3
  159. data/src/cxx_supportlib/vendor-modified/boost/describe/detail/config.hpp +16 -0
  160. data/src/cxx_supportlib/vendor-modified/boost/exception/detail/encoder.hpp +114 -0
  161. data/src/cxx_supportlib/vendor-modified/boost/exception/detail/error_info_impl.hpp +4 -0
  162. data/src/cxx_supportlib/vendor-modified/boost/exception/detail/requires_cxx11.hpp +1 -1
  163. data/src/cxx_supportlib/vendor-modified/boost/exception/detail/type_info.hpp +211 -1
  164. data/src/cxx_supportlib/vendor-modified/boost/exception/diagnostic_information.hpp +59 -0
  165. data/src/cxx_supportlib/vendor-modified/boost/exception/exception.hpp +6 -0
  166. data/src/cxx_supportlib/vendor-modified/boost/exception/info.hpp +34 -0
  167. data/src/cxx_supportlib/vendor-modified/boost/intrusive/avltree.hpp +0 -1
  168. data/src/cxx_supportlib/vendor-modified/boost/intrusive/bstree.hpp +12 -3
  169. data/src/cxx_supportlib/vendor-modified/boost/intrusive/derivation_value_traits.hpp +1 -1
  170. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/ebo_functor_holder.hpp +29 -174
  171. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/generic_hook.hpp +18 -2
  172. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/key_nodeptr_comp.hpp +0 -1
  173. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/workaround.hpp +4 -5
  174. data/src/cxx_supportlib/vendor-modified/boost/intrusive/hashtable.hpp +20 -11
  175. data/src/cxx_supportlib/vendor-modified/boost/intrusive/list.hpp +42 -14
  176. data/src/cxx_supportlib/vendor-modified/boost/intrusive/slist.hpp +58 -22
  177. data/src/cxx_supportlib/vendor-modified/boost/intrusive/unordered_set.hpp +3 -1
  178. data/src/cxx_supportlib/vendor-modified/boost/iterator/advance.hpp +5 -1
  179. data/src/cxx_supportlib/vendor-modified/boost/iterator/distance.hpp +8 -2
  180. data/src/cxx_supportlib/vendor-modified/boost/iterator/is_iterator.hpp +9 -0
  181. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/bad_lexical_cast.hpp +11 -1
  182. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/buffer_view.hpp +9 -1
  183. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/config.hpp +22 -0
  184. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/converter_lexical.hpp +15 -7
  185. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/converter_lexical_streams.hpp +23 -11
  186. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/converter_numeric.hpp +11 -1
  187. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/inf_nan.hpp +9 -1
  188. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/is_character.hpp +11 -2
  189. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/lcast_basic_unlockedbuf.hpp +10 -1
  190. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/lcast_char_constants.hpp +8 -1
  191. data/src/cxx_supportlib/vendor-modified/boost/{detail → lexical_cast/detail}/lcast_precision.hpp +13 -1
  192. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/lcast_unsigned_converters.hpp +11 -1
  193. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/widest_char.hpp +10 -2
  194. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/try_lexical_convert.hpp +15 -2
  195. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast.hpp +11 -1
  196. data/src/cxx_supportlib/vendor-modified/boost/libs/thread/src/pthread/once_atomic.cpp +1 -1
  197. data/src/cxx_supportlib/vendor-modified/boost/libs/thread/src/pthread/thread.cpp +48 -46
  198. data/src/cxx_supportlib/vendor-modified/boost/move/detail/meta_utils.hpp +23 -0
  199. data/src/cxx_supportlib/vendor-modified/boost/move/detail/move_helpers.hpp +24 -24
  200. data/src/cxx_supportlib/vendor-modified/boost/move/detail/nsec_clock.hpp +12 -4
  201. data/src/cxx_supportlib/vendor-modified/boost/move/detail/type_traits.hpp +76 -0
  202. data/src/cxx_supportlib/vendor-modified/boost/move/detail/workaround.hpp +1 -1
  203. data/src/cxx_supportlib/vendor-modified/boost/move/traits.hpp +11 -0
  204. data/src/cxx_supportlib/vendor-modified/boost/mp11/algorithm.hpp +58 -37
  205. data/src/cxx_supportlib/vendor-modified/boost/mp11/detail/mp_copy_if.hpp +1 -2
  206. data/src/cxx_supportlib/vendor-modified/boost/mp11/detail/mp_map_find.hpp +17 -9
  207. data/src/cxx_supportlib/vendor-modified/boost/mp11/detail/mp_remove_if.hpp +1 -2
  208. data/src/cxx_supportlib/vendor-modified/boost/mp11/integer_sequence.hpp +6 -0
  209. data/src/cxx_supportlib/vendor-modified/boost/mp11/version.hpp +1 -1
  210. data/src/cxx_supportlib/vendor-modified/boost/none_t.hpp +6 -1
  211. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_common_defs.hpp +188 -0
  212. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_factory_support.hpp +0 -6
  213. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_hash.hpp +1 -1
  214. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_nonmember_interface.hpp +117 -0
  215. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_reference_spec.hpp +108 -83
  216. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_relops.hpp +39 -39
  217. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_select_implementation.hpp +37 -0
  218. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_swap.hpp +1 -1
  219. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_trivially_copyable_base.hpp +8 -8
  220. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/union_optional.hpp +724 -0
  221. data/src/cxx_supportlib/vendor-modified/boost/optional/optional.hpp +93 -220
  222. data/src/cxx_supportlib/vendor-modified/boost/optional/optional_fwd.hpp +14 -4
  223. data/src/cxx_supportlib/vendor-modified/boost/optional/optional_io.hpp +1 -1
  224. data/src/cxx_supportlib/vendor-modified/boost/random/binomial_distribution.hpp +1 -1
  225. data/src/cxx_supportlib/vendor-modified/boost/random/uniform_int_distribution.hpp +1 -1
  226. data/src/cxx_supportlib/vendor-modified/boost/rational.hpp +1 -1
  227. data/src/cxx_supportlib/vendor-modified/boost/static_assert.hpp +4 -6
  228. data/src/cxx_supportlib/vendor-modified/boost/system/api_config.hpp +1 -1
  229. data/src/cxx_supportlib/vendor-modified/boost/system/detail/config.hpp +16 -0
  230. data/src/cxx_supportlib/vendor-modified/boost/system/detail/error_category.hpp +13 -13
  231. data/src/cxx_supportlib/vendor-modified/boost/system/detail/error_category_impl.hpp +5 -5
  232. data/src/cxx_supportlib/vendor-modified/boost/thread/concurrent_queues/detail/sync_deque_base.hpp +3 -2
  233. data/src/cxx_supportlib/vendor-modified/boost/thread/concurrent_queues/detail/sync_queue_base.hpp +3 -2
  234. data/src/cxx_supportlib/vendor-modified/boost/thread/detail/thread.hpp +2 -1
  235. data/src/cxx_supportlib/vendor-modified/boost/thread/experimental/parallel/v2/task_region.hpp +1 -1
  236. data/src/cxx_supportlib/vendor-modified/boost/thread/future.hpp +30 -28
  237. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/once.hpp +6 -3
  238. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/once_atomic.hpp +5 -1
  239. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/pthread_helpers.hpp +1 -0
  240. data/src/cxx_supportlib/vendor-modified/boost/thread/pthread/shared_mutex.hpp +16 -16
  241. data/src/cxx_supportlib/vendor-modified/boost/thread/v2/shared_mutex.hpp +26 -26
  242. data/src/cxx_supportlib/vendor-modified/boost/unordered/concurrent_flat_map.hpp +196 -6
  243. data/src/cxx_supportlib/vendor-modified/boost/unordered/concurrent_flat_set.hpp +191 -6
  244. data/src/cxx_supportlib/vendor-modified/boost/unordered/concurrent_node_map.hpp +196 -5
  245. data/src/cxx_supportlib/vendor-modified/boost/unordered/concurrent_node_set.hpp +192 -5
  246. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/foa/concurrent_table.hpp +3 -3
  247. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/foa/core.hpp +2 -2
  248. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/foa/table.hpp +3 -3
  249. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/implementation.hpp +52 -16
  250. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/ranges_support.hpp +104 -0
  251. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/type_traits.hpp +1 -14
  252. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/unordered_printers.hpp +10 -4
  253. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_flat_map.hpp +121 -3
  254. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_flat_set.hpp +118 -3
  255. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_map.hpp +338 -1
  256. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_node_map.hpp +121 -3
  257. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_node_set.hpp +118 -3
  258. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_set.hpp +333 -1
  259. data/src/cxx_supportlib/vendor-modified/boost/version.hpp +2 -2
  260. data/src/cxx_supportlib/vendor-modified/jsoncpp/json-forwards.h +276 -143
  261. data/src/cxx_supportlib/vendor-modified/jsoncpp/json.h +1262 -771
  262. data/src/cxx_supportlib/vendor-modified/jsoncpp/jsoncpp.cpp +1704 -1586
  263. data/src/nginx_module/ContentHandler.c +35 -0
  264. data/src/ruby_supportlib/phusion_passenger/common_library.rb +6 -6
  265. data/src/ruby_supportlib/phusion_passenger/utils/json.rb +25 -2
  266. data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller.rb +12 -1
  267. data/src/ruby_supportlib/phusion_passenger.rb +1 -1
  268. metadata +73 -8
  269. data/src/cxx_supportlib/vendor-modified/boost/optional/detail/optional_utility.hpp +0 -41
  270. /data/src/cxx_supportlib/{ServerKit/llhttp_http.c → vendor-copy/llhttp/http.c} +0 -0
@@ -26,6 +26,7 @@
26
26
  #include <boost/container/allocator_traits.hpp>
27
27
  #include <boost/container/new_allocator.hpp> //new_allocator
28
28
  #include <boost/container/throw_exception.hpp>
29
+ #include <boost/container/options.hpp>
29
30
  // container/detail
30
31
  #include <boost/container/detail/alloc_helpers.hpp>
31
32
  #include <boost/container/detail/allocator_version_traits.hpp>
@@ -73,6 +74,22 @@ namespace boost {
73
74
  namespace container {
74
75
 
75
76
  #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
77
+
78
+ template<class Options, class AllocatorSizeType>
79
+ struct get_string_opt
80
+ {
81
+ typedef string_opt< typename default_if_void<typename Options::growth_factor_type, growth_factor_60>::type
82
+ , typename default_if_void<typename Options::stored_size_type, AllocatorSizeType>::type
83
+ , Options::inline_chars
84
+ > type;
85
+ };
86
+
87
+ template<class AllocatorSizeType>
88
+ struct get_string_opt<void, AllocatorSizeType>
89
+ {
90
+ typedef string_opt<growth_factor_60, AllocatorSizeType, 0u> type;
91
+ };
92
+
76
93
  namespace dtl {
77
94
  // ------------------------------------------------------------
78
95
  // Class basic_string_base.
@@ -84,7 +101,7 @@ namespace dtl {
84
101
  // memory. The destructor assumes that the memory either is the internal buffer,
85
102
  // or else points to a block of memory that was allocated using string_base's
86
103
  // allocator and whose size is this->m_storage.
87
- template <class Allocator>
104
+ template <class Allocator, class Options>
88
105
  class basic_string_base
89
106
  {
90
107
  basic_string_base & operator=(const basic_string_base &);
@@ -98,9 +115,17 @@ class basic_string_base
98
115
  typedef typename allocator_traits_type::value_type value_type;
99
116
  typedef typename allocator_traits_type::size_type size_type;
100
117
  typedef typename allocator_traits_type::difference_type difference_type;
118
+ typedef typename boost::container::
119
+ allocator_traits<allocator_type>::size_type alloc_size_type;
120
+ typedef typename get_string_opt
121
+ <Options, alloc_size_type>::type options_type;
122
+ typedef typename options_type::growth_factor_type growth_factor_type;
123
+ typedef typename options_type::stored_size_type stored_size_type;
101
124
 
102
125
  typedef ::boost::intrusive::pointer_traits<pointer> pointer_traits;
103
126
 
127
+ static const std::size_t inline_chars = options_type::inline_chars;
128
+
104
129
  inline basic_string_base()
105
130
  : members_()
106
131
  {}
@@ -142,10 +167,10 @@ class basic_string_base
142
167
  //This is the structure controlling a long string
143
168
  struct long_t
144
169
  {
145
- size_type is_short : 1;
146
- size_type length : (sizeof(size_type)*CHAR_BIT - 1);
147
- size_type storage;
148
- pointer start;
170
+ stored_size_type is_short : 1;
171
+ stored_size_type length : (sizeof(stored_size_type)*CHAR_BIT - 1);
172
+ stored_size_type storage;
173
+ pointer start;
149
174
 
150
175
  inline long_t()
151
176
  : is_short(0)
@@ -187,25 +212,43 @@ class basic_string_base
187
212
 
188
213
  //This type has the same alignment and size as long_t but it's POD
189
214
  //so, unlike long_t, it can be placed in a union
190
-
191
215
  typedef typename dtl::aligned_storage
192
216
  <sizeof(long_t), dtl::alignment_of<long_t>::value>::type long_raw_t;
193
217
 
218
+ template <std::size_t NChar>
219
+ union short_type_test
220
+ {
221
+ long_raw_t l;
222
+ struct short_t
223
+ {
224
+ short_header h;
225
+ value_type data[NChar+1u];
226
+ } s;
227
+ };
228
+
194
229
  protected:
195
- BOOST_STATIC_CONSTEXPR size_type MinInternalBufferChars = 8;
196
- BOOST_STATIC_CONSTEXPR size_type AlignmentOfValueType =
197
- alignment_of<value_type>::value;
198
- BOOST_STATIC_CONSTEXPR size_type ShortDataOffset = ((sizeof(short_header)-1)/AlignmentOfValueType+1)*AlignmentOfValueType;
199
- BOOST_STATIC_CONSTEXPR size_type ZeroCostInternalBufferChars =
200
- (sizeof(long_t) - ShortDataOffset)/sizeof(value_type);
201
- BOOST_STATIC_CONSTEXPR size_type UnalignedFinalInternalBufferChars =
202
- (ZeroCostInternalBufferChars > MinInternalBufferChars) ?
203
- ZeroCostInternalBufferChars : MinInternalBufferChars;
230
+ //Due to internal data representation constraints, inline chars cannot be bigger than this
231
+ BOOST_STATIC_CONSTEXPR size_type MaxInlineChars = 127u;
232
+ BOOST_CONTAINER_STATIC_ASSERT(inline_chars <= MaxInlineChars);
233
+
234
+ BOOST_STATIC_CONSTEXPR size_type SizeOfValueType = sizeof(value_type);
235
+ BOOST_STATIC_CONSTEXPR size_type ShortDataOffset = ((sizeof(short_header)-1)/SizeOfValueType+1)*SizeOfValueType;
236
+ BOOST_STATIC_CONSTEXPR size_type ZeroCostInternalStorage = (sizeof(long_t) - ShortDataOffset)/sizeof(value_type);
237
+ BOOST_STATIC_CONSTEXPR size_type InlineCharsStorage = (sizeof(short_type_test<inline_chars>) - ShortDataOffset)/sizeof(value_type);
238
+
239
+ //Select the biggest internal buffer between zero-cost SSO and user-requested SSO
240
+ BOOST_STATIC_CONSTEXPR size_type CandidateInternalStorageChars =
241
+ ZeroCostInternalStorage > InlineCharsStorage ? ZeroCostInternalStorage : InlineCharsStorage;
242
+
243
+ //Clamp internal buffer chars to MaxInlineChars
244
+ BOOST_STATIC_CONSTEXPR size_type MaxInlineStorage = MaxInlineChars+1u;
245
+ BOOST_STATIC_CONSTEXPR size_type FinalInternalStorage =
246
+ CandidateInternalStorageChars < MaxInlineStorage ? CandidateInternalStorageChars : MaxInlineStorage;
204
247
 
205
248
  struct short_t
206
249
  {
207
250
  short_header h;
208
- value_type data[UnalignedFinalInternalBufferChars];
251
+ value_type data[FinalInternalStorage];
209
252
  };
210
253
 
211
254
  union repr_t_size_t
@@ -240,16 +283,16 @@ class basic_string_base
240
283
  : allocator_type(boost::forward<AllocatorConvertible>(a))
241
284
  { this->init(); }
242
285
 
243
- inline const short_t *pshort_repr() const
286
+ inline const short_t * pshort_repr() const
244
287
  { return move_detail::launder_cast<const short_t*>(&m_repr); }
245
288
 
246
- inline const long_t *plong_repr() const
289
+ inline const long_t * plong_repr() const
247
290
  { return move_detail::launder_cast<const long_t*>(&m_repr); }
248
291
 
249
- inline short_t *pshort_repr()
292
+ inline short_t * pshort_repr()
250
293
  { return move_detail::launder_cast<short_t*>(&m_repr); }
251
294
 
252
- inline long_t *plong_repr()
295
+ inline long_t * plong_repr()
253
296
  { return move_detail::launder_cast<long_t*>(&m_repr); }
254
297
 
255
298
  repr_t m_repr;
@@ -261,7 +304,7 @@ class basic_string_base
261
304
  inline allocator_type &alloc()
262
305
  { return members_; }
263
306
 
264
- BOOST_STATIC_CONSTEXPR size_type InternalBufferChars = (sizeof(repr_t) - ShortDataOffset)/sizeof(value_type);
307
+ BOOST_STATIC_CONSTEXPR size_type InternalBufferChars = FinalInternalStorage;
265
308
 
266
309
  private:
267
310
 
@@ -278,7 +321,7 @@ class basic_string_base
278
321
  return hdr.is_short != 0;
279
322
  }
280
323
 
281
- inline short_t *construct_short()
324
+ inline short_t * construct_short()
282
325
  {
283
326
  short_t *ps = ::new(&this->members_.m_repr) short_t;
284
327
  ps->h.is_short = 1;
@@ -291,7 +334,7 @@ class basic_string_base
291
334
  this->members_.pshort_repr()->~short_t();
292
335
  }
293
336
 
294
- short_t *assure_short()
337
+ short_t * assure_short()
295
338
  {
296
339
  if (!this->is_short()){
297
340
  this->destroy_long();
@@ -300,7 +343,7 @@ class basic_string_base
300
343
  return this->members_.pshort_repr();
301
344
  }
302
345
 
303
- inline long_t *construct_long()
346
+ inline long_t * construct_long()
304
347
  {
305
348
  long_t *pl = ::new(&this->members_.m_repr) long_t;
306
349
  //is_short flag is written in the constructor
@@ -313,7 +356,7 @@ class basic_string_base
313
356
  this->members_.plong_repr()->~long_t();
314
357
  }
315
358
 
316
- long_t *assure_long()
359
+ long_t * assure_long()
317
360
  {
318
361
  if (this->is_short()){
319
362
  this->destroy_short();
@@ -322,7 +365,6 @@ class basic_string_base
322
365
  return this->members_.plong_repr();
323
366
  }
324
367
 
325
-
326
368
  protected:
327
369
 
328
370
  typedef dtl::integral_constant<unsigned,
@@ -341,10 +383,23 @@ class basic_string_base
341
383
  (this->alloc(), command, limit_size, prefer_in_recvd_out_size, reuse);
342
384
  }
343
385
 
344
- size_type next_capacity(size_type additional_objects) const
386
+ size_type next_storage(size_type additional_objects, size_type current_storage) const
345
387
  {
346
- return growth_factor_100()
347
- ( this->priv_storage(), additional_objects, allocator_traits_type::max_size(this->alloc()));
388
+ const size_type cur_cap = this->priv_capacity();
389
+ const size_type spare_cap = size_type(cur_cap - this->priv_size());
390
+ BOOST_ASSERT(additional_objects > spare_cap);
391
+ size_type max_storage = allocator_traits_type::max_size(this->alloc());
392
+ //We need a bit to store the short/ong bit so we can only use half of the stored_size_type capacity
393
+ (clamp_by_half_stored_size_type<size_type>)(max_storage, stored_size_type());
394
+ const size_type max_cap = max_storage - 1u; //we need to save space for null terminator
395
+ const size_type achievable_additional_obj = size_type(max_cap - size_type(cur_cap));
396
+ const size_type min_additional_obj = size_type(additional_objects - spare_cap);
397
+
398
+ if ( achievable_additional_obj < min_additional_obj )
399
+ boost::container::throw_length_error("get_next_capacity, allocator or storage_size_type's max size reached");
400
+
401
+ return growth_factor_type()
402
+ ( current_storage, min_additional_obj, max_storage);
348
403
  }
349
404
 
350
405
  void deallocate(pointer p, size_type n)
@@ -373,17 +428,17 @@ class basic_string_base
373
428
  {
374
429
  if (n <= this->max_size()) {
375
430
  if(n > InternalBufferChars){
376
- size_type new_cap = this->next_capacity(n);
431
+ size_type new_storage = n + 1u;
377
432
  pointer reuse = 0;
378
- pointer p = this->allocation_command(allocate_new, n, new_cap, reuse);
433
+ pointer p = this->allocation_command(allocate_new, n, new_storage, reuse);
379
434
  BOOST_ASSERT(this->is_short());
380
435
  this->construct_long();
381
436
  this->priv_long_addr(p);
382
437
  this->priv_long_size(0);
383
- this->priv_storage(new_cap);
438
+ this->priv_long_storage(new_storage);
384
439
  }
385
440
  }
386
- else{
441
+ else {
387
442
  throw_length_error("basic_string::allocate_initial_block max_size() exceeded");
388
443
  }
389
444
  }
@@ -438,15 +493,9 @@ class basic_string_base
438
493
  inline size_type priv_long_storage() const
439
494
  { return this->members_.plong_repr()->storage; }
440
495
 
441
- inline void priv_storage(size_type storage)
442
- {
443
- if(!this->is_short())
444
- this->priv_long_storage(storage);
445
- }
446
-
447
496
  inline void priv_long_storage(size_type storage)
448
497
  {
449
- this->members_.plong_repr()->storage = storage;
498
+ this->members_.plong_repr()->storage = static_cast<stored_size_type>(storage);
450
499
  }
451
500
 
452
501
  inline size_type priv_size() const
@@ -469,6 +518,7 @@ class basic_string_base
469
518
  inline void priv_short_size(size_type sz)
470
519
  {
471
520
  typedef unsigned char uchar_type;
521
+ BOOST_ASSERT(sz < uchar_type(-1));
472
522
  BOOST_STATIC_CONSTEXPR uchar_type mask = uchar_type(uchar_type(-1) >> 1U);
473
523
  BOOST_ASSERT( sz <= mask );
474
524
  //Make -Wconversion happy
@@ -477,10 +527,10 @@ class basic_string_base
477
527
 
478
528
  inline void priv_long_size(size_type sz)
479
529
  {
480
- BOOST_STATIC_CONSTEXPR size_type mask = size_type(-1) >> 1U;
530
+ BOOST_STATIC_CONSTEXPR stored_size_type mask = static_cast<stored_size_type>(stored_size_type(-1) >> 1U);
481
531
  BOOST_ASSERT( sz <= mask );
482
532
  //Make -Wconversion happy
483
- this->members_.plong_repr()->length = sz & mask;
533
+ this->members_.plong_repr()->length = static_cast<stored_size_type>(sz & mask);
484
534
  }
485
535
  #if defined(BOOST_GCC) && (BOOST_GCC >= 40700)
486
536
  #pragma GCC diagnostic pop
@@ -553,22 +603,24 @@ class basic_string_base
553
603
  //! \tparam CharT The type of character it contains.
554
604
  //! \tparam Traits The Character Traits type, which encapsulates basic character operations
555
605
  //! \tparam Allocator The allocator, used for internal memory management.
606
+ //! \tparam Options A type produced from \c boost::container::string_options.
556
607
  #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
557
- template <class CharT, class Traits = std::char_traits<CharT>, class Allocator = void >
608
+ template <class CharT, class Traits = std::char_traits<CharT>, class Allocator = void, class Options = void >
558
609
  #else
559
- template <class CharT, class Traits, class Allocator>
610
+ template <class CharT, class Traits, class Allocator, class Options>
560
611
  #endif
561
612
  class basic_string
562
- : private dtl::basic_string_base<typename real_allocator<CharT, Allocator>::type>
613
+ : private dtl::basic_string_base<typename real_allocator<CharT, Allocator>::type, Options>
563
614
  {
564
615
  #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
565
616
  private:
566
617
  BOOST_COPYABLE_AND_MOVABLE(basic_string)
567
- typedef dtl::basic_string_base<typename real_allocator<CharT, Allocator>::type> base_t;
618
+ typedef dtl::basic_string_base<typename real_allocator<CharT, Allocator>::type, Options> base_t;
568
619
  typedef typename base_t::allocator_traits_type allocator_traits_type;
620
+
569
621
  BOOST_STATIC_CONSTEXPR typename base_t::size_type InternalBufferChars = base_t::InternalBufferChars;
570
622
 
571
- protected:
623
+ private:
572
624
  // Allocator helper class to use a char_traits as a function object.
573
625
 
574
626
  template <class Tr>
@@ -610,23 +662,29 @@ class basic_string
610
662
  // types
611
663
  //
612
664
  //////////////////////////////////////////////
613
- typedef Traits traits_type;
614
- typedef CharT value_type;
615
- typedef typename real_allocator<CharT, Allocator>::type allocator_type;
616
- typedef typename ::boost::container::allocator_traits<allocator_type>::pointer pointer;
617
- typedef typename ::boost::container::allocator_traits<allocator_type>::const_pointer const_pointer;
618
- typedef typename ::boost::container::allocator_traits<allocator_type>::reference reference;
619
- typedef typename ::boost::container::allocator_traits<allocator_type>::const_reference const_reference;
620
- typedef typename ::boost::container::allocator_traits<allocator_type>::size_type size_type;
621
- typedef typename ::boost::container::allocator_traits<allocator_type>::difference_type difference_type;
622
- typedef BOOST_CONTAINER_IMPDEF(allocator_type) stored_allocator_type;
623
- typedef BOOST_CONTAINER_IMPDEF(pointer) iterator;
624
- typedef BOOST_CONTAINER_IMPDEF(const_pointer) const_iterator;
625
- typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<iterator>) reverse_iterator;
626
- typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<const_iterator>) const_reverse_iterator;
627
- BOOST_STATIC_CONSTEXPR size_type npos = size_type(-1);
665
+ typedef Traits traits_type;
666
+ typedef CharT value_type;
667
+ typedef typename real_allocator<CharT, Allocator>::type allocator_type;
668
+ typedef typename boost::container::allocator_traits<allocator_type>::pointer pointer;
669
+ typedef typename boost::container::allocator_traits<allocator_type>::const_pointer const_pointer;
670
+ typedef typename boost::container::allocator_traits<allocator_type>::reference reference;
671
+ typedef typename boost::container::allocator_traits<allocator_type>::const_reference const_reference;
672
+ typedef typename boost::container::allocator_traits<allocator_type>::size_type size_type;
673
+ typedef typename boost::container::allocator_traits<allocator_type>::difference_type difference_type;
674
+ typedef BOOST_CONTAINER_IMPDEF(allocator_type) stored_allocator_type;
675
+ typedef BOOST_CONTAINER_IMPDEF(pointer) iterator;
676
+ typedef BOOST_CONTAINER_IMPDEF(const_pointer) const_iterator;
677
+ typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<iterator>) reverse_iterator;
678
+ typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<const_iterator>) const_reverse_iterator;
679
+ static const size_type npos = size_type(-1);
628
680
 
629
681
  #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
682
+
683
+ typedef typename base_t::alloc_size_type alloc_size_type;
684
+ typedef typename base_t::options_type options_type;
685
+ typedef typename base_t::growth_factor_type growth_factor_type;
686
+ typedef typename base_t::stored_size_type stored_size_type;
687
+
630
688
  private:
631
689
 
632
690
  //`allocator_type::value_type` must match container's `value type`. If this
@@ -655,6 +713,11 @@ class basic_string
655
713
  , n + 1)
656
714
  { this->priv_terminate_string(); }
657
715
 
716
+ #if !defined( BOOST_NO_CXX11_NULLPTR )
717
+ BOOST_DELETED_FUNCTION(basic_string( decltype(nullptr) ))
718
+ public:
719
+ #endif //!defined( BOOST_NO_CXX11_NULLPTR )
720
+
658
721
  #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
659
722
 
660
723
  //! <b>Effects</b>: Default constructs a basic_string.
@@ -716,7 +779,7 @@ class basic_string
716
779
  //! <b>Postcondition</b>: x == *this.
717
780
  //!
718
781
  //! <b>Throws</b>: If allocation throws.
719
- basic_string(const basic_string& s, const allocator_type &a)
782
+ basic_string(const basic_string& s, const BOOST_CONTAINER_DOC1ST(allocator_type, typename dtl::type_identity<allocator_type>::type) &a)
720
783
  : base_t(a)
721
784
  {
722
785
  this->priv_terminate_string();
@@ -729,7 +792,7 @@ class basic_string
729
792
  //! <b>Throws</b>: If allocation throws.
730
793
  //!
731
794
  //! <b>Complexity</b>: Constant if a == s.get_allocator(), linear otherwise.
732
- basic_string(BOOST_RV_REF(basic_string) s, const allocator_type &a)
795
+ basic_string(BOOST_RV_REF(basic_string) s, const BOOST_CONTAINER_DOC1ST(allocator_type, typename dtl::type_identity<allocator_type>::type) &a)
733
796
  : base_t(a)
734
797
  {
735
798
  this->priv_terminate_string();
@@ -773,7 +836,7 @@ class basic_string
773
836
  : base_t()
774
837
  {
775
838
  this->priv_terminate_string();
776
- this->assign(s, s + difference_type(n));
839
+ this->assign(s, n); // assign checks for s != 0
777
840
  }
778
841
 
779
842
  //! <b>Effects</b>: Constructs a basic_string taking the allocator as parameter,
@@ -782,7 +845,7 @@ class basic_string
782
845
  : base_t(a)
783
846
  {
784
847
  this->priv_terminate_string();
785
- this->assign(s, s + difference_type(n));
848
+ this->assign(s, n); // assign checks for s != 0
786
849
  }
787
850
 
788
851
  //! <b>Effects</b>: Constructs a basic_string with a default-constructed allocator,
@@ -790,6 +853,7 @@ class basic_string
790
853
  basic_string(const CharT* s)
791
854
  : base_t()
792
855
  {
856
+ BOOST_ASSERT(s != 0);
793
857
  this->priv_terminate_string();
794
858
  this->assign(s, s + Traits::length(s));
795
859
  }
@@ -799,6 +863,7 @@ class basic_string
799
863
  basic_string(const CharT* s, const allocator_type& a)
800
864
  : base_t(a)
801
865
  {
866
+ BOOST_ASSERT(s != 0);
802
867
  this->priv_terminate_string();
803
868
  this->assign(s, s + Traits::length(s));
804
869
  }
@@ -843,7 +908,10 @@ class basic_string
843
908
  //! <b>Effects</b>: Constructs a basic_string with a default-constructed allocator,
844
909
  //! and a range of iterators.
845
910
  template <class InputIterator>
846
- basic_string(InputIterator f, InputIterator l)
911
+ basic_string(InputIterator f, InputIterator l
912
+ BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename dtl::disable_if_c
913
+ < dtl::is_convertible<InputIterator BOOST_MOVE_I size_type>::value
914
+ BOOST_MOVE_I dtl::nat >::type * = 0))
847
915
  : base_t()
848
916
  {
849
917
  this->priv_terminate_string();
@@ -853,7 +921,10 @@ class basic_string
853
921
  //! <b>Effects</b>: Constructs a basic_string taking the allocator as parameter,
854
922
  //! and a range of iterators.
855
923
  template <class InputIterator>
856
- basic_string(InputIterator f, InputIterator l, const allocator_type& a)
924
+ basic_string(InputIterator f, InputIterator l, const allocator_type& a
925
+ BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename dtl::disable_if_c
926
+ < dtl::is_convertible<InputIterator BOOST_MOVE_I size_type>::value
927
+ BOOST_MOVE_I dtl::nat >::type * = 0))
857
928
  : base_t(a)
858
929
  {
859
930
  this->priv_terminate_string();
@@ -932,7 +1003,9 @@ class basic_string
932
1003
  //! <b>Effects</b>: Assignment from a null-terminated c-string.
933
1004
  //!
934
1005
  basic_string& operator=(const CharT* s)
935
- { return this->assign(s, s + Traits::length(s)); }
1006
+ {
1007
+ return this->assign(s); // assign checks for s != 0
1008
+ }
936
1009
 
937
1010
  //! <b>Effects</b>: Returns *this = basic_string(1, c).
938
1011
  //!
@@ -959,7 +1032,7 @@ class basic_string
959
1032
  //! <b>Throws</b>: If allocator's copy constructor throws.
960
1033
  //!
961
1034
  //! <b>Complexity</b>: Constant.
962
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1035
+ BOOST_CONTAINER_NODISCARD inline
963
1036
  allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW
964
1037
  { return this->alloc(); }
965
1038
 
@@ -970,7 +1043,7 @@ class basic_string
970
1043
  //! <b>Complexity</b>: Constant.
971
1044
  //!
972
1045
  //! <b>Note</b>: Non-standard extension.
973
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1046
+ BOOST_CONTAINER_NODISCARD inline
974
1047
  stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW
975
1048
  { return this->alloc(); }
976
1049
 
@@ -981,7 +1054,7 @@ class basic_string
981
1054
  //! <b>Complexity</b>: Constant.
982
1055
  //!
983
1056
  //! <b>Note</b>: Non-standard extension.
984
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1057
+ BOOST_CONTAINER_NODISCARD inline
985
1058
  const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW
986
1059
  { return this->alloc(); }
987
1060
 
@@ -996,7 +1069,7 @@ class basic_string
996
1069
  //! <b>Throws</b>: Nothing.
997
1070
  //!
998
1071
  //! <b>Complexity</b>: Constant.
999
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1072
+ BOOST_CONTAINER_NODISCARD inline
1000
1073
  iterator begin() BOOST_NOEXCEPT_OR_NOTHROW
1001
1074
  { return this->priv_addr(); }
1002
1075
 
@@ -1005,7 +1078,7 @@ class basic_string
1005
1078
  //! <b>Throws</b>: Nothing.
1006
1079
  //!
1007
1080
  //! <b>Complexity</b>: Constant.
1008
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1081
+ BOOST_CONTAINER_NODISCARD inline
1009
1082
  const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW
1010
1083
  { return this->priv_addr(); }
1011
1084
 
@@ -1014,7 +1087,7 @@ class basic_string
1014
1087
  //! <b>Throws</b>: Nothing.
1015
1088
  //!
1016
1089
  //! <b>Complexity</b>: Constant.
1017
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1090
+ BOOST_CONTAINER_NODISCARD inline
1018
1091
  iterator end() BOOST_NOEXCEPT_OR_NOTHROW
1019
1092
  { return this->priv_end_addr(); }
1020
1093
 
@@ -1023,7 +1096,7 @@ class basic_string
1023
1096
  //! <b>Throws</b>: Nothing.
1024
1097
  //!
1025
1098
  //! <b>Complexity</b>: Constant.
1026
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1099
+ BOOST_CONTAINER_NODISCARD inline
1027
1100
  const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW
1028
1101
  { return this->priv_end_addr(); }
1029
1102
 
@@ -1033,7 +1106,7 @@ class basic_string
1033
1106
  //! <b>Throws</b>: Nothing.
1034
1107
  //!
1035
1108
  //! <b>Complexity</b>: Constant.
1036
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1109
+ BOOST_CONTAINER_NODISCARD inline
1037
1110
  reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW
1038
1111
  { return reverse_iterator(this->priv_end_addr()); }
1039
1112
 
@@ -1043,7 +1116,7 @@ class basic_string
1043
1116
  //! <b>Throws</b>: Nothing.
1044
1117
  //!
1045
1118
  //! <b>Complexity</b>: Constant.
1046
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1119
+ BOOST_CONTAINER_NODISCARD inline
1047
1120
  const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW
1048
1121
  { return this->crbegin(); }
1049
1122
 
@@ -1053,7 +1126,7 @@ class basic_string
1053
1126
  //! <b>Throws</b>: Nothing.
1054
1127
  //!
1055
1128
  //! <b>Complexity</b>: Constant.
1056
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1129
+ BOOST_CONTAINER_NODISCARD inline
1057
1130
  reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW
1058
1131
  { return reverse_iterator(this->priv_addr()); }
1059
1132
 
@@ -1063,7 +1136,7 @@ class basic_string
1063
1136
  //! <b>Throws</b>: Nothing.
1064
1137
  //!
1065
1138
  //! <b>Complexity</b>: Constant.
1066
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1139
+ BOOST_CONTAINER_NODISCARD inline
1067
1140
  const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW
1068
1141
  { return this->crend(); }
1069
1142
 
@@ -1072,7 +1145,7 @@ class basic_string
1072
1145
  //! <b>Throws</b>: Nothing.
1073
1146
  //!
1074
1147
  //! <b>Complexity</b>: Constant.
1075
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1148
+ BOOST_CONTAINER_NODISCARD inline
1076
1149
  const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW
1077
1150
  { return this->priv_addr(); }
1078
1151
 
@@ -1081,7 +1154,7 @@ class basic_string
1081
1154
  //! <b>Throws</b>: Nothing.
1082
1155
  //!
1083
1156
  //! <b>Complexity</b>: Constant.
1084
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1157
+ BOOST_CONTAINER_NODISCARD inline
1085
1158
  const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW
1086
1159
  { return this->priv_end_addr(); }
1087
1160
 
@@ -1091,7 +1164,7 @@ class basic_string
1091
1164
  //! <b>Throws</b>: Nothing.
1092
1165
  //!
1093
1166
  //! <b>Complexity</b>: Constant.
1094
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1167
+ BOOST_CONTAINER_NODISCARD inline
1095
1168
  const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW
1096
1169
  { return const_reverse_iterator(this->priv_end_addr()); }
1097
1170
 
@@ -1101,7 +1174,7 @@ class basic_string
1101
1174
  //! <b>Throws</b>: Nothing.
1102
1175
  //!
1103
1176
  //! <b>Complexity</b>: Constant.
1104
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1177
+ BOOST_CONTAINER_NODISCARD inline
1105
1178
  const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW
1106
1179
  { return const_reverse_iterator(this->priv_addr()); }
1107
1180
 
@@ -1116,7 +1189,7 @@ class basic_string
1116
1189
  //! <b>Throws</b>: Nothing.
1117
1190
  //!
1118
1191
  //! <b>Complexity</b>: Constant.
1119
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1192
+ BOOST_CONTAINER_NODISCARD inline
1120
1193
  bool empty() const BOOST_NOEXCEPT_OR_NOTHROW
1121
1194
  { return !this->priv_size(); }
1122
1195
 
@@ -1125,7 +1198,7 @@ class basic_string
1125
1198
  //! <b>Throws</b>: Nothing.
1126
1199
  //!
1127
1200
  //! <b>Complexity</b>: Constant.
1128
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1201
+ BOOST_CONTAINER_NODISCARD inline
1129
1202
  size_type size() const BOOST_NOEXCEPT_OR_NOTHROW
1130
1203
  { return this->priv_size(); }
1131
1204
 
@@ -1134,7 +1207,7 @@ class basic_string
1134
1207
  //! <b>Throws</b>: Nothing.
1135
1208
  //!
1136
1209
  //! <b>Complexity</b>: Constant.
1137
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1210
+ BOOST_CONTAINER_NODISCARD inline
1138
1211
  size_type length() const BOOST_NOEXCEPT_OR_NOTHROW
1139
1212
  { return this->size(); }
1140
1213
 
@@ -1143,7 +1216,7 @@ class basic_string
1143
1216
  //! <b>Throws</b>: Nothing.
1144
1217
  //!
1145
1218
  //! <b>Complexity</b>: Constant
1146
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1219
+ BOOST_CONTAINER_NODISCARD inline
1147
1220
  size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW
1148
1221
  { return base_t::max_size(); }
1149
1222
 
@@ -1195,7 +1268,7 @@ class basic_string
1195
1268
  //! <b>Throws</b>: Nothing.
1196
1269
  //!
1197
1270
  //! <b>Complexity</b>: Constant.
1198
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1271
+ BOOST_CONTAINER_NODISCARD inline
1199
1272
  size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW
1200
1273
  { return this->priv_capacity(); }
1201
1274
 
@@ -1255,7 +1328,7 @@ class basic_string
1255
1328
  //! <b>Throws</b>: Nothing.
1256
1329
  //!
1257
1330
  //! <b>Complexity</b>: Constant.
1258
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1331
+ BOOST_CONTAINER_NODISCARD inline
1259
1332
  reference front() BOOST_NOEXCEPT_OR_NOTHROW
1260
1333
  {
1261
1334
  BOOST_ASSERT(!this->empty());
@@ -1270,7 +1343,7 @@ class basic_string
1270
1343
  //! <b>Throws</b>: Nothing.
1271
1344
  //!
1272
1345
  //! <b>Complexity</b>: Constant.
1273
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1346
+ BOOST_CONTAINER_NODISCARD inline
1274
1347
  const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW
1275
1348
  {
1276
1349
  BOOST_ASSERT(!this->empty());
@@ -1285,7 +1358,7 @@ class basic_string
1285
1358
  //! <b>Throws</b>: Nothing.
1286
1359
  //!
1287
1360
  //! <b>Complexity</b>: Constant.
1288
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1361
+ BOOST_CONTAINER_NODISCARD inline
1289
1362
  reference back() BOOST_NOEXCEPT_OR_NOTHROW
1290
1363
  {
1291
1364
  BOOST_ASSERT(!this->empty());
@@ -1300,14 +1373,14 @@ class basic_string
1300
1373
  //! <b>Throws</b>: Nothing.
1301
1374
  //!
1302
1375
  //! <b>Complexity</b>: Constant.
1303
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1376
+ BOOST_CONTAINER_NODISCARD inline
1304
1377
  const_reference back() const BOOST_NOEXCEPT_OR_NOTHROW
1305
1378
  {
1306
1379
  BOOST_ASSERT(!this->empty());
1307
1380
  return *(this->priv_addr() + (this->size() - 1u) );
1308
1381
  }
1309
1382
 
1310
- //! <b>Requires</b>: size() > n.
1383
+ //! <b>Requires</b>: size() >= n.
1311
1384
  //!
1312
1385
  //! <b>Effects</b>: Returns a reference to the nth element
1313
1386
  //! from the beginning of the container.
@@ -1315,14 +1388,14 @@ class basic_string
1315
1388
  //! <b>Throws</b>: Nothing.
1316
1389
  //!
1317
1390
  //! <b>Complexity</b>: Constant.
1318
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1391
+ BOOST_CONTAINER_NODISCARD inline
1319
1392
  reference operator[](size_type n) BOOST_NOEXCEPT_OR_NOTHROW
1320
1393
  {
1321
- BOOST_ASSERT(this->size() > n);
1394
+ BOOST_ASSERT(this->size() >= n);
1322
1395
  return *(this->priv_addr() + difference_type(n));
1323
1396
  }
1324
1397
 
1325
- //! <b>Requires</b>: size() > n.
1398
+ //! <b>Requires</b>: size() >= n.
1326
1399
  //!
1327
1400
  //! <b>Effects</b>: Returns a const reference to the nth element
1328
1401
  //! from the beginning of the container.
@@ -1330,10 +1403,10 @@ class basic_string
1330
1403
  //! <b>Throws</b>: Nothing.
1331
1404
  //!
1332
1405
  //! <b>Complexity</b>: Constant.
1333
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1406
+ BOOST_CONTAINER_NODISCARD inline
1334
1407
  const_reference operator[](size_type n) const BOOST_NOEXCEPT_OR_NOTHROW
1335
1408
  {
1336
- BOOST_ASSERT(this->size() > n);
1409
+ BOOST_ASSERT(this->size() >= n);
1337
1410
  return *(this->priv_addr() + difference_type(n));
1338
1411
  }
1339
1412
 
@@ -1345,7 +1418,7 @@ class basic_string
1345
1418
  //! <b>Throws</b>: range_error if n >= size()
1346
1419
  //!
1347
1420
  //! <b>Complexity</b>: Constant.
1348
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1421
+ BOOST_CONTAINER_NODISCARD inline
1349
1422
  reference at(size_type n)
1350
1423
  {
1351
1424
  if (n >= this->size())
@@ -1361,7 +1434,7 @@ class basic_string
1361
1434
  //! <b>Throws</b>: range_error if n >= size()
1362
1435
  //!
1363
1436
  //! <b>Complexity</b>: Constant.
1364
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
1437
+ BOOST_CONTAINER_NODISCARD inline
1365
1438
  const_reference at(size_type n) const {
1366
1439
  if (n >= this->size())
1367
1440
  throw_out_of_range("basic_string::at invalid subscript");
@@ -1392,7 +1465,9 @@ class basic_string
1392
1465
  //!
1393
1466
  //! <b>Returns</b>: *this
1394
1467
  basic_string& operator+=(const CharT* s)
1395
- { return this->append(s); }
1468
+ {
1469
+ return this->append(s); //append checks for s != 0
1470
+ }
1396
1471
 
1397
1472
  //! <b>Effects</b>: Calls append(1, c).
1398
1473
  //!
@@ -1437,6 +1512,23 @@ class basic_string
1437
1512
  s.begin() + pos + dtl::min_value(n, s.size() - pos));
1438
1513
  }
1439
1514
 
1515
+ //! <b>Requires</b>: pos <= sv.size()
1516
+ //!
1517
+ //! <b>Effects</b>: Determines the effective length rlen of the string to append
1518
+ //! as the smaller of n and sv.size() - pos and calls append(sv.data() + pos, rlen).
1519
+ //!
1520
+ //! <b>Throws</b>: If memory allocation throws and out_of_range if pos > sv.size()
1521
+ //!
1522
+ //! <b>Returns</b>: *this
1523
+ template<template<class, class> class BasicStringView>
1524
+ basic_string& append(BasicStringView<CharT, Traits> sv, size_type pos, size_type n = npos)
1525
+ {
1526
+ if (pos > sv.size())
1527
+ throw_out_of_range("basic_string::append out of range position");
1528
+ return this->append(sv.begin() + pos,
1529
+ sv.begin() + pos + dtl::min_value(n, sv.size() - pos));
1530
+ }
1531
+
1440
1532
  //! <b>Requires</b>: s points to an array of at least n elements of CharT.
1441
1533
  //!
1442
1534
  //! <b>Effects</b>: The function replaces the string controlled by *this with
@@ -1448,7 +1540,10 @@ class basic_string
1448
1540
  //!
1449
1541
  //! <b>Returns</b>: *this
1450
1542
  basic_string& append(const CharT* s, size_type n)
1451
- { return this->append(s, s + difference_type(n)); }
1543
+ {
1544
+ BOOST_ASSERT(s != 0);
1545
+ return this->append(s, s + difference_type(n));
1546
+ }
1452
1547
 
1453
1548
  //! <b>Requires</b>: s points to an array of at least traits::length(s) + 1 elements of CharT.
1454
1549
  //!
@@ -1456,7 +1551,10 @@ class basic_string
1456
1551
  //!
1457
1552
  //! <b>Returns</b>: *this
1458
1553
  basic_string& append(const CharT* s)
1459
- { return this->append(s, s + Traits::length(s)); }
1554
+ {
1555
+ BOOST_ASSERT(s != 0);
1556
+ return this->append(s, s + Traits::length(s));
1557
+ }
1460
1558
 
1461
1559
  //! <b>Effects</b>: Equivalent to append(basic_string(n, c)).
1462
1560
  //!
@@ -1474,11 +1572,11 @@ class basic_string
1474
1572
  { this->insert(this->end(), first, last); return *this; }
1475
1573
 
1476
1574
  #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
1477
- //! <b>Effects</b>: Returns append(il.begin(), il.size()).
1575
+ //! <b>Effects</b>: Returns append(il.begin(), il.end()).
1478
1576
  //!
1479
1577
  basic_string& append(std::initializer_list<CharT> il)
1480
1578
  {
1481
- return this->append(il.begin(), il.size());
1579
+ return this->append(il.begin(), il.end());
1482
1580
  }
1483
1581
  #endif
1484
1582
 
@@ -1499,12 +1597,18 @@ class basic_string
1499
1597
  }
1500
1598
  }
1501
1599
 
1502
- //! <b>Effects</b>: Equivalent to assign(str, 0, npos).
1600
+ //! <b>Effects</b>: return *this = s;
1503
1601
  //!
1504
1602
  //! <b>Returns</b>: *this
1505
1603
  basic_string& assign(const basic_string& s)
1506
1604
  { return this->operator=(s); }
1507
1605
 
1606
+ //! <b>Effects</b>: return *this = move(s);
1607
+ //!
1608
+ //! <b>Returns</b>: *this
1609
+ basic_string& assign(BOOST_RV_REF(basic_string) s) BOOST_NOEXCEPT_OR_NOTHROW
1610
+ { return this->operator=(boost::move(s)); }
1611
+
1508
1612
  //! <b>Effects</b>: Equivalent to return assign(sv.data(), sv.size()).
1509
1613
  //!
1510
1614
  //! <b>Returns</b>: *this
@@ -1512,15 +1616,22 @@ class basic_string
1512
1616
  basic_string& assign(BasicStringView<CharT, Traits> sv)
1513
1617
  { return this->operator=(sv); }
1514
1618
 
1515
- //! <b>Effects</b>: The function replaces the string controlled by *this
1516
- //! with a string of length str.size() whose elements are a copy of the string
1517
- //! controlled by str. Leaves str in a valid but unspecified state.
1619
+ //! <b>Requires</b>: pos <= sv.size()
1518
1620
  //!
1519
- //! <b>Throws</b>: Nothing
1621
+ //! <b>Effects</b>: Determines the effective length rlen of the string to assign as
1622
+ //! the smaller of n and sv.size() - pos and calls assign(sv.data() + pos rlen).
1623
+ //!
1624
+ //! <b>Throws</b>: If memory allocation throws or out_of_range if pos > sv.size().
1520
1625
  //!
1521
1626
  //! <b>Returns</b>: *this
1522
- basic_string& assign(BOOST_RV_REF(basic_string) ms) BOOST_NOEXCEPT_OR_NOTHROW
1523
- { return this->swap_data(ms), *this; }
1627
+ template<template <class, class> class BasicStringView>
1628
+ basic_string& assign(BasicStringView<CharT, Traits> sv, size_type pos, size_type n = npos)
1629
+ {
1630
+ if (pos > sv.size())
1631
+ throw_out_of_range("basic_string::assign out of range position");
1632
+ return this->assign(sv.begin() + pos,
1633
+ sv.begin() + pos + dtl::min_value(n, sv.size() - pos));
1634
+ }
1524
1635
 
1525
1636
  //! <b>Requires</b>: pos <= str.size()
1526
1637
  //!
@@ -1530,7 +1641,7 @@ class basic_string
1530
1641
  //! <b>Throws</b>: If memory allocation throws or out_of_range if pos > str.size().
1531
1642
  //!
1532
1643
  //! <b>Returns</b>: *this
1533
- basic_string& assign(const basic_string& s, size_type pos, size_type n)
1644
+ basic_string& assign(const basic_string& s, size_type pos, size_type n = npos)
1534
1645
  {
1535
1646
  if (pos > s.size())
1536
1647
  throw_out_of_range("basic_string::assign out of range position");
@@ -1547,7 +1658,10 @@ class basic_string
1547
1658
  //!
1548
1659
  //! <b>Returns</b>: *this
1549
1660
  basic_string& assign(const CharT* s, size_type n)
1550
- { return this->assign(s, s + difference_type(n)); }
1661
+ {
1662
+ BOOST_ASSERT(s != 0);
1663
+ return this->assign(s, s + difference_type(n));
1664
+ }
1551
1665
 
1552
1666
  //! <b>Requires</b>: s points to an array of at least traits::length(s) + 1 elements of CharT.
1553
1667
  //!
@@ -1555,7 +1669,10 @@ class basic_string
1555
1669
  //!
1556
1670
  //! <b>Returns</b>: *this
1557
1671
  basic_string& assign(const CharT* s)
1558
- { return this->assign(s, s + Traits::length(s)); }
1672
+ {
1673
+ BOOST_ASSERT(s != 0);
1674
+ return this->assign(s, s + Traits::length(s));
1675
+ }
1559
1676
 
1560
1677
  //! <b>Effects</b>: Equivalent to assign(basic_string(n, c)).
1561
1678
  //!
@@ -1570,7 +1687,7 @@ class basic_string
1570
1687
  {
1571
1688
  size_type n = static_cast<size_type>(last - first);
1572
1689
  this->reserve(n);
1573
- CharT* ptr = boost::movelib::to_raw_pointer(this->priv_addr());
1690
+ CharT* const ptr = boost::movelib::to_raw_pointer(this->priv_addr());
1574
1691
  Traits::copy(ptr, first, n);
1575
1692
  this->priv_construct_null(ptr + difference_type(n));
1576
1693
  this->priv_size(n);
@@ -1605,11 +1722,11 @@ class basic_string
1605
1722
  }
1606
1723
 
1607
1724
  #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
1608
- //! <b>Effects</b>: Returns assign(il.begin(), il.size()).
1725
+ //! <b>Effects</b>: Returns assign(il.begin(), il.end()).
1609
1726
  //!
1610
1727
  basic_string& assign(std::initializer_list<CharT> il)
1611
1728
  {
1612
- return this->assign(il.begin(), il.size());
1729
+ return this->assign(il.begin(), il.end());
1613
1730
  }
1614
1731
  #endif
1615
1732
 
@@ -1667,6 +1784,7 @@ class basic_string
1667
1784
  //! <b>Returns</b>: *this
1668
1785
  basic_string& insert(size_type pos, const CharT* s, size_type n)
1669
1786
  {
1787
+ BOOST_ASSERT(s != 0);
1670
1788
  if (pos > this->size())
1671
1789
  throw_out_of_range("basic_string::insert out of range position");
1672
1790
  if (this->size() > this->max_size() - n)
@@ -1685,6 +1803,7 @@ class basic_string
1685
1803
  //! <b>Returns</b>: *this
1686
1804
  basic_string& insert(size_type pos, const CharT* s)
1687
1805
  {
1806
+ BOOST_ASSERT(s != 0);
1688
1807
  if (pos > this->size())
1689
1808
  throw_out_of_range("basic_string::insert out of range position");
1690
1809
  size_type len = Traits::length(s);
@@ -1716,6 +1835,31 @@ class basic_string
1716
1835
  basic_string& insert(size_type pos, BasicStringView<CharT, Traits> sv)
1717
1836
  { return this->insert(pos, sv.data(), sv.size()); }
1718
1837
 
1838
+
1839
+ //! <b>Requires</b>: pos1 <= size() and pos2 <= sv.size()
1840
+ //!
1841
+ //! <b>Effects</b>: Determines the effective length rlen of the string to insert as
1842
+ //! the smaller of n and sv.size() - pos2 and calls insert(pos1, sv.data() + pos2, rlen).
1843
+ //!
1844
+ //! <b>Throws</b>: If memory allocation throws or out_of_range if pos1 > size() or pos2 > sv.size().
1845
+ //!
1846
+ //! <b>Returns</b>: *this
1847
+ template<template<class, class> class BasicStringView>
1848
+ basic_string& insert(size_type pos1, BasicStringView<CharT, Traits> sv, size_type pos2, size_type n = npos)
1849
+ {
1850
+ const size_type sz = this->size();
1851
+ const size_type str_size = sv.size();
1852
+ if (pos1 > sz || pos2 > str_size)
1853
+ throw_out_of_range("basic_string::insert out of range position");
1854
+ size_type len = dtl::min_value(n, str_size - pos2);
1855
+ if (sz > this->max_size() - len)
1856
+ throw_length_error("basic_string::insert max_size() exceeded");
1857
+ const CharT *beg_ptr = boost::movelib::to_raw_pointer(sv.begin()) + pos2;
1858
+ const CharT *end_ptr = beg_ptr + len;
1859
+ this->insert(this->priv_addr() + pos1, beg_ptr, end_ptr);
1860
+ return *this;
1861
+ }
1862
+
1719
1863
  //! <b>Requires</b>: p is a valid iterator on *this.
1720
1864
  //!
1721
1865
  //! <b>Effects</b>: inserts a copy of c before the character referred to by p.
@@ -1773,28 +1917,27 @@ class basic_string
1773
1917
  if (first != last) {
1774
1918
  const size_type n = boost::container::iterator_udistance(first, last);
1775
1919
  const size_type old_size = this->priv_size();
1776
- const size_type remaining = this->capacity() - old_size;
1920
+ const size_type old_cap = this->capacity();
1921
+ const size_type remaining = old_cap - old_size;
1777
1922
  const pointer old_start = this->priv_addr();
1778
- bool enough_capacity = false;
1779
- size_type new_cap = 0;
1923
+ size_type new_storage = 0;
1780
1924
 
1781
1925
  //Check if we have enough capacity
1782
1926
  pointer hint = pointer();
1783
1927
  pointer allocation_ret = pointer();
1784
- if (remaining >= n){
1785
- enough_capacity = true;
1786
- }
1787
- else {
1928
+ bool enough_capacity = remaining >= n;
1929
+
1930
+ if (!enough_capacity) {
1788
1931
  //Otherwise expand current buffer or allocate new storage
1789
- new_cap = this->next_capacity(n);
1932
+ new_storage = this->next_storage(n, old_cap+1u);
1790
1933
  hint = old_start;
1791
1934
  allocation_ret = this->allocation_command
1792
- (allocate_new | expand_fwd | expand_bwd, old_size + n + 1u, new_cap, hint);
1935
+ (allocate_new | expand_fwd | expand_bwd, old_size + n + 1u, new_storage, hint);
1793
1936
 
1794
1937
  //Check forward expansion
1795
- if(old_start == allocation_ret){
1796
- enough_capacity = true;
1797
- this->priv_storage(new_cap);
1938
+ enough_capacity = old_start == allocation_ret;
1939
+ if(enough_capacity){
1940
+ this->priv_long_storage(new_storage);
1798
1941
  }
1799
1942
  }
1800
1943
 
@@ -1849,7 +1992,7 @@ class basic_string
1849
1992
  this->assure_long();
1850
1993
  this->priv_long_addr(new_start);
1851
1994
  this->priv_long_size(new_length);
1852
- this->priv_long_storage(new_cap);
1995
+ this->priv_long_storage(new_storage);
1853
1996
  }
1854
1997
  else{
1855
1998
  //value_type is POD, so backwards expansion is much easier
@@ -1868,7 +2011,7 @@ class basic_string
1868
2011
  this->assure_long();
1869
2012
  this->priv_long_addr(new_start);
1870
2013
  this->priv_long_size(old_size + n);
1871
- this->priv_long_storage(new_cap);
2014
+ this->priv_long_storage(new_storage);
1872
2015
  }
1873
2016
  }
1874
2017
  }
@@ -2053,6 +2196,7 @@ class basic_string
2053
2196
  //! <b>Returns</b>: *this
2054
2197
  basic_string& replace(size_type pos1, size_type n1, const CharT* s, size_type n2)
2055
2198
  {
2199
+ BOOST_ASSERT(s != 0);
2056
2200
  if (pos1 > this->size())
2057
2201
  throw_out_of_range("basic_string::replace out of range position");
2058
2202
  const size_type len = dtl::min_value(n1, this->size() - pos1);
@@ -2079,6 +2223,7 @@ class basic_string
2079
2223
  //! <b>Returns</b>: *this
2080
2224
  inline basic_string& replace(size_type pos, size_type n1, const CharT* s)
2081
2225
  {
2226
+ BOOST_ASSERT(s != 0);
2082
2227
  return this->replace(pos, n1, s, Traits::length(s));
2083
2228
  }
2084
2229
 
@@ -2120,7 +2265,10 @@ class basic_string
2120
2265
  //!
2121
2266
  //! <b>Returns</b>: *this
2122
2267
  inline basic_string& replace(const_iterator i1, const_iterator i2, const CharT* s, size_type n)
2123
- { return this->replace(i1, i2, s, s + difference_type(n)); }
2268
+ {
2269
+ BOOST_ASSERT(s != 0);
2270
+ return this->replace(i1, i2, s, s + difference_type(n));
2271
+ }
2124
2272
 
2125
2273
  //! <b>Requires</b>: [begin(),i1) and [i1,i2) are valid ranges and s points to an
2126
2274
  //! array of at least traits::length(s) + 1 elements of CharT.
@@ -2131,7 +2279,10 @@ class basic_string
2131
2279
  //!
2132
2280
  //! <b>Returns</b>: *this
2133
2281
  inline basic_string& replace(const_iterator i1, const_iterator i2, const CharT* s)
2134
- { return this->replace(i1, i2, s, s + Traits::length(s)); }
2282
+ {
2283
+ BOOST_ASSERT(s != 0);
2284
+ return this->replace(i1, i2, s, s + Traits::length(s));
2285
+ }
2135
2286
 
2136
2287
  //! <b>Requires</b>: [begin(),i1) and [i1,i2) are valid ranges.
2137
2288
  //!
@@ -2224,14 +2375,12 @@ class basic_string
2224
2375
  #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
2225
2376
  //! <b>Requires</b>: [begin(), i1) and [i1, i2) are valid ranges.
2226
2377
  //!
2227
- //! <b>Effects</b>: Calls replace(i1 - begin(), i2 - i1, il.begin(), il.size()).
2378
+ //! <b>Effects</b>: Calls replace(i1, i2, il.begin(), il.end()).
2228
2379
  //!
2229
2380
  //! <b>Returns</b>: *this.
2230
2381
  inline basic_string& replace(const_iterator i1, const_iterator i2, std::initializer_list<CharT> il)
2231
2382
  {
2232
- return this->replace( static_cast<size_type>(i1 - this->cbegin())
2233
- , static_cast<size_type>(i2 - i1)
2234
- , il.begin(), il.size());
2383
+ return this->replace(i1, i2, il.begin(), il.end());
2235
2384
  }
2236
2385
  #endif
2237
2386
 
@@ -2248,6 +2397,7 @@ class basic_string
2248
2397
  //! <b>Returns</b>: rlen
2249
2398
  size_type copy(CharT* s, size_type n, size_type pos = 0) const
2250
2399
  {
2400
+ BOOST_ASSERT(s != 0);
2251
2401
  if (pos > this->size())
2252
2402
  throw_out_of_range("basic_string::copy out of range position");
2253
2403
  const size_type len = dtl::min_value(n, this->size() - pos);
@@ -2279,7 +2429,7 @@ class basic_string
2279
2429
  //! <b>Returns</b>: A pointer p such that p + i == &operator[](i) for each i in [0,size()].
2280
2430
  //!
2281
2431
  //! <b>Complexity</b>: constant time.
2282
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2432
+ BOOST_CONTAINER_NODISCARD inline
2283
2433
  const CharT* c_str() const BOOST_NOEXCEPT_OR_NOTHROW
2284
2434
  { return boost::movelib::to_raw_pointer(this->priv_addr()); }
2285
2435
 
@@ -2288,14 +2438,14 @@ class basic_string
2288
2438
  //! <b>Returns</b>: A pointer p such that p + i == &operator[](i) for each i in [0,size()].
2289
2439
  //!
2290
2440
  //! <b>Complexity</b>: constant time.
2291
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2441
+ BOOST_CONTAINER_NODISCARD inline
2292
2442
  const CharT* data() const BOOST_NOEXCEPT_OR_NOTHROW
2293
2443
  { return boost::movelib::to_raw_pointer(this->priv_addr()); }
2294
2444
 
2295
2445
  //! <b>Returns</b>: A pointer p such that p + i == &operator[](i) for each i in [0,size()].
2296
2446
  //!
2297
2447
  //! <b>Complexity</b>: constant time.
2298
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2448
+ BOOST_CONTAINER_NODISCARD inline
2299
2449
  CharT* data() BOOST_NOEXCEPT_OR_NOTHROW
2300
2450
  { return boost::movelib::to_raw_pointer(this->priv_addr()); }
2301
2451
 
@@ -2315,7 +2465,7 @@ class basic_string
2315
2465
  //! <b>Note</b>: This function is available to write portable code for compilers
2316
2466
  //! that don't support templated conversion operators.
2317
2467
  template<class BasicStringView>
2318
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2468
+ BOOST_CONTAINER_NODISCARD inline
2319
2469
  BasicStringView to_view() const BOOST_NOEXCEPT_OR_NOTHROW
2320
2470
  { return BasicStringView(this->data(), this->size()); }
2321
2471
 
@@ -2333,7 +2483,7 @@ class basic_string
2333
2483
  //! <b>Throws</b>: Nothing
2334
2484
  //!
2335
2485
  //! <b>Returns</b>: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
2336
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2486
+ BOOST_CONTAINER_NODISCARD inline
2337
2487
  size_type find(const basic_string& s, size_type pos = 0) const
2338
2488
  { return find(s.c_str(), pos, s.size()); }
2339
2489
 
@@ -2346,7 +2496,7 @@ class basic_string
2346
2496
  //!
2347
2497
  //! <b>Returns</b>: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
2348
2498
  template<template <class, class> class BasicStringView>
2349
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2499
+ BOOST_CONTAINER_NODISCARD inline
2350
2500
  size_type find(BasicStringView<CharT, Traits> sv, size_type pos = 0) const
2351
2501
  { return this->find(sv.data(), pos, sv.size()); }
2352
2502
 
@@ -2355,9 +2505,10 @@ class basic_string
2355
2505
  //! <b>Throws</b>: Nothing
2356
2506
  //!
2357
2507
  //! <b>Returns</b>: find(basic_string<CharT,traits,allocator_type>(s,n),pos).
2358
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2508
+ BOOST_CONTAINER_NODISCARD inline
2359
2509
  size_type find(const CharT* s, size_type pos, size_type n) const
2360
2510
  {
2511
+ BOOST_ASSERT(s != 0);
2361
2512
  if (pos + n > this->size())
2362
2513
  return npos;
2363
2514
  else {
@@ -2376,14 +2527,17 @@ class basic_string
2376
2527
  //! <b>Throws</b>: Nothing
2377
2528
  //!
2378
2529
  //! <b>Returns</b>: find(basic_string(s), pos).
2379
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2530
+ BOOST_CONTAINER_NODISCARD inline
2380
2531
  size_type find(const CharT* s, size_type pos = 0) const
2381
- { return this->find(s, pos, Traits::length(s)); }
2532
+ {
2533
+ BOOST_ASSERT(s != 0);
2534
+ return this->find(s, pos, Traits::length(s));
2535
+ }
2382
2536
 
2383
2537
  //! <b>Throws</b>: Nothing
2384
2538
  //!
2385
2539
  //! <b>Returns</b>: find(basic_string<CharT,traits,allocator_type>(1,c), pos).
2386
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2540
+ BOOST_CONTAINER_NODISCARD inline
2387
2541
  size_type find(CharT c, size_type pos = 0) const
2388
2542
  {
2389
2543
  const size_type sz = this->size();
@@ -2407,7 +2561,7 @@ class basic_string
2407
2561
  //! <b>Throws</b>: Nothing
2408
2562
  //!
2409
2563
  //! <b>Returns</b>: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
2410
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2564
+ BOOST_CONTAINER_NODISCARD inline
2411
2565
  size_type rfind(const basic_string& str, size_type pos = npos) const
2412
2566
  { return this->rfind(str.c_str(), pos, str.size()); }
2413
2567
 
@@ -2420,7 +2574,7 @@ class basic_string
2420
2574
  //!
2421
2575
  //! <b>Returns</b>: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
2422
2576
  template<template <class, class> class BasicStringView>
2423
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2577
+ BOOST_CONTAINER_NODISCARD inline
2424
2578
  size_type rfind(BasicStringView<CharT, Traits> sv, size_type pos = npos) const
2425
2579
  { return this->rfind(sv.data(), pos, sv.size()); }
2426
2580
 
@@ -2429,9 +2583,10 @@ class basic_string
2429
2583
  //! <b>Throws</b>: Nothing
2430
2584
  //!
2431
2585
  //! <b>Returns</b>: rfind(basic_string(s, n), pos).
2432
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2586
+ BOOST_CONTAINER_NODISCARD inline
2433
2587
  size_type rfind(const CharT* s, size_type pos, size_type n) const
2434
2588
  {
2589
+ BOOST_ASSERT(s != 0);
2435
2590
  const size_type len = this->size();
2436
2591
 
2437
2592
  if (n > len)
@@ -2452,14 +2607,17 @@ class basic_string
2452
2607
  //! <b>Throws</b>: Nothing
2453
2608
  //!
2454
2609
  //! <b>Returns</b>: rfind(basic_string(s), pos).
2455
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2610
+ BOOST_CONTAINER_NODISCARD inline
2456
2611
  size_type rfind(const CharT* s, size_type pos = npos) const
2457
- { return this->rfind(s, pos, Traits::length(s)); }
2612
+ {
2613
+ BOOST_ASSERT(s != 0);
2614
+ return this->rfind(s, pos, Traits::length(s));
2615
+ }
2458
2616
 
2459
2617
  //! <b>Throws</b>: Nothing
2460
2618
  //!
2461
2619
  //! <b>Returns</b>: rfind(basic_string<CharT,traits,allocator_type>(1,c),pos).
2462
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2620
+ BOOST_CONTAINER_NODISCARD inline
2463
2621
  size_type rfind(CharT c, size_type pos = npos) const
2464
2622
  {
2465
2623
  const size_type len = this->size();
@@ -2482,7 +2640,7 @@ class basic_string
2482
2640
  //! <b>Throws</b>: Nothing
2483
2641
  //!
2484
2642
  //! <b>Returns</b>: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
2485
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2643
+ BOOST_CONTAINER_NODISCARD inline
2486
2644
  size_type find_first_of(const basic_string& str, size_type pos = 0) const
2487
2645
  { return this->find_first_of(str.c_str(), pos, str.size()); }
2488
2646
 
@@ -2494,7 +2652,7 @@ class basic_string
2494
2652
  //!
2495
2653
  //! <b>Returns</b>: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
2496
2654
  template<template <class, class> class BasicStringView>
2497
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2655
+ BOOST_CONTAINER_NODISCARD inline
2498
2656
  size_type find_first_of(BasicStringView<CharT, Traits> sv, size_type pos = 0) const
2499
2657
  { return this->find_first_of(sv.data(), pos, sv.size()); }
2500
2658
 
@@ -2503,9 +2661,10 @@ class basic_string
2503
2661
  //! <b>Throws</b>: Nothing
2504
2662
  //!
2505
2663
  //! <b>Returns</b>: find_first_of(basic_string(s, n), pos).
2506
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2664
+ BOOST_CONTAINER_NODISCARD inline
2507
2665
  size_type find_first_of(const CharT* s, size_type pos, size_type n) const
2508
2666
  {
2667
+ BOOST_ASSERT(s != 0);
2509
2668
  const size_type sz = this->size();
2510
2669
  if (pos >= sz)
2511
2670
  return npos;
@@ -2523,16 +2682,19 @@ class basic_string
2523
2682
  //! <b>Throws</b>: Nothing
2524
2683
  //!
2525
2684
  //! <b>Returns</b>: find_first_of(basic_string(s), pos).
2526
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2685
+ BOOST_CONTAINER_NODISCARD inline
2527
2686
  size_type find_first_of(const CharT* s, size_type pos = 0) const
2528
- { return this->find_first_of(s, pos, Traits::length(s)); }
2687
+ {
2688
+ BOOST_ASSERT(s != 0);
2689
+ return this->find_first_of(s, pos, Traits::length(s));
2690
+ }
2529
2691
 
2530
2692
  //! <b>Requires</b>: s points to an array of at least traits::length(s) + 1 elements of CharT.
2531
2693
  //!
2532
2694
  //! <b>Throws</b>: Nothing
2533
2695
  //!
2534
2696
  //! <b>Returns</b>: find_first_of(basic_string<CharT,traits,allocator_type>(1,c), pos).
2535
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2697
+ BOOST_CONTAINER_NODISCARD inline
2536
2698
  size_type find_first_of(CharT c, size_type pos = 0) const
2537
2699
  { return this->find(c, pos); }
2538
2700
 
@@ -2543,7 +2705,7 @@ class basic_string
2543
2705
  //! <b>Throws</b>: Nothing
2544
2706
  //!
2545
2707
  //! <b>Returns</b>: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
2546
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2708
+ BOOST_CONTAINER_NODISCARD inline
2547
2709
  size_type find_last_of(const basic_string& str, size_type pos = npos) const
2548
2710
  { return this->find_last_of(str.c_str(), pos, str.size()); }
2549
2711
 
@@ -2555,7 +2717,7 @@ class basic_string
2555
2717
  //!
2556
2718
  //! <b>Returns</b>: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
2557
2719
  template<template <class, class> class BasicStringView>
2558
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2720
+ BOOST_CONTAINER_NODISCARD inline
2559
2721
  size_type find_last_of(BasicStringView<CharT, Traits> sv, size_type pos = npos) const
2560
2722
  { return this->find_last_of(sv.data(), pos, sv.size()); }
2561
2723
 
@@ -2564,9 +2726,10 @@ class basic_string
2564
2726
  //! <b>Throws</b>: Nothing
2565
2727
  //!
2566
2728
  //! <b>Returns</b>: find_last_of(basic_string(s, n), pos).
2567
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2729
+ BOOST_CONTAINER_NODISCARD inline
2568
2730
  size_type find_last_of(const CharT* s, size_type pos, size_type n) const
2569
2731
  {
2732
+ BOOST_ASSERT(s != 0);
2570
2733
  const size_type len = this->size();
2571
2734
 
2572
2735
  if (len < 1)
@@ -2586,14 +2749,17 @@ class basic_string
2586
2749
  //! <b>Throws</b>: Nothing
2587
2750
  //!
2588
2751
  //! <b>Returns</b>: find_last_of(basic_string<CharT,traits,allocator_type>(1,c),pos).
2589
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2752
+ BOOST_CONTAINER_NODISCARD inline
2590
2753
  size_type find_last_of(const CharT* s, size_type pos = npos) const
2591
- { return this->find_last_of(s, pos, Traits::length(s)); }
2754
+ {
2755
+ BOOST_ASSERT(s != 0);
2756
+ return this->find_last_of(s, pos, Traits::length(s));
2757
+ }
2592
2758
 
2593
2759
  //! <b>Throws</b>: Nothing
2594
2760
  //!
2595
2761
  //! <b>Returns</b>: find_last_of(basic_string(s), pos).
2596
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2762
+ BOOST_CONTAINER_NODISCARD inline
2597
2763
  size_type find_last_of(CharT c, size_type pos = npos) const
2598
2764
  { return this->rfind(c, pos); }
2599
2765
 
@@ -2605,7 +2771,7 @@ class basic_string
2605
2771
  //! <b>Throws</b>: Nothing
2606
2772
  //!
2607
2773
  //! <b>Returns</b>: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
2608
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2774
+ BOOST_CONTAINER_NODISCARD inline
2609
2775
  size_type find_first_not_of(const basic_string& str, size_type pos = 0) const
2610
2776
  { return this->find_first_not_of(str.c_str(), pos, str.size()); }
2611
2777
 
@@ -2618,7 +2784,7 @@ class basic_string
2618
2784
  //!
2619
2785
  //! <b>Returns</b>: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
2620
2786
  template<template <class, class> class BasicStringView>
2621
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2787
+ BOOST_CONTAINER_NODISCARD inline
2622
2788
  size_type find_first_not_of(BasicStringView<CharT, Traits> sv, size_type pos = 0) const
2623
2789
  { return this->find_first_not_of(sv.data(), pos, sv.size()); }
2624
2790
 
@@ -2627,9 +2793,10 @@ class basic_string
2627
2793
  //! <b>Throws</b>: Nothing
2628
2794
  //!
2629
2795
  //! <b>Returns</b>: find_first_not_of(basic_string(s, n), pos).
2630
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2796
+ BOOST_CONTAINER_NODISCARD inline
2631
2797
  size_type find_first_not_of(const CharT* s, size_type pos, size_type n) const
2632
2798
  {
2799
+ BOOST_ASSERT(s != 0);
2633
2800
  if (pos > this->size())
2634
2801
  return npos;
2635
2802
  else {
@@ -2646,14 +2813,17 @@ class basic_string
2646
2813
  //! <b>Throws</b>: Nothing
2647
2814
  //!
2648
2815
  //! <b>Returns</b>: find_first_not_of(basic_string(s), pos).
2649
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2816
+ BOOST_CONTAINER_NODISCARD inline
2650
2817
  size_type find_first_not_of(const CharT* s, size_type pos = 0) const
2651
- { return this->find_first_not_of(s, pos, Traits::length(s)); }
2818
+ {
2819
+ BOOST_ASSERT(s != 0);
2820
+ return this->find_first_not_of(s, pos, Traits::length(s));
2821
+ }
2652
2822
 
2653
2823
  //! <b>Throws</b>: Nothing
2654
2824
  //!
2655
2825
  //! <b>Returns</b>: find_first_not_of(basic_string(1, c), pos).
2656
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2826
+ BOOST_CONTAINER_NODISCARD inline
2657
2827
  size_type find_first_not_of(CharT c, size_type pos = 0) const
2658
2828
  {
2659
2829
  if (pos > this->size())
@@ -2675,7 +2845,7 @@ class basic_string
2675
2845
  //! <b>Throws</b>: Nothing
2676
2846
  //!
2677
2847
  //! <b>Returns</b>: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
2678
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2848
+ BOOST_CONTAINER_NODISCARD inline
2679
2849
  size_type find_last_not_of(const basic_string& str, size_type pos = npos) const
2680
2850
  { return this->find_last_not_of(str.c_str(), pos, str.size()); }
2681
2851
 
@@ -2687,7 +2857,7 @@ class basic_string
2687
2857
  //!
2688
2858
  //! <b>Returns</b>: xpos if the function can determine such a value for xpos. Otherwise, returns npos.
2689
2859
  template<template <class, class> class BasicStringView>
2690
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2860
+ BOOST_CONTAINER_NODISCARD inline
2691
2861
  size_type find_last_not_of(BasicStringView<CharT, Traits> sv, size_type pos = npos) const
2692
2862
  { return this->find_last_not_of(sv.data(), pos, sv.size()); }
2693
2863
 
@@ -2696,9 +2866,10 @@ class basic_string
2696
2866
  //! <b>Throws</b>: Nothing
2697
2867
  //!
2698
2868
  //! <b>Returns</b>: find_last_not_of(basic_string(s, n), pos).
2699
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2869
+ BOOST_CONTAINER_NODISCARD inline
2700
2870
  size_type find_last_not_of(const CharT* s, size_type pos, size_type n) const
2701
2871
  {
2872
+ BOOST_ASSERT(s != 0);
2702
2873
  const size_type len = this->size();
2703
2874
 
2704
2875
  if (len < 1)
@@ -2717,14 +2888,17 @@ class basic_string
2717
2888
  //! <b>Throws</b>: Nothing
2718
2889
  //!
2719
2890
  //! <b>Returns</b>: find_last_not_of(basic_string(s), pos).
2720
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2891
+ BOOST_CONTAINER_NODISCARD inline
2721
2892
  size_type find_last_not_of(const CharT* s, size_type pos = npos) const
2722
- { return this->find_last_not_of(s, pos, Traits::length(s)); }
2893
+ {
2894
+ BOOST_ASSERT(s != 0);
2895
+ return this->find_last_not_of(s, pos, Traits::length(s));
2896
+ }
2723
2897
 
2724
2898
  //! <b>Throws</b>: Nothing
2725
2899
  //!
2726
2900
  //! <b>Returns</b>: find_last_not_of(basic_string(1, c), pos).
2727
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2901
+ BOOST_CONTAINER_NODISCARD inline
2728
2902
  size_type find_last_not_of(CharT c, size_type pos = npos) const
2729
2903
  {
2730
2904
  const size_type len = this->size();
@@ -2748,7 +2922,7 @@ class basic_string
2748
2922
  //! <b>Throws</b>: If memory allocation throws or out_of_range if pos > size().
2749
2923
  //!
2750
2924
  //! <b>Returns</b>: basic_string<CharT,traits,allocator_type>(data()+pos,rlen).
2751
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2925
+ BOOST_CONTAINER_NODISCARD inline
2752
2926
  basic_string substr(size_type pos = 0, size_type n = npos) const
2753
2927
  {
2754
2928
  if (pos > this->size())
@@ -2767,7 +2941,7 @@ class basic_string
2767
2941
  //! <b>Returns</b>: The nonzero result if the result of the comparison is nonzero.
2768
2942
  //! Otherwise, returns a value < 0 if size() < str.size(), a 0 value if size() == str.size(),
2769
2943
  //! and value > 0 if size() > str.size()
2770
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2944
+ BOOST_CONTAINER_NODISCARD inline
2771
2945
  int compare(const basic_string& str) const
2772
2946
  {
2773
2947
  const pointer addr = this->priv_addr();
@@ -2779,7 +2953,7 @@ class basic_string
2779
2953
  //!
2780
2954
  //! <b>Returns</b>: compare(basic_string(sv)).
2781
2955
  template<template <class, class> class BasicStringView>
2782
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2956
+ BOOST_CONTAINER_NODISCARD inline
2783
2957
  int compare(BasicStringView<CharT,Traits> sv) const
2784
2958
  {
2785
2959
  const pointer addr = this->priv_addr();
@@ -2795,7 +2969,7 @@ class basic_string
2795
2969
  //! <b>Throws</b>: out_of_range if pos1 > size()
2796
2970
  //!
2797
2971
  //! <b>Returns</b>:basic_string(*this,pos1,n1).compare(str).
2798
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2972
+ BOOST_CONTAINER_NODISCARD inline
2799
2973
  int compare(size_type pos1, size_type n1, const basic_string& str) const
2800
2974
  {
2801
2975
  if (pos1 > this->size())
@@ -2813,13 +2987,13 @@ class basic_string
2813
2987
  //!
2814
2988
  //! <b>Returns</b>:basic_string(*this,pos1,n1).compare(sv).
2815
2989
  template<template <class, class> class BasicStringView>
2816
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2990
+ BOOST_CONTAINER_NODISCARD inline
2817
2991
  int compare(size_type pos1, size_type n1, BasicStringView<CharT,Traits> sv) const
2818
2992
  {
2819
2993
  if (pos1 > this->size())
2820
2994
  throw_out_of_range("basic_string::compare out of range position");
2821
2995
  const pointer addr = this->priv_addr() + pos1;
2822
- const CharT* str_addr = sv.data();
2996
+ const CharT* const str_addr = sv.data();
2823
2997
  return this->s_compare(addr, addr + difference_type(dtl::min_value(n1, this->size() - pos1)),
2824
2998
  str_addr, str_addr + sv.size());
2825
2999
  }
@@ -2832,7 +3006,7 @@ class basic_string
2832
3006
  //! <b>Throws</b>: out_of_range if pos1 > size() or pos2 > str.size()
2833
3007
  //!
2834
3008
  //! <b>Returns</b>: basic_string(*this, pos1, n1).compare(basic_string(str, pos2, n2)).
2835
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
3009
+ BOOST_CONTAINER_NODISCARD inline
2836
3010
  int compare(size_type pos1, size_type n1, const basic_string& str, size_type pos2, size_type n2 = npos) const
2837
3011
  {
2838
3012
  if (pos1 > this->size() || pos2 > str.size())
@@ -2852,8 +3026,8 @@ class basic_string
2852
3026
  //!
2853
3027
  //! <b>Returns</b>: basic_string(*this, pos1, n1).compare(BasicStringView<CharT, Traits>(sv, pos2, n2)).
2854
3028
  template<template <class, class> class BasicStringView>
2855
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
2856
- int compare(size_type pos1, size_type n1, BasicStringView<CharT,Traits> sv, size_type pos2, size_type n2) const
3029
+ BOOST_CONTAINER_NODISCARD inline
3030
+ int compare(size_type pos1, size_type n1, BasicStringView<CharT,Traits> sv, size_type pos2, size_type n2 = npos) const
2857
3031
  {
2858
3032
  if (pos1 > this->size() || pos2 > sv.size())
2859
3033
  throw_out_of_range("basic_string::compare out of range position");
@@ -2866,10 +3040,11 @@ class basic_string
2866
3040
  //! <b>Throws</b>: Nothing
2867
3041
  //!
2868
3042
  //! <b>Returns</b>: compare(basic_string(s)).
2869
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
3043
+ BOOST_CONTAINER_NODISCARD inline
2870
3044
  int compare(const CharT* s) const
2871
3045
  {
2872
- const pointer addr = this->priv_addr();
3046
+ BOOST_ASSERT(s != 0);
3047
+ const_pointer const addr = this->priv_addr();
2873
3048
  return this->s_compare(addr, addr + difference_type(this->priv_size()), s, s + Traits::length(s));
2874
3049
  }
2875
3050
 
@@ -2878,9 +3053,10 @@ class basic_string
2878
3053
  //! <b>Throws</b>: out_of_range if pos1 > size()
2879
3054
  //!
2880
3055
  //! <b>Returns</b>: basic_string(*this, pos, n1).compare(basic_string(s, n2)).
2881
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
3056
+ BOOST_CONTAINER_NODISCARD inline
2882
3057
  int compare(size_type pos1, size_type n1, const CharT* s, size_type n2) const
2883
3058
  {
3059
+ BOOST_ASSERT(s != 0);
2884
3060
  if (pos1 > this->size())
2885
3061
  throw_out_of_range("basic_string::compare out of range position");
2886
3062
  const pointer addr = this->priv_addr();
@@ -2894,9 +3070,116 @@ class basic_string
2894
3070
  //! <b>Throws</b>: out_of_range if pos1 > size()
2895
3071
  //!
2896
3072
  //! <b>Returns</b>: basic_string(*this, pos, n1).compare(basic_string(s, n2)).
2897
- BOOST_CONTAINER_ATTRIBUTE_NODISCARD inline
3073
+ BOOST_CONTAINER_NODISCARD inline
2898
3074
  int compare(size_type pos1, size_type n1, const CharT* s) const
2899
- { return this->compare(pos1, n1, s, Traits::length(s)); }
3075
+ {
3076
+ BOOST_ASSERT(s != 0);
3077
+ return this->compare(pos1, n1, s, Traits::length(s));
3078
+ }
3079
+
3080
+ //! <b>Effects</b>: Equivalent to find(sv) != npos
3081
+ //!
3082
+ //! <b>Throws</b>: Nothing
3083
+ //!
3084
+ //! <b>Returns</b>: true if the string contains the provided substring, false otherwise.
3085
+ template<template <class, class> class BasicStringView>
3086
+ BOOST_CONTAINER_NODISCARD inline
3087
+ bool contains(BasicStringView<CharT, Traits> sv) const BOOST_NOEXCEPT
3088
+ { return this->find(sv) != npos; }
3089
+
3090
+ //! <b>Effects</b>: Equivalent to find(c) != npos
3091
+ //!
3092
+ //! <b>Throws</b>: Nothing
3093
+ //!
3094
+ //! <b>Returns</b>: true if the string contains the provided substring, false otherwise.
3095
+ BOOST_CONTAINER_NODISCARD inline
3096
+ bool contains(CharT c) const BOOST_NOEXCEPT
3097
+ { return this->find(c) != npos; }
3098
+
3099
+ //! <b>Effects</b>: Equivalent to find(c) != npos
3100
+ //!
3101
+ //! <b>Throws</b>: Nothing
3102
+ //!
3103
+ //! <b>Returns</b>: true if the string contains the provided substring, false otherwise.
3104
+ BOOST_CONTAINER_NODISCARD inline
3105
+ bool contains(const CharT* s) const BOOST_NOEXCEPT
3106
+ {
3107
+ return this->find(s) != npos; //find checks s != 0
3108
+ }
3109
+
3110
+ //! <b>Effects</b>: Checks if the string begins with the given prefix
3111
+ //!
3112
+ //! <b>Throws</b>: Nothing
3113
+ //!
3114
+ //! <b>Returns</b>: true if the string begins with the provided prefix, false otherwise.
3115
+ template<template <class, class> class BasicStringView>
3116
+ BOOST_CONTAINER_NODISCARD inline
3117
+ bool starts_with(BasicStringView<CharT, Traits> sv) const BOOST_NOEXCEPT
3118
+ {
3119
+ const std::size_t s_sz = sv.size();
3120
+ const std::size_t t_sz = this->size();
3121
+ return t_sz >= s_sz && Traits::compare(this->data(), sv.data(), s_sz) == 0;
3122
+ }
3123
+
3124
+ //! <b>Effects</b>: Checks if the string begins with the given prefix
3125
+ //!
3126
+ //! <b>Throws</b>: Nothing
3127
+ //!
3128
+ //! <b>Returns</b>: true if the string begins with the provided prefix, false otherwise.
3129
+ BOOST_CONTAINER_NODISCARD inline
3130
+ bool starts_with(CharT c) const BOOST_NOEXCEPT
3131
+ { return !empty() && Traits::eq(front(), c); }
3132
+
3133
+ //! <b>Effects</b>: Checks if the string begins with the given prefix
3134
+ //!
3135
+ //! <b>Throws</b>: Nothing
3136
+ //!
3137
+ //! <b>Returns</b>: true if the string begins with the provided prefix, false otherwise.
3138
+ BOOST_CONTAINER_NODISCARD inline
3139
+ bool starts_with(const CharT* s) const BOOST_NOEXCEPT
3140
+ {
3141
+ BOOST_ASSERT(s != 0);
3142
+ const std::size_t s_sz = Traits::length(s);
3143
+ const std::size_t t_sz = this->size();
3144
+ return t_sz >= s_sz && Traits::compare(this->data(), s, s_sz) == 0;
3145
+ }
3146
+
3147
+ //! <b>Effects</b>: Checks if the string begins with the given suffix
3148
+ //!
3149
+ //! <b>Throws</b>: Nothing
3150
+ //!
3151
+ //! <b>Returns</b>: true if the string begins with the provided suffix, false otherwise.
3152
+ template<template <class, class> class BasicStringView>
3153
+ BOOST_CONTAINER_NODISCARD inline
3154
+ bool ends_with(BasicStringView<CharT, Traits> sv) const BOOST_NOEXCEPT
3155
+ {
3156
+ const std::size_t s_sz = sv.size();
3157
+ const std::size_t t_sz = this->size();
3158
+ return t_sz >= s_sz && Traits::compare(this->data() + std::ptrdiff_t(t_sz - s_sz), sv.data(), s_sz) == 0;
3159
+ }
3160
+
3161
+ //! <b>Effects</b>: Checks if the string begins with the given suffix
3162
+ //!
3163
+ //! <b>Throws</b>: Nothing
3164
+ //!
3165
+ //! <b>Returns</b>: true if the string begins with the provided suffix, false otherwise.
3166
+ BOOST_CONTAINER_NODISCARD inline
3167
+ bool ends_with(CharT c) const BOOST_NOEXCEPT
3168
+ { return !empty() && Traits::eq(back(), c); }
3169
+
3170
+ //! <b>Effects</b>: Checks if the string begins with the given suffix
3171
+ //!
3172
+ //! <b>Throws</b>: Nothing
3173
+ //!
3174
+ //! <b>Returns</b>: true if the string begins with the provided suffix, false otherwise.
3175
+ BOOST_CONTAINER_NODISCARD inline
3176
+ bool ends_with(const CharT* s) const BOOST_NOEXCEPT
3177
+ {
3178
+ BOOST_ASSERT(s != 0);
3179
+ const std::size_t s_sz = Traits::length(s);
3180
+ const std::size_t t_sz = this->size();
3181
+ return t_sz >= s_sz && Traits::compare(this->data() + std::ptrdiff_t(t_sz - s_sz), s, s_sz) == 0;
3182
+ }
2900
3183
 
2901
3184
  #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
2902
3185
  private:
@@ -2934,9 +3217,9 @@ class basic_string
2934
3217
  if (do_alloc){
2935
3218
  //size_type n = dtl::max_value(res_arg, this->size()) + 1;
2936
3219
  size_type n = res_arg + 1;
2937
- size_type new_cap = this->next_capacity(n);
3220
+ size_type new_storage = this->next_storage(n, this->priv_storage());
2938
3221
  pointer reuse = 0;
2939
- pointer new_start = this->allocation_command(allocate_new, n, new_cap, reuse);
3222
+ pointer new_start = this->allocation_command(allocate_new, n, new_storage, reuse);
2940
3223
 
2941
3224
  const pointer addr = this->priv_addr();
2942
3225
  size_type new_length = priv_uninitialized_copy
@@ -2945,7 +3228,7 @@ class basic_string
2945
3228
  this->assure_long();
2946
3229
  this->priv_long_addr(new_start);
2947
3230
  this->priv_long_size(new_length);
2948
- this->priv_storage(new_cap);
3231
+ this->priv_long_storage(new_storage);
2949
3232
  }
2950
3233
  return do_alloc;
2951
3234
  }
@@ -2987,7 +3270,7 @@ class basic_string
2987
3270
  , boost::movelib::to_raw_pointer(this->priv_long_addr())
2988
3271
  , long_size+1);
2989
3272
  this->priv_long_addr(ret);
2990
- this->priv_storage(real_cap);
3273
+ this->priv_long_storage(real_cap);
2991
3274
  //And release old buffer
2992
3275
  this->alloc().deallocate(long_addr, long_storage);
2993
3276
  }
@@ -3037,7 +3320,7 @@ class basic_string
3037
3320
  Traits::assign(*result, *first);
3038
3321
  }
3039
3322
 
3040
- static inline void priv_copy(const CharT* first, const CharT* last, CharT* result)
3323
+ static inline void priv_copy( const CharT* first, const CharT* last, CharT* result)
3041
3324
  { Traits::copy(result, first, std::size_t(last - first)); }
3042
3325
 
3043
3326
  template <class Integer>
@@ -3060,10 +3343,16 @@ class basic_string
3060
3343
 
3061
3344
  #ifndef BOOST_CONTAINER_NO_CXX17_CTAD
3062
3345
 
3346
+ //! <b>Deduction guide</b>: allows a `basic_string` to be constructed from the
3347
+ //! iterator range <code>[first, last)</code>, deducing the character type from the
3348
+ //! value type of `InputIterator` and using the default allocator.
3063
3349
  template <typename InputIterator>
3064
3350
  basic_string(InputIterator, InputIterator) ->
3065
3351
  basic_string<typename iterator_traits<InputIterator>::value_type>;
3066
3352
 
3353
+ //! <b>Deduction guide</b>: allows a `basic_string` to be constructed from the
3354
+ //! iterator range <code>[first, last)</code>, deducing the character type from the
3355
+ //! value type of `InputIterator` and taking the allocator type from the supplied allocator.
3067
3356
  template <typename InputIterator, typename Allocator>
3068
3357
  basic_string(InputIterator, InputIterator, Allocator const&) ->
3069
3358
  basic_string<typename iterator_traits<InputIterator>::value_type, Allocator>;
@@ -3090,6 +3379,10 @@ wstring;
3090
3379
 
3091
3380
  #else
3092
3381
 
3382
+ template <class CharT, class Traits, class Allocator, class Options>
3383
+ const typename basic_string<CharT, Traits, Allocator, Options>::size_type
3384
+ basic_string<CharT, Traits, Allocator, Options>::npos;
3385
+
3093
3386
  template<class S>
3094
3387
  struct is_string
3095
3388
  {
@@ -3109,12 +3402,12 @@ struct is_string< basic_string<C, T, A> >
3109
3402
 
3110
3403
  // Operator+
3111
3404
 
3112
- template <class CharT, class Traits, class Allocator> inline
3113
- basic_string<CharT,Traits,Allocator>
3114
- operator+(const basic_string<CharT,Traits,Allocator>& x
3115
- ,const basic_string<CharT,Traits,Allocator>& y)
3405
+ template <class CharT, class Traits, class Allocator, class Options> inline
3406
+ basic_string<CharT,Traits,Allocator,Options>
3407
+ operator+(const basic_string<CharT,Traits,Allocator,Options>& x
3408
+ ,const basic_string<CharT,Traits,Allocator,Options>& y)
3116
3409
  {
3117
- typedef basic_string<CharT,Traits,Allocator> str_t;
3410
+ typedef basic_string<CharT,Traits,Allocator,Options> str_t;
3118
3411
  typedef typename str_t::reserve_t reserve_t;
3119
3412
  reserve_t reserve;
3120
3413
  str_t result(reserve, x.size() + y.size(), x.get_stored_allocator());
@@ -3123,60 +3416,61 @@ template <class CharT, class Traits, class Allocator> inline
3123
3416
  return result;
3124
3417
  }
3125
3418
 
3126
- template <class CharT, class Traits, class Allocator> inline
3127
- basic_string<CharT, Traits, Allocator> operator+
3128
- ( BOOST_RV_REF_BEG basic_string<CharT, Traits, Allocator> BOOST_RV_REF_END x
3129
- , BOOST_RV_REF_BEG basic_string<CharT, Traits, Allocator> BOOST_RV_REF_END y)
3419
+ template <class CharT, class Traits, class Allocator, class Options> inline
3420
+ basic_string<CharT, Traits, Allocator, Options> operator+
3421
+ ( BOOST_RV_REF_BEG basic_string<CharT, Traits, Allocator, Options> BOOST_RV_REF_END x
3422
+ , BOOST_RV_REF_BEG basic_string<CharT, Traits, Allocator, Options> BOOST_RV_REF_END y)
3130
3423
  {
3131
3424
  x += y;
3132
3425
  return boost::move(x);
3133
3426
  }
3134
3427
 
3135
- template <class CharT, class Traits, class Allocator> inline
3136
- basic_string<CharT, Traits, Allocator> operator+
3137
- ( BOOST_RV_REF_BEG basic_string<CharT, Traits, Allocator> BOOST_RV_REF_END x
3138
- , const basic_string<CharT,Traits,Allocator>& y)
3428
+ template <class CharT, class Traits, class Allocator, class Options> inline
3429
+ basic_string<CharT, Traits, Allocator, Options> operator+
3430
+ ( BOOST_RV_REF_BEG basic_string<CharT, Traits, Allocator, Options> BOOST_RV_REF_END x
3431
+ , const basic_string<CharT,Traits,Allocator,Options>& y)
3139
3432
  {
3140
3433
  x += y;
3141
3434
  return boost::move(x);
3142
3435
  }
3143
3436
 
3144
- template <class CharT, class Traits, class Allocator> inline
3145
- basic_string<CharT, Traits, Allocator> operator+
3146
- (const basic_string<CharT,Traits,Allocator>& x
3147
- ,BOOST_RV_REF_BEG basic_string<CharT, Traits, Allocator> BOOST_RV_REF_END y)
3437
+ template <class CharT, class Traits, class Allocator, class Options> inline
3438
+ basic_string<CharT, Traits, Allocator, Options> operator+
3439
+ (const basic_string<CharT,Traits,Allocator,Options>& x
3440
+ ,BOOST_RV_REF_BEG basic_string<CharT, Traits, Allocator, Options> BOOST_RV_REF_END y)
3148
3441
  {
3149
3442
  y.insert(y.begin(), x.begin(), x.end());
3150
3443
  return boost::move(y);
3151
3444
  }
3152
3445
 
3153
- template <class CharT, class Traits, class Allocator> inline
3154
- basic_string<CharT, Traits, Allocator> operator+
3155
- (const CharT* s, basic_string<CharT, Traits, Allocator> y)
3446
+ template <class CharT, class Traits, class Allocator, class Options> inline
3447
+ basic_string<CharT, Traits, Allocator, Options> operator+
3448
+ (const CharT* s, basic_string<CharT, Traits, Allocator, Options> y)
3156
3449
  {
3450
+ BOOST_ASSERT(s != 0);
3157
3451
  y.insert(y.begin(), s, s + Traits::length(s));
3158
3452
  return y;
3159
3453
  }
3160
3454
 
3161
- template <class CharT, class Traits, class Allocator> inline
3162
- basic_string<CharT,Traits,Allocator> operator+
3163
- (basic_string<CharT,Traits,Allocator> x, const CharT* s)
3455
+ template <class CharT, class Traits, class Allocator, class Options> inline
3456
+ basic_string<CharT,Traits,Allocator,Options> operator+
3457
+ (basic_string<CharT,Traits,Allocator,Options> x, const CharT* s)
3164
3458
  {
3165
- x += s;
3459
+ x += s; //operator+= checks s != 0
3166
3460
  return x;
3167
3461
  }
3168
3462
 
3169
- template <class CharT, class Traits, class Allocator> inline
3170
- basic_string<CharT,Traits,Allocator> operator+
3171
- (CharT c, basic_string<CharT,Traits,Allocator> y)
3463
+ template <class CharT, class Traits, class Allocator, class Options> inline
3464
+ basic_string<CharT,Traits,Allocator,Options> operator+
3465
+ (CharT c, basic_string<CharT,Traits,Allocator,Options> y)
3172
3466
  {
3173
3467
  y.insert(y.begin(), c);
3174
3468
  return y;
3175
3469
  }
3176
3470
 
3177
- template <class CharT, class Traits, class Allocator> inline
3178
- basic_string<CharT,Traits,Allocator> operator+
3179
- (basic_string<CharT,Traits,Allocator> x, const CharT c)
3471
+ template <class CharT, class Traits, class Allocator, class Options> inline
3472
+ basic_string<CharT,Traits,Allocator,Options> operator+
3473
+ (basic_string<CharT,Traits,Allocator,Options> x, const CharT c)
3180
3474
  {
3181
3475
  x += c;
3182
3476
  return x;
@@ -3184,226 +3478,227 @@ template <class CharT, class Traits, class Allocator> inline
3184
3478
 
3185
3479
  // Operator== and operator!=
3186
3480
 
3187
- template <class CharT, class Traits, class Allocator>
3481
+ template <class CharT, class Traits, class Allocator, class Options>
3188
3482
  inline bool
3189
- operator==(const basic_string<CharT,Traits,Allocator>& x, const basic_string<CharT,Traits,Allocator>& y)
3483
+ operator==(const basic_string<CharT,Traits,Allocator,Options>& x, const basic_string<CharT,Traits,Allocator,Options>& y)
3190
3484
  {
3191
3485
  return x.size() == y.size() &&
3192
3486
  Traits::compare(x.data(), y.data(), x.size()) == 0;
3193
3487
  }
3194
3488
 
3195
- template <class CharT, class Traits, class Allocator>
3489
+ template <class CharT, class Traits, class Allocator, class Options>
3196
3490
  inline bool
3197
- operator==(const CharT* s, const basic_string<CharT,Traits,Allocator>& y)
3491
+ operator==(const CharT* s, const basic_string<CharT,Traits,Allocator,Options>& y)
3198
3492
  {
3199
- typename basic_string<CharT,Traits,Allocator>::size_type n = Traits::length(s);
3493
+ BOOST_ASSERT(s != 0);
3494
+ typename basic_string<CharT,Traits,Allocator,Options>::size_type n = Traits::length(s);
3200
3495
  return n == y.size() && Traits::compare(s, y.data(), n) == 0;
3201
3496
  }
3202
3497
 
3203
- template <class CharT, class Traits, class Allocator>
3498
+ template <class CharT, class Traits, class Allocator, class Options>
3204
3499
  inline bool
3205
- operator==(const basic_string<CharT,Traits,Allocator>& x, const CharT* s)
3500
+ operator==(const basic_string<CharT,Traits,Allocator,Options>& x, const CharT* s)
3206
3501
  {
3207
- typename basic_string<CharT,Traits,Allocator>::size_type n = Traits::length(s);
3502
+ BOOST_ASSERT(s != 0);
3503
+ typename basic_string<CharT,Traits,Allocator,Options>::size_type n = Traits::length(s);
3208
3504
  return x.size() == n && Traits::compare(x.data(), s, n) == 0;
3209
3505
  }
3210
3506
 
3211
- template <class CharT, class Traits, class Allocator, template <class, class> class BasicStringView>
3507
+ template <class CharT, class Traits, class Allocator, class Options, template <class, class> class BasicStringView>
3212
3508
  inline
3213
3509
  BOOST_CONTAINER_DOC1ST( bool,
3214
3510
  typename dtl::disable_if
3215
3511
  <is_string< BasicStringView<CharT BOOST_MOVE_I Traits> > BOOST_MOVE_I bool >::type)
3216
- operator==( BasicStringView<CharT,Traits> x, const basic_string<CharT,Traits,Allocator>& y)
3512
+ operator==( BasicStringView<CharT,Traits> x, const basic_string<CharT,Traits,Allocator,Options>& y)
3217
3513
  {
3218
3514
  return x.size() == y.size() &&
3219
3515
  Traits::compare(x.data(), y.data(), x.size()) == 0;
3220
3516
  }
3221
3517
 
3222
- template <class CharT, class Traits, class Allocator, template <class, class> class BasicStringView>
3518
+ template <class CharT, class Traits, class Allocator, class Options, template <class, class> class BasicStringView>
3223
3519
  inline
3224
3520
  BOOST_CONTAINER_DOC1ST( bool,
3225
3521
  typename dtl::disable_if
3226
3522
  <is_string< BasicStringView<CharT BOOST_MOVE_I Traits> > BOOST_MOVE_I bool >::type)
3227
- operator==( const basic_string<CharT,Traits,Allocator>& x, BasicStringView<CharT,Traits> y)
3523
+ operator==( const basic_string<CharT,Traits,Allocator,Options>& x, BasicStringView<CharT,Traits> y)
3228
3524
  {
3229
3525
  return x.size() == y.size() &&
3230
3526
  Traits::compare(x.data(), y.data(), x.size()) == 0;
3231
3527
  }
3232
3528
 
3233
- template <class CharT, class Traits, class Allocator>
3529
+ template <class CharT, class Traits, class Allocator, class Options>
3234
3530
  inline bool
3235
- operator!=(const basic_string<CharT,Traits,Allocator>& x, const basic_string<CharT,Traits,Allocator>& y)
3531
+ operator!=(const basic_string<CharT,Traits,Allocator,Options>& x, const basic_string<CharT,Traits,Allocator,Options>& y)
3236
3532
  { return !(x == y); }
3237
3533
 
3238
- template <class CharT, class Traits, class Allocator>
3534
+ template <class CharT, class Traits, class Allocator, class Options>
3239
3535
  inline bool
3240
- operator!=(const CharT* s, const basic_string<CharT,Traits,Allocator>& y)
3241
- { return !(s == y); }
3536
+ operator!=(const CharT* s, const basic_string<CharT,Traits,Allocator,Options>& y)
3537
+ {
3538
+ return !(s == y);
3539
+ }
3242
3540
 
3243
- template <class CharT, class Traits, class Allocator>
3541
+ template <class CharT, class Traits, class Allocator, class Options>
3244
3542
  inline bool
3245
- operator!=(const basic_string<CharT,Traits,Allocator>& x, const CharT* s)
3246
- { return !(x == s); }
3247
-
3543
+ operator!=(const basic_string<CharT,Traits,Allocator,Options>& x, const CharT* s)
3544
+ {
3545
+ return !(x == s);
3546
+ }
3248
3547
 
3249
- template <class CharT, class Traits, class Allocator, template <class, class> class BasicStringView>
3548
+ template <class CharT, class Traits, class Allocator, class Options, template <class, class> class BasicStringView>
3250
3549
  inline
3251
3550
  BOOST_CONTAINER_DOC1ST( bool,
3252
3551
  typename dtl::disable_if
3253
3552
  <is_string< BasicStringView<CharT BOOST_MOVE_I Traits> > BOOST_MOVE_I bool >::type)
3254
- operator!=( BasicStringView<CharT,Traits> x, const basic_string<CharT,Traits,Allocator>& y)
3553
+ operator!=( BasicStringView<CharT,Traits> x, const basic_string<CharT,Traits,Allocator,Options>& y)
3255
3554
  { return !(x == y); }
3256
3555
 
3257
- template <class CharT, class Traits, class Allocator, template <class, class> class BasicStringView>
3556
+ template <class CharT, class Traits, class Allocator, class Options, template <class, class> class BasicStringView>
3258
3557
  inline
3259
3558
  BOOST_CONTAINER_DOC1ST( bool,
3260
3559
  typename dtl::disable_if
3261
3560
  <is_string< BasicStringView<CharT BOOST_MOVE_I Traits> > BOOST_MOVE_I bool >::type)
3262
- operator!=( const basic_string<CharT,Traits,Allocator>& x, BasicStringView<CharT,Traits> y)
3561
+ operator!=( const basic_string<CharT,Traits,Allocator,Options>& x, BasicStringView<CharT,Traits> y)
3263
3562
  { return !(x == y); }
3264
3563
 
3265
3564
  // Operator< (and also >, <=, and >=).
3266
- template <class CharT, class Traits, class Allocator>
3565
+ template <class CharT, class Traits, class Allocator, class Options>
3267
3566
  inline bool
3268
- operator<(const basic_string<CharT,Traits,Allocator>& x, const basic_string<CharT,Traits,Allocator>& y)
3567
+ operator<(const basic_string<CharT,Traits,Allocator,Options>& x, const basic_string<CharT,Traits,Allocator,Options>& y)
3269
3568
  {
3270
3569
  return x.compare(y) < 0;
3271
3570
  }
3272
3571
 
3273
- template <class CharT, class Traits, class Allocator>
3572
+ template <class CharT, class Traits, class Allocator, class Options>
3274
3573
  inline bool
3275
- operator<(const CharT* s, const basic_string<CharT,Traits,Allocator>& y)
3574
+ operator<(const CharT* s, const basic_string<CharT,Traits,Allocator,Options>& y)
3276
3575
  {
3277
3576
  return y.compare(s) > 0;
3278
3577
  }
3279
3578
 
3280
- template <class CharT, class Traits, class Allocator>
3579
+ template <class CharT, class Traits, class Allocator, class Options>
3281
3580
  inline bool
3282
- operator<(const basic_string<CharT,Traits,Allocator>& x, const CharT* s)
3581
+ operator<(const basic_string<CharT,Traits,Allocator,Options>& x, const CharT* s)
3283
3582
  {
3284
3583
  return x.compare(s) < 0;
3285
3584
  }
3286
3585
 
3287
- template <class CharT, class Traits, class Allocator, template <class, class> class BasicStringView>
3586
+ template <class CharT, class Traits, class Allocator, class Options, template <class, class> class BasicStringView>
3288
3587
  inline
3289
3588
  BOOST_CONTAINER_DOC1ST( bool,
3290
3589
  typename dtl::disable_if
3291
3590
  <is_string< BasicStringView<CharT BOOST_MOVE_I Traits> > BOOST_MOVE_I bool >::type)
3292
- operator<( BasicStringView<CharT,Traits> x, const basic_string<CharT,Traits,Allocator>& y)
3591
+ operator<( BasicStringView<CharT,Traits> x, const basic_string<CharT,Traits,Allocator,Options>& y)
3293
3592
  { return y.compare(x) > 0; }
3294
3593
 
3295
- template <class CharT, class Traits, class Allocator, template <class, class> class BasicStringView>
3594
+ template <class CharT, class Traits, class Allocator, class Options, template <class, class> class BasicStringView>
3296
3595
  inline
3297
3596
  BOOST_CONTAINER_DOC1ST( bool,
3298
3597
  typename dtl::disable_if
3299
3598
  <is_string< BasicStringView<CharT BOOST_MOVE_I Traits> > BOOST_MOVE_I bool >::type)
3300
- operator<( const basic_string<CharT,Traits,Allocator>& x, BasicStringView<CharT,Traits> y)
3599
+ operator<( const basic_string<CharT,Traits,Allocator,Options>& x, BasicStringView<CharT,Traits> y)
3301
3600
  { return x.compare(y) < 0; }
3302
3601
 
3303
- template <class CharT, class Traits, class Allocator>
3602
+ template <class CharT, class Traits, class Allocator, class Options>
3304
3603
  inline bool
3305
- operator>(const basic_string<CharT,Traits,Allocator>& x, const basic_string<CharT,Traits,Allocator>& y) {
3306
- return y < x;
3307
- }
3604
+ operator>(const basic_string<CharT,Traits,Allocator,Options>& x, const basic_string<CharT,Traits,Allocator,Options>& y)
3605
+ { return y < x; }
3308
3606
 
3309
- template <class CharT, class Traits, class Allocator>
3607
+ template <class CharT, class Traits, class Allocator, class Options>
3310
3608
  inline bool
3311
- operator>(const CharT* s, const basic_string<CharT,Traits,Allocator>& y) {
3312
- return y < s;
3313
- }
3609
+ operator>(const CharT* s, const basic_string<CharT,Traits,Allocator,Options>& y)
3610
+ { return y < s; }
3314
3611
 
3315
- template <class CharT, class Traits, class Allocator>
3612
+ template <class CharT, class Traits, class Allocator, class Options>
3316
3613
  inline bool
3317
- operator>(const basic_string<CharT,Traits,Allocator>& x, const CharT* s)
3318
- {
3319
- return s < x;
3320
- }
3614
+ operator>(const basic_string<CharT,Traits,Allocator,Options>& x, const CharT* s)
3615
+ { return s < x; }
3321
3616
 
3322
- template <class CharT, class Traits, class Allocator, template <class, class> class BasicStringView>
3617
+ template <class CharT, class Traits, class Allocator, class Options, template <class, class> class BasicStringView>
3323
3618
  inline
3324
3619
  BOOST_CONTAINER_DOC1ST( bool,
3325
3620
  typename dtl::disable_if
3326
3621
  <is_string< BasicStringView<CharT BOOST_MOVE_I Traits> > BOOST_MOVE_I bool >::type)
3327
- operator>( BasicStringView<CharT,Traits> x, const basic_string<CharT,Traits,Allocator>& y)
3622
+ operator>( BasicStringView<CharT,Traits> x, const basic_string<CharT,Traits,Allocator,Options>& y)
3328
3623
  { return y < x; }
3329
3624
 
3330
- template <class CharT, class Traits, class Allocator, template <class, class> class BasicStringView>
3625
+ template <class CharT, class Traits, class Allocator, class Options, template <class, class> class BasicStringView>
3331
3626
  inline
3332
3627
  BOOST_CONTAINER_DOC1ST( bool,
3333
3628
  typename dtl::disable_if
3334
3629
  <is_string< BasicStringView<CharT BOOST_MOVE_I Traits> > BOOST_MOVE_I bool >::type)
3335
- operator>( const basic_string<CharT,Traits,Allocator>& x, BasicStringView<CharT,Traits> y)
3630
+ operator>( const basic_string<CharT,Traits,Allocator,Options>& x, BasicStringView<CharT,Traits> y)
3336
3631
  { return y < x; }
3337
3632
 
3338
- template <class CharT, class Traits, class Allocator>
3633
+ template <class CharT, class Traits, class Allocator, class Options>
3339
3634
  inline bool
3340
- operator<=(const basic_string<CharT,Traits,Allocator>& x, const basic_string<CharT,Traits,Allocator>& y)
3635
+ operator<=(const basic_string<CharT,Traits,Allocator,Options>& x, const basic_string<CharT,Traits,Allocator,Options>& y)
3341
3636
  {
3342
3637
  return !(y < x);
3343
3638
  }
3344
3639
 
3345
- template <class CharT, class Traits, class Allocator>
3640
+ template <class CharT, class Traits, class Allocator, class Options>
3346
3641
  inline bool
3347
- operator<=(const CharT* s, const basic_string<CharT,Traits,Allocator>& y)
3642
+ operator<=(const CharT* s, const basic_string<CharT,Traits,Allocator,Options>& y)
3348
3643
  { return !(y < s); }
3349
3644
 
3350
- template <class CharT, class Traits, class Allocator>
3645
+ template <class CharT, class Traits, class Allocator, class Options>
3351
3646
  inline bool
3352
- operator<=(const basic_string<CharT,Traits,Allocator>& x, const CharT* s)
3647
+ operator<=(const basic_string<CharT,Traits,Allocator,Options>& x, const CharT* s)
3353
3648
  { return !(s < x); }
3354
3649
 
3355
3650
 
3356
- template <class CharT, class Traits, class Allocator, template <class, class> class BasicStringView>
3651
+ template <class CharT, class Traits, class Allocator, class Options, template <class, class> class BasicStringView>
3357
3652
  inline
3358
3653
  BOOST_CONTAINER_DOC1ST( bool,
3359
3654
  typename dtl::disable_if
3360
3655
  <is_string< BasicStringView<CharT BOOST_MOVE_I Traits> > BOOST_MOVE_I bool >::type)
3361
- operator<=( BasicStringView<CharT,Traits> x, const basic_string<CharT,Traits,Allocator>& y)
3656
+ operator<=( BasicStringView<CharT,Traits> x, const basic_string<CharT,Traits,Allocator,Options>& y)
3362
3657
  { return !(y < x); }
3363
3658
 
3364
- template <class CharT, class Traits, class Allocator, template <class, class> class BasicStringView>
3659
+ template <class CharT, class Traits, class Allocator, class Options, template <class, class> class BasicStringView>
3365
3660
  inline
3366
3661
  BOOST_CONTAINER_DOC1ST( bool,
3367
3662
  typename dtl::disable_if
3368
3663
  <is_string< BasicStringView<CharT BOOST_MOVE_I Traits> > BOOST_MOVE_I bool >::type)
3369
- operator<=( const basic_string<CharT,Traits,Allocator>& x, BasicStringView<CharT,Traits> y)
3664
+ operator<=( const basic_string<CharT,Traits,Allocator,Options>& x, BasicStringView<CharT,Traits> y)
3370
3665
  { return !(y < x); }
3371
3666
 
3372
- template <class CharT, class Traits, class Allocator>
3667
+ template <class CharT, class Traits, class Allocator, class Options>
3373
3668
  inline bool
3374
- operator>=(const basic_string<CharT,Traits,Allocator>& x,
3375
- const basic_string<CharT,Traits,Allocator>& y)
3669
+ operator>=(const basic_string<CharT,Traits,Allocator,Options>& x,
3670
+ const basic_string<CharT,Traits,Allocator,Options>& y)
3376
3671
  { return !(x < y); }
3377
3672
 
3378
- template <class CharT, class Traits, class Allocator>
3673
+ template <class CharT, class Traits, class Allocator, class Options>
3379
3674
  inline bool
3380
- operator>=(const CharT* s, const basic_string<CharT,Traits,Allocator>& y)
3675
+ operator>=(const CharT* s, const basic_string<CharT,Traits,Allocator,Options>& y)
3381
3676
  { return !(s < y); }
3382
3677
 
3383
- template <class CharT, class Traits, class Allocator>
3678
+ template <class CharT, class Traits, class Allocator, class Options>
3384
3679
  inline bool
3385
- operator>=(const basic_string<CharT,Traits,Allocator>& x, const CharT* s)
3680
+ operator>=(const basic_string<CharT,Traits,Allocator,Options>& x, const CharT* s)
3386
3681
  { return !(x < s); }
3387
3682
 
3388
- template <class CharT, class Traits, class Allocator, template <class, class> class BasicStringView>
3683
+ template <class CharT, class Traits, class Allocator, class Options, template <class, class> class BasicStringView>
3389
3684
  inline
3390
3685
  BOOST_CONTAINER_DOC1ST( bool,
3391
3686
  typename dtl::disable_if
3392
3687
  <is_string< BasicStringView<CharT BOOST_MOVE_I Traits> > BOOST_MOVE_I bool >::type)
3393
- operator>=( BasicStringView<CharT,Traits> x, const basic_string<CharT,Traits,Allocator>& y)
3688
+ operator>=( BasicStringView<CharT,Traits> x, const basic_string<CharT,Traits,Allocator,Options>& y)
3394
3689
  { return !(x < y); }
3395
3690
 
3396
- template <class CharT, class Traits, class Allocator, template <class, class> class BasicStringView>
3691
+ template <class CharT, class Traits, class Allocator, class Options, template <class, class> class BasicStringView>
3397
3692
  inline
3398
3693
  BOOST_CONTAINER_DOC1ST( bool,
3399
3694
  typename dtl::disable_if
3400
3695
  <is_string< BasicStringView<CharT BOOST_MOVE_I Traits> > BOOST_MOVE_I bool >::type)
3401
- operator>=( const basic_string<CharT,Traits,Allocator>& x, BasicStringView<CharT,Traits> y)
3696
+ operator>=( const basic_string<CharT,Traits,Allocator,Options>& x, BasicStringView<CharT,Traits> y)
3402
3697
  { return !(x < y); }
3403
3698
 
3404
3699
  // Swap.
3405
- template <class CharT, class Traits, class Allocator>
3406
- inline void swap(basic_string<CharT,Traits,Allocator>& x, basic_string<CharT,Traits,Allocator>& y)
3700
+ template <class CharT, class Traits, class Allocator, class Options>
3701
+ inline void swap(basic_string<CharT,Traits,Allocator,Options>& x, basic_string<CharT,Traits,Allocator,Options>& y)
3407
3702
  BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y)))
3408
3703
  { x.swap(y); }
3409
3704
 
@@ -3429,19 +3724,19 @@ string_fill(std::basic_ostream<CharT, Traits>& os,
3429
3724
  } //namespace dtl {
3430
3725
  #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
3431
3726
 
3432
- template <class CharT, class Traits, class Allocator>
3727
+ template <class CharT, class Traits, class Allocator, class Options>
3433
3728
  std::basic_ostream<CharT, Traits>&
3434
- operator<<(std::basic_ostream<CharT, Traits>& os, const basic_string<CharT,Traits,Allocator>& s)
3729
+ operator<<(std::basic_ostream<CharT, Traits>& os, const basic_string<CharT,Traits,Allocator,Options>& s)
3435
3730
  {
3436
3731
  typename std::basic_ostream<CharT, Traits>::sentry sentry(os);
3437
3732
  bool ok = false;
3438
3733
 
3439
3734
  if (sentry) {
3440
3735
  ok = true;
3441
- typename basic_string<CharT,Traits,Allocator>::size_type n = s.size();
3442
- typename basic_string<CharT,Traits,Allocator>::size_type pad_len = 0;
3736
+ typename basic_string<CharT,Traits,Allocator,Options>::size_type n = s.size();
3737
+ typename basic_string<CharT,Traits,Allocator,Options>::size_type pad_len = 0;
3443
3738
  const bool left = (os.flags() & std::ios::left) != 0;
3444
- const std::size_t w = os.width(0);
3739
+ const std::size_t w = static_cast<std::size_t>(os.width(0));
3445
3740
  std::basic_streambuf<CharT, Traits>* buf = os.rdbuf();
3446
3741
 
3447
3742
  if (w != 0 && n < w)
@@ -3464,9 +3759,9 @@ operator<<(std::basic_ostream<CharT, Traits>& os, const basic_string<CharT,Trait
3464
3759
  }
3465
3760
 
3466
3761
 
3467
- template <class CharT, class Traits, class Allocator>
3762
+ template <class CharT, class Traits, class Allocator, class Options>
3468
3763
  std::basic_istream<CharT, Traits>&
3469
- operator>>(std::basic_istream<CharT, Traits>& is, basic_string<CharT,Traits,Allocator>& s)
3764
+ operator>>(std::basic_istream<CharT, Traits>& is, basic_string<CharT,Traits,Allocator,Options>& s)
3470
3765
  {
3471
3766
  typename std::basic_istream<CharT, Traits>::sentry sentry(is);
3472
3767
 
@@ -3475,7 +3770,7 @@ operator>>(std::basic_istream<CharT, Traits>& is, basic_string<CharT,Traits,Allo
3475
3770
  const std::ctype<CharT>& ctype = std::use_facet<std::ctype<CharT> >(is.getloc());
3476
3771
 
3477
3772
  s.clear();
3478
- std::size_t n = is.width(0);
3773
+ std::size_t n = static_cast<std::size_t>(is.width(0));
3479
3774
  if (n == 0)
3480
3775
  n = static_cast<std::size_t>(-1);
3481
3776
  else
@@ -3511,11 +3806,11 @@ operator>>(std::basic_istream<CharT, Traits>& is, basic_string<CharT,Traits,Allo
3511
3806
  return is;
3512
3807
  }
3513
3808
 
3514
- template <class CharT, class Traits, class Allocator>
3809
+ template <class CharT, class Traits, class Allocator, class Options>
3515
3810
  std::basic_istream<CharT, Traits>&
3516
- getline(std::istream& is, basic_string<CharT,Traits,Allocator>& s,CharT delim)
3811
+ getline(std::istream& is, basic_string<CharT,Traits,Allocator,Options>& s,CharT delim)
3517
3812
  {
3518
- typename basic_string<CharT,Traits,Allocator>::size_type nread = 0;
3813
+ typename basic_string<CharT,Traits,Allocator,Options>::size_type nread = 0;
3519
3814
  typename std::basic_istream<CharT, Traits>::sentry sentry(is, true);
3520
3815
  if (sentry) {
3521
3816
  std::basic_streambuf<CharT, Traits>* buf = is.rdbuf();
@@ -3543,9 +3838,9 @@ getline(std::istream& is, basic_string<CharT,Traits,Allocator>& s,CharT delim)
3543
3838
  return is;
3544
3839
  }
3545
3840
 
3546
- template <class CharT, class Traits, class Allocator>
3841
+ template <class CharT, class Traits, class Allocator, class Options>
3547
3842
  inline std::basic_istream<CharT, Traits>&
3548
- getline(std::basic_istream<CharT, Traits>& is, basic_string<CharT,Traits,Allocator>& s)
3843
+ getline(std::basic_istream<CharT, Traits>& is, basic_string<CharT,Traits,Allocator,Options>& s)
3549
3844
  {
3550
3845
  return getline(is, s, '\n');
3551
3846
  }
@@ -3590,7 +3885,7 @@ template <class C, class T, class Allocator>
3590
3885
  struct has_trivial_destructor_after_move<boost::container::basic_string<C, T, Allocator> >
3591
3886
  {
3592
3887
  typedef typename boost::container::basic_string<C, T, Allocator>::allocator_type allocator_type;
3593
- typedef typename ::boost::container::allocator_traits<allocator_type>::pointer pointer;
3888
+ typedef typename boost::container::allocator_traits<allocator_type>::pointer pointer;
3594
3889
  BOOST_STATIC_CONSTEXPR bool value =
3595
3890
  ::boost::has_trivial_destructor_after_move<allocator_type>::value &&
3596
3891
  ::boost::has_trivial_destructor_after_move<pointer>::value;