passenger 4.0.20 → 4.0.21

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

Files changed (496) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.asc +7 -7
  3. data.tar.gz.asc +7 -7
  4. data/.gitignore +1 -0
  5. data/.travis.yml +1 -1
  6. data/NEWS +15 -0
  7. data/README.md +5 -3
  8. data/Rakefile +1 -0
  9. data/bin/passenger-config +1 -5
  10. data/bin/passenger-install-apache2-module +53 -5
  11. data/bin/passenger-install-nginx-module +19 -6
  12. data/bin/passenger-memory-stats +3 -3
  13. data/build/agents.rb +11 -8
  14. data/build/apache2.rb +9 -5
  15. data/build/basics.rb +15 -21
  16. data/build/common_library.rb +16 -6
  17. data/build/cplusplus_support.rb +5 -5
  18. data/build/cxx_tests.rb +3 -3
  19. data/build/documentation.rb +1 -1
  20. data/build/misc.rb +4 -37
  21. data/build/node_tests.rb +29 -0
  22. data/build/oxt_tests.rb +1 -1
  23. data/build/packaging.rb +29 -10
  24. data/build/preprocessor.rb +2 -1
  25. data/build/test_basics.rb +15 -6
  26. data/debian.template/locations.ini.template +1 -0
  27. data/debian.template/passenger.install.template +1 -0
  28. data/dev/copy_boost_headers.rb +7 -3
  29. data/dev/run_travis.sh +32 -16
  30. data/doc/Users guide Apache.idmap.txt +22 -34
  31. data/doc/Users guide Apache.txt +20 -234
  32. data/doc/Users guide Nginx.idmap.txt +84 -66
  33. data/doc/Users guide Nginx.txt +50 -1
  34. data/doc/Users guide Standalone.idmap.txt +74 -0
  35. data/doc/Users guide Standalone.txt +22 -9
  36. data/doc/Users guide.txt +51 -0
  37. data/doc/users_guide_snippets/environment_variables.txt +0 -3
  38. data/doc/users_guide_snippets/installation.txt +337 -380
  39. data/doc/users_guide_snippets/installation/run_installer.txt +58 -0
  40. data/doc/users_guide_snippets/installation/verify_running_epilogue.txt +6 -0
  41. data/doc/users_guide_snippets/support_information.txt +2 -9
  42. data/doc/users_guide_snippets/troubleshooting/default.txt +112 -0
  43. data/doc/users_guide_snippets/troubleshooting/rails.txt +56 -0
  44. data/doc/users_guide_snippets/where_to_get_support.txt +9 -0
  45. data/ext/apache2/Bucket.h +1 -1
  46. data/ext/apache2/Configuration.hpp +0 -44
  47. data/ext/apache2/CreateDirConfig.cpp +1 -1
  48. data/ext/apache2/CreateDirConfig.cpp.erb +1 -1
  49. data/ext/apache2/Hooks.cpp +28 -21
  50. data/ext/apache2/MergeDirConfig.cpp +1 -0
  51. data/ext/apache2/MergeDirConfig.cpp.erb +1 -1
  52. data/ext/apache2/SetHeaders.cpp +73 -0
  53. data/ext/apache2/SetHeaders.cpp.erb +88 -0
  54. data/ext/boost/algorithm/string/detail/find_format.hpp +5 -5
  55. data/ext/boost/algorithm/string/detail/find_format_all.hpp +5 -5
  56. data/ext/boost/algorithm/string/detail/finder.hpp +1 -1
  57. data/ext/boost/algorithm/string/formatter.hpp +2 -2
  58. data/ext/boost/assert.hpp +6 -1
  59. data/ext/boost/atomic.hpp +18 -0
  60. data/ext/boost/atomic/atomic.hpp +241 -0
  61. data/ext/boost/atomic/detail/base.hpp +585 -0
  62. data/ext/boost/atomic/detail/cas32strong.hpp +885 -0
  63. data/ext/boost/atomic/detail/cas32weak.hpp +947 -0
  64. data/ext/boost/atomic/detail/cas64strong.hpp +443 -0
  65. data/ext/boost/atomic/detail/config.hpp +54 -0
  66. data/ext/boost/atomic/detail/gcc-alpha.hpp +368 -0
  67. data/ext/boost/atomic/detail/gcc-armv6plus.hpp +252 -0
  68. data/ext/boost/atomic/detail/gcc-cas.hpp +157 -0
  69. data/ext/boost/atomic/detail/gcc-ppc.hpp +2850 -0
  70. data/ext/boost/atomic/detail/gcc-sparcv9.hpp +1259 -0
  71. data/ext/boost/atomic/detail/gcc-x86.hpp +1766 -0
  72. data/ext/boost/atomic/detail/generic-cas.hpp +206 -0
  73. data/ext/boost/atomic/detail/interlocked.hpp +200 -0
  74. data/ext/boost/atomic/detail/linux-arm.hpp +189 -0
  75. data/ext/boost/atomic/detail/lockpool.hpp +97 -0
  76. data/ext/boost/atomic/detail/platform.hpp +62 -0
  77. data/ext/boost/atomic/detail/type-classification.hpp +45 -0
  78. data/ext/boost/chrono/config.hpp +8 -3
  79. data/ext/boost/chrono/duration.hpp +9 -10
  80. data/ext/boost/chrono/system_clocks.hpp +1 -1
  81. data/ext/boost/chrono/time_point.hpp +4 -3
  82. data/ext/boost/config/auto_link.hpp +53 -52
  83. data/ext/boost/config/compiler/borland.hpp +1 -0
  84. data/ext/boost/config/compiler/clang.hpp +24 -1
  85. data/ext/boost/config/compiler/codegear.hpp +1 -0
  86. data/ext/boost/config/compiler/common_edg.hpp +1 -0
  87. data/ext/boost/config/compiler/cray.hpp +1 -0
  88. data/ext/boost/config/compiler/digitalmars.hpp +1 -0
  89. data/ext/boost/config/compiler/gcc.hpp +29 -3
  90. data/ext/boost/config/compiler/gcc_xml.hpp +2 -1
  91. data/ext/boost/config/compiler/hp_acc.hpp +1 -0
  92. data/ext/boost/config/compiler/intel.hpp +1 -1
  93. data/ext/boost/config/compiler/metrowerks.hpp +1 -0
  94. data/ext/boost/config/compiler/mpw.hpp +1 -0
  95. data/ext/boost/config/compiler/pathscale.hpp +1 -0
  96. data/ext/boost/config/compiler/pgi.hpp +1 -0
  97. data/ext/boost/config/compiler/sunpro_cc.hpp +1 -0
  98. data/ext/boost/config/compiler/vacpp.hpp +3 -2
  99. data/ext/boost/config/compiler/visualc.hpp +25 -11
  100. data/ext/boost/config/platform/vxworks.hpp +353 -15
  101. data/ext/boost/config/select_compiler_config.hpp +4 -4
  102. data/ext/boost/config/stdlib/dinkumware.hpp +10 -3
  103. data/ext/boost/config/stdlib/libstdcpp3.hpp +2 -1
  104. data/ext/boost/config/suffix.hpp +45 -19
  105. data/ext/boost/date_time/format_date_parser.hpp +1 -11
  106. data/ext/boost/date_time/strings_from_facet.hpp +5 -3
  107. data/ext/boost/detail/atomic_redef_macros.hpp +19 -0
  108. data/ext/boost/detail/atomic_undef_macros.hpp +39 -0
  109. data/ext/boost/detail/endian.hpp +52 -4
  110. data/ext/boost/detail/scoped_enum_emulation.hpp +10 -10
  111. data/ext/boost/detail/select_type.hpp +36 -0
  112. data/ext/boost/exception/current_exception_cast.hpp +1 -1
  113. data/ext/boost/exception/detail/error_info_impl.hpp +3 -5
  114. data/ext/boost/exception/detail/exception_ptr.hpp +3 -3
  115. data/ext/boost/exception/detail/is_output_streamable.hpp +1 -1
  116. data/ext/boost/exception/detail/object_hex_dump.hpp +1 -1
  117. data/ext/boost/exception/detail/type_info.hpp +1 -1
  118. data/ext/boost/exception/diagnostic_information.hpp +15 -14
  119. data/ext/boost/exception/exception.hpp +1 -1
  120. data/ext/boost/exception/get_error_info.hpp +1 -1
  121. data/ext/boost/exception/info.hpp +12 -13
  122. data/ext/boost/exception/to_string.hpp +6 -1
  123. data/ext/boost/exception/to_string_stub.hpp +9 -1
  124. data/ext/boost/foreach.hpp +5 -5
  125. data/ext/boost/function/function_template.hpp +6 -6
  126. data/ext/boost/functional/hash/detail/float_functions.hpp +90 -0
  127. data/ext/boost/functional/hash/detail/hash_float.hpp +11 -2
  128. data/ext/boost/functional/hash/extensions.hpp +14 -2
  129. data/ext/boost/functional/hash/hash.hpp +26 -5
  130. data/ext/boost/get_pointer.hpp +17 -2
  131. data/ext/boost/integer_traits.hpp +1 -1
  132. data/ext/boost/lexical_cast.hpp +615 -395
  133. data/ext/boost/libs/atomic/lockpool.cpp +24 -0
  134. data/ext/boost/libs/system/src/error_code.cpp +25 -18
  135. data/ext/boost/libs/thread/src/future.cpp +7 -5
  136. data/ext/boost/libs/thread/src/pthread/once.cpp +9 -3
  137. data/ext/boost/libs/thread/src/pthread/once_atomic.cpp +90 -0
  138. data/ext/boost/libs/thread/src/pthread/thread.cpp +129 -95
  139. data/ext/boost/libs/thread/src/pthread/timeconv.inl +20 -1
  140. data/ext/boost/limits.hpp +1 -1
  141. data/ext/boost/math/policies/policy.hpp +10 -0
  142. data/ext/boost/math/special_functions/detail/round_fwd.hpp +17 -4
  143. data/ext/boost/math/special_functions/fpclassify.hpp +114 -45
  144. data/ext/boost/math/special_functions/math_fwd.hpp +195 -83
  145. data/ext/boost/math/special_functions/sign.hpp +13 -8
  146. data/ext/boost/math/tools/config.hpp +38 -16
  147. data/ext/boost/move/algorithm.hpp +275 -0
  148. data/ext/boost/move/core.hpp +332 -0
  149. data/ext/boost/move/detail/config_begin.hpp +23 -0
  150. data/ext/boost/move/detail/config_end.hpp +20 -0
  151. data/ext/boost/move/detail/meta_utils.hpp +158 -0
  152. data/ext/boost/move/iterator.hpp +298 -0
  153. data/ext/boost/move/move.hpp +10 -1256
  154. data/ext/boost/move/traits.hpp +142 -0
  155. data/ext/boost/move/utility.hpp +194 -0
  156. data/ext/boost/mpl/assert.hpp +72 -4
  157. data/ext/boost/noncopyable.hpp +15 -3
  158. data/ext/boost/pointer_to_other.hpp +55 -0
  159. data/ext/boost/range/concepts.hpp +4 -4
  160. data/ext/boost/range/detail/extract_optional_type.hpp +1 -1
  161. data/ext/boost/range/empty.hpp +1 -1
  162. data/ext/boost/range/iterator_range_core.hpp +4 -1
  163. data/ext/boost/range/iterator_range_io.hpp +2 -2
  164. data/ext/boost/ratio/config.hpp +6 -0
  165. data/ext/boost/ratio/detail/overflow_helpers.hpp +2 -2
  166. data/ext/boost/smart_ptr/allocate_shared_array.hpp +250 -0
  167. data/ext/boost/smart_ptr/detail/allocate_array_helper.hpp +169 -0
  168. data/ext/boost/smart_ptr/detail/array_deleter.hpp +124 -0
  169. data/ext/boost/smart_ptr/detail/array_traits.hpp +53 -0
  170. data/ext/boost/smart_ptr/detail/array_utility.hpp +178 -0
  171. data/ext/boost/smart_ptr/detail/make_array_helper.hpp +157 -0
  172. data/ext/boost/smart_ptr/detail/operator_bool.hpp +16 -9
  173. data/ext/boost/smart_ptr/detail/shared_count.hpp +78 -7
  174. data/ext/boost/smart_ptr/detail/sp_convertible.hpp +15 -0
  175. data/ext/boost/smart_ptr/detail/sp_counted_base.hpp +12 -6
  176. data/ext/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp +1 -0
  177. data/ext/boost/smart_ptr/detail/sp_counted_base_aix.hpp +1 -0
  178. data/ext/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp +1 -0
  179. data/ext/boost/smart_ptr/detail/sp_counted_base_cw_x86.hpp +1 -0
  180. data/ext/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp +1 -0
  181. data/ext/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp +1 -0
  182. data/ext/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp +1 -0
  183. data/ext/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp +1 -0
  184. data/ext/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp +1 -0
  185. data/ext/boost/smart_ptr/detail/sp_counted_base_nt.hpp +1 -0
  186. data/ext/boost/smart_ptr/detail/sp_counted_base_pt.hpp +1 -0
  187. data/ext/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp +162 -0
  188. data/ext/boost/smart_ptr/detail/sp_counted_base_solaris.hpp +1 -0
  189. data/ext/boost/smart_ptr/detail/sp_counted_base_spin.hpp +1 -0
  190. data/ext/boost/smart_ptr/detail/sp_counted_base_sync.hpp +1 -0
  191. data/ext/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp +1 -0
  192. data/ext/boost/smart_ptr/detail/sp_counted_impl.hpp +15 -0
  193. data/ext/boost/smart_ptr/detail/sp_forward.hpp +39 -0
  194. data/ext/boost/smart_ptr/detail/sp_has_sync.hpp +19 -3
  195. data/ext/boost/smart_ptr/detail/sp_if_array.hpp +31 -0
  196. data/ext/boost/smart_ptr/detail/sp_nullptr_t.hpp +45 -0
  197. data/ext/boost/smart_ptr/detail/spinlock_gcc_arm.hpp +5 -12
  198. data/ext/boost/smart_ptr/enable_shared_from_this.hpp +4 -4
  199. data/ext/boost/smart_ptr/make_shared.hpp +5 -1060
  200. data/ext/boost/smart_ptr/make_shared_array.hpp +247 -0
  201. data/ext/boost/smart_ptr/make_shared_object.hpp +1128 -0
  202. data/ext/boost/smart_ptr/scoped_array.hpp +32 -7
  203. data/ext/boost/smart_ptr/scoped_ptr.hpp +31 -5
  204. data/ext/boost/smart_ptr/shared_array.hpp +135 -20
  205. data/ext/boost/smart_ptr/shared_ptr.hpp +444 -126
  206. data/ext/boost/smart_ptr/weak_ptr.hpp +39 -28
  207. data/ext/boost/static_assert.hpp +74 -17
  208. data/ext/boost/system/error_code.hpp +76 -68
  209. data/ext/boost/system/system_error.hpp +5 -1
  210. data/ext/boost/thread/barrier.hpp +6 -2
  211. data/ext/boost/thread/completion_latch.hpp +233 -0
  212. data/ext/boost/thread/condition.hpp +6 -1
  213. data/ext/boost/thread/detail/async_func.hpp +571 -0
  214. data/ext/boost/thread/detail/config.hpp +248 -40
  215. data/ext/boost/thread/detail/counter.hpp +93 -0
  216. data/ext/boost/thread/detail/delete.hpp +12 -0
  217. data/ext/boost/thread/detail/invoke.hpp +1351 -0
  218. data/ext/boost/thread/detail/is_convertible.hpp +48 -0
  219. data/ext/boost/thread/detail/lockable_wrapper.hpp +45 -0
  220. data/ext/boost/thread/detail/log.hpp +83 -0
  221. data/ext/boost/thread/detail/make_tuple_indices.hpp +224 -0
  222. data/ext/boost/thread/detail/move.hpp +32 -16
  223. data/ext/boost/thread/detail/thread.hpp +236 -41
  224. data/ext/boost/thread/detail/thread_group.hpp +55 -9
  225. data/ext/boost/thread/detail/thread_interruption.hpp +4 -1
  226. data/ext/boost/thread/exceptions.hpp +2 -0
  227. data/ext/boost/thread/externally_locked.hpp +351 -0
  228. data/ext/boost/thread/externally_locked_stream.hpp +170 -0
  229. data/ext/boost/thread/future.hpp +2517 -455
  230. data/ext/boost/thread/future_error_code.hpp +61 -0
  231. data/ext/boost/thread/is_locked_by_this_thread.hpp +39 -0
  232. data/ext/boost/thread/latch.hpp +142 -0
  233. data/ext/boost/thread/lock_algorithms.hpp +468 -0
  234. data/ext/boost/thread/lock_concepts.hpp +197 -0
  235. data/ext/boost/thread/lock_factories.hpp +78 -0
  236. data/ext/boost/thread/lock_guard.hpp +88 -0
  237. data/ext/boost/thread/lock_options.hpp +31 -0
  238. data/ext/boost/thread/lock_traits.hpp +45 -0
  239. data/ext/boost/thread/lock_types.hpp +1226 -0
  240. data/ext/boost/thread/lockable_adapter.hpp +226 -0
  241. data/ext/boost/thread/lockable_concepts.hpp +157 -0
  242. data/ext/boost/thread/lockable_traits.hpp +207 -0
  243. data/ext/boost/thread/locks.hpp +5 -1816
  244. data/ext/boost/thread/mutex.hpp +33 -1
  245. data/ext/boost/thread/null_mutex.hpp +243 -0
  246. data/ext/boost/thread/once.hpp +10 -1
  247. data/ext/boost/thread/poly_lockable.hpp +68 -0
  248. data/ext/boost/thread/poly_lockable_adapter.hpp +89 -0
  249. data/ext/boost/thread/poly_shared_lockable.hpp +135 -0
  250. data/ext/boost/thread/poly_shared_lockable_adapter.hpp +170 -0
  251. data/ext/boost/thread/pthread/condition_variable.hpp +74 -26
  252. data/ext/boost/thread/pthread/condition_variable_fwd.hpp +54 -27
  253. data/ext/boost/thread/pthread/mutex.hpp +101 -38
  254. data/ext/boost/thread/pthread/once.hpp +459 -44
  255. data/ext/boost/thread/pthread/once_atomic.hpp +313 -0
  256. data/ext/boost/thread/pthread/recursive_mutex.hpp +19 -10
  257. data/ext/boost/thread/pthread/shared_mutex.hpp +226 -61
  258. data/ext/boost/thread/pthread/shared_mutex_assert.hpp +724 -0
  259. data/ext/boost/thread/pthread/thread_data.hpp +53 -50
  260. data/ext/boost/thread/pthread/timespec.hpp +96 -12
  261. data/ext/boost/thread/recursive_mutex.hpp +44 -1
  262. data/ext/boost/thread/reverse_lock.hpp +3 -2
  263. data/ext/boost/thread/scoped_thread.hpp +285 -0
  264. data/ext/boost/thread/shared_lock_guard.hpp +2 -1
  265. data/ext/boost/thread/shared_mutex.hpp +23 -0
  266. data/ext/boost/thread/strict_lock.hpp +235 -0
  267. data/ext/boost/thread/sync_bounded_queue.hpp +594 -0
  268. data/ext/boost/thread/sync_queue.hpp +516 -0
  269. data/ext/boost/thread/synchronized_value.hpp +1001 -0
  270. data/ext/boost/thread/testable_mutex.hpp +148 -0
  271. data/ext/boost/thread/thread.hpp +1 -13
  272. data/ext/boost/thread/thread_functors.hpp +57 -0
  273. data/ext/boost/thread/thread_guard.hpp +46 -0
  274. data/ext/boost/thread/thread_only.hpp +29 -0
  275. data/ext/boost/thread/v2/shared_mutex.hpp +1062 -0
  276. data/ext/boost/thread/v2/thread.hpp +37 -10
  277. data/ext/boost/thread/xtime.hpp +2 -1
  278. data/ext/boost/token_functions.hpp +16 -16
  279. data/ext/boost/type_traits/add_lvalue_reference.hpp +26 -0
  280. data/ext/boost/type_traits/add_reference.hpp +1 -1
  281. data/ext/boost/type_traits/add_rvalue_reference.hpp +4 -4
  282. data/ext/boost/type_traits/aligned_storage.hpp +13 -0
  283. data/ext/boost/type_traits/common_type.hpp +11 -12
  284. data/ext/boost/type_traits/config.hpp +1 -1
  285. data/ext/boost/type_traits/detail/common_type_imp.hpp +1 -1
  286. data/ext/boost/type_traits/detail/has_binary_operator.hpp +1 -1
  287. data/ext/boost/type_traits/detail/is_function_ptr_tester.hpp +1 -1
  288. data/ext/boost/type_traits/has_left_shift.hpp +49 -0
  289. data/ext/boost/type_traits/has_right_shift.hpp +49 -0
  290. data/ext/boost/type_traits/has_trivial_move_assign.hpp +57 -0
  291. data/ext/boost/type_traits/has_trivial_move_constructor.hpp +57 -0
  292. data/ext/boost/type_traits/intrinsics.hpp +18 -2
  293. data/ext/boost/type_traits/is_abstract.hpp +1 -1
  294. data/ext/boost/type_traits/is_array.hpp +1 -1
  295. data/ext/boost/type_traits/is_const.hpp +1 -1
  296. data/ext/boost/type_traits/is_convertible.hpp +78 -17
  297. data/ext/boost/type_traits/is_function.hpp +6 -1
  298. data/ext/boost/type_traits/is_integral.hpp +6 -1
  299. data/ext/boost/type_traits/is_nothrow_move_assignable.hpp +84 -0
  300. data/ext/boost/type_traits/is_nothrow_move_constructible.hpp +84 -0
  301. data/ext/boost/type_traits/is_pod.hpp +3 -1
  302. data/ext/boost/type_traits/is_rvalue_reference.hpp +1 -1
  303. data/ext/boost/type_traits/is_volatile.hpp +1 -1
  304. data/ext/boost/type_traits/make_signed.hpp +153 -0
  305. data/ext/boost/type_traits/make_unsigned.hpp +16 -0
  306. data/ext/boost/type_traits/remove_const.hpp +1 -1
  307. data/ext/boost/type_traits/remove_cv.hpp +1 -1
  308. data/ext/boost/type_traits/remove_reference.hpp +1 -1
  309. data/ext/boost/type_traits/remove_volatile.hpp +1 -1
  310. data/ext/boost/unordered/detail/allocate.hpp +1120 -0
  311. data/ext/boost/unordered/detail/buckets.hpp +876 -0
  312. data/ext/boost/unordered/detail/equivalent.hpp +680 -0
  313. data/ext/boost/unordered/detail/extract_key.hpp +183 -0
  314. data/ext/boost/unordered/detail/fwd.hpp +23 -0
  315. data/ext/boost/unordered/detail/table.hpp +861 -0
  316. data/ext/boost/unordered/detail/unique.hpp +622 -0
  317. data/ext/boost/unordered/detail/util.hpp +260 -0
  318. data/ext/boost/unordered/unordered_map.hpp +1652 -0
  319. data/ext/boost/unordered/unordered_map_fwd.hpp +65 -0
  320. data/ext/boost/unordered/unordered_set.hpp +1549 -0
  321. data/ext/boost/unordered/unordered_set_fwd.hpp +63 -0
  322. data/ext/boost/unordered_map.hpp +18 -0
  323. data/ext/boost/unordered_set.hpp +18 -0
  324. data/ext/boost/utility/addressof.hpp +2 -2
  325. data/ext/boost/utility/result_of.hpp +8 -1
  326. data/ext/boost/version.hpp +2 -2
  327. data/ext/common/Account.h +1 -1
  328. data/ext/common/AccountsDatabase.h +1 -1
  329. data/ext/common/AgentsStarter.cpp +3 -1
  330. data/ext/common/AgentsStarter.h +2 -2
  331. data/ext/common/ApplicationPool2/AppTypes.cpp +24 -6
  332. data/ext/common/ApplicationPool2/AppTypes.h +17 -8
  333. data/ext/common/ApplicationPool2/Common.h +12 -12
  334. data/ext/common/ApplicationPool2/DirectSpawner.h +2 -2
  335. data/ext/common/ApplicationPool2/DummySpawner.h +3 -3
  336. data/ext/common/ApplicationPool2/Group.h +6 -6
  337. data/ext/common/ApplicationPool2/Implementation.cpp +19 -19
  338. data/ext/common/ApplicationPool2/PipeWatcher.h +5 -5
  339. data/ext/common/ApplicationPool2/Pool.h +21 -21
  340. data/ext/common/ApplicationPool2/Process.h +6 -6
  341. data/ext/common/ApplicationPool2/Session.h +1 -1
  342. data/ext/common/ApplicationPool2/SmartSpawner.h +24 -12
  343. data/ext/common/ApplicationPool2/Socket.h +2 -2
  344. data/ext/common/ApplicationPool2/Spawner.h +64 -14
  345. data/ext/common/ApplicationPool2/SpawnerFactory.h +7 -7
  346. data/ext/common/ApplicationPool2/SuperGroup.h +5 -5
  347. data/ext/common/BackgroundEventLoop.cpp +4 -4
  348. data/ext/common/BackgroundEventLoop.h +1 -1
  349. data/ext/common/Constants.h +13 -1
  350. data/ext/common/EventedBufferedInput.h +8 -8
  351. data/ext/common/Exceptions.cpp +71 -0
  352. data/ext/common/Exceptions.h +60 -7
  353. data/ext/common/FileDescriptor.h +4 -4
  354. data/ext/common/MessageClient.h +1 -1
  355. data/ext/common/MessageServer.h +5 -5
  356. data/ext/common/MultiLibeio.cpp +3 -3
  357. data/ext/common/MultiLibeio.h +2 -2
  358. data/ext/common/RandomGenerator.h +11 -11
  359. data/ext/common/ResourceLocator.h +8 -1
  360. data/ext/common/SafeLibev.h +12 -12
  361. data/ext/common/ServerInstanceDir.h +11 -3
  362. data/ext/common/UnionStation.h +10 -10
  363. data/ext/common/Utils.cpp +11 -13
  364. data/ext/common/Utils.h +9 -9
  365. data/ext/common/Utils/BlockingQueue.h +10 -10
  366. data/ext/common/Utils/BufferedIO.h +1 -1
  367. data/ext/common/Utils/CachedFileStat.hpp +2 -2
  368. data/ext/common/Utils/FileChangeChecker.h +1 -1
  369. data/ext/common/Utils/HashMap.h +13 -4
  370. data/ext/common/Utils/IOUtils.cpp +33 -10
  371. data/ext/common/Utils/IniFile.h +3 -3
  372. data/ext/common/Utils/Lock.h +2 -2
  373. data/ext/common/Utils/MessagePassing.h +10 -10
  374. data/ext/common/Utils/ProcessMetricsCollector.h +24 -6
  375. data/ext/common/Utils/ScopeGuard.h +5 -5
  376. data/ext/common/Utils/jsoncpp.cpp +2 -0
  377. data/ext/common/agents/HelperAgent/FileBackedPipe.h +26 -26
  378. data/ext/common/agents/HelperAgent/Main.cpp +18 -18
  379. data/ext/common/agents/HelperAgent/RequestHandler.cpp +4 -4
  380. data/ext/common/agents/HelperAgent/RequestHandler.h +30 -21
  381. data/ext/common/agents/LoggingAgent/AdminController.h +1 -1
  382. data/ext/common/agents/LoggingAgent/FilterSupport.h +13 -11
  383. data/ext/common/agents/LoggingAgent/LoggingServer.h +11 -11
  384. data/ext/common/agents/LoggingAgent/Main.cpp +9 -9
  385. data/ext/common/agents/LoggingAgent/RemoteSender.h +3 -3
  386. data/ext/common/agents/SpawnPreparer.cpp +1 -0
  387. data/ext/common/agents/Watchdog/AgentWatcher.cpp +8 -7
  388. data/ext/common/agents/Watchdog/Main.cpp +81 -73
  389. data/ext/common/agents/Watchdog/ServerInstanceDirToucher.cpp +1 -1
  390. data/ext/libev/Changes +57 -0
  391. data/ext/libev/LICENSE +2 -1
  392. data/ext/libev/Makefile.in +110 -50
  393. data/ext/libev/README +8 -8
  394. data/ext/libev/aclocal.m4 +1503 -861
  395. data/ext/libev/config.guess +290 -304
  396. data/ext/libev/config.sub +77 -198
  397. data/ext/libev/configure +1735 -890
  398. data/ext/libev/configure.ac +3 -2
  399. data/ext/libev/ev++.h +6 -6
  400. data/ext/libev/ev.c +541 -214
  401. data/ext/libev/ev.h +106 -100
  402. data/ext/libev/ev_epoll.c +1 -1
  403. data/ext/libev/ev_kqueue.c +20 -4
  404. data/ext/libev/ev_vars.h +15 -16
  405. data/ext/libev/ev_win32.c +12 -2
  406. data/ext/libev/ev_wrap.h +162 -160
  407. data/ext/libev/event.c +29 -6
  408. data/ext/libev/event.h +9 -2
  409. data/ext/libev/ltmain.sh +2632 -1384
  410. data/ext/nginx/ConfigurationCommands.c +1 -1
  411. data/ext/nginx/ConfigurationCommands.c.erb +3 -1
  412. data/ext/nginx/ContentHandler.c +25 -2
  413. data/ext/nginx/CreateLocationConfig.c +1 -0
  414. data/ext/nginx/CreateLocationConfig.c.erb +1 -1
  415. data/ext/nginx/MergeLocationConfig.c +1 -0
  416. data/ext/nginx/MergeLocationConfig.c.erb +1 -1
  417. data/ext/nginx/config +12 -0
  418. data/ext/oxt/dynamic_thread_group.hpp +7 -4
  419. data/ext/oxt/system_calls.cpp +5 -1
  420. data/ext/oxt/system_calls.hpp +3 -0
  421. data/helper-scripts/node-loader.js +117 -249
  422. data/lib/phusion_passenger.rb +27 -5
  423. data/lib/phusion_passenger/abstract_installer.rb +104 -9
  424. data/lib/phusion_passenger/admin_tools/memory_stats.rb +10 -9
  425. data/lib/phusion_passenger/apache2/config_options.rb +6 -3
  426. data/lib/phusion_passenger/common_library.rb +7 -1
  427. data/lib/phusion_passenger/constants.rb +6 -0
  428. data/lib/phusion_passenger/loader_shared_helpers.rb +7 -4
  429. data/lib/phusion_passenger/nginx/config_options.rb +2 -1
  430. data/lib/phusion_passenger/packaging.rb +3 -0
  431. data/lib/phusion_passenger/platform_info/apache.rb +43 -6
  432. data/lib/phusion_passenger/platform_info/apache_detector.rb +15 -5
  433. data/lib/phusion_passenger/platform_info/compiler.rb +167 -32
  434. data/lib/phusion_passenger/platform_info/cxx_portability.rb +133 -77
  435. data/lib/phusion_passenger/platform_info/depcheck.rb +17 -7
  436. data/lib/phusion_passenger/platform_info/depcheck_specs/apache2.rb +3 -3
  437. data/lib/phusion_passenger/platform_info/depcheck_specs/compiler_toolchain.rb +4 -4
  438. data/lib/phusion_passenger/platform_info/depcheck_specs/ruby.rb +5 -6
  439. data/lib/phusion_passenger/platform_info/linux.rb +2 -1
  440. data/lib/phusion_passenger/platform_info/operating_system.rb +1 -1
  441. data/lib/phusion_passenger/platform_info/ruby.rb +18 -3
  442. data/lib/phusion_passenger/standalone/runtime_installer.rb +6 -2
  443. data/lib/phusion_passenger/standalone/start_command.rb +8 -2
  444. data/lib/phusion_passenger/utils/ansi_colors.rb +9 -0
  445. data/lib/phusion_passenger/utils/hosts_file_parser.rb +4 -2
  446. data/node_lib/phusion_passenger/httplib_emulation.js +141 -0
  447. data/node_lib/phusion_passenger/line_reader.js +154 -0
  448. data/node_lib/phusion_passenger/request_handler.js +65 -0
  449. data/node_lib/phusion_passenger/session_protocol_parser.js +113 -0
  450. data/resources/templates/apache2/deployment_example.txt.erb +2 -1
  451. data/resources/templates/apache2/installing_against_a_different_apache.txt.erb +14 -0
  452. data/resources/templates/apache2/multiple_apache_installations_detected.txt.erb +15 -0
  453. data/resources/templates/apache2/possible_solutions_for_compilation_and_installation_problems.txt.erb +4 -5
  454. data/resources/templates/general_error_with_html.html.template +1 -1
  455. data/resources/templates/installer_common/gem_install_permission_problems.txt.erb +17 -0
  456. data/resources/templates/installer_common/low_amount_of_memory_warning.txt.erb +6 -4
  457. data/resources/templates/installer_common/world_inaccessible_directories.txt.erb +16 -0
  458. data/resources/templates/nginx/deployment_example.txt.erb +2 -1
  459. data/resources/templates/nginx/possible_solutions_for_compilation_and_installation_problems.txt.erb +4 -5
  460. data/resources/templates/standalone/config.erb +1 -0
  461. data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +3 -3
  462. data/test/cxx/ApplicationPool2/PoolTest.cpp +4 -4
  463. data/test/cxx/ApplicationPool2/ProcessTest.cpp +5 -5
  464. data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +5 -5
  465. data/test/cxx/ApplicationPool2/SpawnerTestCases.cpp +1 -1
  466. data/test/cxx/EventedBufferedInputTest.cpp +6 -6
  467. data/test/cxx/FileBackedPipeTest.cpp +1 -1
  468. data/test/cxx/MessagePassingTest.cpp +1 -1
  469. data/test/cxx/MessageServerTest.cpp +4 -4
  470. data/test/cxx/RequestHandlerTest.cpp +7 -7
  471. data/test/cxx/UnionStationTest.cpp +2 -2
  472. data/test/node/line_reader_spec.js +338 -0
  473. data/test/node/spec_helper.js +27 -0
  474. data/test/ruby/standalone/runtime_installer_spec.rb +2 -1
  475. metadata +131 -22
  476. metadata.gz.asc +7 -7
  477. data/ext/boost/functional/hash/detail/container_fwd_0x.hpp +0 -29
  478. data/ext/boost/lambda/core.hpp +0 -79
  479. data/ext/boost/lambda/detail/actions.hpp +0 -174
  480. data/ext/boost/lambda/detail/arity_code.hpp +0 -110
  481. data/ext/boost/lambda/detail/function_adaptors.hpp +0 -789
  482. data/ext/boost/lambda/detail/is_instance_of.hpp +0 -104
  483. data/ext/boost/lambda/detail/lambda_config.hpp +0 -48
  484. data/ext/boost/lambda/detail/lambda_functor_base.hpp +0 -615
  485. data/ext/boost/lambda/detail/lambda_functors.hpp +0 -324
  486. data/ext/boost/lambda/detail/lambda_fwd.hpp +0 -74
  487. data/ext/boost/lambda/detail/lambda_traits.hpp +0 -578
  488. data/ext/boost/lambda/detail/member_ptr.hpp +0 -737
  489. data/ext/boost/lambda/detail/operator_actions.hpp +0 -139
  490. data/ext/boost/lambda/detail/operator_lambda_func_base.hpp +0 -271
  491. data/ext/boost/lambda/detail/operator_return_type_traits.hpp +0 -917
  492. data/ext/boost/lambda/detail/operators.hpp +0 -370
  493. data/ext/boost/lambda/detail/ret.hpp +0 -325
  494. data/ext/boost/lambda/detail/return_type_traits.hpp +0 -282
  495. data/ext/boost/lambda/detail/select_functions.hpp +0 -74
  496. data/ext/boost/lambda/lambda.hpp +0 -34
@@ -11,9 +11,10 @@
11
11
  // http://www.boost.org/libs/smart_ptr/scoped_array.htm
12
12
  //
13
13
 
14
+ #include <boost/config.hpp>
14
15
  #include <boost/assert.hpp>
15
16
  #include <boost/checked_delete.hpp>
16
- #include <boost/config.hpp> // in case ptrdiff_t not in std
17
+ #include <boost/smart_ptr/detail/sp_nullptr_t.hpp>
17
18
 
18
19
  #include <boost/detail/workaround.hpp>
19
20
 
@@ -53,7 +54,7 @@ public:
53
54
 
54
55
  typedef T element_type;
55
56
 
56
- explicit scoped_array( T * p = 0 ) : px( p ) // never throws
57
+ explicit scoped_array( T * p = 0 ) BOOST_NOEXCEPT : px( p )
57
58
  {
58
59
  #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
59
60
  boost::sp_array_constructor_hook( px );
@@ -68,20 +69,20 @@ public:
68
69
  boost::checked_array_delete( px );
69
70
  }
70
71
 
71
- void reset(T * p = 0) // never throws
72
+ void reset(T * p = 0) // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT)
72
73
  {
73
74
  BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors
74
75
  this_type(p).swap(*this);
75
76
  }
76
77
 
77
- T & operator[](std::ptrdiff_t i) const // never throws
78
+ T & operator[](std::ptrdiff_t i) const // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT)
78
79
  {
79
80
  BOOST_ASSERT( px != 0 );
80
81
  BOOST_ASSERT( i >= 0 );
81
82
  return px[i];
82
83
  }
83
84
 
84
- T * get() const // never throws
85
+ T * get() const BOOST_NOEXCEPT
85
86
  {
86
87
  return px;
87
88
  }
@@ -89,7 +90,7 @@ public:
89
90
  // implicit conversion to "bool"
90
91
  #include <boost/smart_ptr/detail/operator_bool.hpp>
91
92
 
92
- void swap(scoped_array & b) // never throws
93
+ void swap(scoped_array & b) BOOST_NOEXCEPT
93
94
  {
94
95
  T * tmp = b.px;
95
96
  b.px = px;
@@ -97,7 +98,31 @@ public:
97
98
  }
98
99
  };
99
100
 
100
- template<class T> inline void swap(scoped_array<T> & a, scoped_array<T> & b) // never throws
101
+ #if !defined( BOOST_NO_CXX11_NULLPTR )
102
+
103
+ template<class T> inline bool operator==( scoped_array<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
104
+ {
105
+ return p.get() == 0;
106
+ }
107
+
108
+ template<class T> inline bool operator==( boost::detail::sp_nullptr_t, scoped_array<T> const & p ) BOOST_NOEXCEPT
109
+ {
110
+ return p.get() == 0;
111
+ }
112
+
113
+ template<class T> inline bool operator!=( scoped_array<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
114
+ {
115
+ return p.get() != 0;
116
+ }
117
+
118
+ template<class T> inline bool operator!=( boost::detail::sp_nullptr_t, scoped_array<T> const & p ) BOOST_NOEXCEPT
119
+ {
120
+ return p.get() != 0;
121
+ }
122
+
123
+ #endif
124
+
125
+ template<class T> inline void swap(scoped_array<T> & a, scoped_array<T> & b) BOOST_NOEXCEPT
101
126
  {
102
127
  a.swap(b);
103
128
  }
@@ -11,8 +11,10 @@
11
11
  // http://www.boost.org/libs/smart_ptr/scoped_ptr.htm
12
12
  //
13
13
 
14
+ #include <boost/config.hpp>
14
15
  #include <boost/assert.hpp>
15
16
  #include <boost/checked_delete.hpp>
17
+ #include <boost/smart_ptr/detail/sp_nullptr_t.hpp>
16
18
  #include <boost/detail/workaround.hpp>
17
19
 
18
20
  #ifndef BOOST_NO_AUTO_PTR
@@ -63,7 +65,7 @@ public:
63
65
 
64
66
  #ifndef BOOST_NO_AUTO_PTR
65
67
 
66
- explicit scoped_ptr( std::auto_ptr<T> p ): px( p.release() ) // never throws
68
+ explicit scoped_ptr( std::auto_ptr<T> p ) BOOST_NOEXCEPT : px( p.release() )
67
69
  {
68
70
  #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
69
71
  boost::sp_scalar_constructor_hook( px );
@@ -98,7 +100,7 @@ public:
98
100
  return px;
99
101
  }
100
102
 
101
- T * get() const // never throws
103
+ T * get() const BOOST_NOEXCEPT
102
104
  {
103
105
  return px;
104
106
  }
@@ -106,7 +108,7 @@ public:
106
108
  // implicit conversion to "bool"
107
109
  #include <boost/smart_ptr/detail/operator_bool.hpp>
108
110
 
109
- void swap(scoped_ptr & b) // never throws
111
+ void swap(scoped_ptr & b) BOOST_NOEXCEPT
110
112
  {
111
113
  T * tmp = b.px;
112
114
  b.px = px;
@@ -114,14 +116,38 @@ public:
114
116
  }
115
117
  };
116
118
 
117
- template<class T> inline void swap(scoped_ptr<T> & a, scoped_ptr<T> & b) // never throws
119
+ #if !defined( BOOST_NO_CXX11_NULLPTR )
120
+
121
+ template<class T> inline bool operator==( scoped_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
122
+ {
123
+ return p.get() == 0;
124
+ }
125
+
126
+ template<class T> inline bool operator==( boost::detail::sp_nullptr_t, scoped_ptr<T> const & p ) BOOST_NOEXCEPT
127
+ {
128
+ return p.get() == 0;
129
+ }
130
+
131
+ template<class T> inline bool operator!=( scoped_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
132
+ {
133
+ return p.get() != 0;
134
+ }
135
+
136
+ template<class T> inline bool operator!=( boost::detail::sp_nullptr_t, scoped_ptr<T> const & p ) BOOST_NOEXCEPT
137
+ {
138
+ return p.get() != 0;
139
+ }
140
+
141
+ #endif
142
+
143
+ template<class T> inline void swap(scoped_ptr<T> & a, scoped_ptr<T> & b) BOOST_NOEXCEPT
118
144
  {
119
145
  a.swap(b);
120
146
  }
121
147
 
122
148
  // get_pointer(p) is a generic way to say p.get()
123
149
 
124
- template<class T> inline T * get_pointer(scoped_ptr<T> const & p)
150
+ template<class T> inline T * get_pointer(scoped_ptr<T> const & p) BOOST_NOEXCEPT
125
151
  {
126
152
  return p.get();
127
153
  }
@@ -5,7 +5,7 @@
5
5
  // shared_array.hpp
6
6
  //
7
7
  // (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
8
- // Copyright (c) 2001, 2002 Peter Dimov
8
+ // Copyright (c) 2001, 2002, 2012 Peter Dimov
9
9
  //
10
10
  // Distributed under the Boost Software License, Version 1.0. (See
11
11
  // accompanying file LICENSE_1_0.txt or copy at
@@ -25,7 +25,9 @@
25
25
  #include <boost/assert.hpp>
26
26
  #include <boost/checked_delete.hpp>
27
27
 
28
+ #include <boost/smart_ptr/shared_ptr.hpp>
28
29
  #include <boost/smart_ptr/detail/shared_count.hpp>
30
+ #include <boost/smart_ptr/detail/sp_nullptr_t.hpp>
29
31
  #include <boost/detail/workaround.hpp>
30
32
 
31
33
  #include <cstddef> // for std::ptrdiff_t
@@ -55,59 +57,146 @@ public:
55
57
 
56
58
  typedef T element_type;
57
59
 
58
- explicit shared_array(T * p = 0): px(p), pn(p, deleter())
60
+ shared_array() BOOST_NOEXCEPT : px( 0 ), pn()
59
61
  {
60
62
  }
61
63
 
64
+ template<class Y>
65
+ explicit shared_array( Y * p ): px( p ), pn( p, checked_array_deleter<Y>() )
66
+ {
67
+ boost::detail::sp_assert_convertible< Y[], T[] >();
68
+ }
69
+
62
70
  //
63
71
  // Requirements: D's copy constructor must not throw
64
72
  //
65
73
  // shared_array will release p by calling d(p)
66
74
  //
67
75
 
68
- template<class D> shared_array(T * p, D d): px(p), pn(p, d)
76
+ template<class Y, class D> shared_array( Y * p, D d ): px( p ), pn( p, d )
69
77
  {
78
+ boost::detail::sp_assert_convertible< Y[], T[] >();
79
+ }
80
+
81
+ // As above, but with allocator. A's copy constructor shall not throw.
82
+
83
+ template<class Y, class D, class A> shared_array( Y * p, D d, A a ): px( p ), pn( p, d, a )
84
+ {
85
+ boost::detail::sp_assert_convertible< Y[], T[] >();
70
86
  }
71
87
 
72
88
  // generated copy constructor, destructor are fine...
73
89
 
74
- #if defined( BOOST_HAS_RVALUE_REFS )
90
+ #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
75
91
 
76
92
  // ... except in C++0x, move disables the implicit copy
77
93
 
78
- shared_array( shared_array const & r ): px( r.px ), pn( r.pn ) // never throws
94
+ shared_array( shared_array const & r ) BOOST_NOEXCEPT : px( r.px ), pn( r.pn )
79
95
  {
80
96
  }
81
97
 
98
+ shared_array( shared_array && r ) BOOST_NOEXCEPT : px( r.px ), pn()
99
+ {
100
+ pn.swap( r.pn );
101
+ r.px = 0;
102
+ }
103
+
104
+ #endif
105
+
106
+ // conversion
107
+
108
+ template<class Y>
109
+ #if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
110
+
111
+ shared_array( shared_array<Y> const & r, typename boost::detail::sp_enable_if_convertible< Y[], T[] >::type = boost::detail::sp_empty() )
112
+
113
+ #else
114
+
115
+ shared_array( shared_array<Y> const & r )
116
+
82
117
  #endif
118
+ BOOST_NOEXCEPT : px( r.px ), pn( r.pn ) // never throws
119
+ {
120
+ boost::detail::sp_assert_convertible< Y[], T[] >();
121
+ }
122
+
123
+ // aliasing
124
+
125
+ template< class Y >
126
+ shared_array( shared_array<Y> const & r, element_type * p ) BOOST_NOEXCEPT : px( p ), pn( r.pn )
127
+ {
128
+ }
83
129
 
84
130
  // assignment
85
131
 
86
- shared_array & operator=( shared_array const & r ) // never throws
132
+ shared_array & operator=( shared_array const & r ) BOOST_NOEXCEPT
87
133
  {
88
134
  this_type( r ).swap( *this );
89
135
  return *this;
90
136
  }
91
137
 
92
- void reset(T * p = 0)
138
+ #if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1400)
139
+
140
+ template<class Y>
141
+ shared_array & operator=( shared_array<Y> const & r ) BOOST_NOEXCEPT
142
+ {
143
+ this_type( r ).swap( *this );
144
+ return *this;
145
+ }
146
+
147
+ #endif
148
+
149
+ #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
150
+
151
+ shared_array & operator=( shared_array && r ) BOOST_NOEXCEPT
152
+ {
153
+ this_type( static_cast< shared_array && >( r ) ).swap( *this );
154
+ return *this;
155
+ }
156
+
157
+ template<class Y>
158
+ shared_array & operator=( shared_array<Y> && r ) BOOST_NOEXCEPT
159
+ {
160
+ this_type( static_cast< shared_array<Y> && >( r ) ).swap( *this );
161
+ return *this;
162
+ }
163
+
164
+ #endif
165
+
166
+ void reset() BOOST_NOEXCEPT
167
+ {
168
+ this_type().swap( *this );
169
+ }
170
+
171
+ template<class Y> void reset( Y * p ) // Y must be complete
172
+ {
173
+ BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors
174
+ this_type( p ).swap( *this );
175
+ }
176
+
177
+ template<class Y, class D> void reset( Y * p, D d )
178
+ {
179
+ this_type( p, d ).swap( *this );
180
+ }
181
+
182
+ template<class Y, class D, class A> void reset( Y * p, D d, A a )
93
183
  {
94
- BOOST_ASSERT(p == 0 || p != px);
95
- this_type(p).swap(*this);
184
+ this_type( p, d, a ).swap( *this );
96
185
  }
97
186
 
98
- template <class D> void reset(T * p, D d)
187
+ template<class Y> void reset( shared_array<Y> const & r, element_type * p )
99
188
  {
100
- this_type(p, d).swap(*this);
189
+ this_type( r, p ).swap( *this );
101
190
  }
102
191
 
103
- T & operator[] (std::ptrdiff_t i) const // never throws
192
+ T & operator[] (std::ptrdiff_t i) const // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT)
104
193
  {
105
194
  BOOST_ASSERT(px != 0);
106
195
  BOOST_ASSERT(i >= 0);
107
196
  return px[i];
108
197
  }
109
198
 
110
- T * get() const // never throws
199
+ T * get() const BOOST_NOEXCEPT
111
200
  {
112
201
  return px;
113
202
  }
@@ -115,17 +204,17 @@ public:
115
204
  // implicit conversion to "bool"
116
205
  #include <boost/smart_ptr/detail/operator_bool.hpp>
117
206
 
118
- bool unique() const // never throws
207
+ bool unique() const BOOST_NOEXCEPT
119
208
  {
120
209
  return pn.unique();
121
210
  }
122
211
 
123
- long use_count() const // never throws
212
+ long use_count() const BOOST_NOEXCEPT
124
213
  {
125
214
  return pn.use_count();
126
215
  }
127
216
 
128
- void swap(shared_array<T> & other) // never throws
217
+ void swap(shared_array<T> & other) BOOST_NOEXCEPT
129
218
  {
130
219
  std::swap(px, other.px);
131
220
  pn.swap(other.pn);
@@ -138,27 +227,53 @@ public:
138
227
 
139
228
  private:
140
229
 
230
+ template<class Y> friend class shared_array;
231
+
141
232
  T * px; // contained pointer
142
233
  detail::shared_count pn; // reference counter
143
234
 
144
235
  }; // shared_array
145
236
 
146
- template<class T> inline bool operator==(shared_array<T> const & a, shared_array<T> const & b) // never throws
237
+ template<class T> inline bool operator==(shared_array<T> const & a, shared_array<T> const & b) BOOST_NOEXCEPT
147
238
  {
148
239
  return a.get() == b.get();
149
240
  }
150
241
 
151
- template<class T> inline bool operator!=(shared_array<T> const & a, shared_array<T> const & b) // never throws
242
+ template<class T> inline bool operator!=(shared_array<T> const & a, shared_array<T> const & b) BOOST_NOEXCEPT
152
243
  {
153
244
  return a.get() != b.get();
154
245
  }
155
246
 
156
- template<class T> inline bool operator<(shared_array<T> const & a, shared_array<T> const & b) // never throws
247
+ #if !defined( BOOST_NO_CXX11_NULLPTR )
248
+
249
+ template<class T> inline bool operator==( shared_array<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
250
+ {
251
+ return p.get() == 0;
252
+ }
253
+
254
+ template<class T> inline bool operator==( boost::detail::sp_nullptr_t, shared_array<T> const & p ) BOOST_NOEXCEPT
255
+ {
256
+ return p.get() == 0;
257
+ }
258
+
259
+ template<class T> inline bool operator!=( shared_array<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
260
+ {
261
+ return p.get() != 0;
262
+ }
263
+
264
+ template<class T> inline bool operator!=( boost::detail::sp_nullptr_t, shared_array<T> const & p ) BOOST_NOEXCEPT
265
+ {
266
+ return p.get() != 0;
267
+ }
268
+
269
+ #endif
270
+
271
+ template<class T> inline bool operator<(shared_array<T> const & a, shared_array<T> const & b) BOOST_NOEXCEPT
157
272
  {
158
273
  return std::less<T*>()(a.get(), b.get());
159
274
  }
160
275
 
161
- template<class T> void swap(shared_array<T> & a, shared_array<T> & b) // never throws
276
+ template<class T> void swap(shared_array<T> & a, shared_array<T> & b) BOOST_NOEXCEPT
162
277
  {
163
278
  a.swap(b);
164
279
  }
@@ -32,6 +32,7 @@
32
32
  #include <boost/smart_ptr/detail/shared_count.hpp>
33
33
  #include <boost/detail/workaround.hpp>
34
34
  #include <boost/smart_ptr/detail/sp_convertible.hpp>
35
+ #include <boost/smart_ptr/detail/sp_nullptr_t.hpp>
35
36
 
36
37
  #if !defined(BOOST_SP_NO_ATOMIC_ACCESS)
37
38
  #include <boost/smart_ptr/detail/spinlock_pool.hpp>
@@ -57,45 +58,151 @@ namespace boost
57
58
  template<class T> class shared_ptr;
58
59
  template<class T> class weak_ptr;
59
60
  template<class T> class enable_shared_from_this;
60
- template<class T> class enable_shared_from_this2;
61
+ class enable_shared_from_raw;
61
62
 
62
63
  namespace detail
63
64
  {
64
65
 
65
- struct static_cast_tag {};
66
- struct const_cast_tag {};
67
- struct dynamic_cast_tag {};
68
- struct polymorphic_cast_tag {};
66
+ // sp_element, element_type
69
67
 
70
- template<class T> struct shared_ptr_traits
68
+ template< class T > struct sp_element
71
69
  {
72
- typedef T & reference;
70
+ typedef T type;
73
71
  };
74
72
 
75
- template<> struct shared_ptr_traits<void>
73
+ #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
74
+
75
+ template< class T > struct sp_element< T[] >
76
+ {
77
+ typedef T type;
78
+ };
79
+
80
+ #if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 )
81
+
82
+ template< class T, std::size_t N > struct sp_element< T[N] >
83
+ {
84
+ typedef T type;
85
+ };
86
+
87
+ #endif
88
+
89
+ #endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
90
+
91
+ // sp_dereference, return type of operator*
92
+
93
+ template< class T > struct sp_dereference
94
+ {
95
+ typedef T & type;
96
+ };
97
+
98
+ template<> struct sp_dereference< void >
76
99
  {
77
- typedef void reference;
100
+ typedef void type;
78
101
  };
79
102
 
80
103
  #if !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS)
81
104
 
82
- template<> struct shared_ptr_traits<void const>
105
+ template<> struct sp_dereference< void const >
106
+ {
107
+ typedef void type;
108
+ };
109
+
110
+ template<> struct sp_dereference< void volatile >
111
+ {
112
+ typedef void type;
113
+ };
114
+
115
+ template<> struct sp_dereference< void const volatile >
116
+ {
117
+ typedef void type;
118
+ };
119
+
120
+ #endif // !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS)
121
+
122
+ #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
123
+
124
+ template< class T > struct sp_dereference< T[] >
125
+ {
126
+ typedef void type;
127
+ };
128
+
129
+ #if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 )
130
+
131
+ template< class T, std::size_t N > struct sp_dereference< T[N] >
83
132
  {
84
- typedef void reference;
133
+ typedef void type;
85
134
  };
86
135
 
87
- template<> struct shared_ptr_traits<void volatile>
136
+ #endif
137
+
138
+ #endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
139
+
140
+ // sp_member_access, return type of operator->
141
+
142
+ template< class T > struct sp_member_access
143
+ {
144
+ typedef T * type;
145
+ };
146
+
147
+ #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
148
+
149
+ template< class T > struct sp_member_access< T[] >
150
+ {
151
+ typedef void type;
152
+ };
153
+
154
+ #if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 )
155
+
156
+ template< class T, std::size_t N > struct sp_member_access< T[N] >
157
+ {
158
+ typedef void type;
159
+ };
160
+
161
+ #endif
162
+
163
+ #endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
164
+
165
+ // sp_array_access, return type of operator[]
166
+
167
+ template< class T > struct sp_array_access
88
168
  {
89
- typedef void reference;
169
+ typedef void type;
90
170
  };
91
171
 
92
- template<> struct shared_ptr_traits<void const volatile>
172
+ #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
173
+
174
+ template< class T > struct sp_array_access< T[] >
93
175
  {
94
- typedef void reference;
176
+ typedef T & type;
177
+ };
178
+
179
+ #if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 )
180
+
181
+ template< class T, std::size_t N > struct sp_array_access< T[N] >
182
+ {
183
+ typedef T & type;
95
184
  };
96
185
 
97
186
  #endif
98
187
 
188
+ #endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
189
+
190
+ // sp_extent, for operator[] index check
191
+
192
+ template< class T > struct sp_extent
193
+ {
194
+ enum _vt { value = 0 };
195
+ };
196
+
197
+ #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
198
+
199
+ template< class T, std::size_t N > struct sp_extent< T[N] >
200
+ {
201
+ enum _vt { value = N };
202
+ };
203
+
204
+ #endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
205
+
99
206
  // enable_shared_from_this support
100
207
 
101
208
  template< class X, class Y, class T > inline void sp_enable_shared_from_this( boost::shared_ptr<X> const * ppx, Y const * py, boost::enable_shared_from_this< T > const * pe )
@@ -106,13 +213,7 @@ template< class X, class Y, class T > inline void sp_enable_shared_from_this( bo
106
213
  }
107
214
  }
108
215
 
109
- template< class X, class Y, class T > inline void sp_enable_shared_from_this( boost::shared_ptr<X> * ppx, Y const * py, boost::enable_shared_from_this2< T > const * pe )
110
- {
111
- if( pe != 0 )
112
- {
113
- pe->_internal_accept_owner( ppx, const_cast< Y* >( py ) );
114
- }
115
- }
216
+ template< class X, class Y > inline void sp_enable_shared_from_this( boost::shared_ptr<X> * ppx, Y const * py, boost::enable_shared_from_raw const * pe );
116
217
 
117
218
  #ifdef _MANAGED
118
219
 
@@ -150,6 +251,69 @@ template< class T, class R > struct sp_enable_if_auto_ptr< std::auto_ptr< T >, R
150
251
 
151
252
  #endif
152
253
 
254
+ // sp_assert_convertible
255
+
256
+ template< class Y, class T > inline void sp_assert_convertible()
257
+ {
258
+ #if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
259
+
260
+ // static_assert( sp_convertible< Y, T >::value );
261
+ typedef char tmp[ sp_convertible< Y, T >::value? 1: -1 ];
262
+ (void)sizeof( tmp );
263
+
264
+ #else
265
+
266
+ T* p = static_cast< Y* >( 0 );
267
+ (void)p;
268
+
269
+ #endif
270
+ }
271
+
272
+ // pointer constructor helper
273
+
274
+ template< class T, class Y > inline void sp_pointer_construct( boost::shared_ptr< T > * ppx, Y * p, boost::detail::shared_count & pn )
275
+ {
276
+ boost::detail::shared_count( p ).swap( pn );
277
+ boost::detail::sp_enable_shared_from_this( ppx, p, p );
278
+ }
279
+
280
+ #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
281
+
282
+ template< class T, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[] > * /*ppx*/, Y * p, boost::detail::shared_count & pn )
283
+ {
284
+ sp_assert_convertible< Y[], T[] >();
285
+ boost::detail::shared_count( p, boost::checked_array_deleter< T >() ).swap( pn );
286
+ }
287
+
288
+ template< class T, std::size_t N, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[N] > * /*ppx*/, Y * p, boost::detail::shared_count & pn )
289
+ {
290
+ sp_assert_convertible< Y[N], T[N] >();
291
+ boost::detail::shared_count( p, boost::checked_array_deleter< T >() ).swap( pn );
292
+ }
293
+
294
+ #endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
295
+
296
+ // deleter constructor helper
297
+
298
+ template< class T, class Y > inline void sp_deleter_construct( boost::shared_ptr< T > * ppx, Y * p )
299
+ {
300
+ boost::detail::sp_enable_shared_from_this( ppx, p, p );
301
+ }
302
+
303
+ #if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
304
+
305
+ template< class T, class Y > inline void sp_deleter_construct( boost::shared_ptr< T[] > * /*ppx*/, Y * /*p*/ )
306
+ {
307
+ sp_assert_convertible< Y[], T[] >();
308
+ }
309
+
310
+ template< class T, std::size_t N, class Y > inline void sp_deleter_construct( boost::shared_ptr< T[N] > * /*ppx*/, Y * /*p*/ )
311
+ {
312
+ sp_assert_convertible< Y[N], T[N] >();
313
+ }
314
+
315
+ #endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
316
+
153
317
  } // namespace detail
154
318
 
155
319
 
@@ -170,19 +334,24 @@ private:
170
334
 
171
335
  public:
172
336
 
173
- typedef T element_type;
174
- typedef T value_type;
175
- typedef T * pointer;
176
- typedef typename boost::detail::shared_ptr_traits<T>::reference reference;
337
+ typedef typename boost::detail::sp_element< T >::type element_type;
177
338
 
178
- shared_ptr(): px(0), pn() // never throws in 1.30+
339
+ shared_ptr() BOOST_NOEXCEPT : px( 0 ), pn() // never throws in 1.30+
179
340
  {
180
341
  }
181
342
 
343
+ #if !defined( BOOST_NO_CXX11_NULLPTR )
344
+
345
+ shared_ptr( boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT : px( 0 ), pn() // never throws
346
+ {
347
+ }
348
+
349
+ #endif
350
+
182
351
  template<class Y>
183
- explicit shared_ptr( Y * p ): px( p ), pn( p ) // Y must be complete
352
+ explicit shared_ptr( Y * p ): px( p ), pn() // Y must be complete
184
353
  {
185
- boost::detail::sp_enable_shared_from_this( this, p, p );
354
+ boost::detail::sp_pointer_construct( this, p, pn );
186
355
  }
187
356
 
188
357
  //
@@ -191,39 +360,58 @@ public:
191
360
  // shared_ptr will release p by calling d(p)
192
361
  //
193
362
 
194
- template<class Y, class D> shared_ptr(Y * p, D d): px(p), pn(p, d)
363
+ template<class Y, class D> shared_ptr( Y * p, D d ): px( p ), pn( p, d )
195
364
  {
196
- boost::detail::sp_enable_shared_from_this( this, p, p );
365
+ boost::detail::sp_deleter_construct( this, p );
197
366
  }
198
367
 
368
+ #if !defined( BOOST_NO_CXX11_NULLPTR )
369
+
370
+ template<class D> shared_ptr( boost::detail::sp_nullptr_t p, D d ): px( p ), pn( p, d )
371
+ {
372
+ }
373
+
374
+ #endif
375
+
199
376
  // As above, but with allocator. A's copy constructor shall not throw.
200
377
 
201
378
  template<class Y, class D, class A> shared_ptr( Y * p, D d, A a ): px( p ), pn( p, d, a )
202
379
  {
203
- boost::detail::sp_enable_shared_from_this( this, p, p );
380
+ boost::detail::sp_deleter_construct( this, p );
204
381
  }
205
382
 
383
+ #if !defined( BOOST_NO_CXX11_NULLPTR )
384
+
385
+ template<class D, class A> shared_ptr( boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( p, d, a )
386
+ {
387
+ }
388
+
389
+ #endif
390
+
206
391
  // generated copy constructor, destructor are fine...
207
392
 
208
- #if defined( BOOST_HAS_RVALUE_REFS )
393
+ #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
209
394
 
210
395
  // ... except in C++0x, move disables the implicit copy
211
396
 
212
- shared_ptr( shared_ptr const & r ): px( r.px ), pn( r.pn ) // never throws
397
+ shared_ptr( shared_ptr const & r ) BOOST_NOEXCEPT : px( r.px ), pn( r.pn )
213
398
  {
214
399
  }
215
400
 
216
401
  #endif
217
402
 
218
403
  template<class Y>
219
- explicit shared_ptr(weak_ptr<Y> const & r): pn(r.pn) // may throw
404
+ explicit shared_ptr( weak_ptr<Y> const & r ): pn( r.pn ) // may throw
220
405
  {
406
+ boost::detail::sp_assert_convertible< Y, T >();
407
+
221
408
  // it is now safe to copy r.px, as pn(r.pn) did not throw
222
409
  px = r.px;
223
410
  }
224
411
 
225
412
  template<class Y>
226
- shared_ptr( weak_ptr<Y> const & r, boost::detail::sp_nothrow_tag ): px( 0 ), pn( r.pn, boost::detail::sp_nothrow_tag() ) // never throws
413
+ shared_ptr( weak_ptr<Y> const & r, boost::detail::sp_nothrow_tag )
414
+ BOOST_NOEXCEPT : px( 0 ), pn( r.pn, boost::detail::sp_nothrow_tag() )
227
415
  {
228
416
  if( !pn.empty() )
229
417
  {
@@ -241,72 +429,80 @@ public:
241
429
  shared_ptr( shared_ptr<Y> const & r )
242
430
 
243
431
  #endif
244
- : px( r.px ), pn( r.pn ) // never throws
432
+ BOOST_NOEXCEPT : px( r.px ), pn( r.pn )
245
433
  {
434
+ boost::detail::sp_assert_convertible< Y, T >();
246
435
  }
247
436
 
248
437
  // aliasing
249
438
  template< class Y >
250
- shared_ptr( shared_ptr<Y> const & r, T * p ): px( p ), pn( r.pn ) // never throws
439
+ shared_ptr( shared_ptr<Y> const & r, element_type * p ) BOOST_NOEXCEPT : px( p ), pn( r.pn )
251
440
  {
252
441
  }
253
442
 
254
- template<class Y>
255
- shared_ptr(shared_ptr<Y> const & r, boost::detail::static_cast_tag): px(static_cast<element_type *>(r.px)), pn(r.pn)
256
- {
257
- }
443
+ #ifndef BOOST_NO_AUTO_PTR
258
444
 
259
445
  template<class Y>
260
- shared_ptr(shared_ptr<Y> const & r, boost::detail::const_cast_tag): px(const_cast<element_type *>(r.px)), pn(r.pn)
446
+ explicit shared_ptr( std::auto_ptr<Y> & r ): px(r.get()), pn()
261
447
  {
262
- }
448
+ boost::detail::sp_assert_convertible< Y, T >();
263
449
 
264
- template<class Y>
265
- shared_ptr(shared_ptr<Y> const & r, boost::detail::dynamic_cast_tag): px(dynamic_cast<element_type *>(r.px)), pn(r.pn)
266
- {
267
- if(px == 0) // need to allocate new counter -- the cast failed
268
- {
269
- pn = boost::detail::shared_count();
270
- }
271
- }
450
+ Y * tmp = r.get();
451
+ pn = boost::detail::shared_count( r );
272
452
 
273
- template<class Y>
274
- shared_ptr(shared_ptr<Y> const & r, boost::detail::polymorphic_cast_tag): px(dynamic_cast<element_type *>(r.px)), pn(r.pn)
275
- {
276
- if(px == 0)
277
- {
278
- boost::throw_exception(std::bad_cast());
279
- }
453
+ boost::detail::sp_deleter_construct( this, tmp );
280
454
  }
281
455
 
282
- #ifndef BOOST_NO_AUTO_PTR
456
+ #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
283
457
 
284
458
  template<class Y>
285
- explicit shared_ptr(std::auto_ptr<Y> & r): px(r.get()), pn()
459
+ shared_ptr( std::auto_ptr<Y> && r ): px(r.get()), pn()
286
460
  {
461
+ boost::detail::sp_assert_convertible< Y, T >();
462
+
287
463
  Y * tmp = r.get();
288
- pn = boost::detail::shared_count(r);
289
- boost::detail::sp_enable_shared_from_this( this, tmp, tmp );
464
+ pn = boost::detail::shared_count( r );
465
+
466
+ boost::detail::sp_deleter_construct( this, tmp );
290
467
  }
291
468
 
292
- #if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
469
+ #elif !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
293
470
 
294
471
  template<class Ap>
295
472
  explicit shared_ptr( Ap r, typename boost::detail::sp_enable_if_auto_ptr<Ap, int>::type = 0 ): px( r.get() ), pn()
296
473
  {
297
- typename Ap::element_type * tmp = r.get();
474
+ typedef typename Ap::element_type Y;
475
+
476
+ boost::detail::sp_assert_convertible< Y, T >();
477
+
478
+ Y * tmp = r.get();
298
479
  pn = boost::detail::shared_count( r );
299
- boost::detail::sp_enable_shared_from_this( this, tmp, tmp );
300
- }
301
480
 
481
+ boost::detail::sp_deleter_construct( this, tmp );
482
+ }
302
483
 
303
484
  #endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
304
485
 
305
486
  #endif // BOOST_NO_AUTO_PTR
306
487
 
488
+ #if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
489
+
490
+ template< class Y, class D >
491
+ shared_ptr( std::unique_ptr< Y, D > && r ): px( r.get() ), pn()
492
+ {
493
+ boost::detail::sp_assert_convertible< Y, T >();
494
+
495
+ typename std::unique_ptr< Y, D >::pointer tmp = r.get();
496
+ pn = boost::detail::shared_count( r );
497
+
498
+ boost::detail::sp_deleter_construct( this, tmp );
499
+ }
500
+
501
+ #endif
502
+
307
503
  // assignment
308
504
 
309
- shared_ptr & operator=( shared_ptr const & r ) // never throws
505
+ shared_ptr & operator=( shared_ptr const & r ) BOOST_NOEXCEPT
310
506
  {
311
507
  this_type(r).swap(*this);
312
508
  return *this;
@@ -315,7 +511,7 @@ public:
315
511
  #if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1400)
316
512
 
317
513
  template<class Y>
318
- shared_ptr & operator=(shared_ptr<Y> const & r) // never throws
514
+ shared_ptr & operator=(shared_ptr<Y> const & r) BOOST_NOEXCEPT
319
515
  {
320
516
  this_type(r).swap(*this);
321
517
  return *this;
@@ -328,11 +524,20 @@ public:
328
524
  template<class Y>
329
525
  shared_ptr & operator=( std::auto_ptr<Y> & r )
330
526
  {
331
- this_type(r).swap(*this);
527
+ this_type( r ).swap( *this );
528
+ return *this;
529
+ }
530
+
531
+ #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
532
+
533
+ template<class Y>
534
+ shared_ptr & operator=( std::auto_ptr<Y> && r )
535
+ {
536
+ this_type( static_cast< std::auto_ptr<Y> && >( r ) ).swap( *this );
332
537
  return *this;
333
538
  }
334
539
 
335
- #if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
540
+ #elif !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
336
541
 
337
542
  template<class Ap>
338
543
  typename boost::detail::sp_enable_if_auto_ptr< Ap, shared_ptr & >::type operator=( Ap r )
@@ -341,16 +546,26 @@ public:
341
546
  return *this;
342
547
  }
343
548
 
344
-
345
549
  #endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
346
550
 
347
551
  #endif // BOOST_NO_AUTO_PTR
348
552
 
553
+ #if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
554
+
555
+ template<class Y, class D>
556
+ shared_ptr & operator=( std::unique_ptr<Y, D> && r )
557
+ {
558
+ this_type( static_cast< std::unique_ptr<Y, D> && >( r ) ).swap(*this);
559
+ return *this;
560
+ }
561
+
562
+ #endif
563
+
349
564
  // Move support
350
565
 
351
- #if defined( BOOST_HAS_RVALUE_REFS )
566
+ #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
352
567
 
353
- shared_ptr( shared_ptr && r ): px( r.px ), pn() // never throws
568
+ shared_ptr( shared_ptr && r ) BOOST_NOEXCEPT : px( r.px ), pn()
354
569
  {
355
570
  pn.swap( r.pn );
356
571
  r.px = 0;
@@ -366,20 +581,22 @@ public:
366
581
  shared_ptr( shared_ptr<Y> && r )
367
582
 
368
583
  #endif
369
- : px( r.px ), pn() // never throws
584
+ BOOST_NOEXCEPT : px( r.px ), pn()
370
585
  {
586
+ boost::detail::sp_assert_convertible< Y, T >();
587
+
371
588
  pn.swap( r.pn );
372
589
  r.px = 0;
373
590
  }
374
591
 
375
- shared_ptr & operator=( shared_ptr && r ) // never throws
592
+ shared_ptr & operator=( shared_ptr && r ) BOOST_NOEXCEPT
376
593
  {
377
594
  this_type( static_cast< shared_ptr && >( r ) ).swap( *this );
378
595
  return *this;
379
596
  }
380
597
 
381
598
  template<class Y>
382
- shared_ptr & operator=( shared_ptr<Y> && r ) // never throws
599
+ shared_ptr & operator=( shared_ptr<Y> && r ) BOOST_NOEXCEPT
383
600
  {
384
601
  this_type( static_cast< shared_ptr<Y> && >( r ) ).swap( *this );
385
602
  return *this;
@@ -387,15 +604,25 @@ public:
387
604
 
388
605
  #endif
389
606
 
390
- void reset() // never throws in 1.30+
607
+ #if !defined( BOOST_NO_CXX11_NULLPTR )
608
+
609
+ shared_ptr & operator=( boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT // never throws
391
610
  {
392
611
  this_type().swap(*this);
612
+ return *this;
393
613
  }
394
614
 
395
- template<class Y> void reset(Y * p) // Y must be complete
615
+ #endif
616
+
617
+ void reset() BOOST_NOEXCEPT // never throws in 1.30+
396
618
  {
397
- BOOST_ASSERT(p == 0 || p != px); // catch self-reset errors
398
- this_type(p).swap(*this);
619
+ this_type().swap(*this);
620
+ }
621
+
622
+ template<class Y> void reset( Y * p ) // Y must be complete
623
+ {
624
+ BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors
625
+ this_type( p ).swap( *this );
399
626
  }
400
627
 
401
628
  template<class Y, class D> void reset( Y * p, D d )
@@ -408,24 +635,35 @@ public:
408
635
  this_type( p, d, a ).swap( *this );
409
636
  }
410
637
 
411
- template<class Y> void reset( shared_ptr<Y> const & r, T * p )
638
+ template<class Y> void reset( shared_ptr<Y> const & r, element_type * p )
412
639
  {
413
640
  this_type( r, p ).swap( *this );
414
641
  }
415
-
416
- reference operator* () const // never throws
642
+
643
+ // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT)
644
+ typename boost::detail::sp_dereference< T >::type operator* () const
417
645
  {
418
- BOOST_ASSERT(px != 0);
646
+ BOOST_ASSERT( px != 0 );
419
647
  return *px;
420
648
  }
421
-
422
- T * operator-> () const // never throws
649
+
650
+ // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT)
651
+ typename boost::detail::sp_member_access< T >::type operator-> () const
423
652
  {
424
- BOOST_ASSERT(px != 0);
653
+ BOOST_ASSERT( px != 0 );
425
654
  return px;
426
655
  }
656
+
657
+ // never throws (but has a BOOST_ASSERT in it, so not marked with BOOST_NOEXCEPT)
658
+ typename boost::detail::sp_array_access< T >::type operator[] ( std::ptrdiff_t i ) const
659
+ {
660
+ BOOST_ASSERT( px != 0 );
661
+ BOOST_ASSERT( i >= 0 && ( i < boost::detail::sp_extent< T >::value || boost::detail::sp_extent< T >::value == 0 ) );
662
+
663
+ return px[ i ];
664
+ }
427
665
 
428
- T * get() const // never throws
666
+ element_type * get() const BOOST_NOEXCEPT
429
667
  {
430
668
  return px;
431
669
  }
@@ -433,38 +671,43 @@ public:
433
671
  // implicit conversion to "bool"
434
672
  #include <boost/smart_ptr/detail/operator_bool.hpp>
435
673
 
436
- bool unique() const // never throws
674
+ bool unique() const BOOST_NOEXCEPT
437
675
  {
438
676
  return pn.unique();
439
677
  }
440
678
 
441
- long use_count() const // never throws
679
+ long use_count() const BOOST_NOEXCEPT
442
680
  {
443
681
  return pn.use_count();
444
682
  }
445
683
 
446
- void swap(shared_ptr<T> & other) // never throws
684
+ void swap( shared_ptr & other ) BOOST_NOEXCEPT
447
685
  {
448
686
  std::swap(px, other.px);
449
687
  pn.swap(other.pn);
450
688
  }
451
689
 
452
- template<class Y> bool owner_before( shared_ptr<Y> const & rhs ) const
690
+ template<class Y> bool owner_before( shared_ptr<Y> const & rhs ) const BOOST_NOEXCEPT
453
691
  {
454
692
  return pn < rhs.pn;
455
693
  }
456
694
 
457
- template<class Y> bool owner_before( weak_ptr<Y> const & rhs ) const
695
+ template<class Y> bool owner_before( weak_ptr<Y> const & rhs ) const BOOST_NOEXCEPT
458
696
  {
459
697
  return pn < rhs.pn;
460
698
  }
461
699
 
462
- void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const
700
+ void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const BOOST_NOEXCEPT
463
701
  {
464
702
  return pn.get_deleter( ti );
465
703
  }
466
704
 
467
- bool _internal_equiv( shared_ptr const & r ) const
705
+ void * _internal_get_untyped_deleter() const BOOST_NOEXCEPT
706
+ {
707
+ return pn.get_untyped_deleter();
708
+ }
709
+
710
+ bool _internal_equiv( shared_ptr const & r ) const BOOST_NOEXCEPT
468
711
  {
469
712
  return px == r.px && pn == r.pn;
470
713
  }
@@ -482,17 +725,17 @@ private:
482
725
 
483
726
  #endif
484
727
 
485
- T * px; // contained pointer
728
+ element_type * px; // contained pointer
486
729
  boost::detail::shared_count pn; // reference counter
487
730
 
488
731
  }; // shared_ptr
489
732
 
490
- template<class T, class U> inline bool operator==(shared_ptr<T> const & a, shared_ptr<U> const & b)
733
+ template<class T, class U> inline bool operator==(shared_ptr<T> const & a, shared_ptr<U> const & b) BOOST_NOEXCEPT
491
734
  {
492
735
  return a.get() == b.get();
493
736
  }
494
737
 
495
- template<class T, class U> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<U> const & b)
738
+ template<class T, class U> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<U> const & b) BOOST_NOEXCEPT
496
739
  {
497
740
  return a.get() != b.get();
498
741
  }
@@ -501,64 +744,90 @@ template<class T, class U> inline bool operator!=(shared_ptr<T> const & a, share
501
744
 
502
745
  // Resolve the ambiguity between our op!= and the one in rel_ops
503
746
 
504
- template<class T> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<T> const & b)
747
+ template<class T> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<T> const & b) BOOST_NOEXCEPT
505
748
  {
506
749
  return a.get() != b.get();
507
750
  }
508
751
 
509
752
  #endif
510
753
 
511
- template<class T, class U> inline bool operator<(shared_ptr<T> const & a, shared_ptr<U> const & b)
754
+ #if !defined( BOOST_NO_CXX11_NULLPTR )
755
+
756
+ template<class T> inline bool operator==( shared_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
512
757
  {
513
- return a.owner_before( b );
758
+ return p.get() == 0;
514
759
  }
515
760
 
516
- template<class T> inline void swap(shared_ptr<T> & a, shared_ptr<T> & b)
761
+ template<class T> inline bool operator==( boost::detail::sp_nullptr_t, shared_ptr<T> const & p ) BOOST_NOEXCEPT
517
762
  {
518
- a.swap(b);
763
+ return p.get() == 0;
519
764
  }
520
765
 
521
- template<class T, class U> shared_ptr<T> static_pointer_cast(shared_ptr<U> const & r)
766
+ template<class T> inline bool operator!=( shared_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_NOEXCEPT
522
767
  {
523
- return shared_ptr<T>(r, boost::detail::static_cast_tag());
768
+ return p.get() != 0;
524
769
  }
525
770
 
526
- template<class T, class U> shared_ptr<T> const_pointer_cast(shared_ptr<U> const & r)
771
+ template<class T> inline bool operator!=( boost::detail::sp_nullptr_t, shared_ptr<T> const & p ) BOOST_NOEXCEPT
527
772
  {
528
- return shared_ptr<T>(r, boost::detail::const_cast_tag());
773
+ return p.get() != 0;
529
774
  }
530
775
 
531
- template<class T, class U> shared_ptr<T> dynamic_pointer_cast(shared_ptr<U> const & r)
776
+ #endif
777
+
778
+ template<class T, class U> inline bool operator<(shared_ptr<T> const & a, shared_ptr<U> const & b) BOOST_NOEXCEPT
532
779
  {
533
- return shared_ptr<T>(r, boost::detail::dynamic_cast_tag());
780
+ return a.owner_before( b );
534
781
  }
535
782
 
536
- // shared_*_cast names are deprecated. Use *_pointer_cast instead.
783
+ template<class T> inline void swap(shared_ptr<T> & a, shared_ptr<T> & b) BOOST_NOEXCEPT
784
+ {
785
+ a.swap(b);
786
+ }
537
787
 
538
- template<class T, class U> shared_ptr<T> shared_static_cast(shared_ptr<U> const & r)
788
+ template<class T, class U> shared_ptr<T> static_pointer_cast( shared_ptr<U> const & r ) BOOST_NOEXCEPT
539
789
  {
540
- return shared_ptr<T>(r, boost::detail::static_cast_tag());
790
+ (void) static_cast< T* >( static_cast< U* >( 0 ) );
791
+
792
+ typedef typename shared_ptr<T>::element_type E;
793
+
794
+ E * p = static_cast< E* >( r.get() );
795
+ return shared_ptr<T>( r, p );
541
796
  }
542
797
 
543
- template<class T, class U> shared_ptr<T> shared_dynamic_cast(shared_ptr<U> const & r)
798
+ template<class T, class U> shared_ptr<T> const_pointer_cast( shared_ptr<U> const & r ) BOOST_NOEXCEPT
544
799
  {
545
- return shared_ptr<T>(r, boost::detail::dynamic_cast_tag());
800
+ (void) const_cast< T* >( static_cast< U* >( 0 ) );
801
+
802
+ typedef typename shared_ptr<T>::element_type E;
803
+
804
+ E * p = const_cast< E* >( r.get() );
805
+ return shared_ptr<T>( r, p );
546
806
  }
547
807
 
548
- template<class T, class U> shared_ptr<T> shared_polymorphic_cast(shared_ptr<U> const & r)
808
+ template<class T, class U> shared_ptr<T> dynamic_pointer_cast( shared_ptr<U> const & r ) BOOST_NOEXCEPT
549
809
  {
550
- return shared_ptr<T>(r, boost::detail::polymorphic_cast_tag());
810
+ (void) dynamic_cast< T* >( static_cast< U* >( 0 ) );
811
+
812
+ typedef typename shared_ptr<T>::element_type E;
813
+
814
+ E * p = dynamic_cast< E* >( r.get() );
815
+ return p? shared_ptr<T>( r, p ): shared_ptr<T>();
551
816
  }
552
817
 
553
- template<class T, class U> shared_ptr<T> shared_polymorphic_downcast(shared_ptr<U> const & r)
818
+ template<class T, class U> shared_ptr<T> reinterpret_pointer_cast( shared_ptr<U> const & r ) BOOST_NOEXCEPT
554
819
  {
555
- BOOST_ASSERT(dynamic_cast<T *>(r.get()) == r.get());
556
- return shared_static_cast<T>(r);
820
+ (void) reinterpret_cast< T* >( static_cast< U* >( 0 ) );
821
+
822
+ typedef typename shared_ptr<T>::element_type E;
823
+
824
+ E * p = reinterpret_cast< E* >( r.get() );
825
+ return shared_ptr<T>( r, p );
557
826
  }
558
827
 
559
828
  // get_pointer() enables boost::mem_fn to recognize shared_ptr
560
829
 
561
- template<class T> inline T * get_pointer(shared_ptr<T> const & p)
830
+ template<class T> inline typename shared_ptr<T>::element_type * get_pointer(shared_ptr<T> const & p) BOOST_NOEXCEPT
562
831
  {
563
832
  return p.get();
564
833
  }
@@ -600,6 +869,9 @@ template<class E, class T, class Y> std::basic_ostream<E, T> & operator<< (std::
600
869
 
601
870
  // get_deleter
602
871
 
872
+ namespace detail
873
+ {
874
+
603
875
  #if ( defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3) ) || \
604
876
  ( defined(__EDG_VERSION__) && BOOST_WORKAROUND(__EDG_VERSION__, <= 238) ) || \
605
877
  ( defined(__HP_aCC) && BOOST_WORKAROUND(__HP_aCC, <= 33500) )
@@ -607,7 +879,7 @@ template<class E, class T, class Y> std::basic_ostream<E, T> & operator<< (std::
607
879
  // g++ 2.9x doesn't allow static_cast<X const *>(void *)
608
880
  // apparently EDG 2.38 and HP aCC A.03.35 also don't accept it
609
881
 
610
- template<class D, class T> D * get_deleter(shared_ptr<T> const & p)
882
+ template<class D, class T> D * basic_get_deleter(shared_ptr<T> const & p)
611
883
  {
612
884
  void const * q = p._internal_get_deleter(BOOST_SP_TYPEID(D));
613
885
  return const_cast<D *>(static_cast<D const *>(q));
@@ -615,18 +887,64 @@ template<class D, class T> D * get_deleter(shared_ptr<T> const & p)
615
887
 
616
888
  #else
617
889
 
618
- template<class D, class T> D * get_deleter(shared_ptr<T> const & p)
890
+ template<class D, class T> D * basic_get_deleter( shared_ptr<T> const & p ) BOOST_NOEXCEPT
619
891
  {
620
- return static_cast<D *>(p._internal_get_deleter(BOOST_SP_TYPEID(D)));
892
+ return static_cast<D *>( p._internal_get_deleter(BOOST_SP_TYPEID(D)) );
621
893
  }
622
894
 
623
895
  #endif
624
896
 
897
+ class esft2_deleter_wrapper
898
+ {
899
+ private:
900
+
901
+ shared_ptr<void> deleter_;
902
+
903
+ public:
904
+
905
+ esft2_deleter_wrapper()
906
+ {
907
+ }
908
+
909
+ template< class T > void set_deleter( shared_ptr<T> const & deleter )
910
+ {
911
+ deleter_ = deleter;
912
+ }
913
+
914
+ template<typename D> D* get_deleter() const BOOST_NOEXCEPT
915
+ {
916
+ return boost::detail::basic_get_deleter<D>( deleter_ );
917
+ }
918
+
919
+ template< class T> void operator()( T* )
920
+ {
921
+ BOOST_ASSERT( deleter_.use_count() <= 1 );
922
+ deleter_.reset();
923
+ }
924
+ };
925
+
926
+ } // namespace detail
927
+
928
+ template<class D, class T> D * get_deleter( shared_ptr<T> const & p ) BOOST_NOEXCEPT
929
+ {
930
+ D *del = boost::detail::basic_get_deleter<D>(p);
931
+
932
+ if(del == 0)
933
+ {
934
+ boost::detail::esft2_deleter_wrapper *del_wrapper = boost::detail::basic_get_deleter<boost::detail::esft2_deleter_wrapper>(p);
935
+ // The following get_deleter method call is fully qualified because
936
+ // older versions of gcc (2.95, 3.2.3) fail to compile it when written del_wrapper->get_deleter<D>()
937
+ if(del_wrapper) del = del_wrapper->::boost::detail::esft2_deleter_wrapper::get_deleter<D>();
938
+ }
939
+
940
+ return del;
941
+ }
942
+
625
943
  // atomic access
626
944
 
627
945
  #if !defined(BOOST_SP_NO_ATOMIC_ACCESS)
628
946
 
629
- template<class T> inline bool atomic_is_lock_free( shared_ptr<T> const * /*p*/ )
947
+ template<class T> inline bool atomic_is_lock_free( shared_ptr<T> const * /*p*/ ) BOOST_NOEXCEPT
630
948
  {
631
949
  return false;
632
950
  }
@@ -705,7 +1023,7 @@ template<class T> inline bool atomic_compare_exchange_explicit( shared_ptr<T> *
705
1023
 
706
1024
  template< class T > struct hash;
707
1025
 
708
- template< class T > std::size_t hash_value( boost::shared_ptr<T> const & p )
1026
+ template< class T > std::size_t hash_value( boost::shared_ptr<T> const & p ) BOOST_NOEXCEPT
709
1027
  {
710
1028
  return boost::hash< T* >()( p.get() );
711
1029
  }