From b3861a2b5b484e907b663caa5b539ea7065bb3cd Mon Sep 17 00:00:00 2001 From: bugaevskiy Date: Mon, 25 Jul 2022 10:21:31 +0300 Subject: Reimport boost/smart_ptr as a separate project --- CMakeLists.darwin.txt | 1 + CMakeLists.linux.txt | 1 + contrib/restricted/boost/CMakeLists.txt | 1 + .../restricted/boost/boost/detail/atomic_count.hpp | 21 - .../boost/boost/detail/lightweight_mutex.hpp | 22 - .../boost/boost/detail/lightweight_thread.hpp | 159 --- .../boost/boost/detail/quick_allocator.hpp | 23 - .../boost/boost/enable_shared_from_this.hpp | 18 - contrib/restricted/boost/boost/intrusive_ptr.hpp | 18 - contrib/restricted/boost/boost/make_shared.hpp | 16 - contrib/restricted/boost/boost/make_unique.hpp | 13 - contrib/restricted/boost/boost/pointer_cast.hpp | 122 -- .../restricted/boost/boost/pointer_to_other.hpp | 55 - contrib/restricted/boost/boost/scoped_array.hpp | 15 - contrib/restricted/boost/boost/scoped_ptr.hpp | 15 - contrib/restricted/boost/boost/shared_array.hpp | 19 - contrib/restricted/boost/boost/shared_ptr.hpp | 19 - contrib/restricted/boost/boost/smart_ptr.hpp | 26 - .../smart_ptr/allocate_local_shared_array.hpp | 228 ---- .../boost/smart_ptr/allocate_shared_array.hpp | 703 ------------ .../boost/boost/smart_ptr/atomic_shared_ptr.hpp | 233 ---- .../boost/boost/smart_ptr/bad_weak_ptr.hpp | 70 -- .../boost/boost/smart_ptr/detail/atomic_count.hpp | 99 -- .../boost/smart_ptr/detail/atomic_count_gcc.hpp | 72 -- .../smart_ptr/detail/atomic_count_gcc_x86.hpp | 77 -- .../boost/smart_ptr/detail/atomic_count_nt.hpp | 59 - .../boost/smart_ptr/detail/atomic_count_pt.hpp | 97 -- .../smart_ptr/detail/atomic_count_solaris.hpp | 59 - .../boost/smart_ptr/detail/atomic_count_spin.hpp | 62 - .../smart_ptr/detail/atomic_count_std_atomic.hpp | 60 - .../boost/smart_ptr/detail/atomic_count_sync.hpp | 61 - .../boost/smart_ptr/detail/atomic_count_win32.hpp | 63 -- .../boost/smart_ptr/detail/lightweight_mutex.hpp | 42 - .../boost/smart_ptr/detail/local_counted_base.hpp | 148 --- .../boost/smart_ptr/detail/local_sp_deleter.hpp | 91 -- .../boost/boost/smart_ptr/detail/lwm_nop.hpp | 37 - .../boost/boost/smart_ptr/detail/lwm_pthreads.hpp | 87 -- .../boost/boost/smart_ptr/detail/lwm_win32_cs.hpp | 134 --- .../boost/boost/smart_ptr/detail/operator_bool.hpp | 64 -- .../boost/smart_ptr/detail/quick_allocator.hpp | 199 ---- .../boost/boost/smart_ptr/detail/shared_count.hpp | 667 ----------- .../boost/smart_ptr/detail/sp_convertible.hpp | 92 -- .../boost/smart_ptr/detail/sp_counted_base.hpp | 96 -- .../smart_ptr/detail/sp_counted_base_acc_ia64.hpp | 152 --- .../boost/smart_ptr/detail/sp_counted_base_aix.hpp | 144 --- .../smart_ptr/detail/sp_counted_base_clang.hpp | 150 --- .../smart_ptr/detail/sp_counted_base_cw_ppc.hpp | 172 --- .../smart_ptr/detail/sp_counted_base_cw_x86.hpp | 160 --- .../smart_ptr/detail/sp_counted_base_gcc_ia64.hpp | 159 --- .../smart_ptr/detail/sp_counted_base_gcc_mips.hpp | 189 ---- .../smart_ptr/detail/sp_counted_base_gcc_ppc.hpp | 183 --- .../smart_ptr/detail/sp_counted_base_gcc_sparc.hpp | 168 --- .../smart_ptr/detail/sp_counted_base_gcc_x86.hpp | 175 --- .../boost/smart_ptr/detail/sp_counted_base_nt.hpp | 109 -- .../boost/smart_ptr/detail/sp_counted_base_pt.hpp | 138 --- .../smart_ptr/detail/sp_counted_base_snc_ps3.hpp | 163 --- .../smart_ptr/detail/sp_counted_base_solaris.hpp | 115 -- .../smart_ptr/detail/sp_counted_base_spin.hpp | 133 --- .../detail/sp_counted_base_std_atomic.hpp | 138 --- .../smart_ptr/detail/sp_counted_base_sync.hpp | 157 --- .../smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp | 152 --- .../boost/smart_ptr/detail/sp_counted_base_w32.hpp | 132 --- .../boost/smart_ptr/detail/sp_counted_impl.hpp | 292 ----- .../smart_ptr/detail/sp_disable_deprecated.hpp | 40 - .../boost/boost/smart_ptr/detail/sp_forward.hpp | 52 - .../boost/boost/smart_ptr/detail/sp_has_sync.hpp | 69 -- .../boost/smart_ptr/detail/sp_interlocked.hpp | 163 --- .../boost/boost/smart_ptr/detail/sp_noexcept.hpp | 48 - .../boost/boost/smart_ptr/detail/sp_nullptr_t.hpp | 45 - .../boost/boost/smart_ptr/detail/spinlock.hpp | 68 -- .../boost/smart_ptr/detail/spinlock_gcc_arm.hpp | 121 -- .../boost/boost/smart_ptr/detail/spinlock_nt.hpp | 89 -- .../boost/boost/smart_ptr/detail/spinlock_pool.hpp | 91 -- .../boost/boost/smart_ptr/detail/spinlock_pt.hpp | 79 -- .../boost/smart_ptr/detail/spinlock_std_atomic.hpp | 83 -- .../boost/boost/smart_ptr/detail/spinlock_sync.hpp | 87 -- .../boost/boost/smart_ptr/detail/spinlock_w32.hpp | 113 -- .../boost/boost/smart_ptr/detail/yield_k.hpp | 177 --- .../boost/smart_ptr/enable_shared_from_raw.hpp | 165 --- .../boost/smart_ptr/enable_shared_from_this.hpp | 90 -- .../boost/boost/smart_ptr/intrusive_ptr.hpp | 361 ------ .../boost/smart_ptr/intrusive_ref_counter.hpp | 188 ---- .../boost/boost/smart_ptr/local_shared_ptr.hpp | 684 ----------- .../boost/boost/smart_ptr/make_local_shared.hpp | 17 - .../boost/smart_ptr/make_local_shared_array.hpp | 67 -- .../boost/smart_ptr/make_local_shared_object.hpp | 199 ---- .../boost/boost/smart_ptr/make_shared.hpp | 21 - .../boost/boost/smart_ptr/make_shared_array.hpp | 66 -- .../boost/boost/smart_ptr/make_shared_object.hpp | 801 ------------- .../boost/boost/smart_ptr/make_unique.hpp | 110 -- .../boost/boost/smart_ptr/owner_less.hpp | 34 - .../boost/boost/smart_ptr/scoped_array.hpp | 132 --- .../boost/boost/smart_ptr/scoped_ptr.hpp | 167 --- .../boost/boost/smart_ptr/shared_array.hpp | 293 ----- .../boost/boost/smart_ptr/shared_ptr.hpp | 1184 -------------------- .../restricted/boost/boost/smart_ptr/weak_ptr.hpp | 254 ----- contrib/restricted/boost/boost/weak_ptr.hpp | 18 - contrib/restricted/boost/smart_ptr/CMakeLists.txt | 25 + contrib/restricted/boost/smart_ptr/README.md | 6 + .../include/boost/detail/atomic_count.hpp | 21 + .../include/boost/detail/lightweight_mutex.hpp | 22 + .../include/boost/enable_shared_from_this.hpp | 18 + .../smart_ptr/include/boost/intrusive_ptr.hpp | 18 + .../boost/smart_ptr/include/boost/make_shared.hpp | 16 + .../smart_ptr/include/boost/pointer_to_other.hpp | 55 + .../boost/smart_ptr/include/boost/scoped_array.hpp | 15 + .../boost/smart_ptr/include/boost/scoped_ptr.hpp | 15 + .../boost/smart_ptr/include/boost/shared_array.hpp | 19 + .../boost/smart_ptr/include/boost/shared_ptr.hpp | 19 + .../boost/smart_ptr/include/boost/smart_ptr.hpp | 26 + .../boost/smart_ptr/allocate_shared_array.hpp | 703 ++++++++++++ .../include/boost/smart_ptr/bad_weak_ptr.hpp | 70 ++ .../boost/smart_ptr/detail/atomic_count.hpp | 99 ++ .../boost/smart_ptr/detail/atomic_count_gcc.hpp | 72 ++ .../smart_ptr/detail/atomic_count_gcc_x86.hpp | 77 ++ .../boost/smart_ptr/detail/atomic_count_nt.hpp | 59 + .../boost/smart_ptr/detail/atomic_count_pt.hpp | 97 ++ .../boost/smart_ptr/detail/atomic_count_spin.hpp | 62 + .../smart_ptr/detail/atomic_count_std_atomic.hpp | 60 + .../boost/smart_ptr/detail/atomic_count_sync.hpp | 61 + .../boost/smart_ptr/detail/atomic_count_win32.hpp | 63 ++ .../boost/smart_ptr/detail/lightweight_mutex.hpp | 42 + .../boost/smart_ptr/detail/local_counted_base.hpp | 148 +++ .../boost/smart_ptr/detail/local_sp_deleter.hpp | 91 ++ .../include/boost/smart_ptr/detail/lwm_nop.hpp | 37 + .../boost/smart_ptr/detail/lwm_pthreads.hpp | 87 ++ .../boost/smart_ptr/detail/lwm_win32_cs.hpp | 134 +++ .../boost/smart_ptr/detail/operator_bool.hpp | 64 ++ .../boost/smart_ptr/detail/quick_allocator.hpp | 199 ++++ .../boost/smart_ptr/detail/shared_count.hpp | 667 +++++++++++ .../boost/smart_ptr/detail/sp_convertible.hpp | 92 ++ .../boost/smart_ptr/detail/sp_counted_base.hpp | 96 ++ .../smart_ptr/detail/sp_counted_base_acc_ia64.hpp | 152 +++ .../boost/smart_ptr/detail/sp_counted_base_aix.hpp | 144 +++ .../smart_ptr/detail/sp_counted_base_clang.hpp | 150 +++ .../smart_ptr/detail/sp_counted_base_cw_ppc.hpp | 172 +++ .../smart_ptr/detail/sp_counted_base_gcc_ia64.hpp | 159 +++ .../smart_ptr/detail/sp_counted_base_gcc_mips.hpp | 189 ++++ .../smart_ptr/detail/sp_counted_base_gcc_ppc.hpp | 183 +++ .../smart_ptr/detail/sp_counted_base_gcc_sparc.hpp | 168 +++ .../smart_ptr/detail/sp_counted_base_gcc_x86.hpp | 175 +++ .../boost/smart_ptr/detail/sp_counted_base_nt.hpp | 109 ++ .../boost/smart_ptr/detail/sp_counted_base_pt.hpp | 138 +++ .../smart_ptr/detail/sp_counted_base_snc_ps3.hpp | 163 +++ .../smart_ptr/detail/sp_counted_base_spin.hpp | 133 +++ .../detail/sp_counted_base_std_atomic.hpp | 138 +++ .../smart_ptr/detail/sp_counted_base_sync.hpp | 157 +++ .../smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp | 152 +++ .../boost/smart_ptr/detail/sp_counted_base_w32.hpp | 132 +++ .../boost/smart_ptr/detail/sp_counted_impl.hpp | 292 +++++ .../smart_ptr/detail/sp_disable_deprecated.hpp | 40 + .../include/boost/smart_ptr/detail/sp_forward.hpp | 52 + .../include/boost/smart_ptr/detail/sp_has_sync.hpp | 69 ++ .../boost/smart_ptr/detail/sp_interlocked.hpp | 163 +++ .../include/boost/smart_ptr/detail/sp_noexcept.hpp | 48 + .../boost/smart_ptr/detail/sp_nullptr_t.hpp | 45 + .../include/boost/smart_ptr/detail/spinlock.hpp | 68 ++ .../boost/smart_ptr/detail/spinlock_gcc_arm.hpp | 121 ++ .../include/boost/smart_ptr/detail/spinlock_nt.hpp | 89 ++ .../boost/smart_ptr/detail/spinlock_pool.hpp | 91 ++ .../include/boost/smart_ptr/detail/spinlock_pt.hpp | 79 ++ .../boost/smart_ptr/detail/spinlock_std_atomic.hpp | 83 ++ .../boost/smart_ptr/detail/spinlock_sync.hpp | 87 ++ .../boost/smart_ptr/detail/spinlock_w32.hpp | 113 ++ .../include/boost/smart_ptr/detail/yield_k.hpp | 177 +++ .../boost/smart_ptr/enable_shared_from_this.hpp | 90 ++ .../include/boost/smart_ptr/intrusive_ptr.hpp | 361 ++++++ .../boost/smart_ptr/intrusive_ref_counter.hpp | 188 ++++ .../include/boost/smart_ptr/make_shared.hpp | 21 + .../include/boost/smart_ptr/make_shared_array.hpp | 66 ++ .../include/boost/smart_ptr/make_shared_object.hpp | 801 +++++++++++++ .../include/boost/smart_ptr/make_unique.hpp | 110 ++ .../include/boost/smart_ptr/scoped_array.hpp | 132 +++ .../include/boost/smart_ptr/scoped_ptr.hpp | 167 +++ .../include/boost/smart_ptr/shared_array.hpp | 293 +++++ .../include/boost/smart_ptr/shared_ptr.hpp | 1184 ++++++++++++++++++++ .../smart_ptr/include/boost/smart_ptr/weak_ptr.hpp | 254 +++++ .../boost/smart_ptr/include/boost/weak_ptr.hpp | 18 + 178 files changed, 11274 insertions(+), 13518 deletions(-) delete mode 100644 contrib/restricted/boost/boost/detail/atomic_count.hpp delete mode 100644 contrib/restricted/boost/boost/detail/lightweight_mutex.hpp delete mode 100644 contrib/restricted/boost/boost/detail/lightweight_thread.hpp delete mode 100644 contrib/restricted/boost/boost/detail/quick_allocator.hpp delete mode 100644 contrib/restricted/boost/boost/enable_shared_from_this.hpp delete mode 100644 contrib/restricted/boost/boost/intrusive_ptr.hpp delete mode 100644 contrib/restricted/boost/boost/make_shared.hpp delete mode 100644 contrib/restricted/boost/boost/make_unique.hpp delete mode 100644 contrib/restricted/boost/boost/pointer_cast.hpp delete mode 100644 contrib/restricted/boost/boost/pointer_to_other.hpp delete mode 100644 contrib/restricted/boost/boost/scoped_array.hpp delete mode 100644 contrib/restricted/boost/boost/scoped_ptr.hpp delete mode 100644 contrib/restricted/boost/boost/shared_array.hpp delete mode 100644 contrib/restricted/boost/boost/shared_ptr.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/allocate_local_shared_array.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/allocate_shared_array.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/atomic_shared_ptr.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/bad_weak_ptr.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/atomic_count.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_gcc.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_nt.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_pt.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_solaris.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_spin.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_std_atomic.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_sync.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_win32.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/lightweight_mutex.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/local_counted_base.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/local_sp_deleter.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/lwm_nop.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/lwm_pthreads.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/lwm_win32_cs.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/operator_bool.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/quick_allocator.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/shared_count.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_convertible.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_aix.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_clang.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_cw_x86.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_nt.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_pt.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_solaris.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_spin.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_sync.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_w32.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_impl.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_disable_deprecated.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_forward.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_has_sync.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_interlocked.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_noexcept.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/sp_nullptr_t.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/spinlock.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/spinlock_gcc_arm.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/spinlock_nt.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/spinlock_pool.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/spinlock_pt.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/spinlock_std_atomic.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/spinlock_sync.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/spinlock_w32.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/detail/yield_k.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/enable_shared_from_raw.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/enable_shared_from_this.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/intrusive_ptr.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/intrusive_ref_counter.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/local_shared_ptr.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/make_local_shared.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/make_local_shared_array.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/make_local_shared_object.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/make_shared.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/make_shared_array.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/make_shared_object.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/make_unique.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/owner_less.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/scoped_array.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/scoped_ptr.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/shared_array.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/shared_ptr.hpp delete mode 100644 contrib/restricted/boost/boost/smart_ptr/weak_ptr.hpp delete mode 100644 contrib/restricted/boost/boost/weak_ptr.hpp create mode 100644 contrib/restricted/boost/smart_ptr/CMakeLists.txt create mode 100644 contrib/restricted/boost/smart_ptr/README.md create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/detail/atomic_count.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/detail/lightweight_mutex.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/enable_shared_from_this.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/intrusive_ptr.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/make_shared.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/pointer_to_other.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/scoped_array.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/scoped_ptr.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/shared_array.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/shared_ptr.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/allocate_shared_array.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/bad_weak_ptr.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_gcc.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_nt.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_pt.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_spin.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_std_atomic.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_sync.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_win32.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lightweight_mutex.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/local_counted_base.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/local_sp_deleter.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_nop.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_pthreads.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_win32_cs.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/operator_bool.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/quick_allocator.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/shared_count.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_convertible.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_aix.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_clang.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_nt.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_pt.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_spin.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_sync.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_w32.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_impl.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_disable_deprecated.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_forward.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_has_sync.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_interlocked.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_noexcept.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_nullptr_t.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_gcc_arm.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_nt.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_pool.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_pt.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_std_atomic.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_sync.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_w32.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/yield_k.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/enable_shared_from_this.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/intrusive_ptr.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/intrusive_ref_counter.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_shared.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_shared_array.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_shared_object.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_unique.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/scoped_array.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/scoped_ptr.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/shared_array.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/shared_ptr.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/weak_ptr.hpp create mode 100644 contrib/restricted/boost/smart_ptr/include/boost/weak_ptr.hpp diff --git a/CMakeLists.darwin.txt b/CMakeLists.darwin.txt index 9c42e63afba..f311dbf02ce 100644 --- a/CMakeLists.darwin.txt +++ b/CMakeLists.darwin.txt @@ -148,6 +148,7 @@ add_subdirectory(contrib/restricted/boost/move) add_subdirectory(contrib/restricted/boost/mp11) add_subdirectory(contrib/restricted/boost/predef) add_subdirectory(contrib/restricted/boost/preprocessor) +add_subdirectory(contrib/restricted/boost/smart_ptr) add_subdirectory(contrib/restricted/boost/type_traits) add_subdirectory(contrib/restricted/boost/utility) add_subdirectory(contrib/restricted/boost/vmd) diff --git a/CMakeLists.linux.txt b/CMakeLists.linux.txt index 4ec5ce20bd3..4b3cdce6051 100644 --- a/CMakeLists.linux.txt +++ b/CMakeLists.linux.txt @@ -226,6 +226,7 @@ add_subdirectory(contrib/restricted/boost/move) add_subdirectory(contrib/restricted/boost/mp11) add_subdirectory(contrib/restricted/boost/predef) add_subdirectory(contrib/restricted/boost/preprocessor) +add_subdirectory(contrib/restricted/boost/smart_ptr) add_subdirectory(contrib/restricted/boost/type_traits) add_subdirectory(contrib/restricted/boost/utility) add_subdirectory(contrib/restricted/boost/vmd) diff --git a/contrib/restricted/boost/CMakeLists.txt b/contrib/restricted/boost/CMakeLists.txt index e6e3cbdc286..c8d4b64981d 100644 --- a/contrib/restricted/boost/CMakeLists.txt +++ b/contrib/restricted/boost/CMakeLists.txt @@ -26,6 +26,7 @@ target_link_libraries(contrib-restricted-boost INTERFACE restricted-boost-mp11 restricted-boost-predef restricted-boost-preprocessor + restricted-boost-smart_ptr restricted-boost-static_assert restricted-boost-throw_exception restricted-boost-type_traits diff --git a/contrib/restricted/boost/boost/detail/atomic_count.hpp b/contrib/restricted/boost/boost/detail/atomic_count.hpp deleted file mode 100644 index 5411c7ae990..00000000000 --- a/contrib/restricted/boost/boost/detail/atomic_count.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef BOOST_DETAIL_ATOMIC_COUNT_HPP_INCLUDED -#define BOOST_DETAIL_ATOMIC_COUNT_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/atomic_count.hpp - thread/SMP safe reference counter -// -// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include - -#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/detail/lightweight_mutex.hpp b/contrib/restricted/boost/boost/detail/lightweight_mutex.hpp deleted file mode 100644 index b7a7f6dd4ed..00000000000 --- a/contrib/restricted/boost/boost/detail/lightweight_mutex.hpp +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED -#define BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/lightweight_mutex.hpp - lightweight mutex -// -// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// - -#include - -#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/detail/lightweight_thread.hpp b/contrib/restricted/boost/boost/detail/lightweight_thread.hpp deleted file mode 100644 index 21458157050..00000000000 --- a/contrib/restricted/boost/boost/detail/lightweight_thread.hpp +++ /dev/null @@ -1,159 +0,0 @@ -#ifndef BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED -#define BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// boost/detail/lightweight_thread.hpp -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// Copyright (c) 2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include -#include -#include - -// pthread_create, pthread_join - -#if defined( BOOST_HAS_PTHREADS ) - -#include - -#else - -#include -#include - -typedef HANDLE pthread_t; - -int pthread_create( pthread_t * thread, void const *, unsigned (__stdcall * start_routine) (void*), void* arg ) -{ - HANDLE h = (HANDLE)_beginthreadex( 0, 0, start_routine, arg, 0, 0 ); - - if( h != 0 ) - { - *thread = h; - return 0; - } - else - { - return EAGAIN; - } -} - -int pthread_join( pthread_t thread, void ** /*value_ptr*/ ) -{ - ::WaitForSingleObject( thread, INFINITE ); - ::CloseHandle( thread ); - return 0; -} - -#endif - -// template int lw_thread_create( pthread_t & pt, F f ); - -namespace boost -{ - -namespace detail -{ - -class lw_abstract_thread -{ -public: - - virtual ~lw_abstract_thread() {} - virtual void run() = 0; -}; - -#if defined( BOOST_HAS_PTHREADS ) - -extern "C" void * lw_thread_routine( void * pv ) -{ -#if defined(BOOST_NO_CXX11_SMART_PTR) - - std::auto_ptr pt( static_cast( pv ) ); - -#else - - std::unique_ptr pt( static_cast( pv ) ); - -#endif - - pt->run(); - - return 0; -} - -#else - -unsigned __stdcall lw_thread_routine( void * pv ) -{ -#if defined(BOOST_NO_CXX11_SMART_PTR) - - std::auto_ptr pt( static_cast( pv ) ); - -#else - - std::unique_ptr pt( static_cast( pv ) ); - -#endif - - pt->run(); - - return 0; -} - -#endif - -template class lw_thread_impl: public lw_abstract_thread -{ -public: - - explicit lw_thread_impl( F f ): f_( f ) - { - } - - void run() - { - f_(); - } - -private: - - F f_; -}; - -template int lw_thread_create( pthread_t & pt, F f ) -{ -#if defined(BOOST_NO_CXX11_SMART_PTR) - - std::auto_ptr p( new lw_thread_impl( f ) ); - -#else - - std::unique_ptr p( new lw_thread_impl( f ) ); - -#endif - - int r = pthread_create( &pt, 0, lw_thread_routine, p.get() ); - - if( r == 0 ) - { - p.release(); - } - - return r; -} - -} // namespace detail -} // namespace boost - -#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/detail/quick_allocator.hpp b/contrib/restricted/boost/boost/detail/quick_allocator.hpp deleted file mode 100644 index d54b3a792d7..00000000000 --- a/contrib/restricted/boost/boost/detail/quick_allocator.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED -#define BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/quick_allocator.hpp -// -// Copyright (c) 2003 David Abrahams -// Copyright (c) 2003 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// - -#include - -#endif // #ifndef BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/enable_shared_from_this.hpp b/contrib/restricted/boost/boost/enable_shared_from_this.hpp deleted file mode 100644 index 18b938d5d00..00000000000 --- a/contrib/restricted/boost/boost/enable_shared_from_this.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED -#define BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED - -// -// enable_shared_from_this.hpp -// -// Copyright (c) 2002 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. -// - -#include - -#endif // #ifndef BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/intrusive_ptr.hpp b/contrib/restricted/boost/boost/intrusive_ptr.hpp deleted file mode 100644 index c43adbdc0dc..00000000000 --- a/contrib/restricted/boost/boost/intrusive_ptr.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef BOOST_INTRUSIVE_PTR_HPP_INCLUDED -#define BOOST_INTRUSIVE_PTR_HPP_INCLUDED - -// -// intrusive_ptr.hpp -// -// Copyright (c) 2001, 2002 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. -// - -#include - -#endif // #ifndef BOOST_INTRUSIVE_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/make_shared.hpp b/contrib/restricted/boost/boost/make_shared.hpp deleted file mode 100644 index 588fbfde1b8..00000000000 --- a/contrib/restricted/boost/boost/make_shared.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef BOOST_MAKE_SHARED_HPP_INCLUDED -#define BOOST_MAKE_SHARED_HPP_INCLUDED - -// make_shared.hpp -// -// Copyright (c) 2007, 2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. - -#include - -#endif // #ifndef BOOST_MAKE_SHARED_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/make_unique.hpp b/contrib/restricted/boost/boost/make_unique.hpp deleted file mode 100644 index 7189d6e4ec2..00000000000 --- a/contrib/restricted/boost/boost/make_unique.hpp +++ /dev/null @@ -1,13 +0,0 @@ -/* -Copyright 2014 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_MAKE_UNIQUE_HPP_INCLUDED -#define BOOST_MAKE_UNIQUE_HPP_INCLUDED - -#include - -#endif diff --git a/contrib/restricted/boost/boost/pointer_cast.hpp b/contrib/restricted/boost/boost/pointer_cast.hpp deleted file mode 100644 index d47327bc700..00000000000 --- a/contrib/restricted/boost/boost/pointer_cast.hpp +++ /dev/null @@ -1,122 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2005. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_POINTER_CAST_HPP -#define BOOST_POINTER_CAST_HPP - -#include -#include - -namespace boost { - -//static_pointer_cast overload for raw pointers -template -inline T* static_pointer_cast(U *ptr) BOOST_SP_NOEXCEPT -{ - return static_cast(ptr); -} - -//dynamic_pointer_cast overload for raw pointers -template -inline T* dynamic_pointer_cast(U *ptr) BOOST_SP_NOEXCEPT -{ - return dynamic_cast(ptr); -} - -//const_pointer_cast overload for raw pointers -template -inline T* const_pointer_cast(U *ptr) BOOST_SP_NOEXCEPT -{ - return const_cast(ptr); -} - -//reinterpret_pointer_cast overload for raw pointers -template -inline T* reinterpret_pointer_cast(U *ptr) BOOST_SP_NOEXCEPT -{ - return reinterpret_cast(ptr); -} - -} // namespace boost - -#if !defined( BOOST_NO_CXX11_SMART_PTR ) - -#include -#include -#include - -namespace boost { - -//static_pointer_cast overload for std::shared_ptr -using std::static_pointer_cast; - -//dynamic_pointer_cast overload for std::shared_ptr -using std::dynamic_pointer_cast; - -//const_pointer_cast overload for std::shared_ptr -using std::const_pointer_cast; - -//reinterpret_pointer_cast overload for std::shared_ptr -template std::shared_ptr reinterpret_pointer_cast(const std::shared_ptr & r ) BOOST_SP_NOEXCEPT -{ - (void) reinterpret_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename std::shared_ptr::element_type E; - - E * p = reinterpret_cast< E* >( r.get() ); - return std::shared_ptr( r, p ); -} - -//static_pointer_cast overload for std::unique_ptr -template std::unique_ptr static_pointer_cast( std::unique_ptr && r ) BOOST_SP_NOEXCEPT -{ - (void) static_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename std::unique_ptr::element_type E; - - return std::unique_ptr( static_cast( r.release() ) ); -} - -//dynamic_pointer_cast overload for std::unique_ptr -template std::unique_ptr dynamic_pointer_cast( std::unique_ptr && r ) BOOST_SP_NOEXCEPT -{ - (void) dynamic_cast< T* >( static_cast< U* >( 0 ) ); - - BOOST_STATIC_ASSERT_MSG( boost::has_virtual_destructor::value, "The target of dynamic_pointer_cast must have a virtual destructor." ); - - T * p = dynamic_cast( r.get() ); - if( p ) r.release(); - return std::unique_ptr( p ); -} - -//const_pointer_cast overload for std::unique_ptr -template std::unique_ptr const_pointer_cast( std::unique_ptr && r ) BOOST_SP_NOEXCEPT -{ - (void) const_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename std::unique_ptr::element_type E; - - return std::unique_ptr( const_cast( r.release() ) ); -} - -//reinterpret_pointer_cast overload for std::unique_ptr -template std::unique_ptr reinterpret_pointer_cast( std::unique_ptr && r ) BOOST_SP_NOEXCEPT -{ - (void) reinterpret_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename std::unique_ptr::element_type E; - - return std::unique_ptr( reinterpret_cast( r.release() ) ); -} - -} // namespace boost - -#endif // #if !defined( BOOST_NO_CXX11_SMART_PTR ) - -#endif //BOOST_POINTER_CAST_HPP diff --git a/contrib/restricted/boost/boost/pointer_to_other.hpp b/contrib/restricted/boost/boost/pointer_to_other.hpp deleted file mode 100644 index d7d455dc6e3..00000000000 --- a/contrib/restricted/boost/boost/pointer_to_other.hpp +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef BOOST_POINTER_TO_OTHER_HPP_INCLUDED -#define BOOST_POINTER_TO_OTHER_HPP_INCLUDED - -// -// pointer_to_other.hpp -// -// (C) Copyright Ion Gaztanaga 2005. -// Copyright (c) 2005 Peter Dimov. -// -// Distributed under the Boost Software License, Version 1.0. -// -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. -// - -namespace boost -{ - -// Defines the same pointer type (raw or smart) to another pointee type - -template -struct pointer_to_other; - -template class Sp> -struct pointer_to_other< Sp, U > -{ - typedef Sp type; -}; - -template class Sp> -struct pointer_to_other< Sp, U > -{ - typedef Sp type; -}; - -template class Sp> -struct pointer_to_other< Sp, U > -{ - typedef Sp type; -}; - -template -struct pointer_to_other< T*, U > -{ - typedef U* type; -}; - -} // namespace boost - -#endif // #ifndef BOOST_POINTER_TO_OTHER_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/scoped_array.hpp b/contrib/restricted/boost/boost/scoped_array.hpp deleted file mode 100644 index d91889b7cf1..00000000000 --- a/contrib/restricted/boost/boost/scoped_array.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef BOOST_SCOPED_ARRAY_HPP_INCLUDED -#define BOOST_SCOPED_ARRAY_HPP_INCLUDED - -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001, 2002 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. - -#include - -#endif // #ifndef BOOST_SCOPED_ARRAY_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/scoped_ptr.hpp b/contrib/restricted/boost/boost/scoped_ptr.hpp deleted file mode 100644 index 334a22e2fe1..00000000000 --- a/contrib/restricted/boost/boost/scoped_ptr.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef BOOST_SCOPED_PTR_HPP_INCLUDED -#define BOOST_SCOPED_PTR_HPP_INCLUDED - -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001, 2002 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. - -#include - -#endif // #ifndef BOOST_SCOPED_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/shared_array.hpp b/contrib/restricted/boost/boost/shared_array.hpp deleted file mode 100644 index 6804224c277..00000000000 --- a/contrib/restricted/boost/boost/shared_array.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef BOOST_SHARED_ARRAY_HPP_INCLUDED -#define BOOST_SHARED_ARRAY_HPP_INCLUDED - -// -// shared_array.hpp -// -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001, 2002 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. -// - -#include - -#endif // #ifndef BOOST_SHARED_ARRAY_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/shared_ptr.hpp b/contrib/restricted/boost/boost/shared_ptr.hpp deleted file mode 100644 index cb01b265881..00000000000 --- a/contrib/restricted/boost/boost/shared_ptr.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef BOOST_SHARED_PTR_HPP_INCLUDED -#define BOOST_SHARED_PTR_HPP_INCLUDED - -// -// shared_ptr.hpp -// -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001-2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. -// - -#include - -#endif // #ifndef BOOST_SHARED_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr.hpp b/contrib/restricted/boost/boost/smart_ptr.hpp deleted file mode 100644 index 6fabfc5388f..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef BOOST_SMART_PTR_HPP_INCLUDED -#define BOOST_SMART_PTR_HPP_INCLUDED - -// -// smart_ptr.hpp -// -// For convenience, this header includes the rest of the smart -// pointer library headers. -// -// Copyright (c) 2003 Peter Dimov Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. -// - -#include -#include -#include -#include -#include -#include -#include -#include - -#endif // #ifndef BOOST_SMART_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/allocate_local_shared_array.hpp b/contrib/restricted/boost/boost/smart_ptr/allocate_local_shared_array.hpp deleted file mode 100644 index f46f11049bd..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/allocate_local_shared_array.hpp +++ /dev/null @@ -1,228 +0,0 @@ -/* -Copyright 2017 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_SMART_PTR_ALLOCATE_LOCAL_SHARED_ARRAY_HPP -#define BOOST_SMART_PTR_ALLOCATE_LOCAL_SHARED_ARRAY_HPP - -#include -#include - -namespace boost { -namespace detail { - -template -struct lsp_if_array { }; - -template -struct lsp_if_array { - typedef boost::local_shared_ptr type; -}; - -template -struct lsp_if_size_array { }; - -template -struct lsp_if_size_array { - typedef boost::local_shared_ptr type; -}; - -class lsp_array_base - : public local_counted_base { -public: - void set(sp_counted_base* base) BOOST_SP_NOEXCEPT { - count_ = shared_count(base); - } - - virtual void local_cb_destroy() BOOST_SP_NOEXCEPT { - shared_count().swap(count_); - } - - virtual shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT { - return count_; - } - -private: - shared_count count_; -}; - -template -class lsp_array_state - : public sp_array_state { -public: - template - lsp_array_state(const U& other, std::size_t size) BOOST_SP_NOEXCEPT - : sp_array_state(other, size) { } - - lsp_array_base& base() BOOST_SP_NOEXCEPT { - return base_; - } - -private: - lsp_array_base base_; -}; - -template -class lsp_size_array_state - : public sp_size_array_state { -public: - template - lsp_size_array_state(const U& other, std::size_t size) BOOST_SP_NOEXCEPT - : sp_size_array_state(other, size) { } - - lsp_array_base& base() BOOST_SP_NOEXCEPT { - return base_; - } - -private: - lsp_array_base base_; -}; - -} /* detail */ - -template -inline typename detail::lsp_if_array::type -allocate_local_shared(const A& allocator, std::size_t count) -{ - typedef typename detail::sp_array_element::type type; - typedef typename detail::sp_array_scalar::type scalar; - typedef typename detail::sp_bind_allocator::type other; - typedef detail::lsp_array_state state; - typedef detail::sp_array_base base; - std::size_t size = count * detail::sp_array_count::value; - detail::sp_array_result result(allocator, size); - base* node = result.get(); - scalar* start = detail::sp_array_start(node); - ::new(static_cast(node)) base(allocator, size, start); - detail::lsp_array_base& local = node->state().base(); - local.set(node); - result.release(); - return local_shared_ptr(detail::lsp_internal_constructor_tag(), - reinterpret_cast(start), &local); -} - -template -inline typename detail::lsp_if_size_array::type -allocate_local_shared(const A& allocator) -{ - enum { - size = detail::sp_array_count::value - }; - typedef typename detail::sp_array_element::type type; - typedef typename detail::sp_array_scalar::type scalar; - typedef typename detail::sp_bind_allocator::type other; - typedef detail::lsp_size_array_state state; - typedef detail::sp_array_base base; - detail::sp_array_result result(allocator, size); - base* node = result.get(); - scalar* start = detail::sp_array_start(node); - ::new(static_cast(node)) base(allocator, size, start); - detail::lsp_array_base& local = node->state().base(); - local.set(node); - result.release(); - return local_shared_ptr(detail::lsp_internal_constructor_tag(), - reinterpret_cast(start), &local); -} - -template -inline typename detail::lsp_if_array::type -allocate_local_shared(const A& allocator, std::size_t count, - const typename detail::sp_array_element::type& value) -{ - typedef typename detail::sp_array_element::type type; - typedef typename detail::sp_array_scalar::type scalar; - typedef typename detail::sp_bind_allocator::type other; - typedef detail::lsp_array_state state; - typedef detail::sp_array_base base; - std::size_t size = count * detail::sp_array_count::value; - detail::sp_array_result result(allocator, size); - base* node = result.get(); - scalar* start = detail::sp_array_start(node); - ::new(static_cast(node)) base(allocator, size, - reinterpret_cast(&value), - detail::sp_array_count::value, start); - detail::lsp_array_base& local = node->state().base(); - local.set(node); - result.release(); - return local_shared_ptr(detail::lsp_internal_constructor_tag(), - reinterpret_cast(start), &local); -} - -template -inline typename detail::lsp_if_size_array::type -allocate_local_shared(const A& allocator, - const typename detail::sp_array_element::type& value) -{ - enum { - size = detail::sp_array_count::value - }; - typedef typename detail::sp_array_element::type type; - typedef typename detail::sp_array_scalar::type scalar; - typedef typename detail::sp_bind_allocator::type other; - typedef detail::lsp_size_array_state state; - typedef detail::sp_array_base base; - detail::sp_array_result result(allocator, size); - base* node = result.get(); - scalar* start = detail::sp_array_start(node); - ::new(static_cast(node)) base(allocator, size, - reinterpret_cast(&value), - detail::sp_array_count::value, start); - detail::lsp_array_base& local = node->state().base(); - local.set(node); - result.release(); - return local_shared_ptr(detail::lsp_internal_constructor_tag(), - reinterpret_cast(start), &local); -} - -template -inline typename detail::lsp_if_array::type -allocate_local_shared_noinit(const A& allocator, std::size_t count) -{ - typedef typename detail::sp_array_element::type type; - typedef typename detail::sp_array_scalar::type scalar; - typedef typename detail::sp_bind_allocator::type other; - typedef detail::lsp_array_state state; - typedef detail::sp_array_base base; - std::size_t size = count * detail::sp_array_count::value; - detail::sp_array_result result(allocator, size); - base* node = result.get(); - scalar* start = detail::sp_array_start(node); - ::new(static_cast(node)) base(detail::sp_default(), allocator, - size, start); - detail::lsp_array_base& local = node->state().base(); - local.set(node); - result.release(); - return local_shared_ptr(detail::lsp_internal_constructor_tag(), - reinterpret_cast(start), &local); -} - -template -inline typename detail::lsp_if_size_array::type -allocate_local_shared_noinit(const A& allocator) -{ - enum { - size = detail::sp_array_count::value - }; - typedef typename detail::sp_array_element::type type; - typedef typename detail::sp_array_scalar::type scalar; - typedef typename detail::sp_bind_allocator::type other; - typedef detail::lsp_size_array_state state; - typedef detail::sp_array_base base; - detail::sp_array_result result(allocator, size); - base* node = result.get(); - scalar* start = detail::sp_array_start(node); - ::new(static_cast(node)) base(detail::sp_default(), allocator, - size, start); - detail::lsp_array_base& local = node->state().base(); - local.set(node); - result.release(); - return local_shared_ptr(detail::lsp_internal_constructor_tag(), - reinterpret_cast(start), &local); -} - -} /* boost */ - -#endif diff --git a/contrib/restricted/boost/boost/smart_ptr/allocate_shared_array.hpp b/contrib/restricted/boost/boost/smart_ptr/allocate_shared_array.hpp deleted file mode 100644 index 340688146ca..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/allocate_shared_array.hpp +++ /dev/null @@ -1,703 +0,0 @@ -/* -Copyright 2012-2017 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP -#define BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP - -#include -#include -#include -#include -#include -#include - -namespace boost { -namespace detail { - -template -struct sp_if_array { }; - -template -struct sp_if_array { - typedef boost::shared_ptr type; -}; - -template -struct sp_if_size_array { }; - -template -struct sp_if_size_array { - typedef boost::shared_ptr type; -}; - -template -struct sp_array_element { }; - -template -struct sp_array_element { - typedef T type; -}; - -template -struct sp_array_element { - typedef T type; -}; - -template -struct sp_array_scalar { - typedef T type; -}; - -template -struct sp_array_scalar { - typedef typename sp_array_scalar::type type; -}; - -template -struct sp_array_scalar { - typedef typename sp_array_scalar::type type; -}; - -template -struct sp_array_scalar { - typedef typename sp_array_scalar::type type; -}; - -template -struct sp_array_scalar { - typedef typename sp_array_scalar::type type; -}; - -template -struct sp_array_scalar { - typedef typename sp_array_scalar::type type; -}; - -template -struct sp_array_scalar { - typedef typename sp_array_scalar::type type; -}; - -template -struct sp_array_scalar { - typedef typename sp_array_scalar::type type; -}; - -template -struct sp_array_scalar { - typedef typename sp_array_scalar::type type; -}; - -template -struct sp_array_count { - enum { - value = 1 - }; -}; - -template -struct sp_array_count { - enum { - value = N * sp_array_count::value - }; -}; - -template -struct sp_max_size { - enum { - value = N < M ? M : N - }; -}; - -template -struct sp_align_up { - enum { - value = (N + M - 1) & ~(M - 1) - }; -}; - -#if !defined(BOOST_NO_CXX11_ALLOCATOR) -template -struct sp_bind_allocator { - typedef typename std::allocator_traits::template rebind_alloc type; -}; -#else -template -struct sp_bind_allocator { - typedef typename A::template rebind::other type; -}; -#endif - -template -BOOST_CONSTEXPR inline std::size_t -sp_objects(std::size_t size) BOOST_SP_NOEXCEPT -{ - return (size + sizeof(T) - 1) / sizeof(T); -} - -template -struct sp_enable { }; - -template -struct sp_enable { - typedef T type; -}; - -template -inline typename sp_enable::value>::type -sp_array_destroy(A&, T*, std::size_t) BOOST_SP_NOEXCEPT { } - -template -inline typename sp_enable::value>::type -sp_array_destroy(A&, T* start, std::size_t size) -{ - while (size > 0) { - start[--size].~T(); - } -} - -#if !defined(BOOST_NO_CXX11_ALLOCATOR) -template -inline typename sp_enable::type -sp_array_destroy(A& allocator, T* start, std::size_t size) -{ - while (size > 0) { - std::allocator_traits::destroy(allocator, start + --size); - } -} -#endif - -template -inline typename sp_enable::value && - boost::has_trivial_assign::value && - boost::has_trivial_destructor::value>::type -sp_array_construct(A&, T* start, std::size_t size) -{ - for (std::size_t i = 0; i < size; ++i) { - start[i] = T(); - } -} - -template -inline typename sp_enable::value && - boost::has_trivial_assign::value && - boost::has_trivial_destructor::value>::type -sp_array_construct(A&, T* start, std::size_t size, const T* list, - std::size_t count) -{ - for (std::size_t i = 0; i < size; ++i) { - start[i] = list[i % count]; - } -} - -#if !defined(BOOST_NO_EXCEPTIONS) -template -inline typename sp_enable::value && - boost::has_trivial_assign::value && - boost::has_trivial_destructor::value)>::type -sp_array_construct(A& none, T* start, std::size_t size) -{ - std::size_t i = 0; - try { - for (; i < size; ++i) { - ::new(static_cast(start + i)) T(); - } - } catch (...) { - sp_array_destroy(none, start, i); - throw; - } -} - -template -inline typename sp_enable::value && - boost::has_trivial_assign::value && - boost::has_trivial_destructor::value)>::type -sp_array_construct(A& none, T* start, std::size_t size, const T* list, - std::size_t count) -{ - std::size_t i = 0; - try { - for (; i < size; ++i) { - ::new(static_cast(start + i)) T(list[i % count]); - } - } catch (...) { - sp_array_destroy(none, start, i); - throw; - } -} -#else -template -inline typename sp_enable::value && - boost::has_trivial_assign::value && - boost::has_trivial_destructor::value)>::type -sp_array_construct(A&, T* start, std::size_t size) -{ - for (std::size_t i = 0; i < size; ++i) { - ::new(static_cast(start + i)) T(); - } -} - -template -inline typename sp_enable::value && - boost::has_trivial_assign::value && - boost::has_trivial_destructor::value)>::type -sp_array_construct(A&, T* start, std::size_t size, const T* list, - std::size_t count) -{ - for (std::size_t i = 0; i < size; ++i) { - ::new(static_cast(start + i)) T(list[i % count]); - } -} -#endif - -#if !defined(BOOST_NO_CXX11_ALLOCATOR) -#if !defined(BOOST_NO_EXCEPTIONS) -template -inline typename sp_enable::type -sp_array_construct(A& allocator, T* start, std::size_t size) -{ - std::size_t i = 0; - try { - for (i = 0; i < size; ++i) { - std::allocator_traits::construct(allocator, start + i); - } - } catch (...) { - sp_array_destroy(allocator, start, i); - throw; - } -} - -template -inline typename sp_enable::type -sp_array_construct(A& allocator, T* start, std::size_t size, const T* list, - std::size_t count) -{ - std::size_t i = 0; - try { - for (i = 0; i < size; ++i) { - std::allocator_traits::construct(allocator, start + i, - list[i % count]); - } - } catch (...) { - sp_array_destroy(allocator, start, i); - throw; - } -} -#else -template -inline typename sp_enable::type -sp_array_construct(A& allocator, T* start, std::size_t size) -{ - for (std::size_t i = 0; i < size; ++i) { - std::allocator_traits::construct(allocator, start + i); - } -} - -template -inline typename sp_enable::type -sp_array_construct(A& allocator, T* start, std::size_t size, const T* list, - std::size_t count) -{ - for (std::size_t i = 0; i < size; ++i) { - std::allocator_traits::construct(allocator, start + i, - list[i % count]); - } -} -#endif -#endif - -template -inline typename sp_enable::value>::type -sp_array_default(A&, T*, std::size_t) BOOST_SP_NOEXCEPT { } - -#if !defined(BOOST_NO_EXCEPTIONS) -template -inline typename sp_enable::value>::type -sp_array_default(A& none, T* start, std::size_t size) -{ - std::size_t i = 0; - try { - for (; i < size; ++i) { - ::new(static_cast(start + i)) T; - } - } catch (...) { - sp_array_destroy(none, start, i); - throw; - } -} -#else -template -inline typename sp_enable::value>::type -sp_array_default(A&, T* start, std::size_t size) -{ - for (std::size_t i = 0; i < size; ++i) { - ::new(static_cast(start + i)) T; - } -} -#endif - -template -class sp_array_state { -public: - typedef A type; - - template - sp_array_state(const U& _allocator, std::size_t _size) BOOST_SP_NOEXCEPT - : allocator_(_allocator), - size_(_size) { } - - A& allocator() BOOST_SP_NOEXCEPT { - return allocator_; - } - - std::size_t size() const BOOST_SP_NOEXCEPT { - return size_; - } - -private: - A allocator_; - std::size_t size_; -}; - -template -class sp_size_array_state { -public: - typedef A type; - - template - sp_size_array_state(const U& _allocator, std::size_t) BOOST_SP_NOEXCEPT - : allocator_(_allocator) { } - - A& allocator() BOOST_SP_NOEXCEPT { - return allocator_; - } - - BOOST_CONSTEXPR std::size_t size() const BOOST_SP_NOEXCEPT { - return N; - } - -private: - A allocator_; -}; - -#if !defined(BOOST_NO_CXX11_ALLOCATOR) -template -struct sp_use_construct { - enum { - value = true - }; -}; - -template -struct sp_use_construct > { - enum { - value = false - }; -}; -#else -template -struct sp_use_construct { - enum { - value = false - }; -}; -#endif - -template -struct sp_array_alignment { - enum { - value = sp_max_size::value, - boost::alignment_of::value>::value - }; -}; - -template -struct sp_array_offset { - enum { - value = sp_align_up::value>::value - }; -}; - -template -struct sp_array_storage { - enum { - value = sp_array_alignment::value - }; - typedef typename boost::type_with_alignment::type type; -}; - -template -inline U* -sp_array_start(void* base) BOOST_SP_NOEXCEPT -{ - enum { - size = sp_array_offset::value - }; - return reinterpret_cast(static_cast(base) + size); -} - -template -class sp_array_creator { - typedef typename A::value_type scalar; - - enum { - offset = sp_array_offset::value - }; - - typedef typename sp_array_storage::type type; - -public: - template - sp_array_creator(const U& other, std::size_t size) BOOST_SP_NOEXCEPT - : other_(other), - size_(sp_objects(offset + sizeof(scalar) * size)) { } - - T* create() { - return reinterpret_cast(other_.allocate(size_)); - } - - void destroy(T* base) { - other_.deallocate(reinterpret_cast(base), size_); - } - -private: - typename sp_bind_allocator::type other_; - std::size_t size_; -}; - -struct sp_default { }; - -template::value> -class sp_array_base - : public sp_counted_base { - typedef typename T::type allocator; - -public: - typedef typename allocator::value_type type; - - template - sp_array_base(const A& other, std::size_t size, type* start) - : state_(other, size) { - sp_array_construct(state_.allocator(), start, state_.size()); - } - - template - sp_array_base(const A& other, std::size_t size, const type* list, - std::size_t count, type* start) - : state_(other, size) { - sp_array_construct(state_.allocator(), start, state_.size(), list, - count); - } - - template - sp_array_base(sp_default, const A& other, std::size_t size, type* start) - : state_(other, size) { - sp_array_default(state_.allocator(), start, state_.size()); - } - - T& state() BOOST_SP_NOEXCEPT { - return state_; - } - - virtual void dispose() { - sp_array_destroy(state_.allocator(), - sp_array_start(this), state_.size()); - } - - virtual void destroy() { - sp_array_creator other(state_.allocator(), - state_.size()); - this->~sp_array_base(); - other.destroy(this); - } - - virtual void* get_deleter(const sp_typeinfo&) { - return 0; - } - - virtual void* get_local_deleter(const sp_typeinfo&) { - return 0; - } - - virtual void* get_untyped_deleter() { - return 0; - } - -private: - T state_; -}; - -template -struct sp_array_result { -public: - template - sp_array_result(const U& other, std::size_t size) - : creator_(other, size), - result_(creator_.create()) { } - - ~sp_array_result() { - if (result_) { - creator_.destroy(result_); - } - } - - T* get() const { - return result_; - } - - void release() { - result_ = 0; - } - -private: - sp_array_result(const sp_array_result&); - sp_array_result& operator=(const sp_array_result&); - - sp_array_creator creator_; - T* result_; -}; - -} /* detail */ - -template -inline typename detail::sp_if_array::type -allocate_shared(const A& allocator, std::size_t count) -{ - typedef typename detail::sp_array_element::type type; - typedef typename detail::sp_array_scalar::type scalar; - typedef typename detail::sp_bind_allocator::type other; - typedef detail::sp_array_state state; - typedef detail::sp_array_base base; - std::size_t size = count * detail::sp_array_count::value; - detail::sp_array_result result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start(node); - ::new(static_cast(node)) base(allocator, size, start); - result.release(); - return shared_ptr(detail::sp_internal_constructor_tag(), - reinterpret_cast(start), detail::shared_count(node)); -} - -template -inline typename detail::sp_if_size_array::type -allocate_shared(const A& allocator) -{ - enum { - size = detail::sp_array_count::value - }; - typedef typename detail::sp_array_element::type type; - typedef typename detail::sp_array_scalar::type scalar; - typedef typename detail::sp_bind_allocator::type other; - typedef detail::sp_size_array_state state; - typedef detail::sp_array_base base; - detail::sp_array_result result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start(node); - ::new(static_cast(node)) base(allocator, size, start); - result.release(); - return shared_ptr(detail::sp_internal_constructor_tag(), - reinterpret_cast(start), detail::shared_count(node)); -} - -template -inline typename detail::sp_if_array::type -allocate_shared(const A& allocator, std::size_t count, - const typename detail::sp_array_element::type& value) -{ - typedef typename detail::sp_array_element::type type; - typedef typename detail::sp_array_scalar::type scalar; - typedef typename detail::sp_bind_allocator::type other; - typedef detail::sp_array_state state; - typedef detail::sp_array_base base; - std::size_t size = count * detail::sp_array_count::value; - detail::sp_array_result result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start(node); - ::new(static_cast(node)) base(allocator, size, - reinterpret_cast(&value), - detail::sp_array_count::value, start); - result.release(); - return shared_ptr(detail::sp_internal_constructor_tag(), - reinterpret_cast(start), detail::shared_count(node)); -} - -template -inline typename detail::sp_if_size_array::type -allocate_shared(const A& allocator, - const typename detail::sp_array_element::type& value) -{ - enum { - size = detail::sp_array_count::value - }; - typedef typename detail::sp_array_element::type type; - typedef typename detail::sp_array_scalar::type scalar; - typedef typename detail::sp_bind_allocator::type other; - typedef detail::sp_size_array_state state; - typedef detail::sp_array_base base; - detail::sp_array_result result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start(node); - ::new(static_cast(node)) base(allocator, size, - reinterpret_cast(&value), - detail::sp_array_count::value, start); - result.release(); - return shared_ptr(detail::sp_internal_constructor_tag(), - reinterpret_cast(start), detail::shared_count(node)); -} - -template -inline typename detail::sp_if_array::type -allocate_shared_noinit(const A& allocator, std::size_t count) -{ - typedef typename detail::sp_array_element::type type; - typedef typename detail::sp_array_scalar::type scalar; - typedef typename detail::sp_bind_allocator::type other; - typedef detail::sp_array_state state; - typedef detail::sp_array_base base; - std::size_t size = count * detail::sp_array_count::value; - detail::sp_array_result result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start(node); - ::new(static_cast(node)) base(detail::sp_default(), allocator, - size, start); - result.release(); - return shared_ptr(detail::sp_internal_constructor_tag(), - reinterpret_cast(start), detail::shared_count(node)); -} - -template -inline typename detail::sp_if_size_array::type -allocate_shared_noinit(const A& allocator) -{ - enum { - size = detail::sp_array_count::value - }; - typedef typename detail::sp_array_element::type type; - typedef typename detail::sp_array_scalar::type scalar; - typedef typename detail::sp_bind_allocator::type other; - typedef detail::sp_size_array_state state; - typedef detail::sp_array_base base; - detail::sp_array_result result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start(node); - ::new(static_cast(node)) base(detail::sp_default(), allocator, - size, start); - result.release(); - return shared_ptr(detail::sp_internal_constructor_tag(), - reinterpret_cast(start), detail::shared_count(node)); -} - -} /* boost */ - -#endif diff --git a/contrib/restricted/boost/boost/smart_ptr/atomic_shared_ptr.hpp b/contrib/restricted/boost/boost/smart_ptr/atomic_shared_ptr.hpp deleted file mode 100644 index 7c485070f83..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/atomic_shared_ptr.hpp +++ /dev/null @@ -1,233 +0,0 @@ -#ifndef BOOST_SMART_PTR_ATOMIC_SHARED_PTR_HPP_INCLUDED -#define BOOST_SMART_PTR_ATOMIC_SHARED_PTR_HPP_INCLUDED - -// -// atomic_shared_ptr.hpp -// -// Copyright 2017 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. -// - -#include -#include -#include - -namespace boost -{ - -template class atomic_shared_ptr -{ -private: - - boost::shared_ptr p_; - - mutable boost::detail::spinlock l_; - - atomic_shared_ptr(const atomic_shared_ptr&); - atomic_shared_ptr& operator=(const atomic_shared_ptr&); - -private: - - bool compare_exchange( shared_ptr& v, shared_ptr w ) BOOST_SP_NOEXCEPT - { - l_.lock(); - - if( p_._internal_equiv( v ) ) - { - p_.swap( w ); - - l_.unlock(); - return true; - } - else - { - shared_ptr tmp( p_ ); - - l_.unlock(); - - tmp.swap( v ); - return false; - } - } - -public: - -#if !defined( BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX ) && !defined( BOOST_NO_CXX11_CONSTEXPR ) - - constexpr atomic_shared_ptr() BOOST_SP_NOEXCEPT: l_ BOOST_DETAIL_SPINLOCK_INIT - { - } - -#else - - atomic_shared_ptr() BOOST_SP_NOEXCEPT - { - boost::detail::spinlock init = BOOST_DETAIL_SPINLOCK_INIT; - std::memcpy( &l_, &init, sizeof( init ) ); - } - -#endif - - atomic_shared_ptr( shared_ptr p ) BOOST_SP_NOEXCEPT -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - : p_( std::move( p ) ) -#else - : p_( p ) -#endif - { - boost::detail::spinlock init = BOOST_DETAIL_SPINLOCK_INIT; - std::memcpy( &l_, &init, sizeof( init ) ); - } - - atomic_shared_ptr& operator=( shared_ptr r ) BOOST_SP_NOEXCEPT - { - boost::detail::spinlock::scoped_lock lock( l_ ); - p_.swap( r ); - - return *this; - } - - BOOST_CONSTEXPR bool is_lock_free() const BOOST_SP_NOEXCEPT - { - return false; - } - - shared_ptr load() const BOOST_SP_NOEXCEPT - { - boost::detail::spinlock::scoped_lock lock( l_ ); - return p_; - } - - template shared_ptr load( M ) const BOOST_SP_NOEXCEPT - { - boost::detail::spinlock::scoped_lock lock( l_ ); - return p_; - } - - operator shared_ptr() const BOOST_SP_NOEXCEPT - { - boost::detail::spinlock::scoped_lock lock( l_ ); - return p_; - } - - void store( shared_ptr r ) BOOST_SP_NOEXCEPT - { - boost::detail::spinlock::scoped_lock lock( l_ ); - p_.swap( r ); - } - - template void store( shared_ptr r, M ) BOOST_SP_NOEXCEPT - { - boost::detail::spinlock::scoped_lock lock( l_ ); - p_.swap( r ); - } - - shared_ptr exchange( shared_ptr r ) BOOST_SP_NOEXCEPT - { - { - boost::detail::spinlock::scoped_lock lock( l_ ); - p_.swap( r ); - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - return std::move( r ); - -#else - - return r; - -#endif - } - - template shared_ptr exchange( shared_ptr r, M ) BOOST_SP_NOEXCEPT - { - { - boost::detail::spinlock::scoped_lock lock( l_ ); - p_.swap( r ); - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - return std::move( r ); - -#else - - return r; - -#endif - } - - template bool compare_exchange_weak( shared_ptr& v, const shared_ptr& w, M, M ) BOOST_SP_NOEXCEPT - { - return compare_exchange( v, w ); - } - - template bool compare_exchange_weak( shared_ptr& v, const shared_ptr& w, M ) BOOST_SP_NOEXCEPT - { - return compare_exchange( v, w ); - } - - bool compare_exchange_weak( shared_ptr& v, const shared_ptr& w ) BOOST_SP_NOEXCEPT - { - return compare_exchange( v, w ); - } - - template bool compare_exchange_strong( shared_ptr& v, const shared_ptr& w, M, M ) BOOST_SP_NOEXCEPT - { - return compare_exchange( v, w ); - } - - template bool compare_exchange_strong( shared_ptr& v, const shared_ptr& w, M ) BOOST_SP_NOEXCEPT - { - return compare_exchange( v, w ); - } - - bool compare_exchange_strong( shared_ptr& v, const shared_ptr& w ) BOOST_SP_NOEXCEPT - { - return compare_exchange( v, w ); - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template bool compare_exchange_weak( shared_ptr& v, shared_ptr&& w, M, M ) BOOST_SP_NOEXCEPT - { - return compare_exchange( v, std::move( w ) ); - } - - template bool compare_exchange_weak( shared_ptr& v, shared_ptr&& w, M ) BOOST_SP_NOEXCEPT - { - return compare_exchange( v, std::move( w ) ); - } - - bool compare_exchange_weak( shared_ptr& v, shared_ptr&& w ) BOOST_SP_NOEXCEPT - { - return compare_exchange( v, std::move( w ) ); - } - - template bool compare_exchange_strong( shared_ptr& v, shared_ptr&& w, M, M ) BOOST_SP_NOEXCEPT - { - return compare_exchange( v, std::move( w ) ); - } - - template bool compare_exchange_strong( shared_ptr& v, shared_ptr&& w, M ) BOOST_SP_NOEXCEPT - { - return compare_exchange( v, std::move( w ) ); - } - - bool compare_exchange_strong( shared_ptr& v, shared_ptr&& w ) BOOST_SP_NOEXCEPT - { - return compare_exchange( v, std::move( w ) ); - } - -#endif -}; - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_ATOMIC_SHARED_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/bad_weak_ptr.hpp b/contrib/restricted/boost/boost/smart_ptr/bad_weak_ptr.hpp deleted file mode 100644 index 0105ca4cb0e..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/bad_weak_ptr.hpp +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED -#define BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/smart_ptr/bad_weak_ptr.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include -#include - -#ifdef __BORLANDC__ -# pragma warn -8026 // Functions with excep. spec. are not expanded inline -#endif - -namespace boost -{ - -// The standard library that comes with Borland C++ 5.5.1, 5.6.4 -// defines std::exception and its members as having C calling -// convention (-pc). When the definition of bad_weak_ptr -// is compiled with -ps, the compiler issues an error. -// Hence, the temporary #pragma option -pc below. - -#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564 -# pragma option push -pc -#endif - -#if defined(BOOST_CLANG) -// Intel C++ on Mac defines __clang__ but doesn't support the pragma -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wweak-vtables" -#endif - -class bad_weak_ptr: public std::exception -{ -public: - - virtual char const * what() const noexcept - { - return "tr1::bad_weak_ptr"; - } -}; - -#if defined(BOOST_CLANG) -# pragma clang diagnostic pop -#endif - -#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564 -# pragma option pop -#endif - -} // namespace boost - -#ifdef __BORLANDC__ -# pragma warn .8026 // Functions with excep. spec. are not expanded inline -#endif - -#endif // #ifndef BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count.hpp deleted file mode 100644 index 6e4f71aa8e8..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count.hpp +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/atomic_count.hpp - thread/SMP safe reference counter -// -// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. -// Copyright (c) 2013 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// typedef boost::detail::atomic_count; -// -// atomic_count a(n); -// -// (n is convertible to long) -// -// Effects: Constructs an atomic_count with an initial value of n -// -// a; -// -// Returns: (long) the current value of a -// Memory Ordering: acquire -// -// ++a; -// -// Effects: Atomically increments the value of a -// Returns: (long) the new value of a -// Memory Ordering: acquire/release -// -// --a; -// -// Effects: Atomically decrements the value of a -// Returns: (long) the new value of a -// Memory Ordering: acquire/release -// - -#include -#include - -#if defined( BOOST_AC_DISABLE_THREADS ) -# include - -#elif defined( BOOST_AC_USE_STD_ATOMIC ) -# include - -#elif defined( BOOST_AC_USE_SPINLOCK ) -# include - -#elif defined( BOOST_AC_USE_PTHREADS ) -# include - -#elif defined( BOOST_SP_DISABLE_THREADS ) -# include - -#elif defined( BOOST_SP_USE_STD_ATOMIC ) -# include - -#elif defined( BOOST_SP_USE_SPINLOCK ) -# include - -#elif defined( BOOST_SP_USE_PTHREADS ) -# include - -#elif defined( BOOST_DISABLE_THREADS ) && !defined( BOOST_SP_ENABLE_THREADS ) && !defined( BOOST_DISABLE_WIN32 ) -# include - -#elif !defined( BOOST_NO_CXX11_HDR_ATOMIC ) -# include - -#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) && !defined( __PATHSCALE__ ) -# include - -#elif defined( BOOST_SP_HAS_SYNC ) -# include - -#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# include - -#elif defined(__GLIBCPP__) || defined(__GLIBCXX__) -# include - -#elif !defined( BOOST_HAS_THREADS ) -# include - -#else -# include - -#endif - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_gcc.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_gcc.hpp deleted file mode 100644 index df7e32365f4..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_gcc.hpp +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED - -// -// boost/detail/atomic_count_gcc.hpp -// -// atomic_count for GNU libstdc++ v3 -// -// http://gcc.gnu.org/onlinedocs/porting/Thread-safety.html -// -// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. -// Copyright (c) 2002 Lars Gullik Bjønnes -// Copyright 2003-2005 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#if __GNUC__ * 100 + __GNUC_MINOR__ >= 402 -# include -#else -# include -#endif - -namespace boost -{ - -namespace detail -{ - -#if defined(__GLIBCXX__) // g++ 3.4+ - -using __gnu_cxx::__atomic_add; -using __gnu_cxx::__exchange_and_add; - -#endif - -class atomic_count -{ -public: - - explicit atomic_count( long v ) : value_( v ) {} - - long operator++() - { - return __exchange_and_add( &value_, +1 ) + 1; - } - - long operator--() - { - return __exchange_and_add( &value_, -1 ) - 1; - } - - operator long() const - { - return __exchange_and_add( &value_, 0 ); - } - -private: - - atomic_count(atomic_count const &); - atomic_count & operator=(atomic_count const &); - - mutable _Atomic_word value_; -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp deleted file mode 100644 index 5c44d7c1efa..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_X86_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_X86_HPP_INCLUDED - -// -// boost/detail/atomic_count_gcc_x86.hpp -// -// atomic_count for g++ on 486+/AMD64 -// -// Copyright 2007 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -namespace boost -{ - -namespace detail -{ - -class atomic_count -{ -public: - - explicit atomic_count( long v ) : value_( static_cast< int >( v ) ) {} - - long operator++() - { - return atomic_exchange_and_add( &value_, +1 ) + 1; - } - - long operator--() - { - return atomic_exchange_and_add( &value_, -1 ) - 1; - } - - operator long() const - { - return atomic_exchange_and_add( &value_, 0 ); - } - -private: - - atomic_count(atomic_count const &); - atomic_count & operator=(atomic_count const &); - - mutable int value_; - -private: - - static int atomic_exchange_and_add( int * pw, int dv ) - { - // int r = *pw; - // *pw += dv; - // return r; - - int r; - - __asm__ __volatile__ - ( - "lock\n\t" - "xadd %1, %0": - "+m"( *pw ), "=r"( r ): // outputs (%0, %1) - "1"( dv ): // inputs (%2 == %1) - "memory", "cc" // clobbers - ); - - return r; - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_X86_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_nt.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_nt.hpp deleted file mode 100644 index 3bbf1389135..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_nt.hpp +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_NT_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_NT_HPP_INCLUDED - -// -// boost/detail/atomic_count_nt.hpp -// -// Trivial atomic_count for the single-threaded case -// -// http://gcc.gnu.org/onlinedocs/porting/Thread-safety.html -// -// Copyright 2013 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// - -namespace boost -{ - -namespace detail -{ - -class atomic_count -{ -public: - - explicit atomic_count( long v ): value_( v ) - { - } - - long operator++() - { - return ++value_; - } - - long operator--() - { - return --value_; - } - - operator long() const - { - return value_; - } - -private: - - atomic_count(atomic_count const &); - atomic_count & operator=(atomic_count const &); - - long value_; -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_NT_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_pt.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_pt.hpp deleted file mode 100644 index f99b9108e3f..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_pt.hpp +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_PTHREADS_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_PTHREADS_HPP_INCLUDED - -// -// boost/detail/atomic_count_pthreads.hpp -// -// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include -#include - -// -// The generic pthread_mutex-based implementation sometimes leads to -// inefficiencies. Example: a class with two atomic_count members -// can get away with a single mutex. -// -// Users can detect this situation by checking BOOST_AC_USE_PTHREADS. -// - -namespace boost -{ - -namespace detail -{ - -class atomic_count -{ -private: - - class scoped_lock - { - public: - - scoped_lock(pthread_mutex_t & m): m_(m) - { - BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); - } - - ~scoped_lock() - { - BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); - } - - private: - - pthread_mutex_t & m_; - }; - -public: - - explicit atomic_count(long v): value_(v) - { - BOOST_VERIFY( pthread_mutex_init( &mutex_, 0 ) == 0 ); - } - - ~atomic_count() - { - BOOST_VERIFY( pthread_mutex_destroy( &mutex_ ) == 0 ); - } - - long operator++() - { - scoped_lock lock(mutex_); - return ++value_; - } - - long operator--() - { - scoped_lock lock(mutex_); - return --value_; - } - - operator long() const - { - scoped_lock lock(mutex_); - return value_; - } - -private: - - atomic_count(atomic_count const &); - atomic_count & operator=(atomic_count const &); - - mutable pthread_mutex_t mutex_; - long value_; -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_PTHREADS_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_solaris.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_solaris.hpp deleted file mode 100644 index a13bcfb4230..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_solaris.hpp +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SOLARIS_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SOLARIS_HPP_INCLUDED - -// -// boost/detail/atomic_count_solaris.hpp -// based on: boost/detail/atomic_count_win32.hpp -// -// Copyright (c) 2001-2005 Peter Dimov -// Copyright (c) 2006 Michael van der Westhuizen -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include - -namespace boost -{ - -namespace detail -{ - -class atomic_count -{ -public: - - explicit atomic_count( uint32_t v ): value_( v ) - { - } - - long operator++() - { - return atomic_inc_32_nv( &value_ ); - } - - long operator--() - { - return atomic_dec_32_nv( &value_ ); - } - - operator uint32_t() const - { - return static_cast( value_ ); - } - -private: - - atomic_count( atomic_count const & ); - atomic_count & operator=( atomic_count const & ); - - uint32_t value_; -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SOLARIS_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_spin.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_spin.hpp deleted file mode 100644 index 8e623496bf0..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_spin.hpp +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SPIN_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SPIN_HPP_INCLUDED - -// -// boost/detail/atomic_count_spin.hpp -// -// Copyright (c) 2013 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// - -#include - -namespace boost -{ - -namespace detail -{ - -class atomic_count -{ -private: - -public: - - explicit atomic_count( long v ): value_( v ) - { - } - - long operator++() - { - spinlock_pool<0>::scoped_lock lock( &value_ ); - return ++value_; - } - - long operator--() - { - spinlock_pool<0>::scoped_lock lock( &value_ ); - return --value_; - } - - operator long() const - { - spinlock_pool<0>::scoped_lock lock( &value_ ); - return value_; - } - -private: - - atomic_count(atomic_count const &); - atomic_count & operator=(atomic_count const &); - - long value_; -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SPIN_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_std_atomic.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_std_atomic.hpp deleted file mode 100644 index 55b9998e52a..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_std_atomic.hpp +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_STD_ATOMIC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_STD_ATOMIC_HPP_INCLUDED - -// -// boost/detail/atomic_count_std_atomic.hpp -// -// atomic_count for std::atomic -// -// Copyright 2013 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// - -#include -#include - -namespace boost -{ - -namespace detail -{ - -class atomic_count -{ -public: - - explicit atomic_count( long v ): value_( v ) - { - } - - long operator++() - { - return value_.fetch_add( 1, std::memory_order_acq_rel ) + 1; - } - - long operator--() - { - return value_.fetch_sub( 1, std::memory_order_acq_rel ) - 1; - } - - operator long() const - { - return value_.load( std::memory_order_acquire ); - } - -private: - - atomic_count(atomic_count const &); - atomic_count & operator=(atomic_count const &); - - std::atomic_int_least32_t value_; -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_STD_ATOMIC_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_sync.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_sync.hpp deleted file mode 100644 index b6359b5bcf0..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_sync.hpp +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED - -// -// boost/detail/atomic_count_sync.hpp -// -// atomic_count for g++ 4.1+ -// -// http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Atomic-Builtins.html -// -// Copyright 2007 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#if defined( __ia64__ ) && defined( __INTEL_COMPILER ) -# include -#endif - -namespace boost -{ - -namespace detail -{ - -class atomic_count -{ -public: - - explicit atomic_count( long v ) : value_( v ) {} - - long operator++() - { - return __sync_add_and_fetch( &value_, 1 ); - } - - long operator--() - { - return __sync_add_and_fetch( &value_, -1 ); - } - - operator long() const - { - return __sync_fetch_and_add( &value_, 0 ); - } - -private: - - atomic_count(atomic_count const &); - atomic_count & operator=(atomic_count const &); - - mutable long value_; -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_win32.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_win32.hpp deleted file mode 100644 index 633e73c3c0a..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/atomic_count_win32.hpp +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/atomic_count_win32.hpp -// -// Copyright (c) 2001-2005 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include - -namespace boost -{ - -namespace detail -{ - -class atomic_count -{ -public: - - explicit atomic_count( long v ): value_( v ) - { - } - - long operator++() - { - return BOOST_SP_INTERLOCKED_INCREMENT( &value_ ); - } - - long operator--() - { - return BOOST_SP_INTERLOCKED_DECREMENT( &value_ ); - } - - operator long() const - { - return static_cast( value_ ); - } - -private: - - atomic_count( atomic_count const & ); - atomic_count & operator=( atomic_count const & ); - - long value_; -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/lightweight_mutex.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/lightweight_mutex.hpp deleted file mode 100644 index d46b1932c2b..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/lightweight_mutex.hpp +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/lightweight_mutex.hpp - lightweight mutex -// -// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// typedef boost::detail::lightweight_mutex; -// -// boost::detail::lightweight_mutex is a header-only implementation of -// a subset of the Mutex concept requirements: -// -// http://www.boost.org/doc/html/threads/concepts.html#threads.concepts.Mutex -// -// It maps to a CRITICAL_SECTION on Windows or a pthread_mutex on POSIX. -// - -#include - -#if !defined(BOOST_HAS_THREADS) -# include -#elif defined(BOOST_HAS_PTHREADS) -# include -#elif defined(BOOST_HAS_WINTHREADS) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# include -#else -// Use #define BOOST_DISABLE_THREADS to avoid the error -# error Unrecognized threading platform -#endif - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/local_counted_base.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/local_counted_base.hpp deleted file mode 100644 index fdfe2c65cd2..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/local_counted_base.hpp +++ /dev/null @@ -1,148 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_LOCAL_COUNTED_BASE_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_LOCAL_COUNTED_BASE_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/local_counted_base.hpp -// -// Copyright 2017 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. - -#include -#include -#include - -namespace boost -{ - -namespace detail -{ - -class local_counted_base -{ -private: - - local_counted_base & operator= ( local_counted_base const & ); - -private: - - // not 'int' or 'unsigned' to avoid aliasing and enable optimizations - enum count_type { min_ = 0, initial_ = 1, max_ = 2147483647 }; - - count_type local_use_count_; - -public: - - BOOST_CONSTEXPR local_counted_base() BOOST_SP_NOEXCEPT: local_use_count_( initial_ ) - { - } - - BOOST_CONSTEXPR local_counted_base( local_counted_base const & ) BOOST_SP_NOEXCEPT: local_use_count_( initial_ ) - { - } - - virtual ~local_counted_base() /*BOOST_SP_NOEXCEPT*/ - { - } - - virtual void local_cb_destroy() BOOST_SP_NOEXCEPT = 0; - - virtual boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT = 0; - - void add_ref() BOOST_SP_NOEXCEPT - { -#if !defined(__NVCC__) -#if defined( __has_builtin ) -# if __has_builtin( __builtin_assume ) - - __builtin_assume( local_use_count_ >= 1 ); - -# endif -#endif -#endif - - local_use_count_ = static_cast( local_use_count_ + 1 ); - } - - void release() BOOST_SP_NOEXCEPT - { - local_use_count_ = static_cast( local_use_count_ - 1 ); - - if( local_use_count_ == 0 ) - { - local_cb_destroy(); - } - } - - long local_use_count() const BOOST_SP_NOEXCEPT - { - return local_use_count_; - } -}; - -class local_counted_impl: public local_counted_base -{ -private: - - local_counted_impl( local_counted_impl const & ); - -private: - - shared_count pn_; - -public: - - explicit local_counted_impl( shared_count const& pn ): pn_( pn ) - { - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - explicit local_counted_impl( shared_count && pn ): pn_( std::move(pn) ) - { - } - -#endif - - virtual void local_cb_destroy() BOOST_SP_NOEXCEPT - { - delete this; - } - - virtual boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT - { - return pn_; - } -}; - -class local_counted_impl_em: public local_counted_base -{ -public: - - shared_count pn_; - - virtual void local_cb_destroy() BOOST_SP_NOEXCEPT - { - shared_count().swap( pn_ ); - } - - virtual boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT - { - return pn_; - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_LOCAL_COUNTED_BASE_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/local_sp_deleter.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/local_sp_deleter.hpp deleted file mode 100644 index 7d04f1dc527..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/local_sp_deleter.hpp +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_LOCAL_SP_DELETER_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_LOCAL_SP_DELETER_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/local_sp_deleter.hpp -// -// Copyright 2017 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. - -#include -#include - -namespace boost -{ - -namespace detail -{ - -template class local_sp_deleter: public local_counted_impl_em -{ -private: - - D d_; - -public: - - local_sp_deleter(): d_() - { - } - - explicit local_sp_deleter( D const& d ) BOOST_SP_NOEXCEPT: d_( d ) - { - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - explicit local_sp_deleter( D&& d ) BOOST_SP_NOEXCEPT: d_( std::move(d) ) - { - } - -#endif - - D& deleter() - { - return d_; - } - - template void operator()( Y* p ) BOOST_SP_NOEXCEPT - { - d_( p ); - } - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - - void operator()( boost::detail::sp_nullptr_t p ) BOOST_SP_NOEXCEPT - { - d_( p ); - } - -#endif -}; - -template<> class local_sp_deleter -{ -}; - -template D * get_local_deleter( local_sp_deleter * p ) -{ - return &p->deleter(); -} - -inline void * get_local_deleter( local_sp_deleter * /*p*/ ) -{ - return 0; -} - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_LOCAL_SP_DELETER_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/lwm_nop.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/lwm_nop.hpp deleted file mode 100644 index 521a88ec1cd..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/lwm_nop.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/lwm_nop.hpp -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -namespace boost -{ - -namespace detail -{ - -class lightweight_mutex -{ -public: - - typedef lightweight_mutex scoped_lock; -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/lwm_pthreads.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/lwm_pthreads.hpp deleted file mode 100644 index 8eda5182338..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/lwm_pthreads.hpp +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_LWM_PTHREADS_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_LWM_PTHREADS_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/lwm_pthreads.hpp -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include -#include - -namespace boost -{ - -namespace detail -{ - -class lightweight_mutex -{ -private: - - pthread_mutex_t m_; - - lightweight_mutex(lightweight_mutex const &); - lightweight_mutex & operator=(lightweight_mutex const &); - -public: - - lightweight_mutex() - { - -// HPUX 10.20 / DCE has a nonstandard pthread_mutex_init - -#if defined(__hpux) && defined(_DECTHREADS_) - BOOST_VERIFY( pthread_mutex_init( &m_, pthread_mutexattr_default ) == 0 ); -#else - BOOST_VERIFY( pthread_mutex_init( &m_, 0 ) == 0 ); -#endif - } - - ~lightweight_mutex() - { - BOOST_VERIFY( pthread_mutex_destroy( &m_ ) == 0 ); - } - - class scoped_lock; - friend class scoped_lock; - - class scoped_lock - { - private: - - pthread_mutex_t & m_; - - scoped_lock(scoped_lock const &); - scoped_lock & operator=(scoped_lock const &); - - public: - - scoped_lock(lightweight_mutex & m): m_(m.m_) - { - BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); - } - - ~scoped_lock() - { - BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); - } - }; -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_PTHREADS_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/lwm_win32_cs.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/lwm_win32_cs.hpp deleted file mode 100644 index 25b1f195b74..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/lwm_win32_cs.hpp +++ /dev/null @@ -1,134 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_LWM_WIN32_CS_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_LWM_WIN32_CS_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/lwm_win32_cs.hpp -// -// Copyright (c) 2002, 2003 Peter Dimov -// Copyright (c) Microsoft Corporation 2014 -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include - -#ifdef BOOST_USE_WINDOWS_H - -#include - -#else - -struct _RTL_CRITICAL_SECTION; - -#endif - -namespace boost -{ - -namespace detail -{ - -#ifndef BOOST_USE_WINDOWS_H - -struct critical_section -{ - struct critical_section_debug * DebugInfo; - long LockCount; - long RecursionCount; - void * OwningThread; - void * LockSemaphore; -#if defined(_WIN64) - unsigned __int64 SpinCount; -#else - unsigned long SpinCount; -#endif -}; - -#if BOOST_PLAT_WINDOWS_RUNTIME -extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSectionEx(::_RTL_CRITICAL_SECTION *, unsigned long, unsigned long); -#else -extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSection(::_RTL_CRITICAL_SECTION *); -#endif -extern "C" __declspec(dllimport) void __stdcall EnterCriticalSection(::_RTL_CRITICAL_SECTION *); -extern "C" __declspec(dllimport) void __stdcall LeaveCriticalSection(::_RTL_CRITICAL_SECTION *); -extern "C" __declspec(dllimport) void __stdcall DeleteCriticalSection(::_RTL_CRITICAL_SECTION *); - -#else - -typedef ::CRITICAL_SECTION critical_section; - -#if BOOST_PLAT_WINDOWS_RUNTIME -using ::InitializeCriticalSectionEx; -#else -using ::InitializeCriticalSection; -#endif -using ::EnterCriticalSection; -using ::LeaveCriticalSection; -using ::DeleteCriticalSection; - -#endif // #ifndef BOOST_USE_WINDOWS_H - -class lightweight_mutex -{ -private: - - critical_section cs_; - - lightweight_mutex(lightweight_mutex const &); - lightweight_mutex & operator=(lightweight_mutex const &); - -public: - - lightweight_mutex() - { -#if BOOST_PLAT_WINDOWS_RUNTIME - boost::detail::InitializeCriticalSectionEx(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_), 4000, 0); -#else - boost::detail::InitializeCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_)); -#endif - } - - ~lightweight_mutex() - { - boost::detail::DeleteCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_)); - } - - class scoped_lock; - friend class scoped_lock; - - class scoped_lock - { - private: - - lightweight_mutex & m_; - - scoped_lock(scoped_lock const &); - scoped_lock & operator=(scoped_lock const &); - - public: - - explicit scoped_lock(lightweight_mutex & m): m_(m) - { - boost::detail::EnterCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&m_.cs_)); - } - - ~scoped_lock() - { - boost::detail::LeaveCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&m_.cs_)); - } - }; -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_WIN32_CS_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/operator_bool.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/operator_bool.hpp deleted file mode 100644 index f9c5ef68036..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/operator_bool.hpp +++ /dev/null @@ -1,64 +0,0 @@ -// This header intentionally has no include guards. -// -// Copyright (c) 2001-2009, 2012 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#if !defined( BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS ) && !defined( BOOST_NO_CXX11_NULLPTR )\ - && !(defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x5130)) - - explicit operator bool () const BOOST_SP_NOEXCEPT - { - return px != 0; - } - -#elif ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__) - - operator bool () const BOOST_SP_NOEXCEPT - { - return px != 0; - } - -#elif defined( _MANAGED ) - - static void unspecified_bool( this_type*** ) - { - } - - typedef void (*unspecified_bool_type)( this_type*** ); - - operator unspecified_bool_type() const BOOST_SP_NOEXCEPT - { - return px == 0? 0: unspecified_bool; - } - -#elif \ - ( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, < 0x3200) ) || \ - ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) || \ - ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) ) - - typedef element_type * (this_type::*unspecified_bool_type)() const; - - operator unspecified_bool_type() const BOOST_SP_NOEXCEPT - { - return px == 0? 0: &this_type::get; - } - -#else - - typedef element_type * this_type::*unspecified_bool_type; - - operator unspecified_bool_type() const BOOST_SP_NOEXCEPT - { - return px == 0? 0: &this_type::px; - } - -#endif - - // operator! is redundant, but some compilers need it - bool operator! () const BOOST_SP_NOEXCEPT - { - return px == 0; - } diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/quick_allocator.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/quick_allocator.hpp deleted file mode 100644 index 159bd5e7aa8..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/quick_allocator.hpp +++ /dev/null @@ -1,199 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/quick_allocator.hpp -// -// Copyright (c) 2003 David Abrahams -// Copyright (c) 2003 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include - -#include -#include -#include - -#include // ::operator new, ::operator delete -#include // std::size_t - -namespace boost -{ - -namespace detail -{ - -template union freeblock -{ - typedef typename boost::type_with_alignment::type aligner_type; - aligner_type aligner; - char bytes[size]; - freeblock * next; -}; - -template struct allocator_impl -{ - typedef freeblock block; - - // It may seem odd to use such small pages. - // - // However, on a typical Windows implementation that uses - // the OS allocator, "normal size" pages interact with the - // "ordinary" operator new, slowing it down dramatically. - // - // 512 byte pages are handled by the small object allocator, - // and don't interfere with ::new. - // - // The other alternative is to use much bigger pages (1M.) - // - // It is surprisingly easy to hit pathological behavior by - // varying the page size. g++ 2.96 on Red Hat Linux 7.2, - // for example, passionately dislikes 496. 512 seems OK. - -#if defined(BOOST_QA_PAGE_SIZE) - - enum { items_per_page = BOOST_QA_PAGE_SIZE / size }; - -#else - - enum { items_per_page = 512 / size }; // 1048560 / size - -#endif - -#ifdef BOOST_HAS_THREADS - - static lightweight_mutex & mutex() - { - static freeblock< sizeof( lightweight_mutex ), boost::alignment_of< lightweight_mutex >::value > fbm; - static lightweight_mutex * pm = new( &fbm ) lightweight_mutex; - return *pm; - } - - static lightweight_mutex * mutex_init; - -#endif - - static block * free; - static block * page; - static unsigned last; - - static inline void * alloc() - { -#ifdef BOOST_HAS_THREADS - lightweight_mutex::scoped_lock lock( mutex() ); -#endif - if(block * x = free) - { - free = x->next; - return x; - } - else - { - if(last == items_per_page) - { - // "Listen to me carefully: there is no memory leak" - // -- Scott Meyers, Eff C++ 2nd Ed Item 10 - page = ::new block[items_per_page]; - last = 0; - } - - return &page[last++]; - } - } - - static inline void * alloc(std::size_t n) - { - if(n != size) // class-specific new called for a derived object - { - return ::operator new(n); - } - else - { -#ifdef BOOST_HAS_THREADS - lightweight_mutex::scoped_lock lock( mutex() ); -#endif - if(block * x = free) - { - free = x->next; - return x; - } - else - { - if(last == items_per_page) - { - page = ::new block[items_per_page]; - last = 0; - } - - return &page[last++]; - } - } - } - - static inline void dealloc(void * pv) - { - if(pv != 0) // 18.4.1.1/13 - { -#ifdef BOOST_HAS_THREADS - lightweight_mutex::scoped_lock lock( mutex() ); -#endif - block * pb = static_cast(pv); - pb->next = free; - free = pb; - } - } - - static inline void dealloc(void * pv, std::size_t n) - { - if(n != size) // class-specific delete called for a derived object - { - ::operator delete(pv); - } - else if(pv != 0) // 18.4.1.1/13 - { -#ifdef BOOST_HAS_THREADS - lightweight_mutex::scoped_lock lock( mutex() ); -#endif - block * pb = static_cast(pv); - pb->next = free; - free = pb; - } - } -}; - -#ifdef BOOST_HAS_THREADS - -template - lightweight_mutex * allocator_impl::mutex_init = &allocator_impl::mutex(); - -#endif - -template - freeblock * allocator_impl::free = 0; - -template - freeblock * allocator_impl::page = 0; - -template - unsigned allocator_impl::last = allocator_impl::items_per_page; - -template -struct quick_allocator: public allocator_impl< sizeof(T), boost::alignment_of::value > -{ -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/shared_count.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/shared_count.hpp deleted file mode 100644 index ae7d0fb46f0..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/shared_count.hpp +++ /dev/null @@ -1,667 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SHARED_COUNT_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SHARED_COUNT_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/shared_count.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#ifdef __BORLANDC__ -# pragma warn -8027 // Functions containing try are not expanded inline -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -// In order to avoid circular dependencies with Boost.TR1 -// we make sure that our include of doesn't try to -// pull in the TR1 headers: that's why we use this header -// rather than including directly: -#include // std::auto_ptr -#include // std::less - -#ifdef BOOST_NO_EXCEPTIONS -# include // std::bad_alloc -#endif - -#include - -#if defined( BOOST_SP_DISABLE_DEPRECATED ) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - -namespace boost -{ - -namespace movelib -{ - -template< class T, class D > class unique_ptr; - -} // namespace movelib - -namespace detail -{ - -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - -int const shared_count_id = 0x2C35F101; -int const weak_count_id = 0x298C38A4; - -#endif - -struct sp_nothrow_tag {}; - -template< class D > struct sp_inplace_tag -{ -}; - -template< class T > class sp_reference_wrapper -{ -public: - - explicit sp_reference_wrapper( T & t): t_( boost::addressof( t ) ) - { - } - - template< class Y > void operator()( Y * p ) const - { - (*t_)( p ); - } - -private: - - T * t_; -}; - -template< class D > struct sp_convert_reference -{ - typedef D type; -}; - -template< class D > struct sp_convert_reference< D& > -{ - typedef sp_reference_wrapper< D > type; -}; - -class weak_count; - -class shared_count -{ -private: - - sp_counted_base * pi_; - -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - int id_; -#endif - - friend class weak_count; - -public: - - BOOST_CONSTEXPR shared_count(): pi_(0) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - } - - BOOST_CONSTEXPR explicit shared_count( sp_counted_base * pi ): pi_( pi ) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - } - - template explicit shared_count( Y * p ): pi_( 0 ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { -#ifndef BOOST_NO_EXCEPTIONS - - try - { - pi_ = new sp_counted_impl_p( p ); - } - catch(...) - { - boost::checked_delete( p ); - throw; - } - -#else - - pi_ = new sp_counted_impl_p( p ); - - if( pi_ == 0 ) - { - boost::checked_delete( p ); - boost::throw_exception( std::bad_alloc() ); - } - -#endif - } - -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) - template shared_count( Y * p, D d ): pi_(0) -#else - template shared_count( P p, D d ): pi_(0) -#endif -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) - typedef Y* P; -#endif -#ifndef BOOST_NO_EXCEPTIONS - - try - { - pi_ = new sp_counted_impl_pd(p, d); - } - catch(...) - { - d(p); // delete p - throw; - } - -#else - - pi_ = new sp_counted_impl_pd(p, d); - - if(pi_ == 0) - { - d(p); // delete p - boost::throw_exception(std::bad_alloc()); - } - -#endif - } - -#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) - - template< class P, class D > shared_count( P p, sp_inplace_tag ): pi_( 0 ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { -#ifndef BOOST_NO_EXCEPTIONS - - try - { - pi_ = new sp_counted_impl_pd< P, D >( p ); - } - catch( ... ) - { - D::operator_fn( p ); // delete p - throw; - } - -#else - - pi_ = new sp_counted_impl_pd< P, D >( p ); - - if( pi_ == 0 ) - { - D::operator_fn( p ); // delete p - boost::throw_exception( std::bad_alloc() ); - } - -#endif // #ifndef BOOST_NO_EXCEPTIONS - } - -#endif // !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) - - template shared_count( P p, D d, A a ): pi_( 0 ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - typedef sp_counted_impl_pda impl_type; - -#if !defined( BOOST_NO_CXX11_ALLOCATOR ) - - typedef typename std::allocator_traits::template rebind_alloc< impl_type > A2; - -#else - - typedef typename A::template rebind< impl_type >::other A2; - -#endif - - A2 a2( a ); - -#ifndef BOOST_NO_EXCEPTIONS - - try - { - pi_ = a2.allocate( 1 ); - ::new( static_cast< void* >( pi_ ) ) impl_type( p, d, a ); - } - catch(...) - { - d( p ); - - if( pi_ != 0 ) - { - a2.deallocate( static_cast< impl_type* >( pi_ ), 1 ); - } - - throw; - } - -#else - - pi_ = a2.allocate( 1 ); - - if( pi_ != 0 ) - { - ::new( static_cast< void* >( pi_ ) ) impl_type( p, d, a ); - } - else - { - d( p ); - boost::throw_exception( std::bad_alloc() ); - } - -#endif - } - -#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) - - template< class P, class D, class A > shared_count( P p, sp_inplace_tag< D >, A a ): pi_( 0 ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - typedef sp_counted_impl_pda< P, D, A > impl_type; - -#if !defined( BOOST_NO_CXX11_ALLOCATOR ) - - typedef typename std::allocator_traits::template rebind_alloc< impl_type > A2; - -#else - - typedef typename A::template rebind< impl_type >::other A2; - -#endif - - A2 a2( a ); - -#ifndef BOOST_NO_EXCEPTIONS - - try - { - pi_ = a2.allocate( 1 ); - ::new( static_cast< void* >( pi_ ) ) impl_type( p, a ); - } - catch(...) - { - D::operator_fn( p ); - - if( pi_ != 0 ) - { - a2.deallocate( static_cast< impl_type* >( pi_ ), 1 ); - } - - throw; - } - -#else - - pi_ = a2.allocate( 1 ); - - if( pi_ != 0 ) - { - ::new( static_cast< void* >( pi_ ) ) impl_type( p, a ); - } - else - { - D::operator_fn( p ); - boost::throw_exception( std::bad_alloc() ); - } - -#endif // #ifndef BOOST_NO_EXCEPTIONS - } - -#endif // !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) - -#ifndef BOOST_NO_AUTO_PTR - - // auto_ptr is special cased to provide the strong guarantee - - template - explicit shared_count( std::auto_ptr & r ): pi_( new sp_counted_impl_p( r.get() ) ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { -#ifdef BOOST_NO_EXCEPTIONS - - if( pi_ == 0 ) - { - boost::throw_exception(std::bad_alloc()); - } - -#endif - - r.release(); - } - -#endif - -#if !defined( BOOST_NO_CXX11_SMART_PTR ) - - template - explicit shared_count( std::unique_ptr & r ): pi_( 0 ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - typedef typename sp_convert_reference::type D2; - - D2 d2( r.get_deleter() ); - pi_ = new sp_counted_impl_pd< typename std::unique_ptr::pointer, D2 >( r.get(), d2 ); - -#ifdef BOOST_NO_EXCEPTIONS - - if( pi_ == 0 ) - { - boost::throw_exception( std::bad_alloc() ); - } - -#endif - - r.release(); - } - -#endif - - template - explicit shared_count( boost::movelib::unique_ptr & r ): pi_( 0 ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - typedef typename sp_convert_reference::type D2; - - D2 d2( r.get_deleter() ); - pi_ = new sp_counted_impl_pd< typename boost::movelib::unique_ptr::pointer, D2 >( r.get(), d2 ); - -#ifdef BOOST_NO_EXCEPTIONS - - if( pi_ == 0 ) - { - boost::throw_exception( std::bad_alloc() ); - } - -#endif - - r.release(); - } - - ~shared_count() // nothrow - { - if( pi_ != 0 ) pi_->release(); -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - id_ = 0; -#endif - } - - shared_count(shared_count const & r): pi_(r.pi_) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - if( pi_ != 0 ) pi_->add_ref_copy(); - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - shared_count(shared_count && r): pi_(r.pi_) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif - { - r.pi_ = 0; - } - -#endif - - explicit shared_count(weak_count const & r); // throws bad_weak_ptr when r.use_count() == 0 - shared_count( weak_count const & r, sp_nothrow_tag ); // constructs an empty *this when r.use_count() == 0 - - shared_count & operator= (shared_count const & r) // nothrow - { - sp_counted_base * tmp = r.pi_; - - if( tmp != pi_ ) - { - if( tmp != 0 ) tmp->add_ref_copy(); - if( pi_ != 0 ) pi_->release(); - pi_ = tmp; - } - - return *this; - } - - void swap(shared_count & r) // nothrow - { - sp_counted_base * tmp = r.pi_; - r.pi_ = pi_; - pi_ = tmp; - } - - long use_count() const // nothrow - { - return pi_ != 0? pi_->use_count(): 0; - } - - bool unique() const // nothrow - { - return use_count() == 1; - } - - bool empty() const // nothrow - { - return pi_ == 0; - } - - friend inline bool operator==(shared_count const & a, shared_count const & b) - { - return a.pi_ == b.pi_; - } - - friend inline bool operator<(shared_count const & a, shared_count const & b) - { - return std::less()( a.pi_, b.pi_ ); - } - - void * get_deleter( sp_typeinfo const & ti ) const - { - return pi_? pi_->get_deleter( ti ): 0; - } - - void * get_local_deleter( sp_typeinfo const & ti ) const - { - return pi_? pi_->get_local_deleter( ti ): 0; - } - - void * get_untyped_deleter() const - { - return pi_? pi_->get_untyped_deleter(): 0; - } -}; - - -class weak_count -{ -private: - - sp_counted_base * pi_; - -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - int id_; -#endif - - friend class shared_count; - -public: - - BOOST_CONSTEXPR weak_count(): pi_(0) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(weak_count_id) -#endif - { - } - - weak_count(shared_count const & r): pi_(r.pi_) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(weak_count_id) -#endif - { - if(pi_ != 0) pi_->weak_add_ref(); - } - - weak_count(weak_count const & r): pi_(r.pi_) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(weak_count_id) -#endif - { - if(pi_ != 0) pi_->weak_add_ref(); - } - -// Move support - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - weak_count(weak_count && r): pi_(r.pi_) // nothrow -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(weak_count_id) -#endif - { - r.pi_ = 0; - } - -#endif - - ~weak_count() // nothrow - { - if(pi_ != 0) pi_->weak_release(); -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - id_ = 0; -#endif - } - - weak_count & operator= (shared_count const & r) // nothrow - { - sp_counted_base * tmp = r.pi_; - - if( tmp != pi_ ) - { - if(tmp != 0) tmp->weak_add_ref(); - if(pi_ != 0) pi_->weak_release(); - pi_ = tmp; - } - - return *this; - } - - weak_count & operator= (weak_count const & r) // nothrow - { - sp_counted_base * tmp = r.pi_; - - if( tmp != pi_ ) - { - if(tmp != 0) tmp->weak_add_ref(); - if(pi_ != 0) pi_->weak_release(); - pi_ = tmp; - } - - return *this; - } - - void swap(weak_count & r) // nothrow - { - sp_counted_base * tmp = r.pi_; - r.pi_ = pi_; - pi_ = tmp; - } - - long use_count() const // nothrow - { - return pi_ != 0? pi_->use_count(): 0; - } - - bool empty() const // nothrow - { - return pi_ == 0; - } - - friend inline bool operator==(weak_count const & a, weak_count const & b) - { - return a.pi_ == b.pi_; - } - - friend inline bool operator<(weak_count const & a, weak_count const & b) - { - return std::less()(a.pi_, b.pi_); - } -}; - -inline shared_count::shared_count( weak_count const & r ): pi_( r.pi_ ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif -{ - if( pi_ == 0 || !pi_->add_ref_lock() ) - { - boost::throw_exception( boost::bad_weak_ptr() ); - } -} - -inline shared_count::shared_count( weak_count const & r, sp_nothrow_tag ): pi_( r.pi_ ) -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - , id_(shared_count_id) -#endif -{ - if( pi_ != 0 && !pi_->add_ref_lock() ) - { - pi_ = 0; - } -} - -} // namespace detail - -} // namespace boost - -#if defined( BOOST_SP_DISABLE_DEPRECATED ) -#pragma GCC diagnostic pop -#endif - -#ifdef __BORLANDC__ -# pragma warn .8027 // Functions containing try are not expanded inline -#endif - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SHARED_COUNT_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_convertible.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_convertible.hpp deleted file mode 100644 index 4bba9ed4441..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_convertible.hpp +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_convertible.hpp -// -// Copyright 2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include -#include - -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( BOOST_NO_SFINAE ) -# define BOOST_SP_NO_SP_CONVERTIBLE -#endif - -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ < 303 ) -# define BOOST_SP_NO_SP_CONVERTIBLE -#endif - -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x630 ) -# define BOOST_SP_NO_SP_CONVERTIBLE -#endif - -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - -namespace boost -{ - -namespace detail -{ - -template< class Y, class T > struct sp_convertible -{ - typedef char (&yes) [1]; - typedef char (&no) [2]; - - static yes f( T* ); - static no f( ... ); - - enum _vt { value = sizeof( (f)( static_cast(0) ) ) == sizeof(yes) }; -}; - -template< class Y, class T > struct sp_convertible< Y, T[] > -{ - enum _vt { value = false }; -}; - -template< class Y, class T > struct sp_convertible< Y[], T[] > -{ - enum _vt { value = sp_convertible< Y[1], T[1] >::value }; -}; - -template< class Y, std::size_t N, class T > struct sp_convertible< Y[N], T[] > -{ - enum _vt { value = sp_convertible< Y[1], T[1] >::value }; -}; - -struct sp_empty -{ -}; - -template< bool > struct sp_enable_if_convertible_impl; - -template<> struct sp_enable_if_convertible_impl -{ - typedef sp_empty type; -}; - -template<> struct sp_enable_if_convertible_impl -{ -}; - -template< class Y, class T > struct sp_enable_if_convertible: public sp_enable_if_convertible_impl< sp_convertible< Y, T >::value > -{ -}; - -} // namespace detail - -} // namespace boost - -#endif // !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base.hpp deleted file mode 100644 index 438613765b4..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base.hpp +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base.hpp -// -// Copyright 2005-2013 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include -#include - -#if !defined( __c2__ ) && defined( __clang__ ) && defined( __has_extension ) -# if __has_extension( __c_atomic__ ) -# define BOOST_SP_HAS_CLANG_C11_ATOMICS -# endif -#endif - -#if defined( BOOST_SP_DISABLE_THREADS ) -# include - -#elif defined( BOOST_SP_USE_STD_ATOMIC ) -# include - -#elif defined( BOOST_SP_USE_SPINLOCK ) -# include - -#elif defined( BOOST_SP_USE_PTHREADS ) -# include - -#elif defined( BOOST_DISABLE_THREADS ) && !defined( BOOST_SP_ENABLE_THREADS ) && !defined( BOOST_DISABLE_WIN32 ) -# include - -#elif defined( BOOST_SP_HAS_CLANG_C11_ATOMICS ) -# include - -#elif !defined( BOOST_NO_CXX11_HDR_ATOMIC ) -# include - -#elif defined( __SNC__ ) -# include - -#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) && !defined(__PATHSCALE__) -# include - -#elif defined(__HP_aCC) && defined(__ia64) -# include - -#elif defined( __GNUC__ ) && defined( __ia64__ ) && !defined( __INTEL_COMPILER ) && !defined(__PATHSCALE__) -# include - -#elif defined( __IBMCPP__ ) && defined( __powerpc ) -# include - -#elif defined( __MWERKS__ ) && defined( __POWERPC__ ) -# include - -#elif defined( __GNUC__ ) && ( defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc ) ) && !defined(__PATHSCALE__) && !defined( _AIX ) -# include - -#elif defined( __GNUC__ ) && ( defined( __mips__ ) || defined( _mips ) ) && !defined(__PATHSCALE__) && !defined( __mips16 ) -# include - -#elif defined( BOOST_SP_HAS_SYNC ) -# include - -#elif defined(__GNUC__) && ( defined( __sparcv9 ) || ( defined( __sparcv8 ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 402 ) ) ) -# include - -#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined(__CYGWIN__) -# include - -#elif defined( _AIX ) -# include - -#elif !defined( BOOST_HAS_THREADS ) -# include - -#else -# include - -#endif - -#undef BOOST_SP_HAS_CLANG_C11_ATOMICS - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp deleted file mode 100644 index ec6f6ee1840..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp +++ /dev/null @@ -1,152 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED - -// -// detail/sp_counted_base_acc_ia64.hpp - aC++ on HP-UX IA64 -// -// Copyright 2007 Baruch Zilber -// Copyright 2007 Boris Gubenko -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// -// Lock-free algorithm by Alexander Terekhov -// - -#include -#include - -namespace boost -{ - -namespace detail -{ - -inline void atomic_increment( int * pw ) -{ - // ++*pw; - - _Asm_fetchadd(_FASZ_W, _SEM_REL, pw, +1, _LDHINT_NONE); -} - -inline int atomic_decrement( int * pw ) -{ - // return --*pw; - - int r = static_cast(_Asm_fetchadd(_FASZ_W, _SEM_REL, pw, -1, _LDHINT_NONE)); - if (1 == r) - { - _Asm_mf(); - } - - return r - 1; -} - -inline int atomic_conditional_increment( int * pw ) -{ - // if( *pw != 0 ) ++*pw; - // return *pw; - - int v = *pw; - - for (;;) - { - if (0 == v) - { - return 0; - } - - _Asm_mov_to_ar(_AREG_CCV, - v, - (_UP_CALL_FENCE | _UP_SYS_FENCE | _DOWN_CALL_FENCE | _DOWN_SYS_FENCE)); - int r = static_cast(_Asm_cmpxchg(_SZ_W, _SEM_ACQ, pw, v + 1, _LDHINT_NONE)); - if (r == v) - { - return r + 1; - } - - v = r; - } -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); // TODO use ld.acq here - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_aix.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_aix.hpp deleted file mode 100644 index ce8ee686ba0..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_aix.hpp +++ /dev/null @@ -1,144 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_AIX_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_AIX_HPP_INCLUDED - -// -// detail/sp_counted_base_aix.hpp -// based on: detail/sp_counted_base_w32.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// Copyright 2006 Michael van der Westhuizen -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// -// Lock-free algorithm by Alexander Terekhov -// -// Thanks to Ben Hitchings for the #weak + (#shared != 0) -// formulation -// - -#include -#include -#include - -namespace boost -{ - -namespace detail -{ - -inline void atomic_increment( int32_t* pw ) -{ - // ++*pw; - - fetch_and_add( pw, 1 ); -} - -inline int32_t atomic_decrement( int32_t * pw ) -{ - // return --*pw; - - int32_t originalValue; - - __lwsync(); - originalValue = fetch_and_add( pw, -1 ); - __isync(); - - return (originalValue - 1); -} - -inline int32_t atomic_conditional_increment( int32_t * pw ) -{ - // if( *pw != 0 ) ++*pw; - // return *pw; - - int32_t tmp = fetch_and_add( pw, 0 ); - for( ;; ) - { - if( tmp == 0 ) return 0; - if( compare_and_swap( pw, &tmp, tmp + 1 ) ) return (tmp + 1); - } -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int32_t use_count_; // #shared - int32_t weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return fetch_and_add( const_cast(&use_count_), 0 ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_AIX_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_clang.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_clang.hpp deleted file mode 100644 index 5d6e073d957..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_clang.hpp +++ /dev/null @@ -1,150 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CLANG_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CLANG_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_counted_base_clang.hpp - __c11 clang intrinsics -// -// Copyright (c) 2007, 2013, 2015 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include -#include - -namespace boost -{ - -namespace detail -{ - -typedef _Atomic( boost::int_least32_t ) atomic_int_least32_t; - -inline void atomic_increment( atomic_int_least32_t * pw ) -{ - __c11_atomic_fetch_add( pw, 1, __ATOMIC_RELAXED ); -} - -inline boost::int_least32_t atomic_decrement( atomic_int_least32_t * pw ) -{ - return __c11_atomic_fetch_sub( pw, 1, __ATOMIC_ACQ_REL ); -} - -inline boost::int_least32_t atomic_conditional_increment( atomic_int_least32_t * pw ) -{ - // long r = *pw; - // if( r != 0 ) ++*pw; - // return r; - - boost::int_least32_t r = __c11_atomic_load( pw, __ATOMIC_RELAXED ); - - for( ;; ) - { - if( r == 0 ) - { - return r; - } - - if( __c11_atomic_compare_exchange_weak( pw, &r, r + 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED ) ) - { - return r; - } - } -} - -#if defined(__clang__) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wweak-vtables" -#endif - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - atomic_int_least32_t use_count_; // #shared - atomic_int_least32_t weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base() - { - __c11_atomic_init( &use_count_, 1 ); - __c11_atomic_init( &weak_count_, 1 ); - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 1 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 1 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return __c11_atomic_load( const_cast< atomic_int_least32_t* >( &use_count_ ), __ATOMIC_ACQUIRE ); - } -}; - -#if defined(__clang__) -# pragma clang diagnostic pop -#endif - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CLANG_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp deleted file mode 100644 index 25dfe54c987..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp +++ /dev/null @@ -1,172 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_cw_ppc.hpp - CodeWarrior on PowerPC -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// -// Lock-free algorithm by Alexander Terekhov -// -// Thanks to Ben Hitchings for the #weak + (#shared != 0) -// formulation -// - -#include - -namespace boost -{ - -namespace detail -{ - -inline void atomic_increment( register long * pw ) -{ - int a; - - asm - { -loop: - - lwarx a, 0, pw - addi a, a, 1 - stwcx. a, 0, pw - bne- loop - } -} - -inline long atomic_decrement( register long * pw ) -{ - int a; - - asm - { - sync - -loop: - - lwarx a, 0, pw - addi a, a, -1 - stwcx. a, 0, pw - bne- loop - - isync - } - - return a; -} - -inline long atomic_conditional_increment( register long * pw ) -{ - int a; - - asm - { -loop: - - lwarx a, 0, pw - cmpwi a, 0 - beq store - - addi a, a, 1 - -store: - - stwcx. a, 0, pw - bne- loop - } - - return a; -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - long use_count_; // #shared - long weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_cw_x86.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_cw_x86.hpp deleted file mode 100644 index 3a3d4d4119e..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_cw_x86.hpp +++ /dev/null @@ -1,160 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_X86_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_X86_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_cw_x86.hpp - CodeWarrion on 486+ -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// Copyright 2005 Rene Rivera -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// -// Lock-free algorithm by Alexander Terekhov -// -// Thanks to Ben Hitchings for the #weak + (#shared != 0) -// formulation -// - -#include - -namespace boost -{ - -namespace detail -{ - -inline int atomic_exchange_and_add( int * pw, int dv ) -{ - // int r = *pw; - // *pw += dv; - // return r; - - asm - { - mov esi, [pw] - mov eax, dv - lock xadd dword ptr [esi], eax - } -} - -inline void atomic_increment( int * pw ) -{ - //atomic_exchange_and_add( pw, 1 ); - - asm - { - mov esi, [pw] - lock inc dword ptr [esi] - } -} - -inline int atomic_conditional_increment( int * pw ) -{ - // int rv = *pw; - // if( rv != 0 ) ++*pw; - // return rv; - - asm - { - mov esi, [pw] - mov eax, dword ptr [esi] - L0: - test eax, eax - je L1 - mov ebx, eax - inc ebx - lock cmpxchg dword ptr [esi], ebx - jne L0 - L1: - } -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_exchange_and_add( &use_count_, -1 ) == 1 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_X86_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp deleted file mode 100644 index 6c3cce8d44a..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp +++ /dev/null @@ -1,159 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED - -// -// detail/sp_counted_base_gcc_ia64.hpp - g++ on IA64 -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2006 Peter Dimov -// Copyright 2005 Ben Hutchings -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// -// Lock-free algorithm by Alexander Terekhov -// - -#include - -namespace boost -{ - -namespace detail -{ - -inline void atomic_increment( int * pw ) -{ - // ++*pw; - - int tmp; - - // No barrier is required here but fetchadd always has an acquire or - // release barrier associated with it. We choose release as it should be - // cheaper. - __asm__ ("fetchadd4.rel %0=%1,1" : - "=r"(tmp), "=m"(*pw) : - "m"( *pw )); -} - -inline int atomic_decrement( int * pw ) -{ - // return --*pw; - - int rv; - - __asm__ (" fetchadd4.rel %0=%1,-1 ;; \n" - " cmp.eq p7,p0=1,%0 ;; \n" - "(p7) ld4.acq %0=%1 " : - "=&r"(rv), "=m"(*pw) : - "m"( *pw ) : - "p7"); - - return rv; -} - -inline int atomic_conditional_increment( int * pw ) -{ - // if( *pw != 0 ) ++*pw; - // return *pw; - - int rv, tmp, tmp2; - - __asm__ ("0: ld4 %0=%3 ;; \n" - " cmp.eq p7,p0=0,%0 ;; \n" - "(p7) br.cond.spnt 1f \n" - " mov ar.ccv=%0 \n" - " add %1=1,%0 ;; \n" - " cmpxchg4.acq %2=%3,%1,ar.ccv ;; \n" - " cmp.ne p7,p0=%0,%2 ;; \n" - "(p7) br.cond.spnt 0b \n" - " mov %0=%1 ;; \n" - "1:" : - "=&r"(rv), "=&r"(tmp), "=&r"(tmp2), "=m"(*pw) : - "m"( *pw ) : - "ar.ccv", "p7"); - - return rv; -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); // TODO use ld.acq here - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp deleted file mode 100644 index c3175cf8ed1..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp +++ /dev/null @@ -1,189 +0,0 @@ -#ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_MIPS_HPP_INCLUDED -#define BOOST_DETAIL_SP_COUNTED_BASE_GCC_MIPS_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_gcc_mips.hpp - g++ on MIPS -// -// Copyright (c) 2009, Spirent Communications, Inc. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// -// Lock-free algorithm by Alexander Terekhov -// - -#include - -namespace boost -{ - -namespace detail -{ - -inline void atomic_increment( int * pw ) -{ - // ++*pw; - - int tmp; - - __asm__ __volatile__ - ( - "0:\n\t" - ".set push\n\t" -#if !defined(__mips_isa_rev) || (__mips_isa_rev < 6) - ".set mips2\n\t" -#endif - "ll %0, %1\n\t" - "addiu %0, 1\n\t" - "sc %0, %1\n\t" - ".set pop\n\t" - "beqz %0, 0b": - "=&r"( tmp ), "=m"( *pw ): - "m"( *pw ) - ); -} - -inline int atomic_decrement( int * pw ) -{ - // return --*pw; - - int rv, tmp; - - __asm__ __volatile__ - ( - "0:\n\t" - ".set push\n\t" -#if !defined(__mips_isa_rev) || (__mips_isa_rev < 6) - ".set mips2\n\t" -#endif - "ll %1, %2\n\t" - "addiu %0, %1, -1\n\t" - "sc %0, %2\n\t" - ".set pop\n\t" - "beqz %0, 0b\n\t" - "addiu %0, %1, -1": - "=&r"( rv ), "=&r"( tmp ), "=m"( *pw ): - "m"( *pw ): - "memory" - ); - - return rv; -} - -inline int atomic_conditional_increment( int * pw ) -{ - // if( *pw != 0 ) ++*pw; - // return *pw; - - int rv, tmp; - - __asm__ __volatile__ - ( - "0:\n\t" - ".set push\n\t" -#if !defined(__mips_isa_rev) || (__mips_isa_rev < 6) - ".set mips2\n\t" -#endif - "ll %0, %2\n\t" - "beqz %0, 1f\n\t" - "addiu %1, %0, 1\n\t" - "sc %1, %2\n\t" - ".set pop\n\t" - "beqz %1, 0b\n\t" - "addiu %0, %0, 1\n\t" - "1:": - "=&r"( rv ), "=&r"( tmp ), "=m"( *pw ): - "m"( *pw ): - "memory" - ); - - return rv; -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_MIPS_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp deleted file mode 100644 index 0fb807488ae..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp +++ /dev/null @@ -1,183 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_gcc_ppc.hpp - g++ on PowerPC -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// -// Lock-free algorithm by Alexander Terekhov -// -// Thanks to Ben Hitchings for the #weak + (#shared != 0) -// formulation -// - -#include - -namespace boost -{ - -namespace detail -{ - -inline void atomic_increment( int * pw ) -{ - // ++*pw; - - int tmp; - - __asm__ - ( - "0:\n\t" - "lwarx %1, 0, %2\n\t" - "addi %1, %1, 1\n\t" - "stwcx. %1, 0, %2\n\t" - "bne- 0b": - - "=m"( *pw ), "=&b"( tmp ): - "r"( pw ), "m"( *pw ): - "cc" - ); -} - -inline int atomic_decrement( int * pw ) -{ - // return --*pw; - - int rv; - - __asm__ __volatile__ - ( - "sync\n\t" - "0:\n\t" - "lwarx %1, 0, %2\n\t" - "addi %1, %1, -1\n\t" - "stwcx. %1, 0, %2\n\t" - "bne- 0b\n\t" - "isync": - - "=m"( *pw ), "=&b"( rv ): - "r"( pw ), "m"( *pw ): - "memory", "cc" - ); - - return rv; -} - -inline int atomic_conditional_increment( int * pw ) -{ - // if( *pw != 0 ) ++*pw; - // return *pw; - - int rv; - - __asm__ - ( - "0:\n\t" - "lwarx %1, 0, %2\n\t" - "cmpwi %1, 0\n\t" - "beq 1f\n\t" - "addi %1, %1, 1\n\t" - "1:\n\t" - "stwcx. %1, 0, %2\n\t" - "bne- 0b": - - "=m"( *pw ), "=&b"( rv ): - "r"( pw ), "m"( *pw ): - "cc" - ); - - return rv; -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp deleted file mode 100644 index b8bb707f1b9..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp +++ /dev/null @@ -1,168 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_counted_base_gcc_sparc.hpp - g++ on Sparc V8+ -// -// Copyright (c) 2006 Piotr Wyderski -// Copyright (c) 2006 Tomas Puverle -// Copyright (c) 2006 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// Thanks to Michael van der Westhuizen - -#include -#include // int32_t - -namespace boost -{ - -namespace detail -{ - -inline int32_t compare_and_swap( int32_t * dest_, int32_t compare_, int32_t swap_ ) -{ - __asm__ __volatile__( "cas [%1], %2, %0" - : "+r" (swap_) - : "r" (dest_), "r" (compare_) - : "memory" ); - - return swap_; -} - -inline int32_t atomic_fetch_and_add( int32_t * pw, int32_t dv ) -{ - // long r = *pw; - // *pw += dv; - // return r; - - for( ;; ) - { - int32_t r = *pw; - - if( __builtin_expect((compare_and_swap(pw, r, r + dv) == r), 1) ) - { - return r; - } - } -} - -inline void atomic_increment( int32_t * pw ) -{ - atomic_fetch_and_add( pw, 1 ); -} - -inline int32_t atomic_decrement( int32_t * pw ) -{ - return atomic_fetch_and_add( pw, -1 ); -} - -inline int32_t atomic_conditional_increment( int32_t * pw ) -{ - // long r = *pw; - // if( r != 0 ) ++*pw; - // return r; - - for( ;; ) - { - int32_t r = *pw; - - if( r == 0 ) - { - return r; - } - - if( __builtin_expect( ( compare_and_swap( pw, r, r + 1 ) == r ), 1 ) ) - { - return r; - } - } -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int32_t use_count_; // #shared - int32_t weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 1 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 1 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return const_cast< int32_t const volatile & >( use_count_ ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp deleted file mode 100644 index 3d2dd61ed67..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp +++ /dev/null @@ -1,175 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_gcc_x86.hpp - g++ on 486+ or AMD64 -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// -// Lock-free algorithm by Alexander Terekhov -// -// Thanks to Ben Hitchings for the #weak + (#shared != 0) -// formulation -// - -#include - -namespace boost -{ - -namespace detail -{ - -inline int atomic_exchange_and_add( int * pw, int dv ) -{ - // int r = *pw; - // *pw += dv; - // return r; - - int r; - - __asm__ __volatile__ - ( - "lock\n\t" - "xadd %1, %0": - "=m"( *pw ), "=r"( r ): // outputs (%0, %1) - "m"( *pw ), "1"( dv ): // inputs (%2, %3 == %1) - "memory", "cc" // clobbers - ); - - return r; -} - -inline void atomic_increment( int * pw ) -{ - //atomic_exchange_and_add( pw, 1 ); - - __asm__ - ( - "lock\n\t" - "incl %0": - "=m"( *pw ): // output (%0) - "m"( *pw ): // input (%1) - "cc" // clobbers - ); -} - -inline int atomic_conditional_increment( int * pw ) -{ - // int rv = *pw; - // if( rv != 0 ) ++*pw; - // return rv; - - int rv, tmp; - - __asm__ - ( - "movl %0, %%eax\n\t" - "0:\n\t" - "test %%eax, %%eax\n\t" - "je 1f\n\t" - "movl %%eax, %2\n\t" - "incl %2\n\t" - "lock\n\t" - "cmpxchgl %2, %0\n\t" - "jne 0b\n\t" - "1:": - "=m"( *pw ), "=&a"( rv ), "=&r"( tmp ): // outputs (%0, %1, %2) - "m"( *pw ): // input (%3) - "cc" // clobbers - ); - - return rv; -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_exchange_and_add( &use_count_, -1 ) == 1 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_nt.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_nt.hpp deleted file mode 100644 index dea905c905f..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_nt.hpp +++ /dev/null @@ -1,109 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_nt.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include - -namespace boost -{ - -namespace detail -{ - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - long use_count_; // #shared - long weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - ++use_count_; - } - - bool add_ref_lock() // true on success - { - if( use_count_ == 0 ) return false; - ++use_count_; - return true; - } - - void release() // nothrow - { - if( --use_count_ == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - ++weak_count_; - } - - void weak_release() // nothrow - { - if( --weak_count_ == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return use_count_; - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_pt.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_pt.hpp deleted file mode 100644 index 85f2563d5d5..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_pt.hpp +++ /dev/null @@ -1,138 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_pt.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include -#include -#include - -namespace boost -{ - -namespace detail -{ - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - long use_count_; // #shared - long weak_count_; // #weak + (#shared != 0) - - mutable pthread_mutex_t m_; - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { -// HPUX 10.20 / DCE has a nonstandard pthread_mutex_init - -#if defined(__hpux) && defined(_DECTHREADS_) - BOOST_VERIFY( pthread_mutex_init( &m_, pthread_mutexattr_default ) == 0 ); -#else - BOOST_VERIFY( pthread_mutex_init( &m_, 0 ) == 0 ); -#endif - } - - virtual ~sp_counted_base() // nothrow - { - BOOST_VERIFY( pthread_mutex_destroy( &m_ ) == 0 ); - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); - ++use_count_; - BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); - } - - bool add_ref_lock() // true on success - { - BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); - bool r = use_count_ == 0? false: ( ++use_count_, true ); - BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); - return r; - } - - void release() // nothrow - { - BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); - long new_use_count = --use_count_; - BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); - - if( new_use_count == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); - ++weak_count_; - BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); - } - - void weak_release() // nothrow - { - BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); - long new_weak_count = --weak_count_; - BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); - - if( new_weak_count == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); - long r = use_count_; - BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); - - return r; - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp deleted file mode 100644 index 7b5f9178a6b..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp +++ /dev/null @@ -1,163 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SNC_PS3_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SNC_PS3_HPP_INCLUDED - -// MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_counted_base_gcc_sparc.hpp - g++ on Sparc V8+ -// -// Copyright (c) 2006 Piotr Wyderski -// Copyright (c) 2006 Tomas Puverle -// Copyright (c) 2006 Peter Dimov -// Copyright (c) 2011 Emil Dotchevski -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// Thanks to Michael van der Westhuizen - -#include -#include // uint32_t - -namespace boost -{ - -namespace detail -{ - -inline uint32_t compare_and_swap( uint32_t * dest_, uint32_t compare_, uint32_t swap_ ) -{ - return __builtin_cellAtomicCompareAndSwap32(dest_,compare_,swap_); -} - -inline uint32_t atomic_fetch_and_add( uint32_t * pw, uint32_t dv ) -{ - // long r = *pw; - // *pw += dv; - // return r; - - for( ;; ) - { - uint32_t r = *pw; - - if( __builtin_expect((compare_and_swap(pw, r, r + dv) == r), 1) ) - { - return r; - } - } -} - -inline void atomic_increment( uint32_t * pw ) -{ - (void) __builtin_cellAtomicIncr32( pw ); -} - -inline uint32_t atomic_decrement( uint32_t * pw ) -{ - return __builtin_cellAtomicDecr32( pw ); -} - -inline uint32_t atomic_conditional_increment( uint32_t * pw ) -{ - // long r = *pw; - // if( r != 0 ) ++*pw; - // return r; - - for( ;; ) - { - uint32_t r = *pw; - - if( r == 0 ) - { - return r; - } - - if( __builtin_expect( ( compare_and_swap( pw, r, r + 1 ) == r ), 1 ) ) - { - return r; - } - } -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - uint32_t use_count_; // #shared - uint32_t weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 1 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 1 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return const_cast< uint32_t const volatile & >( use_count_ ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SNC_PS3_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_solaris.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_solaris.hpp deleted file mode 100644 index 0db9c6cbd56..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_solaris.hpp +++ /dev/null @@ -1,115 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SOLARIS_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SOLARIS_HPP_INCLUDED - -// -// detail/sp_counted_base_solaris.hpp -// based on: detail/sp_counted_base_w32.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// Copyright 2006 Michael van der Westhuizen -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// -// Lock-free algorithm by Alexander Terekhov -// -// Thanks to Ben Hitchings for the #weak + (#shared != 0) -// formulation -// - -#include -#include - -namespace boost -{ - -namespace detail -{ - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - uint32_t use_count_; // #shared - uint32_t weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_inc_32( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - for( ;; ) - { - uint32_t tmp = static_cast< uint32_t const volatile& >( use_count_ ); - if( tmp == 0 ) return false; - if( atomic_cas_32( &use_count_, tmp, tmp + 1 ) == tmp ) return true; - } - } - - void release() // nothrow - { - if( atomic_dec_32_nv( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_inc_32( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_dec_32_nv( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SOLARIS_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_spin.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_spin.hpp deleted file mode 100644 index faf503ad572..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_spin.hpp +++ /dev/null @@ -1,133 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_spin.hpp - spinlock pool atomic emulation -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include -#include - -namespace boost -{ - -namespace detail -{ - -inline int atomic_exchange_and_add( int * pw, int dv ) -{ - spinlock_pool<1>::scoped_lock lock( pw ); - - int r = *pw; - *pw += dv; - return r; -} - -inline void atomic_increment( int * pw ) -{ - spinlock_pool<1>::scoped_lock lock( pw ); - ++*pw; -} - -inline int atomic_conditional_increment( int * pw ) -{ - spinlock_pool<1>::scoped_lock lock( pw ); - - int rv = *pw; - if( rv != 0 ) ++*pw; - return rv; -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_exchange_and_add( &use_count_, -1 ) == 1 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - spinlock_pool<1>::scoped_lock lock( &use_count_ ); - return use_count_; - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp deleted file mode 100644 index 9f562b9b4aa..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp +++ /dev/null @@ -1,138 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_STD_ATOMIC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_STD_ATOMIC_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_counted_base_std_atomic.hpp - C++11 std::atomic -// -// Copyright (c) 2007, 2013 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include -#include -#include - -namespace boost -{ - -namespace detail -{ - -inline void atomic_increment( std::atomic_int_least32_t * pw ) -{ - pw->fetch_add( 1, std::memory_order_relaxed ); -} - -inline std::int_least32_t atomic_decrement( std::atomic_int_least32_t * pw ) -{ - return pw->fetch_sub( 1, std::memory_order_acq_rel ); -} - -inline std::int_least32_t atomic_conditional_increment( std::atomic_int_least32_t * pw ) -{ - // long r = *pw; - // if( r != 0 ) ++*pw; - // return r; - - std::int_least32_t r = pw->load( std::memory_order_relaxed ); - - for( ;; ) - { - if( r == 0 ) - { - return r; - } - - if( pw->compare_exchange_weak( r, r + 1, std::memory_order_relaxed, std::memory_order_relaxed ) ) - { - return r; - } - } -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - std::atomic_int_least32_t use_count_; // #shared - std::atomic_int_least32_t weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 1 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 1 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return use_count_.load( std::memory_order_acquire ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_STD_ATOMIC_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_sync.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_sync.hpp deleted file mode 100644 index d2138e7c261..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_sync.hpp +++ /dev/null @@ -1,157 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_counted_base_sync.hpp - g++ 4.1+ __sync intrinsics -// -// Copyright (c) 2007 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include -#include - -#if defined( __ia64__ ) && defined( __INTEL_COMPILER ) -# include -#endif - -namespace boost -{ - -namespace detail -{ - -#if INT_MAX >= 2147483647 - -typedef int sp_int32_t; - -#else - -typedef long sp_int32_t; - -#endif - -inline void atomic_increment( sp_int32_t * pw ) -{ - __sync_fetch_and_add( pw, 1 ); -} - -inline sp_int32_t atomic_decrement( sp_int32_t * pw ) -{ - return __sync_fetch_and_add( pw, -1 ); -} - -inline sp_int32_t atomic_conditional_increment( sp_int32_t * pw ) -{ - // long r = *pw; - // if( r != 0 ) ++*pw; - // return r; - - sp_int32_t r = *pw; - - for( ;; ) - { - if( r == 0 ) - { - return r; - } - - sp_int32_t r2 = __sync_val_compare_and_swap( pw, r, r + 1 ); - - if( r2 == r ) - { - return r; - } - else - { - r = r2; - } - } -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - sp_int32_t use_count_; // #shared - sp_int32_t weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 1 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 1 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return const_cast< sp_int32_t const volatile & >( use_count_ ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp deleted file mode 100644 index f2de3b02d8e..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp +++ /dev/null @@ -1,152 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED - -// -// detail/sp_counted_base_vacpp_ppc.hpp - xlC(vacpp) on POWER -// based on: detail/sp_counted_base_w32.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// Copyright 2006 Michael van der Westhuizen -// Copyright 2012 IBM Corp. -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// -// Lock-free algorithm by Alexander Terekhov -// -// Thanks to Ben Hitchings for the #weak + (#shared != 0) -// formulation -// - -#include - -extern "builtin" void __lwsync(void); -extern "builtin" void __isync(void); -extern "builtin" int __fetch_and_add(volatile int* addr, int val); -extern "builtin" int __compare_and_swap(volatile int*, int*, int); - -namespace boost -{ - -namespace detail -{ - -inline void atomic_increment( int *pw ) -{ - // ++*pw; - __lwsync(); - __fetch_and_add(pw, 1); - __isync(); -} - -inline int atomic_decrement( int *pw ) -{ - // return --*pw; - __lwsync(); - int originalValue = __fetch_and_add(pw, -1); - __isync(); - - return (originalValue - 1); -} - -inline int atomic_conditional_increment( int *pw ) -{ - // if( *pw != 0 ) ++*pw; - // return *pw; - - __lwsync(); - int v = *const_cast(pw); - for (;;) - // loop until state is known - { - if (v == 0) return 0; - if (__compare_and_swap(pw, &v, v + 1)) - { - __isync(); return (v + 1); - } - } -} - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - int use_count_; // #shared - int weak_count_; // #weak + (#shared != 0) - char pad[64] __attribute__((__aligned__(64))); - // pad to prevent false sharing -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - atomic_increment( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - return atomic_conditional_increment( &use_count_ ) != 0; - } - - void release() // nothrow - { - if( atomic_decrement( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - atomic_increment( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( atomic_decrement( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return *const_cast(&use_count_); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_w32.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_w32.hpp deleted file mode 100644 index 960e42e1282..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_base_w32.hpp +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_base_w32.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// -// Lock-free algorithm by Alexander Terekhov -// -// Thanks to Ben Hitchings for the #weak + (#shared != 0) -// formulation -// - -#include -#include -#include - -namespace boost -{ - -namespace detail -{ - -class sp_counted_base -{ -private: - - sp_counted_base( sp_counted_base const & ); - sp_counted_base & operator= ( sp_counted_base const & ); - - long use_count_; // #shared - long weak_count_; // #weak + (#shared != 0) - -public: - - sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) - { - } - - virtual ~sp_counted_base() // nothrow - { - } - - // dispose() is called when use_count_ drops to zero, to release - // the resources managed by *this. - - virtual void dispose() = 0; // nothrow - - // destroy() is called when weak_count_ drops to zero. - - virtual void destroy() // nothrow - { - delete this; - } - - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_untyped_deleter() = 0; - - void add_ref_copy() - { - BOOST_SP_INTERLOCKED_INCREMENT( &use_count_ ); - } - - bool add_ref_lock() // true on success - { - for( ;; ) - { - long tmp = static_cast< long const volatile& >( use_count_ ); - if( tmp == 0 ) return false; - -#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1200 ) - - // work around a code generation bug - - long tmp2 = tmp + 1; - if( BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp2, tmp ) == tmp2 - 1 ) return true; - -#else - - if( BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp + 1, tmp ) == tmp ) return true; - -#endif - } - } - - void release() // nothrow - { - if( BOOST_SP_INTERLOCKED_DECREMENT( &use_count_ ) == 0 ) - { - dispose(); - weak_release(); - } - } - - void weak_add_ref() // nothrow - { - BOOST_SP_INTERLOCKED_INCREMENT( &weak_count_ ); - } - - void weak_release() // nothrow - { - if( BOOST_SP_INTERLOCKED_DECREMENT( &weak_count_ ) == 0 ) - { - destroy(); - } - } - - long use_count() const // nothrow - { - return static_cast( use_count_ ); - } -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_impl.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_impl.hpp deleted file mode 100644 index fa2f75eb1aa..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_counted_impl.hpp +++ /dev/null @@ -1,292 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// detail/sp_counted_impl.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. -// Copyright 2004-2005 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include - -#if defined(BOOST_SP_USE_STD_ALLOCATOR) && defined(BOOST_SP_USE_QUICK_ALLOCATOR) -# error BOOST_SP_USE_STD_ALLOCATOR and BOOST_SP_USE_QUICK_ALLOCATOR are incompatible. -#endif - -#include -#include -#include - -#if defined(BOOST_SP_USE_QUICK_ALLOCATOR) -#include -#endif - -#if defined(BOOST_SP_USE_STD_ALLOCATOR) -#include // std::allocator -#endif - -#include // std::size_t - -namespace boost -{ - -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - -void sp_scalar_constructor_hook( void * px, std::size_t size, void * pn ); -void sp_scalar_destructor_hook( void * px, std::size_t size, void * pn ); - -#endif - -namespace detail -{ - -// get_local_deleter - -template class local_sp_deleter; - -template D * get_local_deleter( D * /*p*/ ) -{ - return 0; -} - -template D * get_local_deleter( local_sp_deleter * p ); - -// - -template class sp_counted_impl_p: public sp_counted_base -{ -private: - - X * px_; - - sp_counted_impl_p( sp_counted_impl_p const & ); - sp_counted_impl_p & operator= ( sp_counted_impl_p const & ); - - typedef sp_counted_impl_p this_type; - -public: - - explicit sp_counted_impl_p( X * px ): px_( px ) - { -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - boost::sp_scalar_constructor_hook( px, sizeof(X), this ); -#endif - } - - virtual void dispose() // nothrow - { -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - boost::sp_scalar_destructor_hook( px_, sizeof(X), this ); -#endif - boost::checked_delete( px_ ); - } - - virtual void * get_deleter( sp_typeinfo const & ) - { - return 0; - } - - virtual void * get_local_deleter( sp_typeinfo const & ) - { - return 0; - } - - virtual void * get_untyped_deleter() - { - return 0; - } - -#if defined(BOOST_SP_USE_STD_ALLOCATOR) - - void * operator new( std::size_t ) - { - return std::allocator().allocate( 1, static_cast(0) ); - } - - void operator delete( void * p ) - { - std::allocator().deallocate( static_cast(p), 1 ); - } - -#endif - -#if defined(BOOST_SP_USE_QUICK_ALLOCATOR) - - void * operator new( std::size_t ) - { - return quick_allocator::alloc(); - } - - void operator delete( void * p ) - { - quick_allocator::dealloc( p ); - } - -#endif -}; - -// -// Borland's Codeguard trips up over the -Vx- option here: -// -#ifdef __CODEGUARD__ -# pragma option push -Vx- -#endif - -template class sp_counted_impl_pd: public sp_counted_base -{ -private: - - P ptr; // copy constructor must not throw - D del; // copy constructor must not throw - - sp_counted_impl_pd( sp_counted_impl_pd const & ); - sp_counted_impl_pd & operator= ( sp_counted_impl_pd const & ); - - typedef sp_counted_impl_pd this_type; - -public: - - // pre: d(p) must not throw - - sp_counted_impl_pd( P p, D & d ): ptr( p ), del( d ) - { - } - - sp_counted_impl_pd( P p ): ptr( p ), del() - { - } - - virtual void dispose() // nothrow - { - del( ptr ); - } - - virtual void * get_deleter( sp_typeinfo const & ti ) - { - return ti == BOOST_SP_TYPEID(D)? &reinterpret_cast( del ): 0; - } - - virtual void * get_local_deleter( sp_typeinfo const & ti ) - { - return ti == BOOST_SP_TYPEID(D)? boost::detail::get_local_deleter( boost::addressof( del ) ): 0; - } - - virtual void * get_untyped_deleter() - { - return &reinterpret_cast( del ); - } - -#if defined(BOOST_SP_USE_STD_ALLOCATOR) - - void * operator new( std::size_t ) - { - return std::allocator().allocate( 1, static_cast(0) ); - } - - void operator delete( void * p ) - { - std::allocator().deallocate( static_cast(p), 1 ); - } - -#endif - -#if defined(BOOST_SP_USE_QUICK_ALLOCATOR) - - void * operator new( std::size_t ) - { - return quick_allocator::alloc(); - } - - void operator delete( void * p ) - { - quick_allocator::dealloc( p ); - } - -#endif -}; - -template class sp_counted_impl_pda: public sp_counted_base -{ -private: - - P p_; // copy constructor must not throw - D d_; // copy constructor must not throw - A a_; // copy constructor must not throw - - sp_counted_impl_pda( sp_counted_impl_pda const & ); - sp_counted_impl_pda & operator= ( sp_counted_impl_pda const & ); - - typedef sp_counted_impl_pda this_type; - -public: - - // pre: d( p ) must not throw - - sp_counted_impl_pda( P p, D & d, A a ): p_( p ), d_( d ), a_( a ) - { - } - - sp_counted_impl_pda( P p, A a ): p_( p ), d_( a ), a_( a ) - { - } - - virtual void dispose() // nothrow - { - d_( p_ ); - } - - virtual void destroy() // nothrow - { -#if !defined( BOOST_NO_CXX11_ALLOCATOR ) - - typedef typename std::allocator_traits::template rebind_alloc< this_type > A2; - -#else - - typedef typename A::template rebind< this_type >::other A2; - -#endif - - A2 a2( a_ ); - - this->~this_type(); - - a2.deallocate( this, 1 ); - } - - virtual void * get_deleter( sp_typeinfo const & ti ) - { - return ti == BOOST_SP_TYPEID( D )? &reinterpret_cast( d_ ): 0; - } - - virtual void * get_local_deleter( sp_typeinfo const & ti ) - { - return ti == BOOST_SP_TYPEID(D)? boost::detail::get_local_deleter( boost::addressof( d_ ) ): 0; - } - - virtual void * get_untyped_deleter() - { - return &reinterpret_cast( d_ ); - } -}; - -#ifdef __CODEGUARD__ -# pragma option pop -#endif - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_disable_deprecated.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_disable_deprecated.hpp deleted file mode 100644 index f79bdf38a8d..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_disable_deprecated.hpp +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_DISABLE_DEPRECATED_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_DISABLE_DEPRECATED_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/smart_ptr/detail/sp_disable_deprecated.hpp -// -// Copyright 2015 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include - -#if defined( __GNUC__ ) && ( defined( __GXX_EXPERIMENTAL_CXX0X__ ) || ( __cplusplus >= 201103L ) ) - -# if defined( BOOST_GCC ) - -# if BOOST_GCC >= 40600 -# define BOOST_SP_DISABLE_DEPRECATED -# endif - -# elif defined( __clang__ ) && defined( __has_warning ) - -# if __has_warning( "-Wdeprecated-declarations" ) -# define BOOST_SP_DISABLE_DEPRECATED -# endif - -# endif - -#endif - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_DISABLE_DEPRECATED_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_forward.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_forward.hpp deleted file mode 100644 index 8fdec65b7fa..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_forward.hpp +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_forward.hpp -// -// Copyright 2008,2012 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include - -namespace boost -{ - -namespace detail -{ - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -#if defined( BOOST_GCC ) && __GNUC__ * 100 + __GNUC_MINOR__ <= 404 - -// GCC 4.4 supports an outdated version of rvalue references and creates a copy of the forwarded object. -// This results in warnings 'returning reference to temporary'. Therefore we use a special version similar to std::forward. -template< class T > T&& sp_forward( T && t ) BOOST_NOEXCEPT -{ - return t; -} - -#else - -template< class T > T&& sp_forward( T & t ) BOOST_NOEXCEPT -{ - return static_cast< T&& >( t ); -} - -#endif - -#endif - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_has_sync.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_has_sync.hpp deleted file mode 100644 index e1debf0cc9b..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_has_sync.hpp +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/smart_ptr/detail/sp_has_sync.hpp -// -// Copyright (c) 2008, 2009 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// Defines the BOOST_SP_HAS_SYNC macro if the __sync_* intrinsics -// are available. -// - -#ifndef BOOST_SP_NO_SYNC - -#if !defined( __c2__ ) && defined( __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 ) - -# define BOOST_SP_HAS_SYNC - -#elif defined( __IBMCPP__ ) && ( __IBMCPP__ >= 1210 ) && !defined( __COMPILER_VER__ ) - -# define BOOST_SP_HAS_SYNC - -#elif !defined( __c2__ ) && defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) - -#define BOOST_SP_HAS_SYNC - -#if defined( __arm__ ) || defined( __armel__ ) -#undef BOOST_SP_HAS_SYNC -#endif - -#if defined( __hppa ) || defined( __hppa__ ) -#undef BOOST_SP_HAS_SYNC -#endif - -#if defined( __m68k__ ) -#undef BOOST_SP_HAS_SYNC -#endif - -#if defined( __sh__ ) -#undef BOOST_SP_HAS_SYNC -#endif - -#if defined( __sparc__ ) -#undef BOOST_SP_HAS_SYNC -#endif - -#if defined( __INTEL_COMPILER ) && !defined( __ia64__ ) && ( __INTEL_COMPILER < 1110 ) -#undef BOOST_SP_HAS_SYNC -#endif - -#if defined(__PATHSCALE__) && ((__PATHCC__ == 4) && (__PATHCC_MINOR__ < 9)) -#undef BOOST_SP_HAS_SYNC -#endif - -#endif - -#endif // #ifndef BOOST_SP_NO_SYNC - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_interlocked.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_interlocked.hpp deleted file mode 100644 index 79cae14a370..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_interlocked.hpp +++ /dev/null @@ -1,163 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_INTERLOCKED_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_INTERLOCKED_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/sp_interlocked.hpp -// -// Copyright 2005, 2014 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// - -#include - -// BOOST_SP_HAS_INTRIN_H - -// VC9 has intrin.h, but it collides with -#if defined( BOOST_MSVC ) && BOOST_MSVC >= 1600 - -# define BOOST_SP_HAS_INTRIN_H - -// Unlike __MINGW64__, __MINGW64_VERSION_MAJOR is defined by MinGW-w64 for both 32 and 64-bit targets. -#elif defined( __MINGW64_VERSION_MAJOR ) - -// MinGW-w64 provides intrin.h for both 32 and 64-bit targets. -# define BOOST_SP_HAS_INTRIN_H - -// Intel C++ on Windows on VC10+ stdlib -#elif defined( BOOST_INTEL_WIN ) && defined( _CPPLIB_VER ) && _CPPLIB_VER >= 520 - -# define BOOST_SP_HAS_INTRIN_H - -#endif - -#if defined( BOOST_USE_WINDOWS_H ) - -# include - -# define BOOST_SP_INTERLOCKED_INCREMENT InterlockedIncrement -# define BOOST_SP_INTERLOCKED_DECREMENT InterlockedDecrement -# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE InterlockedExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd - -#elif defined( BOOST_USE_INTRIN_H ) || defined( BOOST_SP_HAS_INTRIN_H ) - -#include - -# define BOOST_SP_INTERLOCKED_INCREMENT _InterlockedIncrement -# define BOOST_SP_INTERLOCKED_DECREMENT _InterlockedDecrement -# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE _InterlockedExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd - -#elif defined( _WIN32_WCE ) - -#if _WIN32_WCE >= 0x600 - -extern "C" long __cdecl _InterlockedIncrement( long volatile * ); -extern "C" long __cdecl _InterlockedDecrement( long volatile * ); -extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long ); -extern "C" long __cdecl _InterlockedExchange( long volatile *, long ); -extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long ); - -# define BOOST_SP_INTERLOCKED_INCREMENT _InterlockedIncrement -# define BOOST_SP_INTERLOCKED_DECREMENT _InterlockedDecrement -# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE _InterlockedExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd - -#else - -// under Windows CE we still have old-style Interlocked* functions - -extern "C" long __cdecl InterlockedIncrement( long* ); -extern "C" long __cdecl InterlockedDecrement( long* ); -extern "C" long __cdecl InterlockedCompareExchange( long*, long, long ); -extern "C" long __cdecl InterlockedExchange( long*, long ); -extern "C" long __cdecl InterlockedExchangeAdd( long*, long ); - -# define BOOST_SP_INTERLOCKED_INCREMENT InterlockedIncrement -# define BOOST_SP_INTERLOCKED_DECREMENT InterlockedDecrement -# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE InterlockedExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd - -#endif - -#elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN ) - -#if defined( __CLRCALL_PURE_OR_CDECL ) - -extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedIncrement( long volatile * ); -extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedDecrement( long volatile * ); -extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedCompareExchange( long volatile *, long, long ); -extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchange( long volatile *, long ); -extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchangeAdd( long volatile *, long ); - -#else - -extern "C" long __cdecl _InterlockedIncrement( long volatile * ); -extern "C" long __cdecl _InterlockedDecrement( long volatile * ); -extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long ); -extern "C" long __cdecl _InterlockedExchange( long volatile *, long ); -extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long ); - -# if defined( BOOST_MSVC ) && BOOST_MSVC == 1310 -//From MSDN, Visual Studio .NET 2003 spedific: To declare one of the interlocked functions -//for use as an intrinsic, the function must be declared with the leading underscore and -//the new function must appear in a #pragma intrinsic statement. -# pragma intrinsic( _InterlockedIncrement ) -# pragma intrinsic( _InterlockedDecrement ) -# pragma intrinsic( _InterlockedCompareExchange ) -# pragma intrinsic( _InterlockedExchange ) -# pragma intrinsic( _InterlockedExchangeAdd ) -# endif - -#endif - -# define BOOST_SP_INTERLOCKED_INCREMENT _InterlockedIncrement -# define BOOST_SP_INTERLOCKED_DECREMENT _InterlockedDecrement -# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE _InterlockedExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd - -#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) - -namespace boost -{ - -namespace detail -{ - -extern "C" __declspec(dllimport) long __stdcall InterlockedIncrement( long volatile * ); -extern "C" __declspec(dllimport) long __stdcall InterlockedDecrement( long volatile * ); -extern "C" __declspec(dllimport) long __stdcall InterlockedCompareExchange( long volatile *, long, long ); -extern "C" __declspec(dllimport) long __stdcall InterlockedExchange( long volatile *, long ); -extern "C" __declspec(dllimport) long __stdcall InterlockedExchangeAdd( long volatile *, long ); - -} // namespace detail - -} // namespace boost - -# define BOOST_SP_INTERLOCKED_INCREMENT ::boost::detail::InterlockedIncrement -# define BOOST_SP_INTERLOCKED_DECREMENT ::boost::detail::InterlockedDecrement -# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE ::boost::detail::InterlockedCompareExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE ::boost::detail::InterlockedExchange -# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD ::boost::detail::InterlockedExchangeAdd - -#else - -# error "Interlocked intrinsics not available" - -#endif - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_INTERLOCKED_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_noexcept.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_noexcept.hpp deleted file mode 100644 index 1287ba49525..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_noexcept.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_NOEXCEPT_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_NOEXCEPT_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_noexcept.hpp -// -// Copyright 2016, 2017 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include - -// BOOST_SP_NOEXCEPT - -#if defined( BOOST_MSVC ) && BOOST_MSVC >= 1700 && BOOST_MSVC < 1900 - -# define BOOST_SP_NOEXCEPT BOOST_NOEXCEPT_OR_NOTHROW - -#else - -# define BOOST_SP_NOEXCEPT BOOST_NOEXCEPT - -#endif - -// BOOST_SP_NOEXCEPT_WITH_ASSERT - -#if defined(BOOST_DISABLE_ASSERTS) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && defined(NDEBUG) ) - -# define BOOST_SP_NOEXCEPT_WITH_ASSERT BOOST_SP_NOEXCEPT - -#elif defined(BOOST_ENABLE_ASSERT_HANDLER) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && !defined(NDEBUG) ) - -# define BOOST_SP_NOEXCEPT_WITH_ASSERT - -#else - -# define BOOST_SP_NOEXCEPT_WITH_ASSERT BOOST_SP_NOEXCEPT - -#endif - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_NOEXCEPT_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/sp_nullptr_t.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/sp_nullptr_t.hpp deleted file mode 100644 index 219ae8070a6..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/sp_nullptr_t.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// detail/sp_nullptr_t.hpp -// -// Copyright 2013 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt - -#include -#include - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - -namespace boost -{ - -namespace detail -{ - -#if !defined( BOOST_NO_CXX11_DECLTYPE ) && ( ( defined( __clang__ ) && !defined( _LIBCPP_VERSION ) ) || defined( __INTEL_COMPILER ) ) - - typedef decltype(nullptr) sp_nullptr_t; - -#else - - typedef std::nullptr_t sp_nullptr_t; - -#endif - -} // namespace detail - -} // namespace boost - -#endif // !defined( BOOST_NO_CXX11_NULLPTR ) - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/spinlock.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/spinlock.hpp deleted file mode 100644 index 0b618dfc155..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/spinlock.hpp +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/spinlock.hpp -// -// Copyright (c) 2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// struct spinlock -// { -// void lock(); -// bool try_lock(); -// void unlock(); -// -// class scoped_lock; -// }; -// -// #define BOOST_DETAIL_SPINLOCK_INIT -// - -#include -#include - -#if defined( BOOST_SP_USE_STD_ATOMIC ) -# if !defined( __clang__ ) -# include -# else -// Clang (at least up to 3.4) can't compile spinlock_pool when -// using std::atomic, so substitute the __sync implementation instead. -# include -# endif - -#elif defined( BOOST_SP_USE_PTHREADS ) -# include - -#elif !defined( BOOST_NO_CXX11_HDR_ATOMIC ) -# include - -#elif defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ ) -# include - -#elif defined( BOOST_SP_HAS_SYNC ) -# include - -#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# include - -#elif defined(BOOST_HAS_PTHREADS) -# include - -#elif !defined(BOOST_HAS_THREADS) -# include - -#else -# error Unrecognized threading platform -#endif - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/spinlock_gcc_arm.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/spinlock_gcc_arm.hpp deleted file mode 100644 index 24d08a8815f..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/spinlock_gcc_arm.hpp +++ /dev/null @@ -1,121 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED - -// -// Copyright (c) 2008, 2011 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include - -#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7S__) - -# define BOOST_SP_ARM_BARRIER "dmb" -# define BOOST_SP_ARM_HAS_LDREX - -#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) - -# define BOOST_SP_ARM_BARRIER "mcr p15, 0, r0, c7, c10, 5" -# define BOOST_SP_ARM_HAS_LDREX - -#else - -# define BOOST_SP_ARM_BARRIER "" - -#endif - -namespace boost -{ - -namespace detail -{ - -class spinlock -{ -public: - - int v_; - -public: - - bool try_lock() - { - int r; - -#ifdef BOOST_SP_ARM_HAS_LDREX - - __asm__ __volatile__( - "ldrex %0, [%2]; \n" - "cmp %0, %1; \n" - "strexne %0, %1, [%2]; \n" - BOOST_SP_ARM_BARRIER : - "=&r"( r ): // outputs - "r"( 1 ), "r"( &v_ ): // inputs - "memory", "cc" ); - -#else - - __asm__ __volatile__( - "swp %0, %1, [%2];\n" - BOOST_SP_ARM_BARRIER : - "=&r"( r ): // outputs - "r"( 1 ), "r"( &v_ ): // inputs - "memory", "cc" ); - -#endif - - return r == 0; - } - - void lock() - { - for( unsigned k = 0; !try_lock(); ++k ) - { - boost::detail::yield( k ); - } - } - - void unlock() - { - __asm__ __volatile__( BOOST_SP_ARM_BARRIER ::: "memory" ); - *const_cast< int volatile* >( &v_ ) = 0; - __asm__ __volatile__( BOOST_SP_ARM_BARRIER ::: "memory" ); - } - -public: - - class scoped_lock - { - private: - - spinlock & sp_; - - scoped_lock( scoped_lock const & ); - scoped_lock & operator=( scoped_lock const & ); - - public: - - explicit scoped_lock( spinlock & sp ): sp_( sp ) - { - sp.lock(); - } - - ~scoped_lock() - { - sp_.unlock(); - } - }; -}; - -} // namespace detail -} // namespace boost - -#define BOOST_DETAIL_SPINLOCK_INIT {0} - -#undef BOOST_SP_ARM_BARRIER -#undef BOOST_SP_ARM_HAS_LDREX - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/spinlock_nt.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/spinlock_nt.hpp deleted file mode 100644 index 1f399d0dd41..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/spinlock_nt.hpp +++ /dev/null @@ -1,89 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// Copyright (c) 2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include - -namespace boost -{ - -namespace detail -{ - -class spinlock -{ -public: - - bool locked_; - -public: - - inline bool try_lock() - { - if( locked_ ) - { - return false; - } - else - { - locked_ = true; - return true; - } - } - - inline void lock() - { - BOOST_ASSERT( !locked_ ); - locked_ = true; - } - - inline void unlock() - { - BOOST_ASSERT( locked_ ); - locked_ = false; - } - -public: - - class scoped_lock - { - private: - - spinlock & sp_; - - scoped_lock( scoped_lock const & ); - scoped_lock & operator=( scoped_lock const & ); - - public: - - explicit scoped_lock( spinlock & sp ): sp_( sp ) - { - sp.lock(); - } - - ~scoped_lock() - { - sp_.unlock(); - } - }; -}; - -} // namespace detail -} // namespace boost - -#define BOOST_DETAIL_SPINLOCK_INIT { false } - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/spinlock_pool.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/spinlock_pool.hpp deleted file mode 100644 index 39cf180b242..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/spinlock_pool.hpp +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/spinlock_pool.hpp -// -// Copyright (c) 2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// spinlock_pool<0> is reserved for atomic<>, when/if it arrives -// spinlock_pool<1> is reserved for shared_ptr reference counts -// spinlock_pool<2> is reserved for shared_ptr atomic access -// - -#include -#include -#include - -namespace boost -{ - -namespace detail -{ - -template< int M > class spinlock_pool -{ -private: - - static spinlock pool_[ 41 ]; - -public: - - static spinlock & spinlock_for( void const * pv ) - { -#if defined(__VMS) && __INITIAL_POINTER_SIZE == 64 - std::size_t i = reinterpret_cast< unsigned long long >( pv ) % 41; -#else - std::size_t i = reinterpret_cast< std::size_t >( pv ) % 41; -#endif - return pool_[ i ]; - } - - class scoped_lock - { - private: - - spinlock & sp_; - - scoped_lock( scoped_lock const & ); - scoped_lock & operator=( scoped_lock const & ); - - public: - - explicit scoped_lock( void const * pv ): sp_( spinlock_for( pv ) ) - { - sp_.lock(); - } - - ~scoped_lock() - { - sp_.unlock(); - } - }; -}; - -template< int M > spinlock spinlock_pool< M >::pool_[ 41 ] = -{ - BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, - BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, - BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, - BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, - BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, - BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, - BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, - BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, - BOOST_DETAIL_SPINLOCK_INIT -}; - -} // namespace detail -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/spinlock_pt.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/spinlock_pt.hpp deleted file mode 100644 index f9cabfc3a7c..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/spinlock_pt.hpp +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// Copyright (c) 2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include - -namespace boost -{ - -namespace detail -{ - -class spinlock -{ -public: - - pthread_mutex_t v_; - -public: - - bool try_lock() - { - return pthread_mutex_trylock( &v_ ) == 0; - } - - void lock() - { - pthread_mutex_lock( &v_ ); - } - - void unlock() - { - pthread_mutex_unlock( &v_ ); - } - -public: - - class scoped_lock - { - private: - - spinlock & sp_; - - scoped_lock( scoped_lock const & ); - scoped_lock & operator=( scoped_lock const & ); - - public: - - explicit scoped_lock( spinlock & sp ): sp_( sp ) - { - sp.lock(); - } - - ~scoped_lock() - { - sp_.unlock(); - } - }; -}; - -} // namespace detail -} // namespace boost - -#define BOOST_DETAIL_SPINLOCK_INIT { PTHREAD_MUTEX_INITIALIZER } - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/spinlock_std_atomic.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/spinlock_std_atomic.hpp deleted file mode 100644 index a61c1cd96d1..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/spinlock_std_atomic.hpp +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_STD_ATOMIC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SPINLOCK_STD_ATOMIC_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// Copyright (c) 2014 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include -#include - -namespace boost -{ - -namespace detail -{ - -class spinlock -{ -public: - - std::atomic_flag v_; - -public: - - bool try_lock() - { - return !v_.test_and_set( std::memory_order_acquire ); - } - - void lock() - { - for( unsigned k = 0; !try_lock(); ++k ) - { - boost::detail::yield( k ); - } - } - - void unlock() - { - v_ .clear( std::memory_order_release ); - } - -public: - - class scoped_lock - { - private: - - spinlock & sp_; - - scoped_lock( scoped_lock const & ); - scoped_lock & operator=( scoped_lock const & ); - - public: - - explicit scoped_lock( spinlock & sp ): sp_( sp ) - { - sp.lock(); - } - - ~scoped_lock() - { - sp_.unlock(); - } - }; -}; - -} // namespace detail -} // namespace boost - -#define BOOST_DETAIL_SPINLOCK_INIT { ATOMIC_FLAG_INIT } - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_STD_ATOMIC_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/spinlock_sync.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/spinlock_sync.hpp deleted file mode 100644 index a7145c5ac27..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/spinlock_sync.hpp +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// Copyright (c) 2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include - -#if defined( __ia64__ ) && defined( __INTEL_COMPILER ) -# include -#endif - -namespace boost -{ - -namespace detail -{ - -class spinlock -{ -public: - - int v_; - -public: - - bool try_lock() - { - int r = __sync_lock_test_and_set( &v_, 1 ); - return r == 0; - } - - void lock() - { - for( unsigned k = 0; !try_lock(); ++k ) - { - boost::detail::yield( k ); - } - } - - void unlock() - { - __sync_lock_release( &v_ ); - } - -public: - - class scoped_lock - { - private: - - spinlock & sp_; - - scoped_lock( scoped_lock const & ); - scoped_lock & operator=( scoped_lock const & ); - - public: - - explicit scoped_lock( spinlock & sp ): sp_( sp ) - { - sp.lock(); - } - - ~scoped_lock() - { - sp_.unlock(); - } - }; -}; - -} // namespace detail -} // namespace boost - -#define BOOST_DETAIL_SPINLOCK_INIT {0} - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/spinlock_w32.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/spinlock_w32.hpp deleted file mode 100644 index d34e4fc2b52..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/spinlock_w32.hpp +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// Copyright (c) 2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// - -#include -#include - -// BOOST_COMPILER_FENCE - -#if defined(__INTEL_COMPILER) - -#define BOOST_COMPILER_FENCE __memory_barrier(); - -#elif defined( _MSC_VER ) && _MSC_VER >= 1310 - -extern "C" void _ReadWriteBarrier(); -#pragma intrinsic( _ReadWriteBarrier ) - -#define BOOST_COMPILER_FENCE _ReadWriteBarrier(); - -#elif defined(__GNUC__) - -#define BOOST_COMPILER_FENCE __asm__ __volatile__( "" : : : "memory" ); - -#else - -#define BOOST_COMPILER_FENCE - -#endif - -// - -namespace boost -{ - -namespace detail -{ - -class spinlock -{ -public: - - long v_; - -public: - - bool try_lock() - { - long r = BOOST_SP_INTERLOCKED_EXCHANGE( &v_, 1 ); - - BOOST_COMPILER_FENCE - - return r == 0; - } - - void lock() - { - for( unsigned k = 0; !try_lock(); ++k ) - { - boost::detail::yield( k ); - } - } - - void unlock() - { - BOOST_COMPILER_FENCE - *const_cast< long volatile* >( &v_ ) = 0; - } - -public: - - class scoped_lock - { - private: - - spinlock & sp_; - - scoped_lock( scoped_lock const & ); - scoped_lock & operator=( scoped_lock const & ); - - public: - - explicit scoped_lock( spinlock & sp ): sp_( sp ) - { - sp.lock(); - } - - ~scoped_lock() - { - sp_.unlock(); - } - }; -}; - -} // namespace detail -} // namespace boost - -#define BOOST_DETAIL_SPINLOCK_INIT {0} - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/detail/yield_k.hpp b/contrib/restricted/boost/boost/smart_ptr/detail/yield_k.hpp deleted file mode 100644 index f8ca6b64676..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/detail/yield_k.hpp +++ /dev/null @@ -1,177 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_YIELD_K_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_YIELD_K_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// yield_k.hpp -// -// Copyright (c) 2008 Peter Dimov -// Copyright (c) Microsoft Corporation 2014 -// -// void yield( unsigned k ); -// -// Typical use: -// -// for( unsigned k = 0; !try_lock(); ++k ) yield( k ); -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// - -#include -#include - -#if BOOST_PLAT_WINDOWS_RUNTIME -#include -#endif - -// BOOST_SMT_PAUSE - -#if defined(_MSC_VER) && _MSC_VER >= 1310 && ( defined(_M_IX86) || defined(_M_X64) ) && !defined(__c2__) - -extern "C" void _mm_pause(); - -#define BOOST_SMT_PAUSE _mm_pause(); - -#elif defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) ) - -#define BOOST_SMT_PAUSE __asm__ __volatile__( "rep; nop" : : : "memory" ); - -#endif - -// - -#if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) - -#if defined( BOOST_USE_WINDOWS_H ) -# include -#endif - -namespace boost -{ - -namespace detail -{ - -#if !defined( BOOST_USE_WINDOWS_H ) && !BOOST_PLAT_WINDOWS_RUNTIME -#if !BOOST_COMP_CLANG || !defined __MINGW32__ - extern "C" void __stdcall Sleep( unsigned long ms ); -#else -#include <_mingw.h> -#if !defined __MINGW64_VERSION_MAJOR - extern "C" void __stdcall Sleep( unsigned long ms ); -#else - extern "C" __declspec(dllimport) void __stdcall Sleep( unsigned long ms ); -#endif -#endif -#endif - -inline void yield( unsigned k ) -{ - if( k < 4 ) - { - } -#if defined( BOOST_SMT_PAUSE ) - else if( k < 16 ) - { - BOOST_SMT_PAUSE - } -#endif -#if !BOOST_PLAT_WINDOWS_RUNTIME - else if( k < 32 ) - { - Sleep( 0 ); - } - else - { - Sleep( 1 ); - } -#else - else - { - // Sleep isn't supported on the Windows Runtime. - std::this_thread::yield(); - } -#endif -} - -} // namespace detail - -} // namespace boost - -#elif defined( BOOST_HAS_PTHREADS ) - -#ifndef _AIX -#include -#else - // AIX's sched.h defines ::var which sometimes conflicts with Lambda's var - extern "C" int sched_yield(void); -#endif - -#include - -namespace boost -{ - -namespace detail -{ - -inline void yield( unsigned k ) -{ - if( k < 4 ) - { - } -#if defined( BOOST_SMT_PAUSE ) - else if( k < 16 ) - { - BOOST_SMT_PAUSE - } -#endif - else if( k < 32 || k & 1 ) - { - sched_yield(); - } - else - { - // g++ -Wextra warns on {} or {0} - struct timespec rqtp = { 0, 0 }; - - // POSIX says that timespec has tv_sec and tv_nsec - // But it doesn't guarantee order or placement - - rqtp.tv_sec = 0; - rqtp.tv_nsec = 1000; - - nanosleep( &rqtp, 0 ); - } -} - -} // namespace detail - -} // namespace boost - -#else - -namespace boost -{ - -namespace detail -{ - -inline void yield( unsigned ) -{ -} - -} // namespace detail - -} // namespace boost - -#endif - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_YIELD_K_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/enable_shared_from_raw.hpp b/contrib/restricted/boost/boost/smart_ptr/enable_shared_from_raw.hpp deleted file mode 100644 index 5cd3574e7c4..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/enable_shared_from_raw.hpp +++ /dev/null @@ -1,165 +0,0 @@ -#ifndef BOOST_ENABLE_SHARED_FROM_RAW_HPP_INCLUDED -#define BOOST_ENABLE_SHARED_FROM_RAW_HPP_INCLUDED - -// -// enable_shared_from_raw.hpp -// -// Copyright 2002, 2009, 2014 Peter Dimov -// Copyright 2008-2009 Frank Mori Hess -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// - -#include -#include -#include -#include -#include - -namespace boost -{ -template boost::shared_ptr shared_from_raw(T *); -template boost::weak_ptr weak_from_raw(T *); - -namespace detail -{ -template< class X, class Y > inline void sp_enable_shared_from_this( boost::shared_ptr * ppx, Y const * py, boost::enable_shared_from_raw const * pe ); - -} // namespace detail - -class enable_shared_from_raw -{ -protected: - - enable_shared_from_raw() - { - } - - enable_shared_from_raw( enable_shared_from_raw const & ) - { - } - - enable_shared_from_raw & operator=( enable_shared_from_raw const & ) - { - return *this; - } - - ~enable_shared_from_raw() - { - BOOST_ASSERT( shared_this_.use_count() <= 1 ); // make sure no dangling shared_ptr objects exist - } - -private: - - void init_if_expired() const - { - if( weak_this_.expired() ) - { - shared_this_.reset( static_cast(0), detail::esft2_deleter_wrapper() ); - weak_this_ = shared_this_; - } - } - - void init_if_empty() const - { - if( weak_this_._empty() ) - { - shared_this_.reset( static_cast(0), detail::esft2_deleter_wrapper() ); - weak_this_ = shared_this_; - } - } - -#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS -public: -#else -private: - template friend class shared_ptr; - template friend boost::shared_ptr shared_from_raw(T *); - template friend boost::weak_ptr weak_from_raw(T *); - template< class X, class Y > friend inline void detail::sp_enable_shared_from_this( boost::shared_ptr * ppx, Y const * py, boost::enable_shared_from_raw const * pe ); -#endif - - shared_ptr shared_from_this() const - { - init_if_expired(); - return shared_ptr( weak_this_ ); - } - - shared_ptr shared_from_this() const volatile - { - return const_cast< enable_shared_from_raw const * >( this )->shared_from_this(); - } - - weak_ptr weak_from_this() const - { - init_if_empty(); - return weak_this_; - } - - weak_ptr weak_from_this() const volatile - { - return const_cast< enable_shared_from_raw const * >( this )->weak_from_this(); - } - - // Note: invoked automatically by shared_ptr; do not call - template void _internal_accept_owner( shared_ptr * ppx, Y * ) const - { - BOOST_ASSERT( ppx != 0 ); - - if( weak_this_.expired() ) - { - weak_this_ = *ppx; - } - else if( shared_this_.use_count() != 0 ) - { - BOOST_ASSERT( ppx->unique() ); // no weak_ptrs should exist either, but there's no way to check that - - detail::esft2_deleter_wrapper * pd = boost::get_deleter( shared_this_ ); - BOOST_ASSERT( pd != 0 ); - - pd->set_deleter( *ppx ); - - ppx->reset( shared_this_, ppx->get() ); - shared_this_.reset(); - } - } - - mutable weak_ptr weak_this_; - -private: - - mutable shared_ptr shared_this_; -}; - -template -boost::shared_ptr shared_from_raw(T *p) -{ - BOOST_ASSERT(p != 0); - return boost::shared_ptr(p->enable_shared_from_raw::shared_from_this(), p); -} - -template -boost::weak_ptr weak_from_raw(T *p) -{ - BOOST_ASSERT(p != 0); - boost::weak_ptr result; - result._internal_aliasing_assign(p->enable_shared_from_raw::weak_from_this(), p); - return result; -} - -namespace detail -{ - template< class X, class Y > inline void sp_enable_shared_from_this( boost::shared_ptr * ppx, Y const * py, boost::enable_shared_from_raw const * pe ) - { - if( pe != 0 ) - { - pe->_internal_accept_owner( ppx, const_cast< Y* >( py ) ); - } - } -} // namepsace detail - -} // namespace boost - -#endif // #ifndef BOOST_ENABLE_SHARED_FROM_RAW_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/enable_shared_from_this.hpp b/contrib/restricted/boost/boost/smart_ptr/enable_shared_from_this.hpp deleted file mode 100644 index fc4de0b5712..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/enable_shared_from_this.hpp +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef BOOST_SMART_PTR_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED -#define BOOST_SMART_PTR_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED - -// -// enable_shared_from_this.hpp -// -// Copyright 2002, 2009 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. -// - -#include -#include -#include -#include -#include - -namespace boost -{ - -template class enable_shared_from_this -{ -protected: - - BOOST_CONSTEXPR enable_shared_from_this() BOOST_SP_NOEXCEPT - { - } - - BOOST_CONSTEXPR enable_shared_from_this(enable_shared_from_this const &) BOOST_SP_NOEXCEPT - { - } - - enable_shared_from_this & operator=(enable_shared_from_this const &) BOOST_SP_NOEXCEPT - { - return *this; - } - - ~enable_shared_from_this() BOOST_SP_NOEXCEPT // ~weak_ptr newer throws, so this call also must not throw - { - } - -public: - - shared_ptr shared_from_this() - { - shared_ptr p( weak_this_ ); - BOOST_ASSERT( p.get() == this ); - return p; - } - - shared_ptr shared_from_this() const - { - shared_ptr p( weak_this_ ); - BOOST_ASSERT( p.get() == this ); - return p; - } - - weak_ptr weak_from_this() BOOST_SP_NOEXCEPT - { - return weak_this_; - } - - weak_ptr weak_from_this() const BOOST_SP_NOEXCEPT - { - return weak_this_; - } - -public: // actually private, but avoids compiler template friendship issues - - // Note: invoked automatically by shared_ptr; do not call - template void _internal_accept_owner( shared_ptr const * ppx, Y * py ) const BOOST_SP_NOEXCEPT - { - if( weak_this_.expired() ) - { - weak_this_ = shared_ptr( *ppx, py ); - } - } - -private: - - mutable weak_ptr weak_this_; -}; - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/intrusive_ptr.hpp b/contrib/restricted/boost/boost/smart_ptr/intrusive_ptr.hpp deleted file mode 100644 index 0ab075d367b..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/intrusive_ptr.hpp +++ /dev/null @@ -1,361 +0,0 @@ -#ifndef BOOST_SMART_PTR_INTRUSIVE_PTR_HPP_INCLUDED -#define BOOST_SMART_PTR_INTRUSIVE_PTR_HPP_INCLUDED - -// -// intrusive_ptr.hpp -// -// Copyright (c) 2001, 2002 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. -// - -#include - -#include -#include -#include -#include -#include - -#include // for std::less - -#if !defined(BOOST_NO_IOSTREAM) -#if !defined(BOOST_NO_IOSFWD) -#include // for std::basic_ostream -#else -#include -#endif -#endif - - -namespace boost -{ - -// -// intrusive_ptr -// -// A smart pointer that uses intrusive reference counting. -// -// Relies on unqualified calls to -// -// void intrusive_ptr_add_ref(T * p); -// void intrusive_ptr_release(T * p); -// -// (p != 0) -// -// The object is responsible for destroying itself. -// - -template class intrusive_ptr -{ -private: - - typedef intrusive_ptr this_type; - -public: - - typedef T element_type; - - BOOST_CONSTEXPR intrusive_ptr() BOOST_SP_NOEXCEPT : px( 0 ) - { - } - - intrusive_ptr( T * p, bool add_ref = true ): px( p ) - { - if( px != 0 && add_ref ) intrusive_ptr_add_ref( px ); - } - -#if !defined(BOOST_NO_MEMBER_TEMPLATES) || defined(BOOST_MSVC6_MEMBER_TEMPLATES) - - template -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - - intrusive_ptr( intrusive_ptr const & rhs, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) - -#else - - intrusive_ptr( intrusive_ptr const & rhs ) - -#endif - : px( rhs.get() ) - { - if( px != 0 ) intrusive_ptr_add_ref( px ); - } - -#endif - - intrusive_ptr(intrusive_ptr const & rhs): px( rhs.px ) - { - if( px != 0 ) intrusive_ptr_add_ref( px ); - } - - ~intrusive_ptr() - { - if( px != 0 ) intrusive_ptr_release( px ); - } - -#if !defined(BOOST_NO_MEMBER_TEMPLATES) || defined(BOOST_MSVC6_MEMBER_TEMPLATES) - - template intrusive_ptr & operator=(intrusive_ptr const & rhs) - { - this_type(rhs).swap(*this); - return *this; - } - -#endif - -// Move support - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - intrusive_ptr(intrusive_ptr && rhs) BOOST_SP_NOEXCEPT : px( rhs.px ) - { - rhs.px = 0; - } - - intrusive_ptr & operator=(intrusive_ptr && rhs) BOOST_SP_NOEXCEPT - { - this_type( static_cast< intrusive_ptr && >( rhs ) ).swap(*this); - return *this; - } - - template friend class intrusive_ptr; - - template -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - - intrusive_ptr(intrusive_ptr && rhs, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty()) - -#else - - intrusive_ptr(intrusive_ptr && rhs) - -#endif - : px( rhs.px ) - { - rhs.px = 0; - } - - template - intrusive_ptr & operator=(intrusive_ptr && rhs) BOOST_SP_NOEXCEPT - { - this_type( static_cast< intrusive_ptr && >( rhs ) ).swap(*this); - return *this; - } - -#endif - - intrusive_ptr & operator=(intrusive_ptr const & rhs) - { - this_type(rhs).swap(*this); - return *this; - } - - intrusive_ptr & operator=(T * rhs) - { - this_type(rhs).swap(*this); - return *this; - } - - void reset() - { - this_type().swap( *this ); - } - - void reset( T * rhs ) - { - this_type( rhs ).swap( *this ); - } - - void reset( T * rhs, bool add_ref ) - { - this_type( rhs, add_ref ).swap( *this ); - } - - T * get() const BOOST_SP_NOEXCEPT - { - return px; - } - - T * detach() BOOST_SP_NOEXCEPT - { - T * ret = px; - px = 0; - return ret; - } - - T & operator*() const BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT( px != 0 ); - return *px; - } - - T * operator->() const BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT( px != 0 ); - return px; - } - -// implicit conversion to "bool" -#include - - void swap(intrusive_ptr & rhs) BOOST_SP_NOEXCEPT - { - T * tmp = px; - px = rhs.px; - rhs.px = tmp; - } - -private: - - T * px; -}; - -template inline bool operator==(intrusive_ptr const & a, intrusive_ptr const & b) BOOST_SP_NOEXCEPT -{ - return a.get() == b.get(); -} - -template inline bool operator!=(intrusive_ptr const & a, intrusive_ptr const & b) BOOST_SP_NOEXCEPT -{ - return a.get() != b.get(); -} - -template inline bool operator==(intrusive_ptr const & a, U * b) BOOST_SP_NOEXCEPT -{ - return a.get() == b; -} - -template inline bool operator!=(intrusive_ptr const & a, U * b) BOOST_SP_NOEXCEPT -{ - return a.get() != b; -} - -template inline bool operator==(T * a, intrusive_ptr const & b) BOOST_SP_NOEXCEPT -{ - return a == b.get(); -} - -template inline bool operator!=(T * a, intrusive_ptr const & b) BOOST_SP_NOEXCEPT -{ - return a != b.get(); -} - -#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96 - -// Resolve the ambiguity between our op!= and the one in rel_ops - -template inline bool operator!=(intrusive_ptr const & a, intrusive_ptr const & b) BOOST_SP_NOEXCEPT -{ - return a.get() != b.get(); -} - -#endif - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - -template inline bool operator==( intrusive_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator==( boost::detail::sp_nullptr_t, intrusive_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator!=( intrusive_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT -{ - return p.get() != 0; -} - -template inline bool operator!=( boost::detail::sp_nullptr_t, intrusive_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return p.get() != 0; -} - -#endif - -template inline bool operator<(intrusive_ptr const & a, intrusive_ptr const & b) BOOST_SP_NOEXCEPT -{ - return std::less()(a.get(), b.get()); -} - -template void swap(intrusive_ptr & lhs, intrusive_ptr & rhs) BOOST_SP_NOEXCEPT -{ - lhs.swap(rhs); -} - -// mem_fn support - -template T * get_pointer(intrusive_ptr const & p) BOOST_SP_NOEXCEPT -{ - return p.get(); -} - -template intrusive_ptr static_pointer_cast(intrusive_ptr const & p) -{ - return static_cast(p.get()); -} - -template intrusive_ptr const_pointer_cast(intrusive_ptr const & p) -{ - return const_cast(p.get()); -} - -template intrusive_ptr dynamic_pointer_cast(intrusive_ptr const & p) -{ - return dynamic_cast(p.get()); -} - -// operator<< - -#if !defined(BOOST_NO_IOSTREAM) - -#if defined(BOOST_NO_TEMPLATED_IOSTREAMS) || ( defined(__GNUC__) && (__GNUC__ < 3) ) - -template std::ostream & operator<< (std::ostream & os, intrusive_ptr const & p) -{ - os << p.get(); - return os; -} - -#else - -// in STLport's no-iostreams mode no iostream symbols can be used -#ifndef _STLP_NO_IOSTREAMS - -# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300 && __SGI_STL_PORT) -// MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL -using std::basic_ostream; -template basic_ostream & operator<< (basic_ostream & os, intrusive_ptr const & p) -# else -template std::basic_ostream & operator<< (std::basic_ostream & os, intrusive_ptr const & p) -# endif -{ - os << p.get(); - return os; -} - -#endif // _STLP_NO_IOSTREAMS - -#endif // __GNUC__ < 3 - -#endif // !defined(BOOST_NO_IOSTREAM) - -// hash_value - -template< class T > struct hash; - -template< class T > std::size_t hash_value( boost::intrusive_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return boost::hash< T* >()( p.get() ); -} - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_INTRUSIVE_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/intrusive_ref_counter.hpp b/contrib/restricted/boost/boost/smart_ptr/intrusive_ref_counter.hpp deleted file mode 100644 index c2f918d0a49..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/intrusive_ref_counter.hpp +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright Andrey Semashev 2007 - 2013. - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - */ -/*! - * \file intrusive_ref_counter.hpp - * \author Andrey Semashev - * \date 12.03.2009 - * - * This header contains a reference counter class for \c intrusive_ptr. - */ - -#ifndef BOOST_SMART_PTR_INTRUSIVE_REF_COUNTER_HPP_INCLUDED_ -#define BOOST_SMART_PTR_INTRUSIVE_REF_COUNTER_HPP_INCLUDED_ - -#include -#include -#include - -#ifdef BOOST_HAS_PRAGMA_ONCE -#pragma once -#endif - -#if defined(_MSC_VER) -#pragma warning(push) -// This is a bogus MSVC warning, which is flagged by friend declarations of intrusive_ptr_add_ref and intrusive_ptr_release in intrusive_ref_counter: -// 'name' : the inline specifier cannot be used when a friend declaration refers to a specialization of a function template -// Note that there is no inline specifier in the declarations. -#pragma warning(disable: 4396) -#endif - -namespace boost { - -namespace sp_adl_block { - -/*! - * \brief Thread unsafe reference counter policy for \c intrusive_ref_counter - * - * The policy instructs the \c intrusive_ref_counter base class to implement - * a reference counter suitable for single threaded use only. Pointers to the same - * object with this kind of reference counter must not be used by different threads. - */ -struct thread_unsafe_counter -{ - typedef unsigned int type; - - static unsigned int load(unsigned int const& counter) BOOST_SP_NOEXCEPT - { - return counter; - } - - static void increment(unsigned int& counter) BOOST_SP_NOEXCEPT - { - ++counter; - } - - static unsigned int decrement(unsigned int& counter) BOOST_SP_NOEXCEPT - { - return --counter; - } -}; - -/*! - * \brief Thread safe reference counter policy for \c intrusive_ref_counter - * - * The policy instructs the \c intrusive_ref_counter base class to implement - * a thread-safe reference counter, if the target platform supports multithreading. - */ -struct thread_safe_counter -{ - typedef boost::detail::atomic_count type; - - static unsigned int load(boost::detail::atomic_count const& counter) BOOST_SP_NOEXCEPT - { - return static_cast< unsigned int >(static_cast< long >(counter)); - } - - static void increment(boost::detail::atomic_count& counter) BOOST_SP_NOEXCEPT - { - ++counter; - } - - static unsigned int decrement(boost::detail::atomic_count& counter) BOOST_SP_NOEXCEPT - { - return static_cast< unsigned int >(--counter); - } -}; - -template< typename DerivedT, typename CounterPolicyT = thread_safe_counter > -class intrusive_ref_counter; - -template< typename DerivedT, typename CounterPolicyT > -void intrusive_ptr_add_ref(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_SP_NOEXCEPT; -template< typename DerivedT, typename CounterPolicyT > -void intrusive_ptr_release(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_SP_NOEXCEPT; - -/*! - * \brief A reference counter base class - * - * This base class can be used with user-defined classes to add support - * for \c intrusive_ptr. The class contains a reference counter defined by the \c CounterPolicyT. - * Upon releasing the last \c intrusive_ptr referencing the object - * derived from the \c intrusive_ref_counter class, operator \c delete - * is automatically called on the pointer to the object. - * - * The other template parameter, \c DerivedT, is the user's class that derives from \c intrusive_ref_counter. - */ -template< typename DerivedT, typename CounterPolicyT > -class intrusive_ref_counter -{ -private: - //! Reference counter type - typedef typename CounterPolicyT::type counter_type; - //! Reference counter - mutable counter_type m_ref_counter; - -public: - /*! - * Default constructor - * - * \post use_count() == 0 - */ - intrusive_ref_counter() BOOST_SP_NOEXCEPT : m_ref_counter(0) - { - } - - /*! - * Copy constructor - * - * \post use_count() == 0 - */ - intrusive_ref_counter(intrusive_ref_counter const&) BOOST_SP_NOEXCEPT : m_ref_counter(0) - { - } - - /*! - * Assignment - * - * \post The reference counter is not modified after assignment - */ - intrusive_ref_counter& operator= (intrusive_ref_counter const&) BOOST_SP_NOEXCEPT { return *this; } - - /*! - * \return The reference counter - */ - unsigned int use_count() const BOOST_SP_NOEXCEPT - { - return CounterPolicyT::load(m_ref_counter); - } - -protected: - /*! - * Destructor - */ - BOOST_DEFAULTED_FUNCTION(~intrusive_ref_counter(), {}) - - friend void intrusive_ptr_add_ref< DerivedT, CounterPolicyT >(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_SP_NOEXCEPT; - friend void intrusive_ptr_release< DerivedT, CounterPolicyT >(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_SP_NOEXCEPT; -}; - -template< typename DerivedT, typename CounterPolicyT > -inline void intrusive_ptr_add_ref(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_SP_NOEXCEPT -{ - CounterPolicyT::increment(p->m_ref_counter); -} - -template< typename DerivedT, typename CounterPolicyT > -inline void intrusive_ptr_release(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_SP_NOEXCEPT -{ - if (CounterPolicyT::decrement(p->m_ref_counter) == 0) - delete static_cast< const DerivedT* >(p); -} - -} // namespace sp_adl_block - -using sp_adl_block::intrusive_ref_counter; -using sp_adl_block::thread_unsafe_counter; -using sp_adl_block::thread_safe_counter; - -} // namespace boost - -#if defined(_MSC_VER) -#pragma warning(pop) -#endif - -#endif // BOOST_SMART_PTR_INTRUSIVE_REF_COUNTER_HPP_INCLUDED_ diff --git a/contrib/restricted/boost/boost/smart_ptr/local_shared_ptr.hpp b/contrib/restricted/boost/boost/smart_ptr/local_shared_ptr.hpp deleted file mode 100644 index 1bf1fdf1743..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/local_shared_ptr.hpp +++ /dev/null @@ -1,684 +0,0 @@ -#ifndef BOOST_SMART_PTR_LOCAL_SHARED_PTR_HPP_INCLUDED -#define BOOST_SMART_PTR_LOCAL_SHARED_PTR_HPP_INCLUDED - -// local_shared_ptr.hpp -// -// Copyright 2017 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. - -#include - -namespace boost -{ - -template class local_shared_ptr; - -namespace detail -{ - -template< class E, class Y > inline void lsp_pointer_construct( boost::local_shared_ptr< E > * /*ppx*/, Y * p, boost::detail::local_counted_base * & pn ) -{ - boost::detail::sp_assert_convertible< Y, E >(); - - typedef boost::detail::local_sp_deleter< boost::checked_deleter > D; - - boost::shared_ptr p2( p, D() ); - - D * pd = static_cast< D * >( p2._internal_get_untyped_deleter() ); - - pd->pn_ = p2._internal_count(); - - pn = pd; -} - -template< class E, class Y > inline void lsp_pointer_construct( boost::local_shared_ptr< E[] > * /*ppx*/, Y * p, boost::detail::local_counted_base * & pn ) -{ - boost::detail::sp_assert_convertible< Y[], E[] >(); - - typedef boost::detail::local_sp_deleter< boost::checked_array_deleter > D; - - boost::shared_ptr p2( p, D() ); - - D * pd = static_cast< D * >( p2._internal_get_untyped_deleter() ); - - pd->pn_ = p2._internal_count(); - - pn = pd; -} - -template< class E, std::size_t N, class Y > inline void lsp_pointer_construct( boost::local_shared_ptr< E[N] > * /*ppx*/, Y * p, boost::detail::local_counted_base * & pn ) -{ - boost::detail::sp_assert_convertible< Y[N], E[N] >(); - - typedef boost::detail::local_sp_deleter< boost::checked_array_deleter > D; - - boost::shared_ptr p2( p, D() ); - - D * pd = static_cast< D * >( p2._internal_get_untyped_deleter() ); - - pd->pn_ = p2._internal_count(); - - pn = pd; -} - -template< class E, class P, class D > inline void lsp_deleter_construct( boost::local_shared_ptr< E > * /*ppx*/, P p, D const& d, boost::detail::local_counted_base * & pn ) -{ - typedef boost::detail::local_sp_deleter D2; - - boost::shared_ptr p2( p, D2( d ) ); - - D2 * pd = static_cast< D2 * >( p2._internal_get_untyped_deleter() ); - - pd->pn_ = p2._internal_count(); - - pn = pd; -} - -template< class E, class P, class D, class A > inline void lsp_allocator_construct( boost::local_shared_ptr< E > * /*ppx*/, P p, D const& d, A const& a, boost::detail::local_counted_base * & pn ) -{ - typedef boost::detail::local_sp_deleter D2; - - boost::shared_ptr p2( p, D2( d ), a ); - - D2 * pd = static_cast< D2 * >( p2._internal_get_untyped_deleter() ); - - pd->pn_ = p2._internal_count(); - - pn = pd; -} - -struct lsp_internal_constructor_tag -{ -}; - -} // namespace detail - -// -// local_shared_ptr -// -// as shared_ptr, but local to a thread. -// reference count manipulations are non-atomic. -// - -template class local_shared_ptr -{ -private: - - typedef local_shared_ptr this_type; - -public: - - typedef typename boost::detail::sp_element::type element_type; - -private: - - element_type * px; - boost::detail::local_counted_base * pn; - - template friend class local_shared_ptr; - -public: - - // destructor - - ~local_shared_ptr() BOOST_SP_NOEXCEPT - { - if( pn ) - { - pn->release(); - } - } - - // constructors - - BOOST_CONSTEXPR local_shared_ptr() BOOST_SP_NOEXCEPT : px( 0 ), pn( 0 ) - { - } - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - - BOOST_CONSTEXPR local_shared_ptr( boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT : px( 0 ), pn( 0 ) - { - } - -#endif - - // internal constructor, used by make_shared - BOOST_CONSTEXPR local_shared_ptr( boost::detail::lsp_internal_constructor_tag, element_type * px_, boost::detail::local_counted_base * pn_ ) BOOST_SP_NOEXCEPT : px( px_ ), pn( pn_ ) - { - } - - template - explicit local_shared_ptr( Y * p ): px( p ), pn( 0 ) - { - boost::detail::lsp_pointer_construct( this, p, pn ); - } - - template local_shared_ptr( Y * p, D d ): px( p ), pn( 0 ) - { - boost::detail::lsp_deleter_construct( this, p, d, pn ); - } - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - - template local_shared_ptr( boost::detail::sp_nullptr_t p, D d ): px( p ), pn( 0 ) - { - boost::detail::lsp_deleter_construct( this, p, d, pn ); - } - -#endif - - template local_shared_ptr( Y * p, D d, A a ): px( p ), pn( 0 ) - { - boost::detail::lsp_allocator_construct( this, p, d, a, pn ); - } - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - - template local_shared_ptr( boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( 0 ) - { - boost::detail::lsp_allocator_construct( this, p, d, a, pn ); - } - -#endif - - // construction from shared_ptr - - template local_shared_ptr( shared_ptr const & r, - typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) - : px( r.get() ), pn( 0 ) - { - boost::detail::sp_assert_convertible< Y, T >(); - - if( r.use_count() != 0 ) - { - pn = new boost::detail::local_counted_impl( r._internal_count() ); - } - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template local_shared_ptr( shared_ptr && r, - typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) - : px( r.get() ), pn( 0 ) - { - boost::detail::sp_assert_convertible< Y, T >(); - - if( r.use_count() != 0 ) - { - pn = new boost::detail::local_counted_impl( r._internal_count() ); - r.reset(); - } - } - -#endif - - // construction from unique_ptr - -#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template< class Y, class D > - local_shared_ptr( std::unique_ptr< Y, D > && r, - typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) - : px( r.get() ), pn( 0 ) - { - boost::detail::sp_assert_convertible< Y, T >(); - - if( px ) - { - pn = new boost::detail::local_counted_impl( shared_ptr( std::move(r) )._internal_count() ); - } - } - -#endif - - template< class Y, class D > - local_shared_ptr( boost::movelib::unique_ptr< Y, D > r ); // ! - // : px( r.get() ), pn( new boost::detail::local_counted_impl( shared_ptr( std::move(r) ) ) ) - //{ - // boost::detail::sp_assert_convertible< Y, T >(); - //} - - // copy constructor - - local_shared_ptr( local_shared_ptr const & r ) BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) - { - if( pn ) - { - pn->add_ref(); - } - } - - // move constructor - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - local_shared_ptr( local_shared_ptr && r ) BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) - { - r.px = 0; - r.pn = 0; - } - -#endif - - // converting copy constructor - - template local_shared_ptr( local_shared_ptr const & r, - typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) BOOST_SP_NOEXCEPT - : px( r.px ), pn( r.pn ) - { - boost::detail::sp_assert_convertible< Y, T >(); - - if( pn ) - { - pn->add_ref(); - } - } - - // converting move constructor - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template local_shared_ptr( local_shared_ptr && r, - typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) BOOST_SP_NOEXCEPT - : px( r.px ), pn( r.pn ) - { - boost::detail::sp_assert_convertible< Y, T >(); - - r.px = 0; - r.pn = 0; - } - -#endif - - // aliasing - - template - local_shared_ptr( local_shared_ptr const & r, element_type * p ) BOOST_SP_NOEXCEPT : px( p ), pn( r.pn ) - { - if( pn ) - { - pn->add_ref(); - } - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template - local_shared_ptr( local_shared_ptr && r, element_type * p ) BOOST_SP_NOEXCEPT : px( p ), pn( r.pn ) - { - r.px = 0; - r.pn = 0; - } - -#endif - - // assignment - - local_shared_ptr & operator=( local_shared_ptr const & r ) BOOST_SP_NOEXCEPT - { - local_shared_ptr( r ).swap( *this ); - return *this; - } - - template local_shared_ptr & operator=( local_shared_ptr const & r ) BOOST_SP_NOEXCEPT - { - local_shared_ptr( r ).swap( *this ); - return *this; - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - local_shared_ptr & operator=( local_shared_ptr && r ) BOOST_SP_NOEXCEPT - { - local_shared_ptr( std::move( r ) ).swap( *this ); - return *this; - } - - template - local_shared_ptr & operator=( local_shared_ptr && r ) BOOST_SP_NOEXCEPT - { - local_shared_ptr( std::move( r ) ).swap( *this ); - return *this; - } - -#endif - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - - local_shared_ptr & operator=( boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT - { - local_shared_ptr().swap(*this); - return *this; - } - -#endif - -#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template - local_shared_ptr & operator=( std::unique_ptr && r ) - { - local_shared_ptr( std::move(r) ).swap( *this ); - return *this; - } - -#endif - - template - local_shared_ptr & operator=( boost::movelib::unique_ptr r ); // ! - - // reset - - void reset() BOOST_SP_NOEXCEPT - { - local_shared_ptr().swap( *this ); - } - - template void reset( Y * p ) // Y must be complete - { - local_shared_ptr( p ).swap( *this ); - } - - template void reset( Y * p, D d ) - { - local_shared_ptr( p, d ).swap( *this ); - } - - template void reset( Y * p, D d, A a ) - { - local_shared_ptr( p, d, a ).swap( *this ); - } - - template void reset( local_shared_ptr const & r, element_type * p ) BOOST_SP_NOEXCEPT - { - local_shared_ptr( r, p ).swap( *this ); - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template void reset( local_shared_ptr && r, element_type * p ) BOOST_SP_NOEXCEPT - { - local_shared_ptr( std::move( r ), p ).swap( *this ); - } - -#endif - - // accessors - - typename boost::detail::sp_dereference< T >::type operator* () const BOOST_SP_NOEXCEPT - { - return *px; - } - - typename boost::detail::sp_member_access< T >::type operator-> () const BOOST_SP_NOEXCEPT - { - return px; - } - - typename boost::detail::sp_array_access< T >::type operator[] ( std::ptrdiff_t i ) const BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT( px != 0 ); - BOOST_ASSERT( i >= 0 && ( i < boost::detail::sp_extent< T >::value || boost::detail::sp_extent< T >::value == 0 ) ); - - return static_cast< typename boost::detail::sp_array_access< T >::type >( px[ i ] ); - } - - element_type * get() const BOOST_SP_NOEXCEPT - { - return px; - } - - // implicit conversion to "bool" -#include - - long local_use_count() const BOOST_SP_NOEXCEPT - { - return pn? pn->local_use_count(): 0; - } - - // conversions to shared_ptr, weak_ptr - -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) - template::type> operator shared_ptr() const BOOST_SP_NOEXCEPT -#else - template operator shared_ptr() const BOOST_SP_NOEXCEPT -#endif - { - boost::detail::sp_assert_convertible(); - - if( pn ) - { - return shared_ptr( boost::detail::sp_internal_constructor_tag(), px, pn->local_cb_get_shared_count() ); - } - else - { - return shared_ptr(); - } - } - -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) - template::type> operator weak_ptr() const BOOST_SP_NOEXCEPT -#else - template operator weak_ptr() const BOOST_SP_NOEXCEPT -#endif - { - boost::detail::sp_assert_convertible(); - - if( pn ) - { - return shared_ptr( boost::detail::sp_internal_constructor_tag(), px, pn->local_cb_get_shared_count() ); - } - else - { - return weak_ptr(); - } - } - - // swap - - void swap( local_shared_ptr & r ) BOOST_SP_NOEXCEPT - { - std::swap( px, r.px ); - std::swap( pn, r.pn ); - } - - // owner_before - - template bool owner_before( local_shared_ptr const & r ) const BOOST_SP_NOEXCEPT - { - return std::less< boost::detail::local_counted_base* >()( pn, r.pn ); - } -}; - -template inline bool operator==( local_shared_ptr const & a, local_shared_ptr const & b ) BOOST_SP_NOEXCEPT -{ - return a.get() == b.get(); -} - -template inline bool operator!=( local_shared_ptr const & a, local_shared_ptr const & b ) BOOST_SP_NOEXCEPT -{ - return a.get() != b.get(); -} - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - -template inline bool operator==( local_shared_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator==( boost::detail::sp_nullptr_t, local_shared_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator!=( local_shared_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT -{ - return p.get() != 0; -} - -template inline bool operator!=( boost::detail::sp_nullptr_t, local_shared_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return p.get() != 0; -} - -#endif - -template inline bool operator==( local_shared_ptr const & a, shared_ptr const & b ) BOOST_SP_NOEXCEPT -{ - return a.get() == b.get(); -} - -template inline bool operator!=( local_shared_ptr const & a, shared_ptr const & b ) BOOST_SP_NOEXCEPT -{ - return a.get() != b.get(); -} - -template inline bool operator==( shared_ptr const & a, local_shared_ptr const & b ) BOOST_SP_NOEXCEPT -{ - return a.get() == b.get(); -} - -template inline bool operator!=( shared_ptr const & a, local_shared_ptr const & b ) BOOST_SP_NOEXCEPT -{ - return a.get() != b.get(); -} - -template inline bool operator<(local_shared_ptr const & a, local_shared_ptr const & b) BOOST_SP_NOEXCEPT -{ - return a.owner_before( b ); -} - -template inline void swap( local_shared_ptr & a, local_shared_ptr & b ) BOOST_SP_NOEXCEPT -{ - a.swap( b ); -} - -template local_shared_ptr static_pointer_cast( local_shared_ptr const & r ) BOOST_SP_NOEXCEPT -{ - (void) static_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename local_shared_ptr::element_type E; - - E * p = static_cast< E* >( r.get() ); - return local_shared_ptr( r, p ); -} - -template local_shared_ptr const_pointer_cast( local_shared_ptr const & r ) BOOST_SP_NOEXCEPT -{ - (void) const_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename local_shared_ptr::element_type E; - - E * p = const_cast< E* >( r.get() ); - return local_shared_ptr( r, p ); -} - -template local_shared_ptr dynamic_pointer_cast( local_shared_ptr const & r ) BOOST_SP_NOEXCEPT -{ - (void) dynamic_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename local_shared_ptr::element_type E; - - E * p = dynamic_cast< E* >( r.get() ); - return p? local_shared_ptr( r, p ): local_shared_ptr(); -} - -template local_shared_ptr reinterpret_pointer_cast( local_shared_ptr const & r ) BOOST_SP_NOEXCEPT -{ - (void) reinterpret_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename local_shared_ptr::element_type E; - - E * p = reinterpret_cast< E* >( r.get() ); - return local_shared_ptr( r, p ); -} - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -template local_shared_ptr static_pointer_cast( local_shared_ptr && r ) BOOST_SP_NOEXCEPT -{ - (void) static_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename local_shared_ptr::element_type E; - - E * p = static_cast< E* >( r.get() ); - return local_shared_ptr( std::move(r), p ); -} - -template local_shared_ptr const_pointer_cast( local_shared_ptr && r ) BOOST_SP_NOEXCEPT -{ - (void) const_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename local_shared_ptr::element_type E; - - E * p = const_cast< E* >( r.get() ); - return local_shared_ptr( std::move(r), p ); -} - -template local_shared_ptr dynamic_pointer_cast( local_shared_ptr && r ) BOOST_SP_NOEXCEPT -{ - (void) dynamic_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename local_shared_ptr::element_type E; - - E * p = dynamic_cast< E* >( r.get() ); - return p? local_shared_ptr( std::move(r), p ): local_shared_ptr(); -} - -template local_shared_ptr reinterpret_pointer_cast( local_shared_ptr && r ) BOOST_SP_NOEXCEPT -{ - (void) reinterpret_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename local_shared_ptr::element_type E; - - E * p = reinterpret_cast< E* >( r.get() ); - return local_shared_ptr( std::move(r), p ); -} - -#endif // !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -// get_pointer() enables boost::mem_fn to recognize local_shared_ptr - -template inline typename local_shared_ptr::element_type * get_pointer( local_shared_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return p.get(); -} - -// operator<< - -#if !defined(BOOST_NO_IOSTREAM) - -template std::basic_ostream & operator<< ( std::basic_ostream & os, local_shared_ptr const & p ) -{ - os << p.get(); - return os; -} - -#endif // !defined(BOOST_NO_IOSTREAM) - -// get_deleter - -template D * get_deleter( local_shared_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return get_deleter( shared_ptr( p ) ); -} - -// hash_value - -template< class T > struct hash; - -template< class T > std::size_t hash_value( local_shared_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return boost::hash< typename local_shared_ptr::element_type* >()( p.get() ); -} - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_LOCAL_SHARED_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/make_local_shared.hpp b/contrib/restricted/boost/boost/smart_ptr/make_local_shared.hpp deleted file mode 100644 index 23114fea268..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/make_local_shared.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef BOOST_SMART_PTR_MAKE_LOCAL_SHARED_HPP_INCLUDED -#define BOOST_SMART_PTR_MAKE_LOCAL_SHARED_HPP_INCLUDED - -// make_local_shared.hpp -// -// Copyright 2017 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. - -#include -#include - -#endif // #ifndef BOOST_SMART_PTR_MAKE_LOCAL_SHARED_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/make_local_shared_array.hpp b/contrib/restricted/boost/boost/smart_ptr/make_local_shared_array.hpp deleted file mode 100644 index 663f83479bf..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/make_local_shared_array.hpp +++ /dev/null @@ -1,67 +0,0 @@ -/* -Copyright 2017 Peter Dimov -Copyright 2017 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_SMART_PTR_MAKE_LOCAL_SHARED_ARRAY_HPP -#define BOOST_SMART_PTR_MAKE_LOCAL_SHARED_ARRAY_HPP - -#include - -namespace boost { - -template -inline typename detail::lsp_if_size_array::type -make_local_shared() -{ - return boost::allocate_local_shared(std::allocator::type>()); -} - -template -inline typename detail::lsp_if_size_array::type -make_local_shared(const typename detail::sp_array_element::type& value) -{ - return boost::allocate_local_shared(std::allocator::type>(), value); -} - -template -inline typename detail::lsp_if_array::type -make_local_shared(std::size_t size) -{ - return boost::allocate_local_shared(std::allocator::type>(), size); -} - -template -inline typename detail::lsp_if_array::type -make_local_shared(std::size_t size, - const typename detail::sp_array_element::type& value) -{ - return boost::allocate_local_shared(std::allocator::type>(), size, value); -} - -template -inline typename detail::lsp_if_size_array::type -make_local_shared_noinit() -{ - return allocate_local_shared_noinit(std::allocator::type>()); -} - -template -inline typename detail::lsp_if_array::type -make_local_shared_noinit(std::size_t size) -{ - return allocate_local_shared_noinit(std::allocator::type>(), size); -} - -} /* boost */ - -#endif diff --git a/contrib/restricted/boost/boost/smart_ptr/make_local_shared_object.hpp b/contrib/restricted/boost/boost/smart_ptr/make_local_shared_object.hpp deleted file mode 100644 index ab83d60e612..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/make_local_shared_object.hpp +++ /dev/null @@ -1,199 +0,0 @@ -#ifndef BOOST_SMART_PTR_MAKE_LOCAL_SHARED_OBJECT_HPP_INCLUDED -#define BOOST_SMART_PTR_MAKE_LOCAL_SHARED_OBJECT_HPP_INCLUDED - -// make_local_shared_object.hpp -// -// Copyright 2017 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. - -#include -#include -#include -#include -#include - -namespace boost -{ - -namespace detail -{ - -// lsp_if_not_array - -template struct lsp_if_not_array -{ - typedef boost::local_shared_ptr type; -}; - -template struct lsp_if_not_array -{ -}; - -template struct lsp_if_not_array -{ -}; - -// lsp_ms_deleter - -template class lsp_ms_deleter: public local_counted_impl_em -{ -private: - - typedef typename sp_aligned_storage::value>::type storage_type; - - storage_type storage_; - A a_; - bool initialized_; - -private: - - void destroy() BOOST_SP_NOEXCEPT - { - if( initialized_ ) - { - T * p = reinterpret_cast< T* >( storage_.data_ ); - -#if !defined( BOOST_NO_CXX11_ALLOCATOR ) - - std::allocator_traits::destroy( a_, p ); - -#else - - p->~T(); - -#endif - - initialized_ = false; - } - } - -public: - - explicit lsp_ms_deleter( A const & a ) BOOST_SP_NOEXCEPT : a_( a ), initialized_( false ) - { - } - - // optimization: do not copy storage_ - lsp_ms_deleter( lsp_ms_deleter const & r ) BOOST_SP_NOEXCEPT : a_( r.a_), initialized_( false ) - { - } - - ~lsp_ms_deleter() BOOST_SP_NOEXCEPT - { - destroy(); - } - - void operator()( T * ) BOOST_SP_NOEXCEPT - { - destroy(); - } - - static void operator_fn( T* ) BOOST_SP_NOEXCEPT // operator() can't be static - { - } - - void * address() BOOST_SP_NOEXCEPT - { - return storage_.data_; - } - - void set_initialized() BOOST_SP_NOEXCEPT - { - initialized_ = true; - } -}; - -} // namespace detail - -template typename boost::detail::lsp_if_not_array::type allocate_local_shared( A const & a, Args&&... args ) -{ -#if !defined( BOOST_NO_CXX11_ALLOCATOR ) - - typedef typename std::allocator_traits::template rebind_alloc A2; - -#else - - typedef typename A::template rebind::other A2; - -#endif - - A2 a2( a ); - - typedef boost::detail::lsp_ms_deleter D; - - boost::shared_ptr pt( static_cast< T* >( 0 ), boost::detail::sp_inplace_tag(), a2 ); - - D * pd = static_cast< D* >( pt._internal_get_untyped_deleter() ); - void * pv = pd->address(); - -#if !defined( BOOST_NO_CXX11_ALLOCATOR ) - - std::allocator_traits::construct( a2, static_cast< T* >( pv ), std::forward( args )... ); - -#else - - ::new( pv ) T( std::forward( args )... ); - -#endif - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - - pd->pn_ = pt._internal_count(); - - return boost::local_shared_ptr( boost::detail::lsp_internal_constructor_tag(), pt2, pd ); -} - -template typename boost::detail::lsp_if_not_array::type allocate_local_shared_noinit( A const & a ) -{ -#if !defined( BOOST_NO_CXX11_ALLOCATOR ) - - typedef typename std::allocator_traits::template rebind_alloc A2; - -#else - - typedef typename A::template rebind::other A2; - -#endif - - A2 a2( a ); - - typedef boost::detail::lsp_ms_deleter< T, std::allocator > D; - - boost::shared_ptr pt( static_cast< T* >( 0 ), boost::detail::sp_inplace_tag(), a2 ); - - D * pd = static_cast< D* >( pt._internal_get_untyped_deleter() ); - void * pv = pd->address(); - - ::new( pv ) T; - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - - pd->pn_ = pt._internal_count(); - - return boost::local_shared_ptr( boost::detail::lsp_internal_constructor_tag(), pt2, pd ); -} - -template typename boost::detail::lsp_if_not_array::type make_local_shared( Args&&... args ) -{ - return boost::allocate_local_shared( std::allocator(), std::forward(args)... ); -} - -template typename boost::detail::lsp_if_not_array::type make_local_shared_noinit() -{ - return boost::allocate_shared_noinit( std::allocator() ); -} - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_MAKE_SHARED_OBJECT_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/make_shared.hpp b/contrib/restricted/boost/boost/smart_ptr/make_shared.hpp deleted file mode 100644 index dd9191c61d3..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/make_shared.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef BOOST_SMART_PTR_MAKE_SHARED_HPP_INCLUDED -#define BOOST_SMART_PTR_MAKE_SHARED_HPP_INCLUDED - -// make_shared.hpp -// -// Copyright (c) 2007, 2008, 2012 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. - -#include - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( BOOST_NO_SFINAE ) -# include -# include -#endif - -#endif // #ifndef BOOST_SMART_PTR_MAKE_SHARED_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/make_shared_array.hpp b/contrib/restricted/boost/boost/smart_ptr/make_shared_array.hpp deleted file mode 100644 index 2eaf4db71b8..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/make_shared_array.hpp +++ /dev/null @@ -1,66 +0,0 @@ -/* -Copyright 2012-2017 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_SMART_PTR_MAKE_SHARED_ARRAY_HPP -#define BOOST_SMART_PTR_MAKE_SHARED_ARRAY_HPP - -#include - -namespace boost { - -template -inline typename detail::sp_if_size_array::type -make_shared() -{ - return boost::allocate_shared(std::allocator::type>()); -} - -template -inline typename detail::sp_if_size_array::type -make_shared(const typename detail::sp_array_element::type& value) -{ - return boost::allocate_shared(std::allocator::type>(), value); -} - -template -inline typename detail::sp_if_array::type -make_shared(std::size_t size) -{ - return boost::allocate_shared(std::allocator::type>(), size); -} - -template -inline typename detail::sp_if_array::type -make_shared(std::size_t size, - const typename detail::sp_array_element::type& value) -{ - return boost::allocate_shared(std::allocator::type>(), size, value); -} - -template -inline typename detail::sp_if_size_array::type -make_shared_noinit() -{ - return allocate_shared_noinit(std::allocator::type>()); -} - -template -inline typename detail::sp_if_array::type -make_shared_noinit(std::size_t size) -{ - return allocate_shared_noinit(std::allocator::type>(), size); -} - -} /* boost */ - -#endif diff --git a/contrib/restricted/boost/boost/smart_ptr/make_shared_object.hpp b/contrib/restricted/boost/boost/smart_ptr/make_shared_object.hpp deleted file mode 100644 index c681602dca2..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/make_shared_object.hpp +++ /dev/null @@ -1,801 +0,0 @@ -#ifndef BOOST_SMART_PTR_MAKE_SHARED_OBJECT_HPP_INCLUDED -#define BOOST_SMART_PTR_MAKE_SHARED_OBJECT_HPP_INCLUDED - -// make_shared_object.hpp -// -// Copyright (c) 2007, 2008, 2012 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace boost -{ - -namespace detail -{ - -template< std::size_t N, std::size_t A > struct sp_aligned_storage -{ - union type - { - char data_[ N ]; - typename boost::type_with_alignment< A >::type align_; - }; -}; - -template< class T > class sp_ms_deleter -{ -private: - - typedef typename sp_aligned_storage< sizeof( T ), ::boost::alignment_of< T >::value >::type storage_type; - - bool initialized_; - storage_type storage_; - -private: - - void destroy() BOOST_SP_NOEXCEPT - { - if( initialized_ ) - { -#if defined( __GNUC__ ) - - // fixes incorrect aliasing warning - T * p = reinterpret_cast< T* >( storage_.data_ ); - p->~T(); - -#else - - reinterpret_cast< T* >( storage_.data_ )->~T(); - -#endif - - initialized_ = false; - } - } - -public: - - sp_ms_deleter() BOOST_SP_NOEXCEPT : initialized_( false ) - { - } - - template explicit sp_ms_deleter( A const & ) BOOST_SP_NOEXCEPT : initialized_( false ) - { - } - - // optimization: do not copy storage_ - sp_ms_deleter( sp_ms_deleter const & ) BOOST_SP_NOEXCEPT : initialized_( false ) - { - } - - ~sp_ms_deleter() BOOST_SP_NOEXCEPT - { - destroy(); - } - - void operator()( T * ) BOOST_SP_NOEXCEPT - { - destroy(); - } - - static void operator_fn( T* ) BOOST_SP_NOEXCEPT // operator() can't be static - { - } - - void * address() BOOST_SP_NOEXCEPT - { - return storage_.data_; - } - - void set_initialized() BOOST_SP_NOEXCEPT - { - initialized_ = true; - } -}; - -template< class T, class A > class sp_as_deleter -{ -private: - - typedef typename sp_aligned_storage< sizeof( T ), ::boost::alignment_of< T >::value >::type storage_type; - - storage_type storage_; - A a_; - bool initialized_; - -private: - - void destroy() BOOST_SP_NOEXCEPT - { - if( initialized_ ) - { - T * p = reinterpret_cast< T* >( storage_.data_ ); - -#if !defined( BOOST_NO_CXX11_ALLOCATOR ) - - std::allocator_traits::destroy( a_, p ); - -#else - - p->~T(); - -#endif - - initialized_ = false; - } - } - -public: - - sp_as_deleter( A const & a ) BOOST_SP_NOEXCEPT : a_( a ), initialized_( false ) - { - } - - // optimization: do not copy storage_ - sp_as_deleter( sp_as_deleter const & r ) BOOST_SP_NOEXCEPT : a_( r.a_), initialized_( false ) - { - } - - ~sp_as_deleter() BOOST_SP_NOEXCEPT - { - destroy(); - } - - void operator()( T * ) BOOST_SP_NOEXCEPT - { - destroy(); - } - - static void operator_fn( T* ) BOOST_SP_NOEXCEPT // operator() can't be static - { - } - - void * address() BOOST_SP_NOEXCEPT - { - return storage_.data_; - } - - void set_initialized() BOOST_SP_NOEXCEPT - { - initialized_ = true; - } -}; - -template< class T > struct sp_if_not_array -{ - typedef boost::shared_ptr< T > type; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T > struct sp_if_not_array< T[] > -{ -}; - -#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) - -template< class T, std::size_t N > struct sp_if_not_array< T[N] > -{ -}; - -#endif - -#endif - -} // namespace detail - -#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) -# define BOOST_SP_MSD( T ) boost::detail::sp_inplace_tag< boost::detail::sp_ms_deleter< T > >() -#else -# define BOOST_SP_MSD( T ) boost::detail::sp_ms_deleter< T >() -#endif - -// _noinit versions - -template< class T > typename boost::detail::sp_if_not_array< T >::type make_shared_noinit() -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T; - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A > typename boost::detail::sp_if_not_array< T >::type allocate_shared_noinit( A const & a ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T; - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -#if !defined( BOOST_NO_CXX11_VARIADIC_TEMPLATES ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -// Variadic templates, rvalue reference - -template< class T, class... Args > typename boost::detail::sp_if_not_array< T >::type make_shared( Args && ... args ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( boost::detail::sp_forward( args )... ); - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A, class... Args > typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, Args && ... args ) -{ -#if !defined( BOOST_NO_CXX11_ALLOCATOR ) - - typedef typename std::allocator_traits::template rebind_alloc A2; - A2 a2( a ); - - typedef boost::detail::sp_as_deleter< T, A2 > D; - - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_inplace_tag(), a2 ); - -#else - - typedef boost::detail::sp_ms_deleter< T > D; - - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_inplace_tag(), a ); - -#endif - - D * pd = static_cast< D* >( pt._internal_get_untyped_deleter() ); - void * pv = pd->address(); - -#if !defined( BOOST_NO_CXX11_ALLOCATOR ) - - std::allocator_traits::construct( a2, static_cast< T* >( pv ), boost::detail::sp_forward( args )... ); - -#else - - ::new( pv ) T( boost::detail::sp_forward( args )... ); - -#endif - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -#else // !defined( BOOST_NO_CXX11_VARIADIC_TEMPLATES ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -// Common zero-argument versions - -template< class T > typename boost::detail::sp_if_not_array< T >::type make_shared() -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T(); - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A > typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T(); - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -// C++03 version - -template< class T, class A1 > -typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A, class A1 > -typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A1, class A2 > -typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A, class A1, class A2 > -typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A1, class A2, class A3 > -typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A, class A1, class A2, class A3 > -typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A1, class A2, class A3, class A4 > -typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A, class A1, class A2, class A3, class A4 > -typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A1, class A2, class A3, class A4, class A5 > -typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ), - boost::forward( a5 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A, class A1, class A2, class A3, class A4, class A5 > -typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ), - boost::forward( a5 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A1, class A2, class A3, class A4, class A5, class A6 > -typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ), - boost::forward( a5 ), - boost::forward( a6 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6 > -typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ), - boost::forward( a5 ), - boost::forward( a6 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > -typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ), - boost::forward( a5 ), - boost::forward( a6 ), - boost::forward( a7 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > -typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ), - boost::forward( a5 ), - boost::forward( a6 ), - boost::forward( a7 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > -typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7, BOOST_FWD_REF(A8) a8 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ), - boost::forward( a5 ), - boost::forward( a6 ), - boost::forward( a7 ), - boost::forward( a8 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > -typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7, BOOST_FWD_REF(A8) a8 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ), - boost::forward( a5 ), - boost::forward( a6 ), - boost::forward( a7 ), - boost::forward( a8 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > -typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7, BOOST_FWD_REF(A8) a8, BOOST_FWD_REF(A9) a9 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ), - boost::forward( a5 ), - boost::forward( a6 ), - boost::forward( a7 ), - boost::forward( a8 ), - boost::forward( a9 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > -typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7, BOOST_FWD_REF(A8) a8, BOOST_FWD_REF(A9) a9 ) -{ - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); - - boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); - - void * pv = pd->address(); - - ::new( pv ) T( - boost::forward( a1 ), - boost::forward( a2 ), - boost::forward( a3 ), - boost::forward( a4 ), - boost::forward( a5 ), - boost::forward( a6 ), - boost::forward( a7 ), - boost::forward( a8 ), - boost::forward( a9 ) - ); - - pd->set_initialized(); - - T * pt2 = static_cast< T* >( pv ); - - boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); - return boost::shared_ptr< T >( pt, pt2 ); -} - -#endif // !defined( BOOST_NO_CXX11_VARIADIC_TEMPLATES ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -#undef BOOST_SP_MSD - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_MAKE_SHARED_OBJECT_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/make_unique.hpp b/contrib/restricted/boost/boost/smart_ptr/make_unique.hpp deleted file mode 100644 index eed503392b8..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/make_unique.hpp +++ /dev/null @@ -1,110 +0,0 @@ -/* -Copyright 2012-2015 Glen Joseph Fernandes -(glenjofe@gmail.com) - -Distributed under the Boost Software License, Version 1.0. -(http://www.boost.org/LICENSE_1_0.txt) -*/ -#ifndef BOOST_SMART_PTR_MAKE_UNIQUE_HPP -#define BOOST_SMART_PTR_MAKE_UNIQUE_HPP - -#include -#include -#include - -namespace boost { -namespace detail { - -template -struct up_if_object { - typedef std::unique_ptr type; -}; - -template -struct up_if_object { }; - -template -struct up_if_object { }; - -template -struct up_if_array { }; - -template -struct up_if_array { - typedef std::unique_ptr type; -}; - -template -struct up_remove_reference { - typedef T type; -}; - -template -struct up_remove_reference { - typedef T type; -}; - -template -struct up_remove_reference { - typedef T type; -}; - -template -struct up_element { }; - -template -struct up_element { - typedef T type; -}; - -} /* detail */ - -template -inline typename detail::up_if_object::type -make_unique() -{ - return std::unique_ptr(new T()); -} - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) -template -inline typename detail::up_if_object::type -make_unique(Args&&... args) -{ - return std::unique_ptr(new T(std::forward(args)...)); -} -#endif - -template -inline typename detail::up_if_object::type -make_unique(typename detail::up_remove_reference::type&& value) -{ - return std::unique_ptr(new T(std::move(value))); -} - -template -inline typename detail::up_if_object::type -make_unique_noinit() -{ - return std::unique_ptr(new T); -} - -template -inline typename detail::up_if_array::type -make_unique(std::size_t size) -{ - return std::unique_ptr(new typename - detail::up_element::type[size]()); -} - -template -inline typename detail::up_if_array::type -make_unique_noinit(std::size_t size) -{ - return std::unique_ptr(new typename - detail::up_element::type[size]); -} - -} /* boost */ - -#endif diff --git a/contrib/restricted/boost/boost/smart_ptr/owner_less.hpp b/contrib/restricted/boost/boost/smart_ptr/owner_less.hpp deleted file mode 100644 index 5f50aeb5b84..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/owner_less.hpp +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef BOOST_SMART_PTR_OWNER_LESS_HPP_INCLUDED -#define BOOST_SMART_PTR_OWNER_LESS_HPP_INCLUDED - -// -// owner_less.hpp -// -// Copyright (c) 2008 Frank Mori Hess -// Copyright (c) 2016 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. -// - -namespace boost -{ - -template struct owner_less -{ - typedef bool result_type; - typedef T first_argument_type; - typedef T second_argument_type; - - template bool operator()( U const & u, V const & v ) const - { - return u.owner_before( v ); - } -}; - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_OWNER_LESS_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/scoped_array.hpp b/contrib/restricted/boost/boost/smart_ptr/scoped_array.hpp deleted file mode 100644 index 05dd05aea8d..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/scoped_array.hpp +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED -#define BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED - -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001, 2002 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. - -#include -#include -#include -#include -#include - -#include - -#include // for std::ptrdiff_t - -namespace boost -{ - -// Debug hooks - -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - -void sp_array_constructor_hook(void * p); -void sp_array_destructor_hook(void * p); - -#endif - -// scoped_array extends scoped_ptr to arrays. Deletion of the array pointed to -// is guaranteed, either on destruction of the scoped_array or via an explicit -// reset(). Use shared_array or std::vector if your needs are more complex. - -template class scoped_array // noncopyable -{ -private: - - T * px; - - scoped_array(scoped_array const &); - scoped_array & operator=(scoped_array const &); - - typedef scoped_array this_type; - - void operator==( scoped_array const& ) const; - void operator!=( scoped_array const& ) const; - -public: - - typedef T element_type; - - explicit scoped_array( T * p = 0 ) BOOST_SP_NOEXCEPT : px( p ) - { -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - boost::sp_array_constructor_hook( px ); -#endif - } - - ~scoped_array() BOOST_SP_NOEXCEPT - { -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - boost::sp_array_destructor_hook( px ); -#endif - boost::checked_array_delete( px ); - } - - void reset(T * p = 0) BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors - this_type(p).swap(*this); - } - - T & operator[](std::ptrdiff_t i) const BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT( px != 0 ); - BOOST_ASSERT( i >= 0 ); - return px[i]; - } - - T * get() const BOOST_SP_NOEXCEPT - { - return px; - } - -// implicit conversion to "bool" -#include - - void swap(scoped_array & b) BOOST_SP_NOEXCEPT - { - T * tmp = b.px; - b.px = px; - px = tmp; - } -}; - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - -template inline bool operator==( scoped_array const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator==( boost::detail::sp_nullptr_t, scoped_array const & p ) BOOST_SP_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator!=( scoped_array const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT -{ - return p.get() != 0; -} - -template inline bool operator!=( boost::detail::sp_nullptr_t, scoped_array const & p ) BOOST_SP_NOEXCEPT -{ - return p.get() != 0; -} - -#endif - -template inline void swap(scoped_array & a, scoped_array & b) BOOST_SP_NOEXCEPT -{ - a.swap(b); -} - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/scoped_ptr.hpp b/contrib/restricted/boost/boost/smart_ptr/scoped_ptr.hpp deleted file mode 100644 index 5325eba5ffe..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/scoped_ptr.hpp +++ /dev/null @@ -1,167 +0,0 @@ -#ifndef BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED -#define BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED - -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001, 2002 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. - -#include -#include -#include -#include -#include -#include -#include - -#ifndef BOOST_NO_AUTO_PTR -# include // for std::auto_ptr -#endif - -#if defined( BOOST_SP_DISABLE_DEPRECATED ) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - -namespace boost -{ - -// Debug hooks - -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - -void sp_scalar_constructor_hook(void * p); -void sp_scalar_destructor_hook(void * p); - -#endif - -// scoped_ptr mimics a built-in pointer except that it guarantees deletion -// of the object pointed to, either on destruction of the scoped_ptr or via -// an explicit reset(). scoped_ptr is a simple solution for simple needs; -// use shared_ptr or std::auto_ptr if your needs are more complex. - -template class scoped_ptr // noncopyable -{ -private: - - T * px; - - scoped_ptr(scoped_ptr const &); - scoped_ptr & operator=(scoped_ptr const &); - - typedef scoped_ptr this_type; - - void operator==( scoped_ptr const& ) const; - void operator!=( scoped_ptr const& ) const; - -public: - - typedef T element_type; - - explicit scoped_ptr( T * p = 0 ) BOOST_SP_NOEXCEPT : px( p ) - { -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - boost::sp_scalar_constructor_hook( px ); -#endif - } - -#ifndef BOOST_NO_AUTO_PTR - - explicit scoped_ptr( std::auto_ptr p ) BOOST_SP_NOEXCEPT : px( p.release() ) - { -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - boost::sp_scalar_constructor_hook( px ); -#endif - } - -#endif - - ~scoped_ptr() BOOST_SP_NOEXCEPT - { -#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) - boost::sp_scalar_destructor_hook( px ); -#endif - boost::checked_delete( px ); - } - - void reset(T * p = 0) BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors - this_type(p).swap(*this); - } - - T & operator*() const BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT( px != 0 ); - return *px; - } - - T * operator->() const BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT( px != 0 ); - return px; - } - - T * get() const BOOST_SP_NOEXCEPT - { - return px; - } - -// implicit conversion to "bool" -#include - - void swap(scoped_ptr & b) BOOST_SP_NOEXCEPT - { - T * tmp = b.px; - b.px = px; - px = tmp; - } -}; - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - -template inline bool operator==( scoped_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator==( boost::detail::sp_nullptr_t, scoped_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator!=( scoped_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT -{ - return p.get() != 0; -} - -template inline bool operator!=( boost::detail::sp_nullptr_t, scoped_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return p.get() != 0; -} - -#endif - -template inline void swap(scoped_ptr & a, scoped_ptr & b) BOOST_SP_NOEXCEPT -{ - a.swap(b); -} - -// get_pointer(p) is a generic way to say p.get() - -template inline T * get_pointer(scoped_ptr const & p) BOOST_SP_NOEXCEPT -{ - return p.get(); -} - -} // namespace boost - -#if defined( BOOST_SP_DISABLE_DEPRECATED ) -#pragma GCC diagnostic pop -#endif - -#endif // #ifndef BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/shared_array.hpp b/contrib/restricted/boost/boost/smart_ptr/shared_array.hpp deleted file mode 100644 index 3ffa7426c30..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/shared_array.hpp +++ /dev/null @@ -1,293 +0,0 @@ -#ifndef BOOST_SMART_PTR_SHARED_ARRAY_HPP_INCLUDED -#define BOOST_SMART_PTR_SHARED_ARRAY_HPP_INCLUDED - -// -// shared_array.hpp -// -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001, 2002, 2012 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. -// - -#include // for broken compiler workarounds - -#include // TR1 cyclic inclusion fix - -#include -#include - -#include -#include -#include -#include -#include - -#include // for std::ptrdiff_t -#include // for std::swap -#include // for std::less - -namespace boost -{ - -// -// shared_array -// -// shared_array extends shared_ptr to arrays. -// The array pointed to is deleted when the last shared_array pointing to it -// is destroyed or reset. -// - -template class shared_array -{ -private: - - // Borland 5.5.1 specific workarounds - typedef checked_array_deleter deleter; - typedef shared_array this_type; - -public: - - typedef T element_type; - - shared_array() BOOST_SP_NOEXCEPT : px( 0 ), pn() - { - } - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - - shared_array( boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT : px( 0 ), pn() - { - } - -#endif - - template - explicit shared_array( Y * p ): px( p ), pn( p, checked_array_deleter() ) - { - boost::detail::sp_assert_convertible< Y[], T[] >(); - } - - // - // Requirements: D's copy constructor must not throw - // - // shared_array will release p by calling d(p) - // - - template shared_array( Y * p, D d ): px( p ), pn( p, d ) - { - boost::detail::sp_assert_convertible< Y[], T[] >(); - } - - // As above, but with allocator. A's copy constructor shall not throw. - - template shared_array( Y * p, D d, A a ): px( p ), pn( p, d, a ) - { - boost::detail::sp_assert_convertible< Y[], T[] >(); - } - -// generated copy constructor, destructor are fine... - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -// ... except in C++0x, move disables the implicit copy - - shared_array( shared_array const & r ) BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) - { - } - - shared_array( shared_array && r ) BOOST_SP_NOEXCEPT : px( r.px ), pn() - { - pn.swap( r.pn ); - r.px = 0; - } - -#endif - - // conversion - - template -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - - shared_array( shared_array const & r, typename boost::detail::sp_enable_if_convertible< Y[], T[] >::type = boost::detail::sp_empty() ) - -#else - - shared_array( shared_array const & r ) - -#endif - BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) - { - boost::detail::sp_assert_convertible< Y[], T[] >(); - } - - // aliasing - - template< class Y > - shared_array( shared_array const & r, element_type * p ) BOOST_SP_NOEXCEPT : px( p ), pn( r.pn ) - { - } - - // assignment - - shared_array & operator=( shared_array const & r ) BOOST_SP_NOEXCEPT - { - this_type( r ).swap( *this ); - return *this; - } - -#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1400) - - template - shared_array & operator=( shared_array const & r ) BOOST_SP_NOEXCEPT - { - this_type( r ).swap( *this ); - return *this; - } - -#endif - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - shared_array & operator=( shared_array && r ) BOOST_SP_NOEXCEPT - { - this_type( static_cast< shared_array && >( r ) ).swap( *this ); - return *this; - } - - template - shared_array & operator=( shared_array && r ) BOOST_SP_NOEXCEPT - { - this_type( static_cast< shared_array && >( r ) ).swap( *this ); - return *this; - } - -#endif - - void reset() BOOST_SP_NOEXCEPT - { - this_type().swap( *this ); - } - - template void reset( Y * p ) // Y must be complete - { - BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors - this_type( p ).swap( *this ); - } - - template void reset( Y * p, D d ) - { - this_type( p, d ).swap( *this ); - } - - template void reset( Y * p, D d, A a ) - { - this_type( p, d, a ).swap( *this ); - } - - template void reset( shared_array const & r, element_type * p ) BOOST_SP_NOEXCEPT - { - this_type( r, p ).swap( *this ); - } - - T & operator[] (std::ptrdiff_t i) const BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT(px != 0); - BOOST_ASSERT(i >= 0); - return px[i]; - } - - T * get() const BOOST_SP_NOEXCEPT - { - return px; - } - -// implicit conversion to "bool" -#include - - bool unique() const BOOST_SP_NOEXCEPT - { - return pn.unique(); - } - - long use_count() const BOOST_SP_NOEXCEPT - { - return pn.use_count(); - } - - void swap(shared_array & other) BOOST_SP_NOEXCEPT - { - std::swap(px, other.px); - pn.swap(other.pn); - } - - void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT - { - return pn.get_deleter( ti ); - } - -private: - - template friend class shared_array; - - T * px; // contained pointer - detail::shared_count pn; // reference counter - -}; // shared_array - -template inline bool operator==(shared_array const & a, shared_array const & b) BOOST_SP_NOEXCEPT -{ - return a.get() == b.get(); -} - -template inline bool operator!=(shared_array const & a, shared_array const & b) BOOST_SP_NOEXCEPT -{ - return a.get() != b.get(); -} - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - -template inline bool operator==( shared_array const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator==( boost::detail::sp_nullptr_t, shared_array const & p ) BOOST_SP_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator!=( shared_array const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT -{ - return p.get() != 0; -} - -template inline bool operator!=( boost::detail::sp_nullptr_t, shared_array const & p ) BOOST_SP_NOEXCEPT -{ - return p.get() != 0; -} - -#endif - -template inline bool operator<(shared_array const & a, shared_array const & b) BOOST_SP_NOEXCEPT -{ - return std::less()(a.get(), b.get()); -} - -template void swap(shared_array & a, shared_array & b) BOOST_SP_NOEXCEPT -{ - a.swap(b); -} - -template< class D, class T > D * get_deleter( shared_array const & p ) BOOST_SP_NOEXCEPT -{ - return static_cast< D * >( p._internal_get_deleter( BOOST_SP_TYPEID(D) ) ); -} - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_SHARED_ARRAY_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/shared_ptr.hpp b/contrib/restricted/boost/boost/smart_ptr/shared_ptr.hpp deleted file mode 100644 index 4ac0699ef67..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/shared_ptr.hpp +++ /dev/null @@ -1,1184 +0,0 @@ -#ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED -#define BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED - -// -// shared_ptr.hpp -// -// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. -// Copyright (c) 2001-2008 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. -// - -#include // for broken compiler workarounds - -// In order to avoid circular dependencies with Boost.TR1 -// we make sure that our include of doesn't try to -// pull in the TR1 headers: that's why we use this header -// rather than including directly: -#include // std::auto_ptr - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if !defined(BOOST_SP_NO_ATOMIC_ACCESS) -#include -#endif - -#include // for std::swap -#include // for std::less -#include // for std::bad_cast -#include // for std::size_t - -#if !defined(BOOST_NO_IOSTREAM) -#if !defined(BOOST_NO_IOSFWD) -#include // for std::basic_ostream -#else -#include -#endif -#endif - -#if defined( BOOST_SP_DISABLE_DEPRECATED ) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - -namespace boost -{ - -template class shared_ptr; -template class weak_ptr; -template class enable_shared_from_this; -class enable_shared_from_raw; - -namespace movelib -{ - - template< class T, class D > class unique_ptr; - -} // namespace movelib - -namespace detail -{ - -// sp_element, element_type - -template< class T > struct sp_element -{ - typedef T type; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T > struct sp_element< T[] > -{ - typedef T type; -}; - -#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) - -template< class T, std::size_t N > struct sp_element< T[N] > -{ - typedef T type; -}; - -#endif - -#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -// sp_dereference, return type of operator* - -template< class T > struct sp_dereference -{ - typedef T & type; -}; - -template<> struct sp_dereference< void > -{ - typedef void type; -}; - -#if !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) - -template<> struct sp_dereference< void const > -{ - typedef void type; -}; - -template<> struct sp_dereference< void volatile > -{ - typedef void type; -}; - -template<> struct sp_dereference< void const volatile > -{ - typedef void type; -}; - -#endif // !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T > struct sp_dereference< T[] > -{ - typedef void type; -}; - -#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) - -template< class T, std::size_t N > struct sp_dereference< T[N] > -{ - typedef void type; -}; - -#endif - -#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -// sp_member_access, return type of operator-> - -template< class T > struct sp_member_access -{ - typedef T * type; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T > struct sp_member_access< T[] > -{ - typedef void type; -}; - -#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) - -template< class T, std::size_t N > struct sp_member_access< T[N] > -{ - typedef void type; -}; - -#endif - -#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -// sp_array_access, return type of operator[] - -template< class T > struct sp_array_access -{ - typedef void type; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T > struct sp_array_access< T[] > -{ - typedef T & type; -}; - -#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) - -template< class T, std::size_t N > struct sp_array_access< T[N] > -{ - typedef T & type; -}; - -#endif - -#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -// sp_extent, for operator[] index check - -template< class T > struct sp_extent -{ - enum _vt { value = 0 }; -}; - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T, std::size_t N > struct sp_extent< T[N] > -{ - enum _vt { value = N }; -}; - -#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -// enable_shared_from_this support - -template< class X, class Y, class T > inline void sp_enable_shared_from_this( boost::shared_ptr const * ppx, Y const * py, boost::enable_shared_from_this< T > const * pe ) -{ - if( pe != 0 ) - { - pe->_internal_accept_owner( ppx, const_cast< Y* >( py ) ); - } -} - -template< class X, class Y > inline void sp_enable_shared_from_this( boost::shared_ptr * ppx, Y const * py, boost::enable_shared_from_raw const * pe ); - -#ifdef _MANAGED - -// Avoid C4793, ... causes native code generation - -struct sp_any_pointer -{ - template sp_any_pointer( T* ) {} -}; - -inline void sp_enable_shared_from_this( sp_any_pointer, sp_any_pointer, sp_any_pointer ) -{ -} - -#else // _MANAGED - -inline void sp_enable_shared_from_this( ... ) -{ -} - -#endif // _MANAGED - -#if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( BOOST_NO_AUTO_PTR ) - -// rvalue auto_ptr support based on a technique by Dave Abrahams - -template< class T, class R > struct sp_enable_if_auto_ptr -{ -}; - -template< class T, class R > struct sp_enable_if_auto_ptr< std::auto_ptr< T >, R > -{ - typedef R type; -}; - -#endif - -// sp_assert_convertible - -template< class Y, class T > inline void sp_assert_convertible() BOOST_SP_NOEXCEPT -{ -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - - // static_assert( sp_convertible< Y, T >::value ); - typedef char tmp[ sp_convertible< Y, T >::value? 1: -1 ]; - (void)sizeof( tmp ); - -#else - - T* p = static_cast< Y* >( 0 ); - (void)p; - -#endif -} - -// pointer constructor helper - -template< class T, class Y > inline void sp_pointer_construct( boost::shared_ptr< T > * ppx, Y * p, boost::detail::shared_count & pn ) -{ - boost::detail::shared_count( p ).swap( pn ); - boost::detail::sp_enable_shared_from_this( ppx, p, p ); -} - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[] > * /*ppx*/, Y * p, boost::detail::shared_count & pn ) -{ - sp_assert_convertible< Y[], T[] >(); - boost::detail::shared_count( p, boost::checked_array_deleter< T >() ).swap( pn ); -} - -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 ) -{ - sp_assert_convertible< Y[N], T[N] >(); - boost::detail::shared_count( p, boost::checked_array_deleter< T >() ).swap( pn ); -} - -#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -// deleter constructor helper - -template< class T, class Y > inline void sp_deleter_construct( boost::shared_ptr< T > * ppx, Y * p ) -{ - boost::detail::sp_enable_shared_from_this( ppx, p, p ); -} - -#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -template< class T, class Y > inline void sp_deleter_construct( boost::shared_ptr< T[] > * /*ppx*/, Y * /*p*/ ) -{ - sp_assert_convertible< Y[], T[] >(); -} - -template< class T, std::size_t N, class Y > inline void sp_deleter_construct( boost::shared_ptr< T[N] > * /*ppx*/, Y * /*p*/ ) -{ - sp_assert_convertible< Y[N], T[N] >(); -} - -#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - -struct sp_internal_constructor_tag -{ -}; - -} // namespace detail - - -// -// shared_ptr -// -// An enhanced relative of scoped_ptr with reference counted copy semantics. -// The object pointed to is deleted when the last shared_ptr pointing to it -// is destroyed or reset. -// - -template class shared_ptr -{ -private: - - // Borland 5.5.1 specific workaround - typedef shared_ptr this_type; - -public: - - typedef typename boost::detail::sp_element< T >::type element_type; - - BOOST_CONSTEXPR shared_ptr() BOOST_SP_NOEXCEPT : px( 0 ), pn() - { - } - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - - BOOST_CONSTEXPR shared_ptr( boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT : px( 0 ), pn() - { - } - -#endif - - BOOST_CONSTEXPR shared_ptr( boost::detail::sp_internal_constructor_tag, element_type * px_, boost::detail::shared_count const & pn_ ) BOOST_SP_NOEXCEPT : px( px_ ), pn( pn_ ) - { - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - BOOST_CONSTEXPR shared_ptr( boost::detail::sp_internal_constructor_tag, element_type * px_, boost::detail::shared_count && pn_ ) BOOST_SP_NOEXCEPT : px( px_ ), pn( std::move( pn_ ) ) - { - } - -#endif - - template - explicit shared_ptr( Y * p ): px( p ), pn() // Y must be complete - { - boost::detail::sp_pointer_construct( this, p, pn ); - } - - // - // Requirements: D's copy constructor must not throw - // - // shared_ptr will release p by calling d(p) - // - - template shared_ptr( Y * p, D d ): px( p ), pn( p, d ) - { - boost::detail::sp_deleter_construct( this, p ); - } - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - - template shared_ptr( boost::detail::sp_nullptr_t p, D d ): px( p ), pn( p, d ) - { - } - -#endif - - // As above, but with allocator. A's copy constructor shall not throw. - - template shared_ptr( Y * p, D d, A a ): px( p ), pn( p, d, a ) - { - boost::detail::sp_deleter_construct( this, p ); - } - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - - template shared_ptr( boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( p, d, a ) - { - } - -#endif - -// generated copy constructor, destructor are fine... - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -// ... except in C++0x, move disables the implicit copy - - shared_ptr( shared_ptr const & r ) BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) - { - } - -#endif - - template - explicit shared_ptr( weak_ptr const & r ): pn( r.pn ) // may throw - { - boost::detail::sp_assert_convertible< Y, T >(); - - // it is now safe to copy r.px, as pn(r.pn) did not throw - px = r.px; - } - - template - shared_ptr( weak_ptr const & r, boost::detail::sp_nothrow_tag ) - BOOST_SP_NOEXCEPT : px( 0 ), pn( r.pn, boost::detail::sp_nothrow_tag() ) - { - if( !pn.empty() ) - { - px = r.px; - } - } - - template -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - - shared_ptr( shared_ptr const & r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) - -#else - - shared_ptr( shared_ptr const & r ) - -#endif - BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) - { - boost::detail::sp_assert_convertible< Y, T >(); - } - - // aliasing - template< class Y > - shared_ptr( shared_ptr const & r, element_type * p ) BOOST_SP_NOEXCEPT : px( p ), pn( r.pn ) - { - } - -#ifndef BOOST_NO_AUTO_PTR - - template - explicit shared_ptr( std::auto_ptr & r ): px(r.get()), pn() - { - boost::detail::sp_assert_convertible< Y, T >(); - - Y * tmp = r.get(); - pn = boost::detail::shared_count( r ); - - boost::detail::sp_deleter_construct( this, tmp ); - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template - shared_ptr( std::auto_ptr && r ): px(r.get()), pn() - { - boost::detail::sp_assert_convertible< Y, T >(); - - Y * tmp = r.get(); - pn = boost::detail::shared_count( r ); - - boost::detail::sp_deleter_construct( this, tmp ); - } - -#elif !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - - template - explicit shared_ptr( Ap r, typename boost::detail::sp_enable_if_auto_ptr::type = 0 ): px( r.get() ), pn() - { - typedef typename Ap::element_type Y; - - boost::detail::sp_assert_convertible< Y, T >(); - - Y * tmp = r.get(); - pn = boost::detail::shared_count( r ); - - boost::detail::sp_deleter_construct( this, tmp ); - } - -#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -#endif // BOOST_NO_AUTO_PTR - -#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template< class Y, class D > - shared_ptr( std::unique_ptr< Y, D > && r ): px( r.get() ), pn() - { - boost::detail::sp_assert_convertible< Y, T >(); - - typename std::unique_ptr< Y, D >::pointer tmp = r.get(); - - if( tmp != 0 ) - { - pn = boost::detail::shared_count( r ); - boost::detail::sp_deleter_construct( this, tmp ); - } - } - -#endif - - template< class Y, class D > - shared_ptr( boost::movelib::unique_ptr< Y, D > r ): px( r.get() ), pn() - { - boost::detail::sp_assert_convertible< Y, T >(); - - typename boost::movelib::unique_ptr< Y, D >::pointer tmp = r.get(); - - if( tmp != 0 ) - { - pn = boost::detail::shared_count( r ); - boost::detail::sp_deleter_construct( this, tmp ); - } - } - - // assignment - - shared_ptr & operator=( shared_ptr const & r ) BOOST_SP_NOEXCEPT - { - this_type(r).swap(*this); - return *this; - } - -#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1400) - - template - shared_ptr & operator=(shared_ptr const & r) BOOST_SP_NOEXCEPT - { - this_type(r).swap(*this); - return *this; - } - -#endif - -#ifndef BOOST_NO_AUTO_PTR - - template - shared_ptr & operator=( std::auto_ptr & r ) - { - this_type( r ).swap( *this ); - return *this; - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template - shared_ptr & operator=( std::auto_ptr && r ) - { - this_type( static_cast< std::auto_ptr && >( r ) ).swap( *this ); - return *this; - } - -#elif !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) - - template - typename boost::detail::sp_enable_if_auto_ptr< Ap, shared_ptr & >::type operator=( Ap r ) - { - this_type( r ).swap( *this ); - return *this; - } - -#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -#endif // BOOST_NO_AUTO_PTR - -#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template - shared_ptr & operator=( std::unique_ptr && r ) - { - this_type( static_cast< std::unique_ptr && >( r ) ).swap(*this); - return *this; - } - -#endif - - template - shared_ptr & operator=( boost::movelib::unique_ptr r ) - { - // this_type( static_cast< unique_ptr && >( r ) ).swap( *this ); - - boost::detail::sp_assert_convertible< Y, T >(); - - typename boost::movelib::unique_ptr< Y, D >::pointer p = r.get(); - - shared_ptr tmp; - - if( p != 0 ) - { - tmp.px = p; - tmp.pn = boost::detail::shared_count( r ); - - boost::detail::sp_deleter_construct( &tmp, p ); - } - - tmp.swap( *this ); - - return *this; - } - -// Move support - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - shared_ptr( shared_ptr && r ) BOOST_SP_NOEXCEPT : px( r.px ), pn() - { - pn.swap( r.pn ); - r.px = 0; - } - - template -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - - shared_ptr( shared_ptr && r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) - -#else - - shared_ptr( shared_ptr && r ) - -#endif - BOOST_SP_NOEXCEPT : px( r.px ), pn() - { - boost::detail::sp_assert_convertible< Y, T >(); - - pn.swap( r.pn ); - r.px = 0; - } - - shared_ptr & operator=( shared_ptr && r ) BOOST_SP_NOEXCEPT - { - this_type( static_cast< shared_ptr && >( r ) ).swap( *this ); - return *this; - } - - template - shared_ptr & operator=( shared_ptr && r ) BOOST_SP_NOEXCEPT - { - this_type( static_cast< shared_ptr && >( r ) ).swap( *this ); - return *this; - } - - // aliasing move - template - shared_ptr( shared_ptr && r, element_type * p ) BOOST_SP_NOEXCEPT : px( p ), pn() - { - pn.swap( r.pn ); - r.px = 0; - } - -#endif - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - - shared_ptr & operator=( boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT - { - this_type().swap(*this); - return *this; - } - -#endif - - void reset() BOOST_SP_NOEXCEPT - { - this_type().swap(*this); - } - - template void reset( Y * p ) // Y must be complete - { - BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors - this_type( p ).swap( *this ); - } - - template void reset( Y * p, D d ) - { - this_type( p, d ).swap( *this ); - } - - template void reset( Y * p, D d, A a ) - { - this_type( p, d, a ).swap( *this ); - } - - template void reset( shared_ptr const & r, element_type * p ) BOOST_SP_NOEXCEPT - { - this_type( r, p ).swap( *this ); - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template void reset( shared_ptr && r, element_type * p ) BOOST_SP_NOEXCEPT - { - this_type( static_cast< shared_ptr && >( r ), p ).swap( *this ); - } - -#endif - - typename boost::detail::sp_dereference< T >::type operator* () const BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT( px != 0 ); - return *px; - } - - typename boost::detail::sp_member_access< T >::type operator-> () const BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT( px != 0 ); - return px; - } - - typename boost::detail::sp_array_access< T >::type operator[] ( std::ptrdiff_t i ) const BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT( px != 0 ); - BOOST_ASSERT( i >= 0 && ( i < boost::detail::sp_extent< T >::value || boost::detail::sp_extent< T >::value == 0 ) ); - - return static_cast< typename boost::detail::sp_array_access< T >::type >( px[ i ] ); - } - - element_type * get() const BOOST_SP_NOEXCEPT - { - return px; - } - -// implicit conversion to "bool" -#include - - bool unique() const BOOST_SP_NOEXCEPT - { - return pn.unique(); - } - - long use_count() const BOOST_SP_NOEXCEPT - { - return pn.use_count(); - } - - void swap( shared_ptr & other ) BOOST_SP_NOEXCEPT - { - std::swap(px, other.px); - pn.swap(other.pn); - } - - template bool owner_before( shared_ptr const & rhs ) const BOOST_SP_NOEXCEPT - { - return pn < rhs.pn; - } - - template bool owner_before( weak_ptr const & rhs ) const BOOST_SP_NOEXCEPT - { - return pn < rhs.pn; - } - - void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT - { - return pn.get_deleter( ti ); - } - - void * _internal_get_local_deleter( boost::detail::sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT - { - return pn.get_local_deleter( ti ); - } - - void * _internal_get_untyped_deleter() const BOOST_SP_NOEXCEPT - { - return pn.get_untyped_deleter(); - } - - bool _internal_equiv( shared_ptr const & r ) const BOOST_SP_NOEXCEPT - { - return px == r.px && pn == r.pn; - } - - boost::detail::shared_count _internal_count() const BOOST_NOEXCEPT - { - return pn; - } - -// Tasteless as this may seem, making all members public allows member templates -// to work in the absence of member template friends. (Matthew Langston) - -#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS - -private: - - template friend class shared_ptr; - template friend class weak_ptr; - - -#endif - - element_type * px; // contained pointer - boost::detail::shared_count pn; // reference counter - -}; // shared_ptr - -template inline bool operator==(shared_ptr const & a, shared_ptr const & b) BOOST_SP_NOEXCEPT -{ - return a.get() == b.get(); -} - -template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) BOOST_SP_NOEXCEPT -{ - return a.get() != b.get(); -} - -#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96 - -// Resolve the ambiguity between our op!= and the one in rel_ops - -template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) BOOST_SP_NOEXCEPT -{ - return a.get() != b.get(); -} - -#endif - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - -template inline bool operator==( shared_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator==( boost::detail::sp_nullptr_t, shared_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return p.get() == 0; -} - -template inline bool operator!=( shared_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT -{ - return p.get() != 0; -} - -template inline bool operator!=( boost::detail::sp_nullptr_t, shared_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return p.get() != 0; -} - -#endif - -template inline bool operator<(shared_ptr const & a, shared_ptr const & b) BOOST_SP_NOEXCEPT -{ - return a.owner_before( b ); -} - -template inline void swap(shared_ptr & a, shared_ptr & b) BOOST_SP_NOEXCEPT -{ - a.swap(b); -} - -template shared_ptr static_pointer_cast( shared_ptr const & r ) BOOST_SP_NOEXCEPT -{ - (void) static_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename shared_ptr::element_type E; - - E * p = static_cast< E* >( r.get() ); - return shared_ptr( r, p ); -} - -template shared_ptr const_pointer_cast( shared_ptr const & r ) BOOST_SP_NOEXCEPT -{ - (void) const_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename shared_ptr::element_type E; - - E * p = const_cast< E* >( r.get() ); - return shared_ptr( r, p ); -} - -template shared_ptr dynamic_pointer_cast( shared_ptr const & r ) BOOST_SP_NOEXCEPT -{ - (void) dynamic_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename shared_ptr::element_type E; - - E * p = dynamic_cast< E* >( r.get() ); - return p? shared_ptr( r, p ): shared_ptr(); -} - -template shared_ptr reinterpret_pointer_cast( shared_ptr const & r ) BOOST_SP_NOEXCEPT -{ - (void) reinterpret_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename shared_ptr::element_type E; - - E * p = reinterpret_cast< E* >( r.get() ); - return shared_ptr( r, p ); -} - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -template shared_ptr static_pointer_cast( shared_ptr && r ) BOOST_SP_NOEXCEPT -{ - (void) static_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename shared_ptr::element_type E; - - E * p = static_cast< E* >( r.get() ); - return shared_ptr( std::move(r), p ); -} - -template shared_ptr const_pointer_cast( shared_ptr && r ) BOOST_SP_NOEXCEPT -{ - (void) const_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename shared_ptr::element_type E; - - E * p = const_cast< E* >( r.get() ); - return shared_ptr( std::move(r), p ); -} - -template shared_ptr dynamic_pointer_cast( shared_ptr && r ) BOOST_SP_NOEXCEPT -{ - (void) dynamic_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename shared_ptr::element_type E; - - E * p = dynamic_cast< E* >( r.get() ); - return p? shared_ptr( std::move(r), p ): shared_ptr(); -} - -template shared_ptr reinterpret_pointer_cast( shared_ptr && r ) BOOST_SP_NOEXCEPT -{ - (void) reinterpret_cast< T* >( static_cast< U* >( 0 ) ); - - typedef typename shared_ptr::element_type E; - - E * p = reinterpret_cast< E* >( r.get() ); - return shared_ptr( std::move(r), p ); -} - -#endif // !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -// get_pointer() enables boost::mem_fn to recognize shared_ptr - -template inline typename shared_ptr::element_type * get_pointer(shared_ptr const & p) BOOST_SP_NOEXCEPT -{ - return p.get(); -} - -// operator<< - -#if !defined(BOOST_NO_IOSTREAM) - -#if defined(BOOST_NO_TEMPLATED_IOSTREAMS) || ( defined(__GNUC__) && (__GNUC__ < 3) ) - -template std::ostream & operator<< (std::ostream & os, shared_ptr const & p) -{ - os << p.get(); - return os; -} - -#else - -// in STLport's no-iostreams mode no iostream symbols can be used -#ifndef _STLP_NO_IOSTREAMS - -# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300 && __SGI_STL_PORT) -// MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL -using std::basic_ostream; -template basic_ostream & operator<< (basic_ostream & os, shared_ptr const & p) -# else -template std::basic_ostream & operator<< (std::basic_ostream & os, shared_ptr const & p) -# endif -{ - os << p.get(); - return os; -} - -#endif // _STLP_NO_IOSTREAMS - -#endif // __GNUC__ < 3 - -#endif // !defined(BOOST_NO_IOSTREAM) - -// get_deleter - -namespace detail -{ - -template D * basic_get_deleter( shared_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return static_cast( p._internal_get_deleter(BOOST_SP_TYPEID(D)) ); -} - -template D * basic_get_local_deleter( D *, shared_ptr const & p ) BOOST_SP_NOEXCEPT; -template D const * basic_get_local_deleter( D const *, shared_ptr const & p ) BOOST_SP_NOEXCEPT; - -class esft2_deleter_wrapper -{ -private: - - shared_ptr deleter_; - -public: - - esft2_deleter_wrapper() - { - } - - template< class T > void set_deleter( shared_ptr const & deleter ) BOOST_SP_NOEXCEPT - { - deleter_ = deleter; - } - - template D* get_deleter() const BOOST_SP_NOEXCEPT - { - return boost::detail::basic_get_deleter( deleter_ ); - } - - template< class T> void operator()( T* ) BOOST_SP_NOEXCEPT_WITH_ASSERT - { - BOOST_ASSERT( deleter_.use_count() <= 1 ); - deleter_.reset(); - } -}; - -} // namespace detail - -template D * get_deleter( shared_ptr const & p ) BOOST_SP_NOEXCEPT -{ - D * d = boost::detail::basic_get_deleter( p ); - - if( d == 0 ) - { - d = boost::detail::basic_get_local_deleter( d, p ); - } - - if( d == 0 ) - { - boost::detail::esft2_deleter_wrapper *del_wrapper = boost::detail::basic_get_deleter(p); -// The following get_deleter method call is fully qualified because -// older versions of gcc (2.95, 3.2.3) fail to compile it when written del_wrapper->get_deleter() - if(del_wrapper) d = del_wrapper->::boost::detail::esft2_deleter_wrapper::get_deleter(); - } - - return d; -} - -// atomic access - -#if !defined(BOOST_SP_NO_ATOMIC_ACCESS) - -template inline bool atomic_is_lock_free( shared_ptr const * /*p*/ ) BOOST_SP_NOEXCEPT -{ - return false; -} - -template shared_ptr atomic_load( shared_ptr const * p ) BOOST_SP_NOEXCEPT -{ - boost::detail::spinlock_pool<2>::scoped_lock lock( p ); - return *p; -} - -template inline shared_ptr atomic_load_explicit( shared_ptr const * p, /*memory_order mo*/ M ) BOOST_SP_NOEXCEPT -{ - return atomic_load( p ); -} - -template void atomic_store( shared_ptr * p, shared_ptr r ) BOOST_SP_NOEXCEPT -{ - boost::detail::spinlock_pool<2>::scoped_lock lock( p ); - p->swap( r ); -} - -template inline void atomic_store_explicit( shared_ptr * p, shared_ptr r, /*memory_order mo*/ M ) BOOST_SP_NOEXCEPT -{ - atomic_store( p, r ); // std::move( r ) -} - -template shared_ptr atomic_exchange( shared_ptr * p, shared_ptr r ) BOOST_SP_NOEXCEPT -{ - boost::detail::spinlock & sp = boost::detail::spinlock_pool<2>::spinlock_for( p ); - - sp.lock(); - p->swap( r ); - sp.unlock(); - - return r; // return std::move( r ) -} - -template shared_ptr inline atomic_exchange_explicit( shared_ptr * p, shared_ptr r, /*memory_order mo*/ M ) BOOST_SP_NOEXCEPT -{ - return atomic_exchange( p, r ); // std::move( r ) -} - -template bool atomic_compare_exchange( shared_ptr * p, shared_ptr * v, shared_ptr w ) BOOST_SP_NOEXCEPT -{ - boost::detail::spinlock & sp = boost::detail::spinlock_pool<2>::spinlock_for( p ); - - sp.lock(); - - if( p->_internal_equiv( *v ) ) - { - p->swap( w ); - - sp.unlock(); - - return true; - } - else - { - shared_ptr tmp( *p ); - - sp.unlock(); - - tmp.swap( *v ); - return false; - } -} - -template inline bool atomic_compare_exchange_explicit( shared_ptr * p, shared_ptr * v, shared_ptr w, /*memory_order success*/ M, /*memory_order failure*/ M ) BOOST_SP_NOEXCEPT -{ - return atomic_compare_exchange( p, v, w ); // std::move( w ) -} - -#endif // !defined(BOOST_SP_NO_ATOMIC_ACCESS) - -// hash_value - -template< class T > struct hash; - -template< class T > std::size_t hash_value( boost::shared_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return boost::hash< typename boost::shared_ptr::element_type* >()( p.get() ); -} - -} // namespace boost - -#include - -namespace boost -{ - -namespace detail -{ - -template D * basic_get_local_deleter( D *, shared_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return static_cast( p._internal_get_local_deleter( BOOST_SP_TYPEID(local_sp_deleter) ) ); -} - -template D const * basic_get_local_deleter( D const *, shared_ptr const & p ) BOOST_SP_NOEXCEPT -{ - return static_cast( p._internal_get_local_deleter( BOOST_SP_TYPEID(local_sp_deleter) ) ); -} - -} // namespace detail - -} // namespace boost - -#if defined( BOOST_SP_DISABLE_DEPRECATED ) -#pragma GCC diagnostic pop -#endif - -#endif // #ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/smart_ptr/weak_ptr.hpp b/contrib/restricted/boost/boost/smart_ptr/weak_ptr.hpp deleted file mode 100644 index 54d9ef37812..00000000000 --- a/contrib/restricted/boost/boost/smart_ptr/weak_ptr.hpp +++ /dev/null @@ -1,254 +0,0 @@ -#ifndef BOOST_SMART_PTR_WEAK_PTR_HPP_INCLUDED -#define BOOST_SMART_PTR_WEAK_PTR_HPP_INCLUDED - -// -// weak_ptr.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. -// - -#include // boost.TR1 include order fix -#include -#include -#include - -namespace boost -{ - -template class weak_ptr -{ -private: - - // Borland 5.5.1 specific workarounds - typedef weak_ptr this_type; - -public: - - typedef typename boost::detail::sp_element< T >::type element_type; - - BOOST_CONSTEXPR weak_ptr() BOOST_SP_NOEXCEPT : px(0), pn() - { - } - -// generated copy constructor, assignment, destructor are fine... - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - -// ... except in C++0x, move disables the implicit copy - - weak_ptr( weak_ptr const & r ) BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) - { - } - - weak_ptr & operator=( weak_ptr const & r ) BOOST_SP_NOEXCEPT - { - px = r.px; - pn = r.pn; - return *this; - } - -#endif - -// -// The "obvious" converting constructor implementation: -// -// template -// weak_ptr(weak_ptr const & r): px(r.px), pn(r.pn) -// { -// } -// -// has a serious problem. -// -// r.px may already have been invalidated. The px(r.px) -// conversion may require access to *r.px (virtual inheritance). -// -// It is not possible to avoid spurious access violations since -// in multithreaded programs r.px may be invalidated at any point. -// - - template -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - - weak_ptr( weak_ptr const & r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) - -#else - - weak_ptr( weak_ptr const & r ) - -#endif - BOOST_SP_NOEXCEPT : px(r.lock().get()), pn(r.pn) - { - boost::detail::sp_assert_convertible< Y, T >(); - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - - weak_ptr( weak_ptr && r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) - -#else - - weak_ptr( weak_ptr && r ) - -#endif - BOOST_SP_NOEXCEPT : px( r.lock().get() ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) - { - boost::detail::sp_assert_convertible< Y, T >(); - r.px = 0; - } - - // for better efficiency in the T == Y case - weak_ptr( weak_ptr && r ) - BOOST_SP_NOEXCEPT : px( r.px ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) - { - r.px = 0; - } - - // for better efficiency in the T == Y case - weak_ptr & operator=( weak_ptr && r ) BOOST_SP_NOEXCEPT - { - this_type( static_cast< weak_ptr && >( r ) ).swap( *this ); - return *this; - } - - -#endif - - template -#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) - - weak_ptr( shared_ptr const & r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) - -#else - - weak_ptr( shared_ptr const & r ) - -#endif - BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) - { - boost::detail::sp_assert_convertible< Y, T >(); - } - -#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1300) - - template - weak_ptr & operator=( weak_ptr const & r ) BOOST_SP_NOEXCEPT - { - boost::detail::sp_assert_convertible< Y, T >(); - - px = r.lock().get(); - pn = r.pn; - - return *this; - } - -#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - - template - weak_ptr & operator=( weak_ptr && r ) BOOST_SP_NOEXCEPT - { - this_type( static_cast< weak_ptr && >( r ) ).swap( *this ); - return *this; - } - -#endif - - template - weak_ptr & operator=( shared_ptr const & r ) BOOST_SP_NOEXCEPT - { - boost::detail::sp_assert_convertible< Y, T >(); - - px = r.px; - pn = r.pn; - - return *this; - } - -#endif - - shared_ptr lock() const BOOST_SP_NOEXCEPT - { - return shared_ptr( *this, boost::detail::sp_nothrow_tag() ); - } - - long use_count() const BOOST_SP_NOEXCEPT - { - return pn.use_count(); - } - - bool expired() const BOOST_SP_NOEXCEPT - { - return pn.use_count() == 0; - } - - bool _empty() const BOOST_SP_NOEXCEPT // extension, not in std::weak_ptr - { - return pn.empty(); - } - - void reset() BOOST_SP_NOEXCEPT - { - this_type().swap(*this); - } - - void swap(this_type & other) BOOST_SP_NOEXCEPT - { - std::swap(px, other.px); - pn.swap(other.pn); - } - - template - void _internal_aliasing_assign(weak_ptr const & r, element_type * px2) BOOST_SP_NOEXCEPT - { - px = px2; - pn = r.pn; - } - - template bool owner_before( weak_ptr const & rhs ) const BOOST_SP_NOEXCEPT - { - return pn < rhs.pn; - } - - template bool owner_before( shared_ptr const & rhs ) const BOOST_SP_NOEXCEPT - { - return pn < rhs.pn; - } - -// Tasteless as this may seem, making all members public allows member templates -// to work in the absence of member template friends. (Matthew Langston) - -#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS - -private: - - template friend class weak_ptr; - template friend class shared_ptr; - -#endif - - element_type * px; // contained pointer - boost::detail::weak_count pn; // reference counter - -}; // weak_ptr - -template inline bool operator<(weak_ptr const & a, weak_ptr const & b) BOOST_SP_NOEXCEPT -{ - return a.owner_before( b ); -} - -template void swap(weak_ptr & a, weak_ptr & b) BOOST_SP_NOEXCEPT -{ - a.swap(b); -} - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_WEAK_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/boost/weak_ptr.hpp b/contrib/restricted/boost/boost/weak_ptr.hpp deleted file mode 100644 index fa8574beac4..00000000000 --- a/contrib/restricted/boost/boost/weak_ptr.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef BOOST_WEAK_PTR_HPP_INCLUDED -#define BOOST_WEAK_PTR_HPP_INCLUDED - -// -// weak_ptr.hpp -// -// Copyright (c) 2001, 2002, 2003 Peter Dimov -// -// Distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt -// -// See http://www.boost.org/libs/smart_ptr/ for documentation. -// - -#include - -#endif // #ifndef BOOST_WEAK_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/CMakeLists.txt b/contrib/restricted/boost/smart_ptr/CMakeLists.txt new file mode 100644 index 00000000000..53f7c2e4c82 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/CMakeLists.txt @@ -0,0 +1,25 @@ + +# This file was gererated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + + +add_library(restricted-boost-smart_ptr INTERFACE) +target_include_directories(restricted-boost-smart_ptr INTERFACE + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/smart_ptr/include +) +target_link_libraries(restricted-boost-smart_ptr INTERFACE + contrib-libs-cxxsupp + yutil + restricted-boost-assert + restricted-boost-config + restricted-boost-core + restricted-boost-move + restricted-boost-predef + restricted-boost-static_assert + restricted-boost-throw_exception + restricted-boost-type_traits +) diff --git a/contrib/restricted/boost/smart_ptr/README.md b/contrib/restricted/boost/smart_ptr/README.md new file mode 100644 index 00000000000..1301e79c437 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/README.md @@ -0,0 +1,6 @@ +# Boost.SmartPtr + +Branch | Travis | Appveyor +---------|--------|--------- +Develop | [![Build Status](https://travis-ci.org/boostorg/smart_ptr.svg?branch=develop)](https://travis-ci.org/boostorg/smart_ptr) | [![Build Status](https://ci.appveyor.com/api/projects/status/github/boostorg/smart_ptr?branch=develop&svg=true)](https://ci.appveyor.com/project/pdimov/smart-ptr) +Master | [![Build Status](https://travis-ci.org/boostorg/smart_ptr.svg?branch=master)](https://travis-ci.org/boostorg/smart_ptr) | [![Build Status](https://ci.appveyor.com/api/projects/status/github/boostorg/smart_ptr?branch=master&svg=true)](https://ci.appveyor.com/project/pdimov/smart-ptr) diff --git a/contrib/restricted/boost/smart_ptr/include/boost/detail/atomic_count.hpp b/contrib/restricted/boost/smart_ptr/include/boost/detail/atomic_count.hpp new file mode 100644 index 00000000000..5411c7ae990 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/detail/atomic_count.hpp @@ -0,0 +1,21 @@ +#ifndef BOOST_DETAIL_ATOMIC_COUNT_HPP_INCLUDED +#define BOOST_DETAIL_ATOMIC_COUNT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/atomic_count.hpp - thread/SMP safe reference counter +// +// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include + +#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/detail/lightweight_mutex.hpp b/contrib/restricted/boost/smart_ptr/include/boost/detail/lightweight_mutex.hpp new file mode 100644 index 00000000000..b7a7f6dd4ed --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/detail/lightweight_mutex.hpp @@ -0,0 +1,22 @@ +#ifndef BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED +#define BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/lightweight_mutex.hpp - lightweight mutex +// +// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// + +#include + +#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/enable_shared_from_this.hpp b/contrib/restricted/boost/smart_ptr/include/boost/enable_shared_from_this.hpp new file mode 100644 index 00000000000..18b938d5d00 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/enable_shared_from_this.hpp @@ -0,0 +1,18 @@ +#ifndef BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED +#define BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED + +// +// enable_shared_from_this.hpp +// +// Copyright (c) 2002 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. +// + +#include + +#endif // #ifndef BOOST_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/intrusive_ptr.hpp b/contrib/restricted/boost/smart_ptr/include/boost/intrusive_ptr.hpp new file mode 100644 index 00000000000..c43adbdc0dc --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/intrusive_ptr.hpp @@ -0,0 +1,18 @@ +#ifndef BOOST_INTRUSIVE_PTR_HPP_INCLUDED +#define BOOST_INTRUSIVE_PTR_HPP_INCLUDED + +// +// intrusive_ptr.hpp +// +// Copyright (c) 2001, 2002 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. +// + +#include + +#endif // #ifndef BOOST_INTRUSIVE_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/make_shared.hpp b/contrib/restricted/boost/smart_ptr/include/boost/make_shared.hpp new file mode 100644 index 00000000000..588fbfde1b8 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/make_shared.hpp @@ -0,0 +1,16 @@ +#ifndef BOOST_MAKE_SHARED_HPP_INCLUDED +#define BOOST_MAKE_SHARED_HPP_INCLUDED + +// make_shared.hpp +// +// Copyright (c) 2007, 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. + +#include + +#endif // #ifndef BOOST_MAKE_SHARED_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/pointer_to_other.hpp b/contrib/restricted/boost/smart_ptr/include/boost/pointer_to_other.hpp new file mode 100644 index 00000000000..d7d455dc6e3 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/pointer_to_other.hpp @@ -0,0 +1,55 @@ +#ifndef BOOST_POINTER_TO_OTHER_HPP_INCLUDED +#define BOOST_POINTER_TO_OTHER_HPP_INCLUDED + +// +// pointer_to_other.hpp +// +// (C) Copyright Ion Gaztanaga 2005. +// Copyright (c) 2005 Peter Dimov. +// +// Distributed under the Boost Software License, Version 1.0. +// +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. +// + +namespace boost +{ + +// Defines the same pointer type (raw or smart) to another pointee type + +template +struct pointer_to_other; + +template class Sp> +struct pointer_to_other< Sp, U > +{ + typedef Sp type; +}; + +template class Sp> +struct pointer_to_other< Sp, U > +{ + typedef Sp type; +}; + +template class Sp> +struct pointer_to_other< Sp, U > +{ + typedef Sp type; +}; + +template +struct pointer_to_other< T*, U > +{ + typedef U* type; +}; + +} // namespace boost + +#endif // #ifndef BOOST_POINTER_TO_OTHER_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/scoped_array.hpp b/contrib/restricted/boost/smart_ptr/include/boost/scoped_array.hpp new file mode 100644 index 00000000000..d91889b7cf1 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/scoped_array.hpp @@ -0,0 +1,15 @@ +#ifndef BOOST_SCOPED_ARRAY_HPP_INCLUDED +#define BOOST_SCOPED_ARRAY_HPP_INCLUDED + +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001, 2002 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. + +#include + +#endif // #ifndef BOOST_SCOPED_ARRAY_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/scoped_ptr.hpp b/contrib/restricted/boost/smart_ptr/include/boost/scoped_ptr.hpp new file mode 100644 index 00000000000..334a22e2fe1 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/scoped_ptr.hpp @@ -0,0 +1,15 @@ +#ifndef BOOST_SCOPED_PTR_HPP_INCLUDED +#define BOOST_SCOPED_PTR_HPP_INCLUDED + +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001, 2002 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. + +#include + +#endif // #ifndef BOOST_SCOPED_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/shared_array.hpp b/contrib/restricted/boost/smart_ptr/include/boost/shared_array.hpp new file mode 100644 index 00000000000..6804224c277 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/shared_array.hpp @@ -0,0 +1,19 @@ +#ifndef BOOST_SHARED_ARRAY_HPP_INCLUDED +#define BOOST_SHARED_ARRAY_HPP_INCLUDED + +// +// shared_array.hpp +// +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001, 2002 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. +// + +#include + +#endif // #ifndef BOOST_SHARED_ARRAY_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/shared_ptr.hpp b/contrib/restricted/boost/smart_ptr/include/boost/shared_ptr.hpp new file mode 100644 index 00000000000..cb01b265881 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/shared_ptr.hpp @@ -0,0 +1,19 @@ +#ifndef BOOST_SHARED_PTR_HPP_INCLUDED +#define BOOST_SHARED_PTR_HPP_INCLUDED + +// +// shared_ptr.hpp +// +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001-2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. +// + +#include + +#endif // #ifndef BOOST_SHARED_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr.hpp new file mode 100644 index 00000000000..6fabfc5388f --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr.hpp @@ -0,0 +1,26 @@ +#ifndef BOOST_SMART_PTR_HPP_INCLUDED +#define BOOST_SMART_PTR_HPP_INCLUDED + +// +// smart_ptr.hpp +// +// For convenience, this header includes the rest of the smart +// pointer library headers. +// +// Copyright (c) 2003 Peter Dimov Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. +// + +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // #ifndef BOOST_SMART_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/allocate_shared_array.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/allocate_shared_array.hpp new file mode 100644 index 00000000000..340688146ca --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/allocate_shared_array.hpp @@ -0,0 +1,703 @@ +/* +Copyright 2012-2017 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP +#define BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace detail { + +template +struct sp_if_array { }; + +template +struct sp_if_array { + typedef boost::shared_ptr type; +}; + +template +struct sp_if_size_array { }; + +template +struct sp_if_size_array { + typedef boost::shared_ptr type; +}; + +template +struct sp_array_element { }; + +template +struct sp_array_element { + typedef T type; +}; + +template +struct sp_array_element { + typedef T type; +}; + +template +struct sp_array_scalar { + typedef T type; +}; + +template +struct sp_array_scalar { + typedef typename sp_array_scalar::type type; +}; + +template +struct sp_array_scalar { + typedef typename sp_array_scalar::type type; +}; + +template +struct sp_array_scalar { + typedef typename sp_array_scalar::type type; +}; + +template +struct sp_array_scalar { + typedef typename sp_array_scalar::type type; +}; + +template +struct sp_array_scalar { + typedef typename sp_array_scalar::type type; +}; + +template +struct sp_array_scalar { + typedef typename sp_array_scalar::type type; +}; + +template +struct sp_array_scalar { + typedef typename sp_array_scalar::type type; +}; + +template +struct sp_array_scalar { + typedef typename sp_array_scalar::type type; +}; + +template +struct sp_array_count { + enum { + value = 1 + }; +}; + +template +struct sp_array_count { + enum { + value = N * sp_array_count::value + }; +}; + +template +struct sp_max_size { + enum { + value = N < M ? M : N + }; +}; + +template +struct sp_align_up { + enum { + value = (N + M - 1) & ~(M - 1) + }; +}; + +#if !defined(BOOST_NO_CXX11_ALLOCATOR) +template +struct sp_bind_allocator { + typedef typename std::allocator_traits::template rebind_alloc type; +}; +#else +template +struct sp_bind_allocator { + typedef typename A::template rebind::other type; +}; +#endif + +template +BOOST_CONSTEXPR inline std::size_t +sp_objects(std::size_t size) BOOST_SP_NOEXCEPT +{ + return (size + sizeof(T) - 1) / sizeof(T); +} + +template +struct sp_enable { }; + +template +struct sp_enable { + typedef T type; +}; + +template +inline typename sp_enable::value>::type +sp_array_destroy(A&, T*, std::size_t) BOOST_SP_NOEXCEPT { } + +template +inline typename sp_enable::value>::type +sp_array_destroy(A&, T* start, std::size_t size) +{ + while (size > 0) { + start[--size].~T(); + } +} + +#if !defined(BOOST_NO_CXX11_ALLOCATOR) +template +inline typename sp_enable::type +sp_array_destroy(A& allocator, T* start, std::size_t size) +{ + while (size > 0) { + std::allocator_traits::destroy(allocator, start + --size); + } +} +#endif + +template +inline typename sp_enable::value && + boost::has_trivial_assign::value && + boost::has_trivial_destructor::value>::type +sp_array_construct(A&, T* start, std::size_t size) +{ + for (std::size_t i = 0; i < size; ++i) { + start[i] = T(); + } +} + +template +inline typename sp_enable::value && + boost::has_trivial_assign::value && + boost::has_trivial_destructor::value>::type +sp_array_construct(A&, T* start, std::size_t size, const T* list, + std::size_t count) +{ + for (std::size_t i = 0; i < size; ++i) { + start[i] = list[i % count]; + } +} + +#if !defined(BOOST_NO_EXCEPTIONS) +template +inline typename sp_enable::value && + boost::has_trivial_assign::value && + boost::has_trivial_destructor::value)>::type +sp_array_construct(A& none, T* start, std::size_t size) +{ + std::size_t i = 0; + try { + for (; i < size; ++i) { + ::new(static_cast(start + i)) T(); + } + } catch (...) { + sp_array_destroy(none, start, i); + throw; + } +} + +template +inline typename sp_enable::value && + boost::has_trivial_assign::value && + boost::has_trivial_destructor::value)>::type +sp_array_construct(A& none, T* start, std::size_t size, const T* list, + std::size_t count) +{ + std::size_t i = 0; + try { + for (; i < size; ++i) { + ::new(static_cast(start + i)) T(list[i % count]); + } + } catch (...) { + sp_array_destroy(none, start, i); + throw; + } +} +#else +template +inline typename sp_enable::value && + boost::has_trivial_assign::value && + boost::has_trivial_destructor::value)>::type +sp_array_construct(A&, T* start, std::size_t size) +{ + for (std::size_t i = 0; i < size; ++i) { + ::new(static_cast(start + i)) T(); + } +} + +template +inline typename sp_enable::value && + boost::has_trivial_assign::value && + boost::has_trivial_destructor::value)>::type +sp_array_construct(A&, T* start, std::size_t size, const T* list, + std::size_t count) +{ + for (std::size_t i = 0; i < size; ++i) { + ::new(static_cast(start + i)) T(list[i % count]); + } +} +#endif + +#if !defined(BOOST_NO_CXX11_ALLOCATOR) +#if !defined(BOOST_NO_EXCEPTIONS) +template +inline typename sp_enable::type +sp_array_construct(A& allocator, T* start, std::size_t size) +{ + std::size_t i = 0; + try { + for (i = 0; i < size; ++i) { + std::allocator_traits::construct(allocator, start + i); + } + } catch (...) { + sp_array_destroy(allocator, start, i); + throw; + } +} + +template +inline typename sp_enable::type +sp_array_construct(A& allocator, T* start, std::size_t size, const T* list, + std::size_t count) +{ + std::size_t i = 0; + try { + for (i = 0; i < size; ++i) { + std::allocator_traits::construct(allocator, start + i, + list[i % count]); + } + } catch (...) { + sp_array_destroy(allocator, start, i); + throw; + } +} +#else +template +inline typename sp_enable::type +sp_array_construct(A& allocator, T* start, std::size_t size) +{ + for (std::size_t i = 0; i < size; ++i) { + std::allocator_traits::construct(allocator, start + i); + } +} + +template +inline typename sp_enable::type +sp_array_construct(A& allocator, T* start, std::size_t size, const T* list, + std::size_t count) +{ + for (std::size_t i = 0; i < size; ++i) { + std::allocator_traits::construct(allocator, start + i, + list[i % count]); + } +} +#endif +#endif + +template +inline typename sp_enable::value>::type +sp_array_default(A&, T*, std::size_t) BOOST_SP_NOEXCEPT { } + +#if !defined(BOOST_NO_EXCEPTIONS) +template +inline typename sp_enable::value>::type +sp_array_default(A& none, T* start, std::size_t size) +{ + std::size_t i = 0; + try { + for (; i < size; ++i) { + ::new(static_cast(start + i)) T; + } + } catch (...) { + sp_array_destroy(none, start, i); + throw; + } +} +#else +template +inline typename sp_enable::value>::type +sp_array_default(A&, T* start, std::size_t size) +{ + for (std::size_t i = 0; i < size; ++i) { + ::new(static_cast(start + i)) T; + } +} +#endif + +template +class sp_array_state { +public: + typedef A type; + + template + sp_array_state(const U& _allocator, std::size_t _size) BOOST_SP_NOEXCEPT + : allocator_(_allocator), + size_(_size) { } + + A& allocator() BOOST_SP_NOEXCEPT { + return allocator_; + } + + std::size_t size() const BOOST_SP_NOEXCEPT { + return size_; + } + +private: + A allocator_; + std::size_t size_; +}; + +template +class sp_size_array_state { +public: + typedef A type; + + template + sp_size_array_state(const U& _allocator, std::size_t) BOOST_SP_NOEXCEPT + : allocator_(_allocator) { } + + A& allocator() BOOST_SP_NOEXCEPT { + return allocator_; + } + + BOOST_CONSTEXPR std::size_t size() const BOOST_SP_NOEXCEPT { + return N; + } + +private: + A allocator_; +}; + +#if !defined(BOOST_NO_CXX11_ALLOCATOR) +template +struct sp_use_construct { + enum { + value = true + }; +}; + +template +struct sp_use_construct > { + enum { + value = false + }; +}; +#else +template +struct sp_use_construct { + enum { + value = false + }; +}; +#endif + +template +struct sp_array_alignment { + enum { + value = sp_max_size::value, + boost::alignment_of::value>::value + }; +}; + +template +struct sp_array_offset { + enum { + value = sp_align_up::value>::value + }; +}; + +template +struct sp_array_storage { + enum { + value = sp_array_alignment::value + }; + typedef typename boost::type_with_alignment::type type; +}; + +template +inline U* +sp_array_start(void* base) BOOST_SP_NOEXCEPT +{ + enum { + size = sp_array_offset::value + }; + return reinterpret_cast(static_cast(base) + size); +} + +template +class sp_array_creator { + typedef typename A::value_type scalar; + + enum { + offset = sp_array_offset::value + }; + + typedef typename sp_array_storage::type type; + +public: + template + sp_array_creator(const U& other, std::size_t size) BOOST_SP_NOEXCEPT + : other_(other), + size_(sp_objects(offset + sizeof(scalar) * size)) { } + + T* create() { + return reinterpret_cast(other_.allocate(size_)); + } + + void destroy(T* base) { + other_.deallocate(reinterpret_cast(base), size_); + } + +private: + typename sp_bind_allocator::type other_; + std::size_t size_; +}; + +struct sp_default { }; + +template::value> +class sp_array_base + : public sp_counted_base { + typedef typename T::type allocator; + +public: + typedef typename allocator::value_type type; + + template + sp_array_base(const A& other, std::size_t size, type* start) + : state_(other, size) { + sp_array_construct(state_.allocator(), start, state_.size()); + } + + template + sp_array_base(const A& other, std::size_t size, const type* list, + std::size_t count, type* start) + : state_(other, size) { + sp_array_construct(state_.allocator(), start, state_.size(), list, + count); + } + + template + sp_array_base(sp_default, const A& other, std::size_t size, type* start) + : state_(other, size) { + sp_array_default(state_.allocator(), start, state_.size()); + } + + T& state() BOOST_SP_NOEXCEPT { + return state_; + } + + virtual void dispose() { + sp_array_destroy(state_.allocator(), + sp_array_start(this), state_.size()); + } + + virtual void destroy() { + sp_array_creator other(state_.allocator(), + state_.size()); + this->~sp_array_base(); + other.destroy(this); + } + + virtual void* get_deleter(const sp_typeinfo&) { + return 0; + } + + virtual void* get_local_deleter(const sp_typeinfo&) { + return 0; + } + + virtual void* get_untyped_deleter() { + return 0; + } + +private: + T state_; +}; + +template +struct sp_array_result { +public: + template + sp_array_result(const U& other, std::size_t size) + : creator_(other, size), + result_(creator_.create()) { } + + ~sp_array_result() { + if (result_) { + creator_.destroy(result_); + } + } + + T* get() const { + return result_; + } + + void release() { + result_ = 0; + } + +private: + sp_array_result(const sp_array_result&); + sp_array_result& operator=(const sp_array_result&); + + sp_array_creator creator_; + T* result_; +}; + +} /* detail */ + +template +inline typename detail::sp_if_array::type +allocate_shared(const A& allocator, std::size_t count) +{ + typedef typename detail::sp_array_element::type type; + typedef typename detail::sp_array_scalar::type scalar; + typedef typename detail::sp_bind_allocator::type other; + typedef detail::sp_array_state state; + typedef detail::sp_array_base base; + std::size_t size = count * detail::sp_array_count::value; + detail::sp_array_result result(allocator, size); + detail::sp_counted_base* node = result.get(); + scalar* start = detail::sp_array_start(node); + ::new(static_cast(node)) base(allocator, size, start); + result.release(); + return shared_ptr(detail::sp_internal_constructor_tag(), + reinterpret_cast(start), detail::shared_count(node)); +} + +template +inline typename detail::sp_if_size_array::type +allocate_shared(const A& allocator) +{ + enum { + size = detail::sp_array_count::value + }; + typedef typename detail::sp_array_element::type type; + typedef typename detail::sp_array_scalar::type scalar; + typedef typename detail::sp_bind_allocator::type other; + typedef detail::sp_size_array_state state; + typedef detail::sp_array_base base; + detail::sp_array_result result(allocator, size); + detail::sp_counted_base* node = result.get(); + scalar* start = detail::sp_array_start(node); + ::new(static_cast(node)) base(allocator, size, start); + result.release(); + return shared_ptr(detail::sp_internal_constructor_tag(), + reinterpret_cast(start), detail::shared_count(node)); +} + +template +inline typename detail::sp_if_array::type +allocate_shared(const A& allocator, std::size_t count, + const typename detail::sp_array_element::type& value) +{ + typedef typename detail::sp_array_element::type type; + typedef typename detail::sp_array_scalar::type scalar; + typedef typename detail::sp_bind_allocator::type other; + typedef detail::sp_array_state state; + typedef detail::sp_array_base base; + std::size_t size = count * detail::sp_array_count::value; + detail::sp_array_result result(allocator, size); + detail::sp_counted_base* node = result.get(); + scalar* start = detail::sp_array_start(node); + ::new(static_cast(node)) base(allocator, size, + reinterpret_cast(&value), + detail::sp_array_count::value, start); + result.release(); + return shared_ptr(detail::sp_internal_constructor_tag(), + reinterpret_cast(start), detail::shared_count(node)); +} + +template +inline typename detail::sp_if_size_array::type +allocate_shared(const A& allocator, + const typename detail::sp_array_element::type& value) +{ + enum { + size = detail::sp_array_count::value + }; + typedef typename detail::sp_array_element::type type; + typedef typename detail::sp_array_scalar::type scalar; + typedef typename detail::sp_bind_allocator::type other; + typedef detail::sp_size_array_state state; + typedef detail::sp_array_base base; + detail::sp_array_result result(allocator, size); + detail::sp_counted_base* node = result.get(); + scalar* start = detail::sp_array_start(node); + ::new(static_cast(node)) base(allocator, size, + reinterpret_cast(&value), + detail::sp_array_count::value, start); + result.release(); + return shared_ptr(detail::sp_internal_constructor_tag(), + reinterpret_cast(start), detail::shared_count(node)); +} + +template +inline typename detail::sp_if_array::type +allocate_shared_noinit(const A& allocator, std::size_t count) +{ + typedef typename detail::sp_array_element::type type; + typedef typename detail::sp_array_scalar::type scalar; + typedef typename detail::sp_bind_allocator::type other; + typedef detail::sp_array_state state; + typedef detail::sp_array_base base; + std::size_t size = count * detail::sp_array_count::value; + detail::sp_array_result result(allocator, size); + detail::sp_counted_base* node = result.get(); + scalar* start = detail::sp_array_start(node); + ::new(static_cast(node)) base(detail::sp_default(), allocator, + size, start); + result.release(); + return shared_ptr(detail::sp_internal_constructor_tag(), + reinterpret_cast(start), detail::shared_count(node)); +} + +template +inline typename detail::sp_if_size_array::type +allocate_shared_noinit(const A& allocator) +{ + enum { + size = detail::sp_array_count::value + }; + typedef typename detail::sp_array_element::type type; + typedef typename detail::sp_array_scalar::type scalar; + typedef typename detail::sp_bind_allocator::type other; + typedef detail::sp_size_array_state state; + typedef detail::sp_array_base base; + detail::sp_array_result result(allocator, size); + detail::sp_counted_base* node = result.get(); + scalar* start = detail::sp_array_start(node); + ::new(static_cast(node)) base(detail::sp_default(), allocator, + size, start); + result.release(); + return shared_ptr(detail::sp_internal_constructor_tag(), + reinterpret_cast(start), detail::shared_count(node)); +} + +} /* boost */ + +#endif diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/bad_weak_ptr.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/bad_weak_ptr.hpp new file mode 100644 index 00000000000..0105ca4cb0e --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/bad_weak_ptr.hpp @@ -0,0 +1,70 @@ +#ifndef BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED +#define BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/smart_ptr/bad_weak_ptr.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include +#include + +#ifdef __BORLANDC__ +# pragma warn -8026 // Functions with excep. spec. are not expanded inline +#endif + +namespace boost +{ + +// The standard library that comes with Borland C++ 5.5.1, 5.6.4 +// defines std::exception and its members as having C calling +// convention (-pc). When the definition of bad_weak_ptr +// is compiled with -ps, the compiler issues an error. +// Hence, the temporary #pragma option -pc below. + +#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564 +# pragma option push -pc +#endif + +#if defined(BOOST_CLANG) +// Intel C++ on Mac defines __clang__ but doesn't support the pragma +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wweak-vtables" +#endif + +class bad_weak_ptr: public std::exception +{ +public: + + virtual char const * what() const noexcept + { + return "tr1::bad_weak_ptr"; + } +}; + +#if defined(BOOST_CLANG) +# pragma clang diagnostic pop +#endif + +#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564 +# pragma option pop +#endif + +} // namespace boost + +#ifdef __BORLANDC__ +# pragma warn .8026 // Functions with excep. spec. are not expanded inline +#endif + +#endif // #ifndef BOOST_SMART_PTR_BAD_WEAK_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count.hpp new file mode 100644 index 00000000000..6e4f71aa8e8 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count.hpp @@ -0,0 +1,99 @@ +#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/atomic_count.hpp - thread/SMP safe reference counter +// +// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2013 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// typedef boost::detail::atomic_count; +// +// atomic_count a(n); +// +// (n is convertible to long) +// +// Effects: Constructs an atomic_count with an initial value of n +// +// a; +// +// Returns: (long) the current value of a +// Memory Ordering: acquire +// +// ++a; +// +// Effects: Atomically increments the value of a +// Returns: (long) the new value of a +// Memory Ordering: acquire/release +// +// --a; +// +// Effects: Atomically decrements the value of a +// Returns: (long) the new value of a +// Memory Ordering: acquire/release +// + +#include +#include + +#if defined( BOOST_AC_DISABLE_THREADS ) +# include + +#elif defined( BOOST_AC_USE_STD_ATOMIC ) +# include + +#elif defined( BOOST_AC_USE_SPINLOCK ) +# include + +#elif defined( BOOST_AC_USE_PTHREADS ) +# include + +#elif defined( BOOST_SP_DISABLE_THREADS ) +# include + +#elif defined( BOOST_SP_USE_STD_ATOMIC ) +# include + +#elif defined( BOOST_SP_USE_SPINLOCK ) +# include + +#elif defined( BOOST_SP_USE_PTHREADS ) +# include + +#elif defined( BOOST_DISABLE_THREADS ) && !defined( BOOST_SP_ENABLE_THREADS ) && !defined( BOOST_DISABLE_WIN32 ) +# include + +#elif !defined( BOOST_NO_CXX11_HDR_ATOMIC ) +# include + +#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) && !defined( __PATHSCALE__ ) +# include + +#elif defined( BOOST_SP_HAS_SYNC ) +# include + +#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# include + +#elif defined(__GLIBCPP__) || defined(__GLIBCXX__) +# include + +#elif !defined( BOOST_HAS_THREADS ) +# include + +#else +# include + +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_gcc.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_gcc.hpp new file mode 100644 index 00000000000..df7e32365f4 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_gcc.hpp @@ -0,0 +1,72 @@ +#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED + +// +// boost/detail/atomic_count_gcc.hpp +// +// atomic_count for GNU libstdc++ v3 +// +// http://gcc.gnu.org/onlinedocs/porting/Thread-safety.html +// +// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2002 Lars Gullik Bjønnes +// Copyright 2003-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#if __GNUC__ * 100 + __GNUC_MINOR__ >= 402 +# include +#else +# include +#endif + +namespace boost +{ + +namespace detail +{ + +#if defined(__GLIBCXX__) // g++ 3.4+ + +using __gnu_cxx::__atomic_add; +using __gnu_cxx::__exchange_and_add; + +#endif + +class atomic_count +{ +public: + + explicit atomic_count( long v ) : value_( v ) {} + + long operator++() + { + return __exchange_and_add( &value_, +1 ) + 1; + } + + long operator--() + { + return __exchange_and_add( &value_, -1 ) - 1; + } + + operator long() const + { + return __exchange_and_add( &value_, 0 ); + } + +private: + + atomic_count(atomic_count const &); + atomic_count & operator=(atomic_count const &); + + mutable _Atomic_word value_; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp new file mode 100644 index 00000000000..5c44d7c1efa --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp @@ -0,0 +1,77 @@ +#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_X86_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_X86_HPP_INCLUDED + +// +// boost/detail/atomic_count_gcc_x86.hpp +// +// atomic_count for g++ on 486+/AMD64 +// +// Copyright 2007 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +namespace boost +{ + +namespace detail +{ + +class atomic_count +{ +public: + + explicit atomic_count( long v ) : value_( static_cast< int >( v ) ) {} + + long operator++() + { + return atomic_exchange_and_add( &value_, +1 ) + 1; + } + + long operator--() + { + return atomic_exchange_and_add( &value_, -1 ) - 1; + } + + operator long() const + { + return atomic_exchange_and_add( &value_, 0 ); + } + +private: + + atomic_count(atomic_count const &); + atomic_count & operator=(atomic_count const &); + + mutable int value_; + +private: + + static int atomic_exchange_and_add( int * pw, int dv ) + { + // int r = *pw; + // *pw += dv; + // return r; + + int r; + + __asm__ __volatile__ + ( + "lock\n\t" + "xadd %1, %0": + "+m"( *pw ), "=r"( r ): // outputs (%0, %1) + "1"( dv ): // inputs (%2 == %1) + "memory", "cc" // clobbers + ); + + return r; + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_X86_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_nt.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_nt.hpp new file mode 100644 index 00000000000..3bbf1389135 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_nt.hpp @@ -0,0 +1,59 @@ +#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_NT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_NT_HPP_INCLUDED + +// +// boost/detail/atomic_count_nt.hpp +// +// Trivial atomic_count for the single-threaded case +// +// http://gcc.gnu.org/onlinedocs/porting/Thread-safety.html +// +// Copyright 2013 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// + +namespace boost +{ + +namespace detail +{ + +class atomic_count +{ +public: + + explicit atomic_count( long v ): value_( v ) + { + } + + long operator++() + { + return ++value_; + } + + long operator--() + { + return --value_; + } + + operator long() const + { + return value_; + } + +private: + + atomic_count(atomic_count const &); + atomic_count & operator=(atomic_count const &); + + long value_; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_NT_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_pt.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_pt.hpp new file mode 100644 index 00000000000..f99b9108e3f --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_pt.hpp @@ -0,0 +1,97 @@ +#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_PTHREADS_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_PTHREADS_HPP_INCLUDED + +// +// boost/detail/atomic_count_pthreads.hpp +// +// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include +#include + +// +// The generic pthread_mutex-based implementation sometimes leads to +// inefficiencies. Example: a class with two atomic_count members +// can get away with a single mutex. +// +// Users can detect this situation by checking BOOST_AC_USE_PTHREADS. +// + +namespace boost +{ + +namespace detail +{ + +class atomic_count +{ +private: + + class scoped_lock + { + public: + + scoped_lock(pthread_mutex_t & m): m_(m) + { + BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); + } + + ~scoped_lock() + { + BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); + } + + private: + + pthread_mutex_t & m_; + }; + +public: + + explicit atomic_count(long v): value_(v) + { + BOOST_VERIFY( pthread_mutex_init( &mutex_, 0 ) == 0 ); + } + + ~atomic_count() + { + BOOST_VERIFY( pthread_mutex_destroy( &mutex_ ) == 0 ); + } + + long operator++() + { + scoped_lock lock(mutex_); + return ++value_; + } + + long operator--() + { + scoped_lock lock(mutex_); + return --value_; + } + + operator long() const + { + scoped_lock lock(mutex_); + return value_; + } + +private: + + atomic_count(atomic_count const &); + atomic_count & operator=(atomic_count const &); + + mutable pthread_mutex_t mutex_; + long value_; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_PTHREADS_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_spin.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_spin.hpp new file mode 100644 index 00000000000..8e623496bf0 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_spin.hpp @@ -0,0 +1,62 @@ +#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SPIN_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SPIN_HPP_INCLUDED + +// +// boost/detail/atomic_count_spin.hpp +// +// Copyright (c) 2013 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// + +#include + +namespace boost +{ + +namespace detail +{ + +class atomic_count +{ +private: + +public: + + explicit atomic_count( long v ): value_( v ) + { + } + + long operator++() + { + spinlock_pool<0>::scoped_lock lock( &value_ ); + return ++value_; + } + + long operator--() + { + spinlock_pool<0>::scoped_lock lock( &value_ ); + return --value_; + } + + operator long() const + { + spinlock_pool<0>::scoped_lock lock( &value_ ); + return value_; + } + +private: + + atomic_count(atomic_count const &); + atomic_count & operator=(atomic_count const &); + + long value_; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SPIN_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_std_atomic.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_std_atomic.hpp new file mode 100644 index 00000000000..55b9998e52a --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_std_atomic.hpp @@ -0,0 +1,60 @@ +#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_STD_ATOMIC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_STD_ATOMIC_HPP_INCLUDED + +// +// boost/detail/atomic_count_std_atomic.hpp +// +// atomic_count for std::atomic +// +// Copyright 2013 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// + +#include +#include + +namespace boost +{ + +namespace detail +{ + +class atomic_count +{ +public: + + explicit atomic_count( long v ): value_( v ) + { + } + + long operator++() + { + return value_.fetch_add( 1, std::memory_order_acq_rel ) + 1; + } + + long operator--() + { + return value_.fetch_sub( 1, std::memory_order_acq_rel ) - 1; + } + + operator long() const + { + return value_.load( std::memory_order_acquire ); + } + +private: + + atomic_count(atomic_count const &); + atomic_count & operator=(atomic_count const &); + + std::atomic_int_least32_t value_; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_STD_ATOMIC_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_sync.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_sync.hpp new file mode 100644 index 00000000000..b6359b5bcf0 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_sync.hpp @@ -0,0 +1,61 @@ +#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED + +// +// boost/detail/atomic_count_sync.hpp +// +// atomic_count for g++ 4.1+ +// +// http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Atomic-Builtins.html +// +// Copyright 2007 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#if defined( __ia64__ ) && defined( __INTEL_COMPILER ) +# include +#endif + +namespace boost +{ + +namespace detail +{ + +class atomic_count +{ +public: + + explicit atomic_count( long v ) : value_( v ) {} + + long operator++() + { + return __sync_add_and_fetch( &value_, 1 ); + } + + long operator--() + { + return __sync_add_and_fetch( &value_, -1 ); + } + + operator long() const + { + return __sync_fetch_and_add( &value_, 0 ); + } + +private: + + atomic_count(atomic_count const &); + atomic_count & operator=(atomic_count const &); + + mutable long value_; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_win32.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_win32.hpp new file mode 100644 index 00000000000..633e73c3c0a --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/atomic_count_win32.hpp @@ -0,0 +1,63 @@ +#ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/atomic_count_win32.hpp +// +// Copyright (c) 2001-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +namespace boost +{ + +namespace detail +{ + +class atomic_count +{ +public: + + explicit atomic_count( long v ): value_( v ) + { + } + + long operator++() + { + return BOOST_SP_INTERLOCKED_INCREMENT( &value_ ); + } + + long operator--() + { + return BOOST_SP_INTERLOCKED_DECREMENT( &value_ ); + } + + operator long() const + { + return static_cast( value_ ); + } + +private: + + atomic_count( atomic_count const & ); + atomic_count & operator=( atomic_count const & ); + + long value_; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lightweight_mutex.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lightweight_mutex.hpp new file mode 100644 index 00000000000..d46b1932c2b --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lightweight_mutex.hpp @@ -0,0 +1,42 @@ +#ifndef BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/lightweight_mutex.hpp - lightweight mutex +// +// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// typedef boost::detail::lightweight_mutex; +// +// boost::detail::lightweight_mutex is a header-only implementation of +// a subset of the Mutex concept requirements: +// +// http://www.boost.org/doc/html/threads/concepts.html#threads.concepts.Mutex +// +// It maps to a CRITICAL_SECTION on Windows or a pthread_mutex on POSIX. +// + +#include + +#if !defined(BOOST_HAS_THREADS) +# include +#elif defined(BOOST_HAS_PTHREADS) +# include +#elif defined(BOOST_HAS_WINTHREADS) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# include +#else +// Use #define BOOST_DISABLE_THREADS to avoid the error +# error Unrecognized threading platform +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/local_counted_base.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/local_counted_base.hpp new file mode 100644 index 00000000000..fdfe2c65cd2 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/local_counted_base.hpp @@ -0,0 +1,148 @@ +#ifndef BOOST_SMART_PTR_DETAIL_LOCAL_COUNTED_BASE_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_LOCAL_COUNTED_BASE_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/local_counted_base.hpp +// +// Copyright 2017 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. + +#include +#include +#include + +namespace boost +{ + +namespace detail +{ + +class local_counted_base +{ +private: + + local_counted_base & operator= ( local_counted_base const & ); + +private: + + // not 'int' or 'unsigned' to avoid aliasing and enable optimizations + enum count_type { min_ = 0, initial_ = 1, max_ = 2147483647 }; + + count_type local_use_count_; + +public: + + BOOST_CONSTEXPR local_counted_base() BOOST_SP_NOEXCEPT: local_use_count_( initial_ ) + { + } + + BOOST_CONSTEXPR local_counted_base( local_counted_base const & ) BOOST_SP_NOEXCEPT: local_use_count_( initial_ ) + { + } + + virtual ~local_counted_base() /*BOOST_SP_NOEXCEPT*/ + { + } + + virtual void local_cb_destroy() BOOST_SP_NOEXCEPT = 0; + + virtual boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT = 0; + + void add_ref() BOOST_SP_NOEXCEPT + { +#if !defined(__NVCC__) +#if defined( __has_builtin ) +# if __has_builtin( __builtin_assume ) + + __builtin_assume( local_use_count_ >= 1 ); + +# endif +#endif +#endif + + local_use_count_ = static_cast( local_use_count_ + 1 ); + } + + void release() BOOST_SP_NOEXCEPT + { + local_use_count_ = static_cast( local_use_count_ - 1 ); + + if( local_use_count_ == 0 ) + { + local_cb_destroy(); + } + } + + long local_use_count() const BOOST_SP_NOEXCEPT + { + return local_use_count_; + } +}; + +class local_counted_impl: public local_counted_base +{ +private: + + local_counted_impl( local_counted_impl const & ); + +private: + + shared_count pn_; + +public: + + explicit local_counted_impl( shared_count const& pn ): pn_( pn ) + { + } + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + explicit local_counted_impl( shared_count && pn ): pn_( std::move(pn) ) + { + } + +#endif + + virtual void local_cb_destroy() BOOST_SP_NOEXCEPT + { + delete this; + } + + virtual boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT + { + return pn_; + } +}; + +class local_counted_impl_em: public local_counted_base +{ +public: + + shared_count pn_; + + virtual void local_cb_destroy() BOOST_SP_NOEXCEPT + { + shared_count().swap( pn_ ); + } + + virtual boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT + { + return pn_; + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_LOCAL_COUNTED_BASE_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/local_sp_deleter.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/local_sp_deleter.hpp new file mode 100644 index 00000000000..7d04f1dc527 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/local_sp_deleter.hpp @@ -0,0 +1,91 @@ +#ifndef BOOST_SMART_PTR_DETAIL_LOCAL_SP_DELETER_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_LOCAL_SP_DELETER_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/local_sp_deleter.hpp +// +// Copyright 2017 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. + +#include +#include + +namespace boost +{ + +namespace detail +{ + +template class local_sp_deleter: public local_counted_impl_em +{ +private: + + D d_; + +public: + + local_sp_deleter(): d_() + { + } + + explicit local_sp_deleter( D const& d ) BOOST_SP_NOEXCEPT: d_( d ) + { + } + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + explicit local_sp_deleter( D&& d ) BOOST_SP_NOEXCEPT: d_( std::move(d) ) + { + } + +#endif + + D& deleter() + { + return d_; + } + + template void operator()( Y* p ) BOOST_SP_NOEXCEPT + { + d_( p ); + } + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + + void operator()( boost::detail::sp_nullptr_t p ) BOOST_SP_NOEXCEPT + { + d_( p ); + } + +#endif +}; + +template<> class local_sp_deleter +{ +}; + +template D * get_local_deleter( local_sp_deleter * p ) +{ + return &p->deleter(); +} + +inline void * get_local_deleter( local_sp_deleter * /*p*/ ) +{ + return 0; +} + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_LOCAL_SP_DELETER_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_nop.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_nop.hpp new file mode 100644 index 00000000000..521a88ec1cd --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_nop.hpp @@ -0,0 +1,37 @@ +#ifndef BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/lwm_nop.hpp +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +namespace boost +{ + +namespace detail +{ + +class lightweight_mutex +{ +public: + + typedef lightweight_mutex scoped_lock; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_pthreads.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_pthreads.hpp new file mode 100644 index 00000000000..8eda5182338 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_pthreads.hpp @@ -0,0 +1,87 @@ +#ifndef BOOST_SMART_PTR_DETAIL_LWM_PTHREADS_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_LWM_PTHREADS_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/lwm_pthreads.hpp +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include +#include + +namespace boost +{ + +namespace detail +{ + +class lightweight_mutex +{ +private: + + pthread_mutex_t m_; + + lightweight_mutex(lightweight_mutex const &); + lightweight_mutex & operator=(lightweight_mutex const &); + +public: + + lightweight_mutex() + { + +// HPUX 10.20 / DCE has a nonstandard pthread_mutex_init + +#if defined(__hpux) && defined(_DECTHREADS_) + BOOST_VERIFY( pthread_mutex_init( &m_, pthread_mutexattr_default ) == 0 ); +#else + BOOST_VERIFY( pthread_mutex_init( &m_, 0 ) == 0 ); +#endif + } + + ~lightweight_mutex() + { + BOOST_VERIFY( pthread_mutex_destroy( &m_ ) == 0 ); + } + + class scoped_lock; + friend class scoped_lock; + + class scoped_lock + { + private: + + pthread_mutex_t & m_; + + scoped_lock(scoped_lock const &); + scoped_lock & operator=(scoped_lock const &); + + public: + + scoped_lock(lightweight_mutex & m): m_(m.m_) + { + BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); + } + + ~scoped_lock() + { + BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); + } + }; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_PTHREADS_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_win32_cs.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_win32_cs.hpp new file mode 100644 index 00000000000..25b1f195b74 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/lwm_win32_cs.hpp @@ -0,0 +1,134 @@ +#ifndef BOOST_SMART_PTR_DETAIL_LWM_WIN32_CS_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_LWM_WIN32_CS_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/lwm_win32_cs.hpp +// +// Copyright (c) 2002, 2003 Peter Dimov +// Copyright (c) Microsoft Corporation 2014 +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +#ifdef BOOST_USE_WINDOWS_H + +#include + +#else + +struct _RTL_CRITICAL_SECTION; + +#endif + +namespace boost +{ + +namespace detail +{ + +#ifndef BOOST_USE_WINDOWS_H + +struct critical_section +{ + struct critical_section_debug * DebugInfo; + long LockCount; + long RecursionCount; + void * OwningThread; + void * LockSemaphore; +#if defined(_WIN64) + unsigned __int64 SpinCount; +#else + unsigned long SpinCount; +#endif +}; + +#if BOOST_PLAT_WINDOWS_RUNTIME +extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSectionEx(::_RTL_CRITICAL_SECTION *, unsigned long, unsigned long); +#else +extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSection(::_RTL_CRITICAL_SECTION *); +#endif +extern "C" __declspec(dllimport) void __stdcall EnterCriticalSection(::_RTL_CRITICAL_SECTION *); +extern "C" __declspec(dllimport) void __stdcall LeaveCriticalSection(::_RTL_CRITICAL_SECTION *); +extern "C" __declspec(dllimport) void __stdcall DeleteCriticalSection(::_RTL_CRITICAL_SECTION *); + +#else + +typedef ::CRITICAL_SECTION critical_section; + +#if BOOST_PLAT_WINDOWS_RUNTIME +using ::InitializeCriticalSectionEx; +#else +using ::InitializeCriticalSection; +#endif +using ::EnterCriticalSection; +using ::LeaveCriticalSection; +using ::DeleteCriticalSection; + +#endif // #ifndef BOOST_USE_WINDOWS_H + +class lightweight_mutex +{ +private: + + critical_section cs_; + + lightweight_mutex(lightweight_mutex const &); + lightweight_mutex & operator=(lightweight_mutex const &); + +public: + + lightweight_mutex() + { +#if BOOST_PLAT_WINDOWS_RUNTIME + boost::detail::InitializeCriticalSectionEx(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_), 4000, 0); +#else + boost::detail::InitializeCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_)); +#endif + } + + ~lightweight_mutex() + { + boost::detail::DeleteCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&cs_)); + } + + class scoped_lock; + friend class scoped_lock; + + class scoped_lock + { + private: + + lightweight_mutex & m_; + + scoped_lock(scoped_lock const &); + scoped_lock & operator=(scoped_lock const &); + + public: + + explicit scoped_lock(lightweight_mutex & m): m_(m) + { + boost::detail::EnterCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&m_.cs_)); + } + + ~scoped_lock() + { + boost::detail::LeaveCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&m_.cs_)); + } + }; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_WIN32_CS_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/operator_bool.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/operator_bool.hpp new file mode 100644 index 00000000000..f9c5ef68036 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/operator_bool.hpp @@ -0,0 +1,64 @@ +// This header intentionally has no include guards. +// +// Copyright (c) 2001-2009, 2012 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#if !defined( BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS ) && !defined( BOOST_NO_CXX11_NULLPTR )\ + && !(defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x5130)) + + explicit operator bool () const BOOST_SP_NOEXCEPT + { + return px != 0; + } + +#elif ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__) + + operator bool () const BOOST_SP_NOEXCEPT + { + return px != 0; + } + +#elif defined( _MANAGED ) + + static void unspecified_bool( this_type*** ) + { + } + + typedef void (*unspecified_bool_type)( this_type*** ); + + operator unspecified_bool_type() const BOOST_SP_NOEXCEPT + { + return px == 0? 0: unspecified_bool; + } + +#elif \ + ( defined(__MWERKS__) && BOOST_WORKAROUND(__MWERKS__, < 0x3200) ) || \ + ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) || \ + ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) ) + + typedef element_type * (this_type::*unspecified_bool_type)() const; + + operator unspecified_bool_type() const BOOST_SP_NOEXCEPT + { + return px == 0? 0: &this_type::get; + } + +#else + + typedef element_type * this_type::*unspecified_bool_type; + + operator unspecified_bool_type() const BOOST_SP_NOEXCEPT + { + return px == 0? 0: &this_type::px; + } + +#endif + + // operator! is redundant, but some compilers need it + bool operator! () const BOOST_SP_NOEXCEPT + { + return px == 0; + } diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/quick_allocator.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/quick_allocator.hpp new file mode 100644 index 00000000000..159bd5e7aa8 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/quick_allocator.hpp @@ -0,0 +1,199 @@ +#ifndef BOOST_SMART_PTR_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/quick_allocator.hpp +// +// Copyright (c) 2003 David Abrahams +// Copyright (c) 2003 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +#include +#include +#include + +#include // ::operator new, ::operator delete +#include // std::size_t + +namespace boost +{ + +namespace detail +{ + +template union freeblock +{ + typedef typename boost::type_with_alignment::type aligner_type; + aligner_type aligner; + char bytes[size]; + freeblock * next; +}; + +template struct allocator_impl +{ + typedef freeblock block; + + // It may seem odd to use such small pages. + // + // However, on a typical Windows implementation that uses + // the OS allocator, "normal size" pages interact with the + // "ordinary" operator new, slowing it down dramatically. + // + // 512 byte pages are handled by the small object allocator, + // and don't interfere with ::new. + // + // The other alternative is to use much bigger pages (1M.) + // + // It is surprisingly easy to hit pathological behavior by + // varying the page size. g++ 2.96 on Red Hat Linux 7.2, + // for example, passionately dislikes 496. 512 seems OK. + +#if defined(BOOST_QA_PAGE_SIZE) + + enum { items_per_page = BOOST_QA_PAGE_SIZE / size }; + +#else + + enum { items_per_page = 512 / size }; // 1048560 / size + +#endif + +#ifdef BOOST_HAS_THREADS + + static lightweight_mutex & mutex() + { + static freeblock< sizeof( lightweight_mutex ), boost::alignment_of< lightweight_mutex >::value > fbm; + static lightweight_mutex * pm = new( &fbm ) lightweight_mutex; + return *pm; + } + + static lightweight_mutex * mutex_init; + +#endif + + static block * free; + static block * page; + static unsigned last; + + static inline void * alloc() + { +#ifdef BOOST_HAS_THREADS + lightweight_mutex::scoped_lock lock( mutex() ); +#endif + if(block * x = free) + { + free = x->next; + return x; + } + else + { + if(last == items_per_page) + { + // "Listen to me carefully: there is no memory leak" + // -- Scott Meyers, Eff C++ 2nd Ed Item 10 + page = ::new block[items_per_page]; + last = 0; + } + + return &page[last++]; + } + } + + static inline void * alloc(std::size_t n) + { + if(n != size) // class-specific new called for a derived object + { + return ::operator new(n); + } + else + { +#ifdef BOOST_HAS_THREADS + lightweight_mutex::scoped_lock lock( mutex() ); +#endif + if(block * x = free) + { + free = x->next; + return x; + } + else + { + if(last == items_per_page) + { + page = ::new block[items_per_page]; + last = 0; + } + + return &page[last++]; + } + } + } + + static inline void dealloc(void * pv) + { + if(pv != 0) // 18.4.1.1/13 + { +#ifdef BOOST_HAS_THREADS + lightweight_mutex::scoped_lock lock( mutex() ); +#endif + block * pb = static_cast(pv); + pb->next = free; + free = pb; + } + } + + static inline void dealloc(void * pv, std::size_t n) + { + if(n != size) // class-specific delete called for a derived object + { + ::operator delete(pv); + } + else if(pv != 0) // 18.4.1.1/13 + { +#ifdef BOOST_HAS_THREADS + lightweight_mutex::scoped_lock lock( mutex() ); +#endif + block * pb = static_cast(pv); + pb->next = free; + free = pb; + } + } +}; + +#ifdef BOOST_HAS_THREADS + +template + lightweight_mutex * allocator_impl::mutex_init = &allocator_impl::mutex(); + +#endif + +template + freeblock * allocator_impl::free = 0; + +template + freeblock * allocator_impl::page = 0; + +template + unsigned allocator_impl::last = allocator_impl::items_per_page; + +template +struct quick_allocator: public allocator_impl< sizeof(T), boost::alignment_of::value > +{ +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/shared_count.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/shared_count.hpp new file mode 100644 index 00000000000..ae7d0fb46f0 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/shared_count.hpp @@ -0,0 +1,667 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SHARED_COUNT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SHARED_COUNT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/shared_count.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#ifdef __BORLANDC__ +# pragma warn -8027 // Functions containing try are not expanded inline +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +// In order to avoid circular dependencies with Boost.TR1 +// we make sure that our include of doesn't try to +// pull in the TR1 headers: that's why we use this header +// rather than including directly: +#include // std::auto_ptr +#include // std::less + +#ifdef BOOST_NO_EXCEPTIONS +# include // std::bad_alloc +#endif + +#include + +#if defined( BOOST_SP_DISABLE_DEPRECATED ) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + +namespace boost +{ + +namespace movelib +{ + +template< class T, class D > class unique_ptr; + +} // namespace movelib + +namespace detail +{ + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + +int const shared_count_id = 0x2C35F101; +int const weak_count_id = 0x298C38A4; + +#endif + +struct sp_nothrow_tag {}; + +template< class D > struct sp_inplace_tag +{ +}; + +template< class T > class sp_reference_wrapper +{ +public: + + explicit sp_reference_wrapper( T & t): t_( boost::addressof( t ) ) + { + } + + template< class Y > void operator()( Y * p ) const + { + (*t_)( p ); + } + +private: + + T * t_; +}; + +template< class D > struct sp_convert_reference +{ + typedef D type; +}; + +template< class D > struct sp_convert_reference< D& > +{ + typedef sp_reference_wrapper< D > type; +}; + +class weak_count; + +class shared_count +{ +private: + + sp_counted_base * pi_; + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + int id_; +#endif + + friend class weak_count; + +public: + + BOOST_CONSTEXPR shared_count(): pi_(0) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + } + + BOOST_CONSTEXPR explicit shared_count( sp_counted_base * pi ): pi_( pi ) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + } + + template explicit shared_count( Y * p ): pi_( 0 ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { +#ifndef BOOST_NO_EXCEPTIONS + + try + { + pi_ = new sp_counted_impl_p( p ); + } + catch(...) + { + boost::checked_delete( p ); + throw; + } + +#else + + pi_ = new sp_counted_impl_p( p ); + + if( pi_ == 0 ) + { + boost::checked_delete( p ); + boost::throw_exception( std::bad_alloc() ); + } + +#endif + } + +#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) + template shared_count( Y * p, D d ): pi_(0) +#else + template shared_count( P p, D d ): pi_(0) +#endif +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { +#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) + typedef Y* P; +#endif +#ifndef BOOST_NO_EXCEPTIONS + + try + { + pi_ = new sp_counted_impl_pd(p, d); + } + catch(...) + { + d(p); // delete p + throw; + } + +#else + + pi_ = new sp_counted_impl_pd(p, d); + + if(pi_ == 0) + { + d(p); // delete p + boost::throw_exception(std::bad_alloc()); + } + +#endif + } + +#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) + + template< class P, class D > shared_count( P p, sp_inplace_tag ): pi_( 0 ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { +#ifndef BOOST_NO_EXCEPTIONS + + try + { + pi_ = new sp_counted_impl_pd< P, D >( p ); + } + catch( ... ) + { + D::operator_fn( p ); // delete p + throw; + } + +#else + + pi_ = new sp_counted_impl_pd< P, D >( p ); + + if( pi_ == 0 ) + { + D::operator_fn( p ); // delete p + boost::throw_exception( std::bad_alloc() ); + } + +#endif // #ifndef BOOST_NO_EXCEPTIONS + } + +#endif // !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) + + template shared_count( P p, D d, A a ): pi_( 0 ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + typedef sp_counted_impl_pda impl_type; + +#if !defined( BOOST_NO_CXX11_ALLOCATOR ) + + typedef typename std::allocator_traits::template rebind_alloc< impl_type > A2; + +#else + + typedef typename A::template rebind< impl_type >::other A2; + +#endif + + A2 a2( a ); + +#ifndef BOOST_NO_EXCEPTIONS + + try + { + pi_ = a2.allocate( 1 ); + ::new( static_cast< void* >( pi_ ) ) impl_type( p, d, a ); + } + catch(...) + { + d( p ); + + if( pi_ != 0 ) + { + a2.deallocate( static_cast< impl_type* >( pi_ ), 1 ); + } + + throw; + } + +#else + + pi_ = a2.allocate( 1 ); + + if( pi_ != 0 ) + { + ::new( static_cast< void* >( pi_ ) ) impl_type( p, d, a ); + } + else + { + d( p ); + boost::throw_exception( std::bad_alloc() ); + } + +#endif + } + +#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) + + template< class P, class D, class A > shared_count( P p, sp_inplace_tag< D >, A a ): pi_( 0 ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + typedef sp_counted_impl_pda< P, D, A > impl_type; + +#if !defined( BOOST_NO_CXX11_ALLOCATOR ) + + typedef typename std::allocator_traits::template rebind_alloc< impl_type > A2; + +#else + + typedef typename A::template rebind< impl_type >::other A2; + +#endif + + A2 a2( a ); + +#ifndef BOOST_NO_EXCEPTIONS + + try + { + pi_ = a2.allocate( 1 ); + ::new( static_cast< void* >( pi_ ) ) impl_type( p, a ); + } + catch(...) + { + D::operator_fn( p ); + + if( pi_ != 0 ) + { + a2.deallocate( static_cast< impl_type* >( pi_ ), 1 ); + } + + throw; + } + +#else + + pi_ = a2.allocate( 1 ); + + if( pi_ != 0 ) + { + ::new( static_cast< void* >( pi_ ) ) impl_type( p, a ); + } + else + { + D::operator_fn( p ); + boost::throw_exception( std::bad_alloc() ); + } + +#endif // #ifndef BOOST_NO_EXCEPTIONS + } + +#endif // !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) + +#ifndef BOOST_NO_AUTO_PTR + + // auto_ptr is special cased to provide the strong guarantee + + template + explicit shared_count( std::auto_ptr & r ): pi_( new sp_counted_impl_p( r.get() ) ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { +#ifdef BOOST_NO_EXCEPTIONS + + if( pi_ == 0 ) + { + boost::throw_exception(std::bad_alloc()); + } + +#endif + + r.release(); + } + +#endif + +#if !defined( BOOST_NO_CXX11_SMART_PTR ) + + template + explicit shared_count( std::unique_ptr & r ): pi_( 0 ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + typedef typename sp_convert_reference::type D2; + + D2 d2( r.get_deleter() ); + pi_ = new sp_counted_impl_pd< typename std::unique_ptr::pointer, D2 >( r.get(), d2 ); + +#ifdef BOOST_NO_EXCEPTIONS + + if( pi_ == 0 ) + { + boost::throw_exception( std::bad_alloc() ); + } + +#endif + + r.release(); + } + +#endif + + template + explicit shared_count( boost::movelib::unique_ptr & r ): pi_( 0 ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + typedef typename sp_convert_reference::type D2; + + D2 d2( r.get_deleter() ); + pi_ = new sp_counted_impl_pd< typename boost::movelib::unique_ptr::pointer, D2 >( r.get(), d2 ); + +#ifdef BOOST_NO_EXCEPTIONS + + if( pi_ == 0 ) + { + boost::throw_exception( std::bad_alloc() ); + } + +#endif + + r.release(); + } + + ~shared_count() // nothrow + { + if( pi_ != 0 ) pi_->release(); +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + id_ = 0; +#endif + } + + shared_count(shared_count const & r): pi_(r.pi_) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + if( pi_ != 0 ) pi_->add_ref_copy(); + } + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + shared_count(shared_count && r): pi_(r.pi_) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + r.pi_ = 0; + } + +#endif + + explicit shared_count(weak_count const & r); // throws bad_weak_ptr when r.use_count() == 0 + shared_count( weak_count const & r, sp_nothrow_tag ); // constructs an empty *this when r.use_count() == 0 + + shared_count & operator= (shared_count const & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + + if( tmp != pi_ ) + { + if( tmp != 0 ) tmp->add_ref_copy(); + if( pi_ != 0 ) pi_->release(); + pi_ = tmp; + } + + return *this; + } + + void swap(shared_count & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + r.pi_ = pi_; + pi_ = tmp; + } + + long use_count() const // nothrow + { + return pi_ != 0? pi_->use_count(): 0; + } + + bool unique() const // nothrow + { + return use_count() == 1; + } + + bool empty() const // nothrow + { + return pi_ == 0; + } + + friend inline bool operator==(shared_count const & a, shared_count const & b) + { + return a.pi_ == b.pi_; + } + + friend inline bool operator<(shared_count const & a, shared_count const & b) + { + return std::less()( a.pi_, b.pi_ ); + } + + void * get_deleter( sp_typeinfo const & ti ) const + { + return pi_? pi_->get_deleter( ti ): 0; + } + + void * get_local_deleter( sp_typeinfo const & ti ) const + { + return pi_? pi_->get_local_deleter( ti ): 0; + } + + void * get_untyped_deleter() const + { + return pi_? pi_->get_untyped_deleter(): 0; + } +}; + + +class weak_count +{ +private: + + sp_counted_base * pi_; + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + int id_; +#endif + + friend class shared_count; + +public: + + BOOST_CONSTEXPR weak_count(): pi_(0) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(weak_count_id) +#endif + { + } + + weak_count(shared_count const & r): pi_(r.pi_) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(weak_count_id) +#endif + { + if(pi_ != 0) pi_->weak_add_ref(); + } + + weak_count(weak_count const & r): pi_(r.pi_) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(weak_count_id) +#endif + { + if(pi_ != 0) pi_->weak_add_ref(); + } + +// Move support + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + weak_count(weak_count && r): pi_(r.pi_) // nothrow +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(weak_count_id) +#endif + { + r.pi_ = 0; + } + +#endif + + ~weak_count() // nothrow + { + if(pi_ != 0) pi_->weak_release(); +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + id_ = 0; +#endif + } + + weak_count & operator= (shared_count const & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + + if( tmp != pi_ ) + { + if(tmp != 0) tmp->weak_add_ref(); + if(pi_ != 0) pi_->weak_release(); + pi_ = tmp; + } + + return *this; + } + + weak_count & operator= (weak_count const & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + + if( tmp != pi_ ) + { + if(tmp != 0) tmp->weak_add_ref(); + if(pi_ != 0) pi_->weak_release(); + pi_ = tmp; + } + + return *this; + } + + void swap(weak_count & r) // nothrow + { + sp_counted_base * tmp = r.pi_; + r.pi_ = pi_; + pi_ = tmp; + } + + long use_count() const // nothrow + { + return pi_ != 0? pi_->use_count(): 0; + } + + bool empty() const // nothrow + { + return pi_ == 0; + } + + friend inline bool operator==(weak_count const & a, weak_count const & b) + { + return a.pi_ == b.pi_; + } + + friend inline bool operator<(weak_count const & a, weak_count const & b) + { + return std::less()(a.pi_, b.pi_); + } +}; + +inline shared_count::shared_count( weak_count const & r ): pi_( r.pi_ ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif +{ + if( pi_ == 0 || !pi_->add_ref_lock() ) + { + boost::throw_exception( boost::bad_weak_ptr() ); + } +} + +inline shared_count::shared_count( weak_count const & r, sp_nothrow_tag ): pi_( r.pi_ ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif +{ + if( pi_ != 0 && !pi_->add_ref_lock() ) + { + pi_ = 0; + } +} + +} // namespace detail + +} // namespace boost + +#if defined( BOOST_SP_DISABLE_DEPRECATED ) +#pragma GCC diagnostic pop +#endif + +#ifdef __BORLANDC__ +# pragma warn .8027 // Functions containing try are not expanded inline +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SHARED_COUNT_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_convertible.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_convertible.hpp new file mode 100644 index 00000000000..4bba9ed4441 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_convertible.hpp @@ -0,0 +1,92 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_convertible.hpp +// +// Copyright 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include +#include + +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( BOOST_NO_SFINAE ) +# define BOOST_SP_NO_SP_CONVERTIBLE +#endif + +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ < 303 ) +# define BOOST_SP_NO_SP_CONVERTIBLE +#endif + +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x630 ) +# define BOOST_SP_NO_SP_CONVERTIBLE +#endif + +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + +namespace boost +{ + +namespace detail +{ + +template< class Y, class T > struct sp_convertible +{ + typedef char (&yes) [1]; + typedef char (&no) [2]; + + static yes f( T* ); + static no f( ... ); + + enum _vt { value = sizeof( (f)( static_cast(0) ) ) == sizeof(yes) }; +}; + +template< class Y, class T > struct sp_convertible< Y, T[] > +{ + enum _vt { value = false }; +}; + +template< class Y, class T > struct sp_convertible< Y[], T[] > +{ + enum _vt { value = sp_convertible< Y[1], T[1] >::value }; +}; + +template< class Y, std::size_t N, class T > struct sp_convertible< Y[N], T[] > +{ + enum _vt { value = sp_convertible< Y[1], T[1] >::value }; +}; + +struct sp_empty +{ +}; + +template< bool > struct sp_enable_if_convertible_impl; + +template<> struct sp_enable_if_convertible_impl +{ + typedef sp_empty type; +}; + +template<> struct sp_enable_if_convertible_impl +{ +}; + +template< class Y, class T > struct sp_enable_if_convertible: public sp_enable_if_convertible_impl< sp_convertible< Y, T >::value > +{ +}; + +} // namespace detail + +} // namespace boost + +#endif // !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base.hpp new file mode 100644 index 00000000000..438613765b4 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base.hpp @@ -0,0 +1,96 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base.hpp +// +// Copyright 2005-2013 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include +#include + +#if !defined( __c2__ ) && defined( __clang__ ) && defined( __has_extension ) +# if __has_extension( __c_atomic__ ) +# define BOOST_SP_HAS_CLANG_C11_ATOMICS +# endif +#endif + +#if defined( BOOST_SP_DISABLE_THREADS ) +# include + +#elif defined( BOOST_SP_USE_STD_ATOMIC ) +# include + +#elif defined( BOOST_SP_USE_SPINLOCK ) +# include + +#elif defined( BOOST_SP_USE_PTHREADS ) +# include + +#elif defined( BOOST_DISABLE_THREADS ) && !defined( BOOST_SP_ENABLE_THREADS ) && !defined( BOOST_DISABLE_WIN32 ) +# include + +#elif defined( BOOST_SP_HAS_CLANG_C11_ATOMICS ) +# include + +#elif !defined( BOOST_NO_CXX11_HDR_ATOMIC ) +# include + +#elif defined( __SNC__ ) +# include + +#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) && !defined(__PATHSCALE__) +# include + +#elif defined(__HP_aCC) && defined(__ia64) +# include + +#elif defined( __GNUC__ ) && defined( __ia64__ ) && !defined( __INTEL_COMPILER ) && !defined(__PATHSCALE__) +# include + +#elif defined( __IBMCPP__ ) && defined( __powerpc ) +# include + +#elif defined( __MWERKS__ ) && defined( __POWERPC__ ) +# include + +#elif defined( __GNUC__ ) && ( defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc ) ) && !defined(__PATHSCALE__) && !defined( _AIX ) +# include + +#elif defined( __GNUC__ ) && ( defined( __mips__ ) || defined( _mips ) ) && !defined(__PATHSCALE__) && !defined( __mips16 ) +# include + +#elif defined( BOOST_SP_HAS_SYNC ) +# include + +#elif defined(__GNUC__) && ( defined( __sparcv9 ) || ( defined( __sparcv8 ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 402 ) ) ) +# include + +#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined(__CYGWIN__) +# include + +#elif defined( _AIX ) +# include + +#elif !defined( BOOST_HAS_THREADS ) +# include + +#else +# include + +#endif + +#undef BOOST_SP_HAS_CLANG_C11_ATOMICS + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp new file mode 100644 index 00000000000..ec6f6ee1840 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp @@ -0,0 +1,152 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED + +// +// detail/sp_counted_base_acc_ia64.hpp - aC++ on HP-UX IA64 +// +// Copyright 2007 Baruch Zilber +// Copyright 2007 Boris Gubenko +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// + +#include +#include + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( int * pw ) +{ + // ++*pw; + + _Asm_fetchadd(_FASZ_W, _SEM_REL, pw, +1, _LDHINT_NONE); +} + +inline int atomic_decrement( int * pw ) +{ + // return --*pw; + + int r = static_cast(_Asm_fetchadd(_FASZ_W, _SEM_REL, pw, -1, _LDHINT_NONE)); + if (1 == r) + { + _Asm_mf(); + } + + return r - 1; +} + +inline int atomic_conditional_increment( int * pw ) +{ + // if( *pw != 0 ) ++*pw; + // return *pw; + + int v = *pw; + + for (;;) + { + if (0 == v) + { + return 0; + } + + _Asm_mov_to_ar(_AREG_CCV, + v, + (_UP_CALL_FENCE | _UP_SYS_FENCE | _DOWN_CALL_FENCE | _DOWN_SYS_FENCE)); + int r = static_cast(_Asm_cmpxchg(_SZ_W, _SEM_ACQ, pw, v + 1, _LDHINT_NONE)); + if (r == v) + { + return r + 1; + } + + v = r; + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); // TODO use ld.acq here + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_aix.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_aix.hpp new file mode 100644 index 00000000000..ce8ee686ba0 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_aix.hpp @@ -0,0 +1,144 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_AIX_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_AIX_HPP_INCLUDED + +// +// detail/sp_counted_base_aix.hpp +// based on: detail/sp_counted_base_w32.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// Copyright 2006 Michael van der Westhuizen +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// +// Thanks to Ben Hitchings for the #weak + (#shared != 0) +// formulation +// + +#include +#include +#include + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( int32_t* pw ) +{ + // ++*pw; + + fetch_and_add( pw, 1 ); +} + +inline int32_t atomic_decrement( int32_t * pw ) +{ + // return --*pw; + + int32_t originalValue; + + __lwsync(); + originalValue = fetch_and_add( pw, -1 ); + __isync(); + + return (originalValue - 1); +} + +inline int32_t atomic_conditional_increment( int32_t * pw ) +{ + // if( *pw != 0 ) ++*pw; + // return *pw; + + int32_t tmp = fetch_and_add( pw, 0 ); + for( ;; ) + { + if( tmp == 0 ) return 0; + if( compare_and_swap( pw, &tmp, tmp + 1 ) ) return (tmp + 1); + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int32_t use_count_; // #shared + int32_t weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return fetch_and_add( const_cast(&use_count_), 0 ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_AIX_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_clang.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_clang.hpp new file mode 100644 index 00000000000..5d6e073d957 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_clang.hpp @@ -0,0 +1,150 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CLANG_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CLANG_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_counted_base_clang.hpp - __c11 clang intrinsics +// +// Copyright (c) 2007, 2013, 2015 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include +#include + +namespace boost +{ + +namespace detail +{ + +typedef _Atomic( boost::int_least32_t ) atomic_int_least32_t; + +inline void atomic_increment( atomic_int_least32_t * pw ) +{ + __c11_atomic_fetch_add( pw, 1, __ATOMIC_RELAXED ); +} + +inline boost::int_least32_t atomic_decrement( atomic_int_least32_t * pw ) +{ + return __c11_atomic_fetch_sub( pw, 1, __ATOMIC_ACQ_REL ); +} + +inline boost::int_least32_t atomic_conditional_increment( atomic_int_least32_t * pw ) +{ + // long r = *pw; + // if( r != 0 ) ++*pw; + // return r; + + boost::int_least32_t r = __c11_atomic_load( pw, __ATOMIC_RELAXED ); + + for( ;; ) + { + if( r == 0 ) + { + return r; + } + + if( __c11_atomic_compare_exchange_weak( pw, &r, r + 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED ) ) + { + return r; + } + } +} + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wweak-vtables" +#endif + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + atomic_int_least32_t use_count_; // #shared + atomic_int_least32_t weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base() + { + __c11_atomic_init( &use_count_, 1 ); + __c11_atomic_init( &weak_count_, 1 ); + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return __c11_atomic_load( const_cast< atomic_int_least32_t* >( &use_count_ ), __ATOMIC_ACQUIRE ); + } +}; + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CLANG_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp new file mode 100644 index 00000000000..25dfe54c987 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp @@ -0,0 +1,172 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_cw_ppc.hpp - CodeWarrior on PowerPC +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// +// Thanks to Ben Hitchings for the #weak + (#shared != 0) +// formulation +// + +#include + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( register long * pw ) +{ + int a; + + asm + { +loop: + + lwarx a, 0, pw + addi a, a, 1 + stwcx. a, 0, pw + bne- loop + } +} + +inline long atomic_decrement( register long * pw ) +{ + int a; + + asm + { + sync + +loop: + + lwarx a, 0, pw + addi a, a, -1 + stwcx. a, 0, pw + bne- loop + + isync + } + + return a; +} + +inline long atomic_conditional_increment( register long * pw ) +{ + int a; + + asm + { +loop: + + lwarx a, 0, pw + cmpwi a, 0 + beq store + + addi a, a, 1 + +store: + + stwcx. a, 0, pw + bne- loop + } + + return a; +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + long use_count_; // #shared + long weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp new file mode 100644 index 00000000000..6c3cce8d44a --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp @@ -0,0 +1,159 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED + +// +// detail/sp_counted_base_gcc_ia64.hpp - g++ on IA64 +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2006 Peter Dimov +// Copyright 2005 Ben Hutchings +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// + +#include + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( int * pw ) +{ + // ++*pw; + + int tmp; + + // No barrier is required here but fetchadd always has an acquire or + // release barrier associated with it. We choose release as it should be + // cheaper. + __asm__ ("fetchadd4.rel %0=%1,1" : + "=r"(tmp), "=m"(*pw) : + "m"( *pw )); +} + +inline int atomic_decrement( int * pw ) +{ + // return --*pw; + + int rv; + + __asm__ (" fetchadd4.rel %0=%1,-1 ;; \n" + " cmp.eq p7,p0=1,%0 ;; \n" + "(p7) ld4.acq %0=%1 " : + "=&r"(rv), "=m"(*pw) : + "m"( *pw ) : + "p7"); + + return rv; +} + +inline int atomic_conditional_increment( int * pw ) +{ + // if( *pw != 0 ) ++*pw; + // return *pw; + + int rv, tmp, tmp2; + + __asm__ ("0: ld4 %0=%3 ;; \n" + " cmp.eq p7,p0=0,%0 ;; \n" + "(p7) br.cond.spnt 1f \n" + " mov ar.ccv=%0 \n" + " add %1=1,%0 ;; \n" + " cmpxchg4.acq %2=%3,%1,ar.ccv ;; \n" + " cmp.ne p7,p0=%0,%2 ;; \n" + "(p7) br.cond.spnt 0b \n" + " mov %0=%1 ;; \n" + "1:" : + "=&r"(rv), "=&r"(tmp), "=&r"(tmp2), "=m"(*pw) : + "m"( *pw ) : + "ar.ccv", "p7"); + + return rv; +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); // TODO use ld.acq here + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp new file mode 100644 index 00000000000..c3175cf8ed1 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp @@ -0,0 +1,189 @@ +#ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_MIPS_HPP_INCLUDED +#define BOOST_DETAIL_SP_COUNTED_BASE_GCC_MIPS_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_gcc_mips.hpp - g++ on MIPS +// +// Copyright (c) 2009, Spirent Communications, Inc. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// + +#include + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( int * pw ) +{ + // ++*pw; + + int tmp; + + __asm__ __volatile__ + ( + "0:\n\t" + ".set push\n\t" +#if !defined(__mips_isa_rev) || (__mips_isa_rev < 6) + ".set mips2\n\t" +#endif + "ll %0, %1\n\t" + "addiu %0, 1\n\t" + "sc %0, %1\n\t" + ".set pop\n\t" + "beqz %0, 0b": + "=&r"( tmp ), "=m"( *pw ): + "m"( *pw ) + ); +} + +inline int atomic_decrement( int * pw ) +{ + // return --*pw; + + int rv, tmp; + + __asm__ __volatile__ + ( + "0:\n\t" + ".set push\n\t" +#if !defined(__mips_isa_rev) || (__mips_isa_rev < 6) + ".set mips2\n\t" +#endif + "ll %1, %2\n\t" + "addiu %0, %1, -1\n\t" + "sc %0, %2\n\t" + ".set pop\n\t" + "beqz %0, 0b\n\t" + "addiu %0, %1, -1": + "=&r"( rv ), "=&r"( tmp ), "=m"( *pw ): + "m"( *pw ): + "memory" + ); + + return rv; +} + +inline int atomic_conditional_increment( int * pw ) +{ + // if( *pw != 0 ) ++*pw; + // return *pw; + + int rv, tmp; + + __asm__ __volatile__ + ( + "0:\n\t" + ".set push\n\t" +#if !defined(__mips_isa_rev) || (__mips_isa_rev < 6) + ".set mips2\n\t" +#endif + "ll %0, %2\n\t" + "beqz %0, 1f\n\t" + "addiu %1, %0, 1\n\t" + "sc %1, %2\n\t" + ".set pop\n\t" + "beqz %1, 0b\n\t" + "addiu %0, %0, 1\n\t" + "1:": + "=&r"( rv ), "=&r"( tmp ), "=m"( *pw ): + "m"( *pw ): + "memory" + ); + + return rv; +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_MIPS_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp new file mode 100644 index 00000000000..0fb807488ae --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp @@ -0,0 +1,183 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_gcc_ppc.hpp - g++ on PowerPC +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// +// Thanks to Ben Hitchings for the #weak + (#shared != 0) +// formulation +// + +#include + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( int * pw ) +{ + // ++*pw; + + int tmp; + + __asm__ + ( + "0:\n\t" + "lwarx %1, 0, %2\n\t" + "addi %1, %1, 1\n\t" + "stwcx. %1, 0, %2\n\t" + "bne- 0b": + + "=m"( *pw ), "=&b"( tmp ): + "r"( pw ), "m"( *pw ): + "cc" + ); +} + +inline int atomic_decrement( int * pw ) +{ + // return --*pw; + + int rv; + + __asm__ __volatile__ + ( + "sync\n\t" + "0:\n\t" + "lwarx %1, 0, %2\n\t" + "addi %1, %1, -1\n\t" + "stwcx. %1, 0, %2\n\t" + "bne- 0b\n\t" + "isync": + + "=m"( *pw ), "=&b"( rv ): + "r"( pw ), "m"( *pw ): + "memory", "cc" + ); + + return rv; +} + +inline int atomic_conditional_increment( int * pw ) +{ + // if( *pw != 0 ) ++*pw; + // return *pw; + + int rv; + + __asm__ + ( + "0:\n\t" + "lwarx %1, 0, %2\n\t" + "cmpwi %1, 0\n\t" + "beq 1f\n\t" + "addi %1, %1, 1\n\t" + "1:\n\t" + "stwcx. %1, 0, %2\n\t" + "bne- 0b": + + "=m"( *pw ), "=&b"( rv ): + "r"( pw ), "m"( *pw ): + "cc" + ); + + return rv; +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp new file mode 100644 index 00000000000..b8bb707f1b9 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp @@ -0,0 +1,168 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_counted_base_gcc_sparc.hpp - g++ on Sparc V8+ +// +// Copyright (c) 2006 Piotr Wyderski +// Copyright (c) 2006 Tomas Puverle +// Copyright (c) 2006 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// Thanks to Michael van der Westhuizen + +#include +#include // int32_t + +namespace boost +{ + +namespace detail +{ + +inline int32_t compare_and_swap( int32_t * dest_, int32_t compare_, int32_t swap_ ) +{ + __asm__ __volatile__( "cas [%1], %2, %0" + : "+r" (swap_) + : "r" (dest_), "r" (compare_) + : "memory" ); + + return swap_; +} + +inline int32_t atomic_fetch_and_add( int32_t * pw, int32_t dv ) +{ + // long r = *pw; + // *pw += dv; + // return r; + + for( ;; ) + { + int32_t r = *pw; + + if( __builtin_expect((compare_and_swap(pw, r, r + dv) == r), 1) ) + { + return r; + } + } +} + +inline void atomic_increment( int32_t * pw ) +{ + atomic_fetch_and_add( pw, 1 ); +} + +inline int32_t atomic_decrement( int32_t * pw ) +{ + return atomic_fetch_and_add( pw, -1 ); +} + +inline int32_t atomic_conditional_increment( int32_t * pw ) +{ + // long r = *pw; + // if( r != 0 ) ++*pw; + // return r; + + for( ;; ) + { + int32_t r = *pw; + + if( r == 0 ) + { + return r; + } + + if( __builtin_expect( ( compare_and_swap( pw, r, r + 1 ) == r ), 1 ) ) + { + return r; + } + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int32_t use_count_; // #shared + int32_t weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return const_cast< int32_t const volatile & >( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp new file mode 100644 index 00000000000..3d2dd61ed67 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp @@ -0,0 +1,175 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_gcc_x86.hpp - g++ on 486+ or AMD64 +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// +// Thanks to Ben Hitchings for the #weak + (#shared != 0) +// formulation +// + +#include + +namespace boost +{ + +namespace detail +{ + +inline int atomic_exchange_and_add( int * pw, int dv ) +{ + // int r = *pw; + // *pw += dv; + // return r; + + int r; + + __asm__ __volatile__ + ( + "lock\n\t" + "xadd %1, %0": + "=m"( *pw ), "=r"( r ): // outputs (%0, %1) + "m"( *pw ), "1"( dv ): // inputs (%2, %3 == %1) + "memory", "cc" // clobbers + ); + + return r; +} + +inline void atomic_increment( int * pw ) +{ + //atomic_exchange_and_add( pw, 1 ); + + __asm__ + ( + "lock\n\t" + "incl %0": + "=m"( *pw ): // output (%0) + "m"( *pw ): // input (%1) + "cc" // clobbers + ); +} + +inline int atomic_conditional_increment( int * pw ) +{ + // int rv = *pw; + // if( rv != 0 ) ++*pw; + // return rv; + + int rv, tmp; + + __asm__ + ( + "movl %0, %%eax\n\t" + "0:\n\t" + "test %%eax, %%eax\n\t" + "je 1f\n\t" + "movl %%eax, %2\n\t" + "incl %2\n\t" + "lock\n\t" + "cmpxchgl %2, %0\n\t" + "jne 0b\n\t" + "1:": + "=m"( *pw ), "=&a"( rv ), "=&r"( tmp ): // outputs (%0, %1, %2) + "m"( *pw ): // input (%3) + "cc" // clobbers + ); + + return rv; +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_exchange_and_add( &use_count_, -1 ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_nt.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_nt.hpp new file mode 100644 index 00000000000..dea905c905f --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_nt.hpp @@ -0,0 +1,109 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_nt.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +namespace boost +{ + +namespace detail +{ + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + long use_count_; // #shared + long weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + ++use_count_; + } + + bool add_ref_lock() // true on success + { + if( use_count_ == 0 ) return false; + ++use_count_; + return true; + } + + void release() // nothrow + { + if( --use_count_ == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + ++weak_count_; + } + + void weak_release() // nothrow + { + if( --weak_count_ == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return use_count_; + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_pt.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_pt.hpp new file mode 100644 index 00000000000..85f2563d5d5 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_pt.hpp @@ -0,0 +1,138 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_pt.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include +#include +#include + +namespace boost +{ + +namespace detail +{ + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + long use_count_; // #shared + long weak_count_; // #weak + (#shared != 0) + + mutable pthread_mutex_t m_; + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { +// HPUX 10.20 / DCE has a nonstandard pthread_mutex_init + +#if defined(__hpux) && defined(_DECTHREADS_) + BOOST_VERIFY( pthread_mutex_init( &m_, pthread_mutexattr_default ) == 0 ); +#else + BOOST_VERIFY( pthread_mutex_init( &m_, 0 ) == 0 ); +#endif + } + + virtual ~sp_counted_base() // nothrow + { + BOOST_VERIFY( pthread_mutex_destroy( &m_ ) == 0 ); + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); + ++use_count_; + BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); + } + + bool add_ref_lock() // true on success + { + BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); + bool r = use_count_ == 0? false: ( ++use_count_, true ); + BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); + return r; + } + + void release() // nothrow + { + BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); + long new_use_count = --use_count_; + BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); + + if( new_use_count == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); + ++weak_count_; + BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); + } + + void weak_release() // nothrow + { + BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); + long new_weak_count = --weak_count_; + BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); + + if( new_weak_count == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + BOOST_VERIFY( pthread_mutex_lock( &m_ ) == 0 ); + long r = use_count_; + BOOST_VERIFY( pthread_mutex_unlock( &m_ ) == 0 ); + + return r; + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp new file mode 100644 index 00000000000..7b5f9178a6b --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp @@ -0,0 +1,163 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SNC_PS3_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SNC_PS3_HPP_INCLUDED + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_counted_base_gcc_sparc.hpp - g++ on Sparc V8+ +// +// Copyright (c) 2006 Piotr Wyderski +// Copyright (c) 2006 Tomas Puverle +// Copyright (c) 2006 Peter Dimov +// Copyright (c) 2011 Emil Dotchevski +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// Thanks to Michael van der Westhuizen + +#include +#include // uint32_t + +namespace boost +{ + +namespace detail +{ + +inline uint32_t compare_and_swap( uint32_t * dest_, uint32_t compare_, uint32_t swap_ ) +{ + return __builtin_cellAtomicCompareAndSwap32(dest_,compare_,swap_); +} + +inline uint32_t atomic_fetch_and_add( uint32_t * pw, uint32_t dv ) +{ + // long r = *pw; + // *pw += dv; + // return r; + + for( ;; ) + { + uint32_t r = *pw; + + if( __builtin_expect((compare_and_swap(pw, r, r + dv) == r), 1) ) + { + return r; + } + } +} + +inline void atomic_increment( uint32_t * pw ) +{ + (void) __builtin_cellAtomicIncr32( pw ); +} + +inline uint32_t atomic_decrement( uint32_t * pw ) +{ + return __builtin_cellAtomicDecr32( pw ); +} + +inline uint32_t atomic_conditional_increment( uint32_t * pw ) +{ + // long r = *pw; + // if( r != 0 ) ++*pw; + // return r; + + for( ;; ) + { + uint32_t r = *pw; + + if( r == 0 ) + { + return r; + } + + if( __builtin_expect( ( compare_and_swap( pw, r, r + 1 ) == r ), 1 ) ) + { + return r; + } + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + uint32_t use_count_; // #shared + uint32_t weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return const_cast< uint32_t const volatile & >( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SNC_PS3_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_spin.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_spin.hpp new file mode 100644 index 00000000000..faf503ad572 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_spin.hpp @@ -0,0 +1,133 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_spin.hpp - spinlock pool atomic emulation +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include +#include + +namespace boost +{ + +namespace detail +{ + +inline int atomic_exchange_and_add( int * pw, int dv ) +{ + spinlock_pool<1>::scoped_lock lock( pw ); + + int r = *pw; + *pw += dv; + return r; +} + +inline void atomic_increment( int * pw ) +{ + spinlock_pool<1>::scoped_lock lock( pw ); + ++*pw; +} + +inline int atomic_conditional_increment( int * pw ) +{ + spinlock_pool<1>::scoped_lock lock( pw ); + + int rv = *pw; + if( rv != 0 ) ++*pw; + return rv; +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_exchange_and_add( &use_count_, -1 ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + spinlock_pool<1>::scoped_lock lock( &use_count_ ); + return use_count_; + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp new file mode 100644 index 00000000000..9f562b9b4aa --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp @@ -0,0 +1,138 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_STD_ATOMIC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_STD_ATOMIC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_counted_base_std_atomic.hpp - C++11 std::atomic +// +// Copyright (c) 2007, 2013 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include +#include +#include + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( std::atomic_int_least32_t * pw ) +{ + pw->fetch_add( 1, std::memory_order_relaxed ); +} + +inline std::int_least32_t atomic_decrement( std::atomic_int_least32_t * pw ) +{ + return pw->fetch_sub( 1, std::memory_order_acq_rel ); +} + +inline std::int_least32_t atomic_conditional_increment( std::atomic_int_least32_t * pw ) +{ + // long r = *pw; + // if( r != 0 ) ++*pw; + // return r; + + std::int_least32_t r = pw->load( std::memory_order_relaxed ); + + for( ;; ) + { + if( r == 0 ) + { + return r; + } + + if( pw->compare_exchange_weak( r, r + 1, std::memory_order_relaxed, std::memory_order_relaxed ) ) + { + return r; + } + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + std::atomic_int_least32_t use_count_; // #shared + std::atomic_int_least32_t weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return use_count_.load( std::memory_order_acquire ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_STD_ATOMIC_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_sync.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_sync.hpp new file mode 100644 index 00000000000..d2138e7c261 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_sync.hpp @@ -0,0 +1,157 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_counted_base_sync.hpp - g++ 4.1+ __sync intrinsics +// +// Copyright (c) 2007 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include +#include + +#if defined( __ia64__ ) && defined( __INTEL_COMPILER ) +# include +#endif + +namespace boost +{ + +namespace detail +{ + +#if INT_MAX >= 2147483647 + +typedef int sp_int32_t; + +#else + +typedef long sp_int32_t; + +#endif + +inline void atomic_increment( sp_int32_t * pw ) +{ + __sync_fetch_and_add( pw, 1 ); +} + +inline sp_int32_t atomic_decrement( sp_int32_t * pw ) +{ + return __sync_fetch_and_add( pw, -1 ); +} + +inline sp_int32_t atomic_conditional_increment( sp_int32_t * pw ) +{ + // long r = *pw; + // if( r != 0 ) ++*pw; + // return r; + + sp_int32_t r = *pw; + + for( ;; ) + { + if( r == 0 ) + { + return r; + } + + sp_int32_t r2 = __sync_val_compare_and_swap( pw, r, r + 1 ); + + if( r2 == r ) + { + return r; + } + else + { + r = r2; + } + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + sp_int32_t use_count_; // #shared + sp_int32_t weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 1 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 1 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return const_cast< sp_int32_t const volatile & >( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp new file mode 100644 index 00000000000..f2de3b02d8e --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp @@ -0,0 +1,152 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED + +// +// detail/sp_counted_base_vacpp_ppc.hpp - xlC(vacpp) on POWER +// based on: detail/sp_counted_base_w32.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// Copyright 2006 Michael van der Westhuizen +// Copyright 2012 IBM Corp. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// +// Thanks to Ben Hitchings for the #weak + (#shared != 0) +// formulation +// + +#include + +extern "builtin" void __lwsync(void); +extern "builtin" void __isync(void); +extern "builtin" int __fetch_and_add(volatile int* addr, int val); +extern "builtin" int __compare_and_swap(volatile int*, int*, int); + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( int *pw ) +{ + // ++*pw; + __lwsync(); + __fetch_and_add(pw, 1); + __isync(); +} + +inline int atomic_decrement( int *pw ) +{ + // return --*pw; + __lwsync(); + int originalValue = __fetch_and_add(pw, -1); + __isync(); + + return (originalValue - 1); +} + +inline int atomic_conditional_increment( int *pw ) +{ + // if( *pw != 0 ) ++*pw; + // return *pw; + + __lwsync(); + int v = *const_cast(pw); + for (;;) + // loop until state is known + { + if (v == 0) return 0; + if (__compare_and_swap(pw, &v, v + 1)) + { + __isync(); return (v + 1); + } + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + char pad[64] __attribute__((__aligned__(64))); + // pad to prevent false sharing +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return *const_cast(&use_count_); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_w32.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_w32.hpp new file mode 100644 index 00000000000..960e42e1282 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_base_w32.hpp @@ -0,0 +1,132 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_base_w32.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// +// Lock-free algorithm by Alexander Terekhov +// +// Thanks to Ben Hitchings for the #weak + (#shared != 0) +// formulation +// + +#include +#include +#include + +namespace boost +{ + +namespace detail +{ + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + long use_count_; // #shared + long weak_count_; // #weak + (#shared != 0) + +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_untyped_deleter() = 0; + + void add_ref_copy() + { + BOOST_SP_INTERLOCKED_INCREMENT( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + for( ;; ) + { + long tmp = static_cast< long const volatile& >( use_count_ ); + if( tmp == 0 ) return false; + +#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1200 ) + + // work around a code generation bug + + long tmp2 = tmp + 1; + if( BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp2, tmp ) == tmp2 - 1 ) return true; + +#else + + if( BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp + 1, tmp ) == tmp ) return true; + +#endif + } + } + + void release() // nothrow + { + if( BOOST_SP_INTERLOCKED_DECREMENT( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + BOOST_SP_INTERLOCKED_INCREMENT( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( BOOST_SP_INTERLOCKED_DECREMENT( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return static_cast( use_count_ ); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_impl.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_impl.hpp new file mode 100644 index 00000000000..fa2f75eb1aa --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_counted_impl.hpp @@ -0,0 +1,292 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// detail/sp_counted_impl.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +#if defined(BOOST_SP_USE_STD_ALLOCATOR) && defined(BOOST_SP_USE_QUICK_ALLOCATOR) +# error BOOST_SP_USE_STD_ALLOCATOR and BOOST_SP_USE_QUICK_ALLOCATOR are incompatible. +#endif + +#include +#include +#include + +#if defined(BOOST_SP_USE_QUICK_ALLOCATOR) +#include +#endif + +#if defined(BOOST_SP_USE_STD_ALLOCATOR) +#include // std::allocator +#endif + +#include // std::size_t + +namespace boost +{ + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + +void sp_scalar_constructor_hook( void * px, std::size_t size, void * pn ); +void sp_scalar_destructor_hook( void * px, std::size_t size, void * pn ); + +#endif + +namespace detail +{ + +// get_local_deleter + +template class local_sp_deleter; + +template D * get_local_deleter( D * /*p*/ ) +{ + return 0; +} + +template D * get_local_deleter( local_sp_deleter * p ); + +// + +template class sp_counted_impl_p: public sp_counted_base +{ +private: + + X * px_; + + sp_counted_impl_p( sp_counted_impl_p const & ); + sp_counted_impl_p & operator= ( sp_counted_impl_p const & ); + + typedef sp_counted_impl_p this_type; + +public: + + explicit sp_counted_impl_p( X * px ): px_( px ) + { +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + boost::sp_scalar_constructor_hook( px, sizeof(X), this ); +#endif + } + + virtual void dispose() // nothrow + { +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + boost::sp_scalar_destructor_hook( px_, sizeof(X), this ); +#endif + boost::checked_delete( px_ ); + } + + virtual void * get_deleter( sp_typeinfo const & ) + { + return 0; + } + + virtual void * get_local_deleter( sp_typeinfo const & ) + { + return 0; + } + + virtual void * get_untyped_deleter() + { + return 0; + } + +#if defined(BOOST_SP_USE_STD_ALLOCATOR) + + void * operator new( std::size_t ) + { + return std::allocator().allocate( 1, static_cast(0) ); + } + + void operator delete( void * p ) + { + std::allocator().deallocate( static_cast(p), 1 ); + } + +#endif + +#if defined(BOOST_SP_USE_QUICK_ALLOCATOR) + + void * operator new( std::size_t ) + { + return quick_allocator::alloc(); + } + + void operator delete( void * p ) + { + quick_allocator::dealloc( p ); + } + +#endif +}; + +// +// Borland's Codeguard trips up over the -Vx- option here: +// +#ifdef __CODEGUARD__ +# pragma option push -Vx- +#endif + +template class sp_counted_impl_pd: public sp_counted_base +{ +private: + + P ptr; // copy constructor must not throw + D del; // copy constructor must not throw + + sp_counted_impl_pd( sp_counted_impl_pd const & ); + sp_counted_impl_pd & operator= ( sp_counted_impl_pd const & ); + + typedef sp_counted_impl_pd this_type; + +public: + + // pre: d(p) must not throw + + sp_counted_impl_pd( P p, D & d ): ptr( p ), del( d ) + { + } + + sp_counted_impl_pd( P p ): ptr( p ), del() + { + } + + virtual void dispose() // nothrow + { + del( ptr ); + } + + virtual void * get_deleter( sp_typeinfo const & ti ) + { + return ti == BOOST_SP_TYPEID(D)? &reinterpret_cast( del ): 0; + } + + virtual void * get_local_deleter( sp_typeinfo const & ti ) + { + return ti == BOOST_SP_TYPEID(D)? boost::detail::get_local_deleter( boost::addressof( del ) ): 0; + } + + virtual void * get_untyped_deleter() + { + return &reinterpret_cast( del ); + } + +#if defined(BOOST_SP_USE_STD_ALLOCATOR) + + void * operator new( std::size_t ) + { + return std::allocator().allocate( 1, static_cast(0) ); + } + + void operator delete( void * p ) + { + std::allocator().deallocate( static_cast(p), 1 ); + } + +#endif + +#if defined(BOOST_SP_USE_QUICK_ALLOCATOR) + + void * operator new( std::size_t ) + { + return quick_allocator::alloc(); + } + + void operator delete( void * p ) + { + quick_allocator::dealloc( p ); + } + +#endif +}; + +template class sp_counted_impl_pda: public sp_counted_base +{ +private: + + P p_; // copy constructor must not throw + D d_; // copy constructor must not throw + A a_; // copy constructor must not throw + + sp_counted_impl_pda( sp_counted_impl_pda const & ); + sp_counted_impl_pda & operator= ( sp_counted_impl_pda const & ); + + typedef sp_counted_impl_pda this_type; + +public: + + // pre: d( p ) must not throw + + sp_counted_impl_pda( P p, D & d, A a ): p_( p ), d_( d ), a_( a ) + { + } + + sp_counted_impl_pda( P p, A a ): p_( p ), d_( a ), a_( a ) + { + } + + virtual void dispose() // nothrow + { + d_( p_ ); + } + + virtual void destroy() // nothrow + { +#if !defined( BOOST_NO_CXX11_ALLOCATOR ) + + typedef typename std::allocator_traits::template rebind_alloc< this_type > A2; + +#else + + typedef typename A::template rebind< this_type >::other A2; + +#endif + + A2 a2( a_ ); + + this->~this_type(); + + a2.deallocate( this, 1 ); + } + + virtual void * get_deleter( sp_typeinfo const & ti ) + { + return ti == BOOST_SP_TYPEID( D )? &reinterpret_cast( d_ ): 0; + } + + virtual void * get_local_deleter( sp_typeinfo const & ti ) + { + return ti == BOOST_SP_TYPEID(D)? boost::detail::get_local_deleter( boost::addressof( d_ ) ): 0; + } + + virtual void * get_untyped_deleter() + { + return &reinterpret_cast( d_ ); + } +}; + +#ifdef __CODEGUARD__ +# pragma option pop +#endif + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_disable_deprecated.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_disable_deprecated.hpp new file mode 100644 index 00000000000..f79bdf38a8d --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_disable_deprecated.hpp @@ -0,0 +1,40 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_DISABLE_DEPRECATED_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_DISABLE_DEPRECATED_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/smart_ptr/detail/sp_disable_deprecated.hpp +// +// Copyright 2015 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +#if defined( __GNUC__ ) && ( defined( __GXX_EXPERIMENTAL_CXX0X__ ) || ( __cplusplus >= 201103L ) ) + +# if defined( BOOST_GCC ) + +# if BOOST_GCC >= 40600 +# define BOOST_SP_DISABLE_DEPRECATED +# endif + +# elif defined( __clang__ ) && defined( __has_warning ) + +# if __has_warning( "-Wdeprecated-declarations" ) +# define BOOST_SP_DISABLE_DEPRECATED +# endif + +# endif + +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_DISABLE_DEPRECATED_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_forward.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_forward.hpp new file mode 100644 index 00000000000..8fdec65b7fa --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_forward.hpp @@ -0,0 +1,52 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_forward.hpp +// +// Copyright 2008,2012 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include + +namespace boost +{ + +namespace detail +{ + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + +#if defined( BOOST_GCC ) && __GNUC__ * 100 + __GNUC_MINOR__ <= 404 + +// GCC 4.4 supports an outdated version of rvalue references and creates a copy of the forwarded object. +// This results in warnings 'returning reference to temporary'. Therefore we use a special version similar to std::forward. +template< class T > T&& sp_forward( T && t ) BOOST_NOEXCEPT +{ + return t; +} + +#else + +template< class T > T&& sp_forward( T & t ) BOOST_NOEXCEPT +{ + return static_cast< T&& >( t ); +} + +#endif + +#endif + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_has_sync.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_has_sync.hpp new file mode 100644 index 00000000000..e1debf0cc9b --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_has_sync.hpp @@ -0,0 +1,69 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/smart_ptr/detail/sp_has_sync.hpp +// +// Copyright (c) 2008, 2009 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// Defines the BOOST_SP_HAS_SYNC macro if the __sync_* intrinsics +// are available. +// + +#ifndef BOOST_SP_NO_SYNC + +#if !defined( __c2__ ) && defined( __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 ) + +# define BOOST_SP_HAS_SYNC + +#elif defined( __IBMCPP__ ) && ( __IBMCPP__ >= 1210 ) && !defined( __COMPILER_VER__ ) + +# define BOOST_SP_HAS_SYNC + +#elif !defined( __c2__ ) && defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) + +#define BOOST_SP_HAS_SYNC + +#if defined( __arm__ ) || defined( __armel__ ) +#undef BOOST_SP_HAS_SYNC +#endif + +#if defined( __hppa ) || defined( __hppa__ ) +#undef BOOST_SP_HAS_SYNC +#endif + +#if defined( __m68k__ ) +#undef BOOST_SP_HAS_SYNC +#endif + +#if defined( __sh__ ) +#undef BOOST_SP_HAS_SYNC +#endif + +#if defined( __sparc__ ) +#undef BOOST_SP_HAS_SYNC +#endif + +#if defined( __INTEL_COMPILER ) && !defined( __ia64__ ) && ( __INTEL_COMPILER < 1110 ) +#undef BOOST_SP_HAS_SYNC +#endif + +#if defined(__PATHSCALE__) && ((__PATHCC__ == 4) && (__PATHCC_MINOR__ < 9)) +#undef BOOST_SP_HAS_SYNC +#endif + +#endif + +#endif // #ifndef BOOST_SP_NO_SYNC + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_interlocked.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_interlocked.hpp new file mode 100644 index 00000000000..79cae14a370 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_interlocked.hpp @@ -0,0 +1,163 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_INTERLOCKED_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_INTERLOCKED_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/sp_interlocked.hpp +// +// Copyright 2005, 2014 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// + +#include + +// BOOST_SP_HAS_INTRIN_H + +// VC9 has intrin.h, but it collides with +#if defined( BOOST_MSVC ) && BOOST_MSVC >= 1600 + +# define BOOST_SP_HAS_INTRIN_H + +// Unlike __MINGW64__, __MINGW64_VERSION_MAJOR is defined by MinGW-w64 for both 32 and 64-bit targets. +#elif defined( __MINGW64_VERSION_MAJOR ) + +// MinGW-w64 provides intrin.h for both 32 and 64-bit targets. +# define BOOST_SP_HAS_INTRIN_H + +// Intel C++ on Windows on VC10+ stdlib +#elif defined( BOOST_INTEL_WIN ) && defined( _CPPLIB_VER ) && _CPPLIB_VER >= 520 + +# define BOOST_SP_HAS_INTRIN_H + +#endif + +#if defined( BOOST_USE_WINDOWS_H ) + +# include + +# define BOOST_SP_INTERLOCKED_INCREMENT InterlockedIncrement +# define BOOST_SP_INTERLOCKED_DECREMENT InterlockedDecrement +# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE InterlockedExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd + +#elif defined( BOOST_USE_INTRIN_H ) || defined( BOOST_SP_HAS_INTRIN_H ) + +#include + +# define BOOST_SP_INTERLOCKED_INCREMENT _InterlockedIncrement +# define BOOST_SP_INTERLOCKED_DECREMENT _InterlockedDecrement +# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE _InterlockedExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd + +#elif defined( _WIN32_WCE ) + +#if _WIN32_WCE >= 0x600 + +extern "C" long __cdecl _InterlockedIncrement( long volatile * ); +extern "C" long __cdecl _InterlockedDecrement( long volatile * ); +extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long ); +extern "C" long __cdecl _InterlockedExchange( long volatile *, long ); +extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long ); + +# define BOOST_SP_INTERLOCKED_INCREMENT _InterlockedIncrement +# define BOOST_SP_INTERLOCKED_DECREMENT _InterlockedDecrement +# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE _InterlockedExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd + +#else + +// under Windows CE we still have old-style Interlocked* functions + +extern "C" long __cdecl InterlockedIncrement( long* ); +extern "C" long __cdecl InterlockedDecrement( long* ); +extern "C" long __cdecl InterlockedCompareExchange( long*, long, long ); +extern "C" long __cdecl InterlockedExchange( long*, long ); +extern "C" long __cdecl InterlockedExchangeAdd( long*, long ); + +# define BOOST_SP_INTERLOCKED_INCREMENT InterlockedIncrement +# define BOOST_SP_INTERLOCKED_DECREMENT InterlockedDecrement +# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE InterlockedExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd + +#endif + +#elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN ) + +#if defined( __CLRCALL_PURE_OR_CDECL ) + +extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedIncrement( long volatile * ); +extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedDecrement( long volatile * ); +extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedCompareExchange( long volatile *, long, long ); +extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchange( long volatile *, long ); +extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchangeAdd( long volatile *, long ); + +#else + +extern "C" long __cdecl _InterlockedIncrement( long volatile * ); +extern "C" long __cdecl _InterlockedDecrement( long volatile * ); +extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long ); +extern "C" long __cdecl _InterlockedExchange( long volatile *, long ); +extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long ); + +# if defined( BOOST_MSVC ) && BOOST_MSVC == 1310 +//From MSDN, Visual Studio .NET 2003 spedific: To declare one of the interlocked functions +//for use as an intrinsic, the function must be declared with the leading underscore and +//the new function must appear in a #pragma intrinsic statement. +# pragma intrinsic( _InterlockedIncrement ) +# pragma intrinsic( _InterlockedDecrement ) +# pragma intrinsic( _InterlockedCompareExchange ) +# pragma intrinsic( _InterlockedExchange ) +# pragma intrinsic( _InterlockedExchangeAdd ) +# endif + +#endif + +# define BOOST_SP_INTERLOCKED_INCREMENT _InterlockedIncrement +# define BOOST_SP_INTERLOCKED_DECREMENT _InterlockedDecrement +# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE _InterlockedExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd + +#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) + +namespace boost +{ + +namespace detail +{ + +extern "C" __declspec(dllimport) long __stdcall InterlockedIncrement( long volatile * ); +extern "C" __declspec(dllimport) long __stdcall InterlockedDecrement( long volatile * ); +extern "C" __declspec(dllimport) long __stdcall InterlockedCompareExchange( long volatile *, long, long ); +extern "C" __declspec(dllimport) long __stdcall InterlockedExchange( long volatile *, long ); +extern "C" __declspec(dllimport) long __stdcall InterlockedExchangeAdd( long volatile *, long ); + +} // namespace detail + +} // namespace boost + +# define BOOST_SP_INTERLOCKED_INCREMENT ::boost::detail::InterlockedIncrement +# define BOOST_SP_INTERLOCKED_DECREMENT ::boost::detail::InterlockedDecrement +# define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE ::boost::detail::InterlockedCompareExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE ::boost::detail::InterlockedExchange +# define BOOST_SP_INTERLOCKED_EXCHANGE_ADD ::boost::detail::InterlockedExchangeAdd + +#else + +# error "Interlocked intrinsics not available" + +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_INTERLOCKED_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_noexcept.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_noexcept.hpp new file mode 100644 index 00000000000..1287ba49525 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_noexcept.hpp @@ -0,0 +1,48 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_NOEXCEPT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_NOEXCEPT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_noexcept.hpp +// +// Copyright 2016, 2017 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include + +// BOOST_SP_NOEXCEPT + +#if defined( BOOST_MSVC ) && BOOST_MSVC >= 1700 && BOOST_MSVC < 1900 + +# define BOOST_SP_NOEXCEPT BOOST_NOEXCEPT_OR_NOTHROW + +#else + +# define BOOST_SP_NOEXCEPT BOOST_NOEXCEPT + +#endif + +// BOOST_SP_NOEXCEPT_WITH_ASSERT + +#if defined(BOOST_DISABLE_ASSERTS) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && defined(NDEBUG) ) + +# define BOOST_SP_NOEXCEPT_WITH_ASSERT BOOST_SP_NOEXCEPT + +#elif defined(BOOST_ENABLE_ASSERT_HANDLER) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && !defined(NDEBUG) ) + +# define BOOST_SP_NOEXCEPT_WITH_ASSERT + +#else + +# define BOOST_SP_NOEXCEPT_WITH_ASSERT BOOST_SP_NOEXCEPT + +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_NOEXCEPT_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_nullptr_t.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_nullptr_t.hpp new file mode 100644 index 00000000000..219ae8070a6 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/sp_nullptr_t.hpp @@ -0,0 +1,45 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_nullptr_t.hpp +// +// Copyright 2013 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include +#include + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + +namespace boost +{ + +namespace detail +{ + +#if !defined( BOOST_NO_CXX11_DECLTYPE ) && ( ( defined( __clang__ ) && !defined( _LIBCPP_VERSION ) ) || defined( __INTEL_COMPILER ) ) + + typedef decltype(nullptr) sp_nullptr_t; + +#else + + typedef std::nullptr_t sp_nullptr_t; + +#endif + +} // namespace detail + +} // namespace boost + +#endif // !defined( BOOST_NO_CXX11_NULLPTR ) + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_NULLPTR_T_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock.hpp new file mode 100644 index 00000000000..0b618dfc155 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock.hpp @@ -0,0 +1,68 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/spinlock.hpp +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// struct spinlock +// { +// void lock(); +// bool try_lock(); +// void unlock(); +// +// class scoped_lock; +// }; +// +// #define BOOST_DETAIL_SPINLOCK_INIT +// + +#include +#include + +#if defined( BOOST_SP_USE_STD_ATOMIC ) +# if !defined( __clang__ ) +# include +# else +// Clang (at least up to 3.4) can't compile spinlock_pool when +// using std::atomic, so substitute the __sync implementation instead. +# include +# endif + +#elif defined( BOOST_SP_USE_PTHREADS ) +# include + +#elif !defined( BOOST_NO_CXX11_HDR_ATOMIC ) +# include + +#elif defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ ) +# include + +#elif defined( BOOST_SP_HAS_SYNC ) +# include + +#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# include + +#elif defined(BOOST_HAS_PTHREADS) +# include + +#elif !defined(BOOST_HAS_THREADS) +# include + +#else +# error Unrecognized threading platform +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_gcc_arm.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_gcc_arm.hpp new file mode 100644 index 00000000000..24d08a8815f --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_gcc_arm.hpp @@ -0,0 +1,121 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED + +// +// Copyright (c) 2008, 2011 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7S__) + +# define BOOST_SP_ARM_BARRIER "dmb" +# define BOOST_SP_ARM_HAS_LDREX + +#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) + +# define BOOST_SP_ARM_BARRIER "mcr p15, 0, r0, c7, c10, 5" +# define BOOST_SP_ARM_HAS_LDREX + +#else + +# define BOOST_SP_ARM_BARRIER "" + +#endif + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + int v_; + +public: + + bool try_lock() + { + int r; + +#ifdef BOOST_SP_ARM_HAS_LDREX + + __asm__ __volatile__( + "ldrex %0, [%2]; \n" + "cmp %0, %1; \n" + "strexne %0, %1, [%2]; \n" + BOOST_SP_ARM_BARRIER : + "=&r"( r ): // outputs + "r"( 1 ), "r"( &v_ ): // inputs + "memory", "cc" ); + +#else + + __asm__ __volatile__( + "swp %0, %1, [%2];\n" + BOOST_SP_ARM_BARRIER : + "=&r"( r ): // outputs + "r"( 1 ), "r"( &v_ ): // inputs + "memory", "cc" ); + +#endif + + return r == 0; + } + + void lock() + { + for( unsigned k = 0; !try_lock(); ++k ) + { + boost::detail::yield( k ); + } + } + + void unlock() + { + __asm__ __volatile__( BOOST_SP_ARM_BARRIER ::: "memory" ); + *const_cast< int volatile* >( &v_ ) = 0; + __asm__ __volatile__( BOOST_SP_ARM_BARRIER ::: "memory" ); + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT {0} + +#undef BOOST_SP_ARM_BARRIER +#undef BOOST_SP_ARM_HAS_LDREX + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_nt.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_nt.hpp new file mode 100644 index 00000000000..1f399d0dd41 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_nt.hpp @@ -0,0 +1,89 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + bool locked_; + +public: + + inline bool try_lock() + { + if( locked_ ) + { + return false; + } + else + { + locked_ = true; + return true; + } + } + + inline void lock() + { + BOOST_ASSERT( !locked_ ); + locked_ = true; + } + + inline void unlock() + { + BOOST_ASSERT( locked_ ); + locked_ = false; + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT { false } + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_NT_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_pool.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_pool.hpp new file mode 100644 index 00000000000..39cf180b242 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_pool.hpp @@ -0,0 +1,91 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// boost/detail/spinlock_pool.hpp +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// spinlock_pool<0> is reserved for atomic<>, when/if it arrives +// spinlock_pool<1> is reserved for shared_ptr reference counts +// spinlock_pool<2> is reserved for shared_ptr atomic access +// + +#include +#include +#include + +namespace boost +{ + +namespace detail +{ + +template< int M > class spinlock_pool +{ +private: + + static spinlock pool_[ 41 ]; + +public: + + static spinlock & spinlock_for( void const * pv ) + { +#if defined(__VMS) && __INITIAL_POINTER_SIZE == 64 + std::size_t i = reinterpret_cast< unsigned long long >( pv ) % 41; +#else + std::size_t i = reinterpret_cast< std::size_t >( pv ) % 41; +#endif + return pool_[ i ]; + } + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( void const * pv ): sp_( spinlock_for( pv ) ) + { + sp_.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +template< int M > spinlock spinlock_pool< M >::pool_[ 41 ] = +{ + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, + BOOST_DETAIL_SPINLOCK_INIT +}; + +} // namespace detail +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_POOL_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_pt.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_pt.hpp new file mode 100644 index 00000000000..f9cabfc3a7c --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_pt.hpp @@ -0,0 +1,79 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + pthread_mutex_t v_; + +public: + + bool try_lock() + { + return pthread_mutex_trylock( &v_ ) == 0; + } + + void lock() + { + pthread_mutex_lock( &v_ ); + } + + void unlock() + { + pthread_mutex_unlock( &v_ ); + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT { PTHREAD_MUTEX_INITIALIZER } + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_PT_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_std_atomic.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_std_atomic.hpp new file mode 100644 index 00000000000..a61c1cd96d1 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_std_atomic.hpp @@ -0,0 +1,83 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_STD_ATOMIC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_STD_ATOMIC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// Copyright (c) 2014 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include +#include + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + std::atomic_flag v_; + +public: + + bool try_lock() + { + return !v_.test_and_set( std::memory_order_acquire ); + } + + void lock() + { + for( unsigned k = 0; !try_lock(); ++k ) + { + boost::detail::yield( k ); + } + } + + void unlock() + { + v_ .clear( std::memory_order_release ); + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT { ATOMIC_FLAG_INIT } + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_STD_ATOMIC_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_sync.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_sync.hpp new file mode 100644 index 00000000000..a7145c5ac27 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_sync.hpp @@ -0,0 +1,87 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include + +#if defined( __ia64__ ) && defined( __INTEL_COMPILER ) +# include +#endif + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + int v_; + +public: + + bool try_lock() + { + int r = __sync_lock_test_and_set( &v_, 1 ); + return r == 0; + } + + void lock() + { + for( unsigned k = 0; !try_lock(); ++k ) + { + boost::detail::yield( k ); + } + } + + void unlock() + { + __sync_lock_release( &v_ ); + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT {0} + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_w32.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_w32.hpp new file mode 100644 index 00000000000..d34e4fc2b52 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/spinlock_w32.hpp @@ -0,0 +1,113 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#include +#include + +// BOOST_COMPILER_FENCE + +#if defined(__INTEL_COMPILER) + +#define BOOST_COMPILER_FENCE __memory_barrier(); + +#elif defined( _MSC_VER ) && _MSC_VER >= 1310 + +extern "C" void _ReadWriteBarrier(); +#pragma intrinsic( _ReadWriteBarrier ) + +#define BOOST_COMPILER_FENCE _ReadWriteBarrier(); + +#elif defined(__GNUC__) + +#define BOOST_COMPILER_FENCE __asm__ __volatile__( "" : : : "memory" ); + +#else + +#define BOOST_COMPILER_FENCE + +#endif + +// + +namespace boost +{ + +namespace detail +{ + +class spinlock +{ +public: + + long v_; + +public: + + bool try_lock() + { + long r = BOOST_SP_INTERLOCKED_EXCHANGE( &v_, 1 ); + + BOOST_COMPILER_FENCE + + return r == 0; + } + + void lock() + { + for( unsigned k = 0; !try_lock(); ++k ) + { + boost::detail::yield( k ); + } + } + + void unlock() + { + BOOST_COMPILER_FENCE + *const_cast< long volatile* >( &v_ ) = 0; + } + +public: + + class scoped_lock + { + private: + + spinlock & sp_; + + scoped_lock( scoped_lock const & ); + scoped_lock & operator=( scoped_lock const & ); + + public: + + explicit scoped_lock( spinlock & sp ): sp_( sp ) + { + sp.lock(); + } + + ~scoped_lock() + { + sp_.unlock(); + } + }; +}; + +} // namespace detail +} // namespace boost + +#define BOOST_DETAIL_SPINLOCK_INIT {0} + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_W32_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/yield_k.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/yield_k.hpp new file mode 100644 index 00000000000..f8ca6b64676 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/detail/yield_k.hpp @@ -0,0 +1,177 @@ +#ifndef BOOST_SMART_PTR_DETAIL_YIELD_K_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_YIELD_K_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// yield_k.hpp +// +// Copyright (c) 2008 Peter Dimov +// Copyright (c) Microsoft Corporation 2014 +// +// void yield( unsigned k ); +// +// Typical use: +// +// for( unsigned k = 0; !try_lock(); ++k ) yield( k ); +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// + +#include +#include + +#if BOOST_PLAT_WINDOWS_RUNTIME +#include +#endif + +// BOOST_SMT_PAUSE + +#if defined(_MSC_VER) && _MSC_VER >= 1310 && ( defined(_M_IX86) || defined(_M_X64) ) && !defined(__c2__) + +extern "C" void _mm_pause(); + +#define BOOST_SMT_PAUSE _mm_pause(); + +#elif defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) ) + +#define BOOST_SMT_PAUSE __asm__ __volatile__( "rep; nop" : : : "memory" ); + +#endif + +// + +#if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) + +#if defined( BOOST_USE_WINDOWS_H ) +# include +#endif + +namespace boost +{ + +namespace detail +{ + +#if !defined( BOOST_USE_WINDOWS_H ) && !BOOST_PLAT_WINDOWS_RUNTIME +#if !BOOST_COMP_CLANG || !defined __MINGW32__ + extern "C" void __stdcall Sleep( unsigned long ms ); +#else +#include <_mingw.h> +#if !defined __MINGW64_VERSION_MAJOR + extern "C" void __stdcall Sleep( unsigned long ms ); +#else + extern "C" __declspec(dllimport) void __stdcall Sleep( unsigned long ms ); +#endif +#endif +#endif + +inline void yield( unsigned k ) +{ + if( k < 4 ) + { + } +#if defined( BOOST_SMT_PAUSE ) + else if( k < 16 ) + { + BOOST_SMT_PAUSE + } +#endif +#if !BOOST_PLAT_WINDOWS_RUNTIME + else if( k < 32 ) + { + Sleep( 0 ); + } + else + { + Sleep( 1 ); + } +#else + else + { + // Sleep isn't supported on the Windows Runtime. + std::this_thread::yield(); + } +#endif +} + +} // namespace detail + +} // namespace boost + +#elif defined( BOOST_HAS_PTHREADS ) + +#ifndef _AIX +#include +#else + // AIX's sched.h defines ::var which sometimes conflicts with Lambda's var + extern "C" int sched_yield(void); +#endif + +#include + +namespace boost +{ + +namespace detail +{ + +inline void yield( unsigned k ) +{ + if( k < 4 ) + { + } +#if defined( BOOST_SMT_PAUSE ) + else if( k < 16 ) + { + BOOST_SMT_PAUSE + } +#endif + else if( k < 32 || k & 1 ) + { + sched_yield(); + } + else + { + // g++ -Wextra warns on {} or {0} + struct timespec rqtp = { 0, 0 }; + + // POSIX says that timespec has tv_sec and tv_nsec + // But it doesn't guarantee order or placement + + rqtp.tv_sec = 0; + rqtp.tv_nsec = 1000; + + nanosleep( &rqtp, 0 ); + } +} + +} // namespace detail + +} // namespace boost + +#else + +namespace boost +{ + +namespace detail +{ + +inline void yield( unsigned ) +{ +} + +} // namespace detail + +} // namespace boost + +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_YIELD_K_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/enable_shared_from_this.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/enable_shared_from_this.hpp new file mode 100644 index 00000000000..fc4de0b5712 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/enable_shared_from_this.hpp @@ -0,0 +1,90 @@ +#ifndef BOOST_SMART_PTR_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED +#define BOOST_SMART_PTR_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED + +// +// enable_shared_from_this.hpp +// +// Copyright 2002, 2009 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. +// + +#include +#include +#include +#include +#include + +namespace boost +{ + +template class enable_shared_from_this +{ +protected: + + BOOST_CONSTEXPR enable_shared_from_this() BOOST_SP_NOEXCEPT + { + } + + BOOST_CONSTEXPR enable_shared_from_this(enable_shared_from_this const &) BOOST_SP_NOEXCEPT + { + } + + enable_shared_from_this & operator=(enable_shared_from_this const &) BOOST_SP_NOEXCEPT + { + return *this; + } + + ~enable_shared_from_this() BOOST_SP_NOEXCEPT // ~weak_ptr newer throws, so this call also must not throw + { + } + +public: + + shared_ptr shared_from_this() + { + shared_ptr p( weak_this_ ); + BOOST_ASSERT( p.get() == this ); + return p; + } + + shared_ptr shared_from_this() const + { + shared_ptr p( weak_this_ ); + BOOST_ASSERT( p.get() == this ); + return p; + } + + weak_ptr weak_from_this() BOOST_SP_NOEXCEPT + { + return weak_this_; + } + + weak_ptr weak_from_this() const BOOST_SP_NOEXCEPT + { + return weak_this_; + } + +public: // actually private, but avoids compiler template friendship issues + + // Note: invoked automatically by shared_ptr; do not call + template void _internal_accept_owner( shared_ptr const * ppx, Y * py ) const BOOST_SP_NOEXCEPT + { + if( weak_this_.expired() ) + { + weak_this_ = shared_ptr( *ppx, py ); + } + } + +private: + + mutable weak_ptr weak_this_; +}; + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/intrusive_ptr.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/intrusive_ptr.hpp new file mode 100644 index 00000000000..0ab075d367b --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/intrusive_ptr.hpp @@ -0,0 +1,361 @@ +#ifndef BOOST_SMART_PTR_INTRUSIVE_PTR_HPP_INCLUDED +#define BOOST_SMART_PTR_INTRUSIVE_PTR_HPP_INCLUDED + +// +// intrusive_ptr.hpp +// +// Copyright (c) 2001, 2002 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. +// + +#include + +#include +#include +#include +#include +#include + +#include // for std::less + +#if !defined(BOOST_NO_IOSTREAM) +#if !defined(BOOST_NO_IOSFWD) +#include // for std::basic_ostream +#else +#include +#endif +#endif + + +namespace boost +{ + +// +// intrusive_ptr +// +// A smart pointer that uses intrusive reference counting. +// +// Relies on unqualified calls to +// +// void intrusive_ptr_add_ref(T * p); +// void intrusive_ptr_release(T * p); +// +// (p != 0) +// +// The object is responsible for destroying itself. +// + +template class intrusive_ptr +{ +private: + + typedef intrusive_ptr this_type; + +public: + + typedef T element_type; + + BOOST_CONSTEXPR intrusive_ptr() BOOST_SP_NOEXCEPT : px( 0 ) + { + } + + intrusive_ptr( T * p, bool add_ref = true ): px( p ) + { + if( px != 0 && add_ref ) intrusive_ptr_add_ref( px ); + } + +#if !defined(BOOST_NO_MEMBER_TEMPLATES) || defined(BOOST_MSVC6_MEMBER_TEMPLATES) + + template +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + intrusive_ptr( intrusive_ptr const & rhs, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) + +#else + + intrusive_ptr( intrusive_ptr const & rhs ) + +#endif + : px( rhs.get() ) + { + if( px != 0 ) intrusive_ptr_add_ref( px ); + } + +#endif + + intrusive_ptr(intrusive_ptr const & rhs): px( rhs.px ) + { + if( px != 0 ) intrusive_ptr_add_ref( px ); + } + + ~intrusive_ptr() + { + if( px != 0 ) intrusive_ptr_release( px ); + } + +#if !defined(BOOST_NO_MEMBER_TEMPLATES) || defined(BOOST_MSVC6_MEMBER_TEMPLATES) + + template intrusive_ptr & operator=(intrusive_ptr const & rhs) + { + this_type(rhs).swap(*this); + return *this; + } + +#endif + +// Move support + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + intrusive_ptr(intrusive_ptr && rhs) BOOST_SP_NOEXCEPT : px( rhs.px ) + { + rhs.px = 0; + } + + intrusive_ptr & operator=(intrusive_ptr && rhs) BOOST_SP_NOEXCEPT + { + this_type( static_cast< intrusive_ptr && >( rhs ) ).swap(*this); + return *this; + } + + template friend class intrusive_ptr; + + template +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + intrusive_ptr(intrusive_ptr && rhs, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty()) + +#else + + intrusive_ptr(intrusive_ptr && rhs) + +#endif + : px( rhs.px ) + { + rhs.px = 0; + } + + template + intrusive_ptr & operator=(intrusive_ptr && rhs) BOOST_SP_NOEXCEPT + { + this_type( static_cast< intrusive_ptr && >( rhs ) ).swap(*this); + return *this; + } + +#endif + + intrusive_ptr & operator=(intrusive_ptr const & rhs) + { + this_type(rhs).swap(*this); + return *this; + } + + intrusive_ptr & operator=(T * rhs) + { + this_type(rhs).swap(*this); + return *this; + } + + void reset() + { + this_type().swap( *this ); + } + + void reset( T * rhs ) + { + this_type( rhs ).swap( *this ); + } + + void reset( T * rhs, bool add_ref ) + { + this_type( rhs, add_ref ).swap( *this ); + } + + T * get() const BOOST_SP_NOEXCEPT + { + return px; + } + + T * detach() BOOST_SP_NOEXCEPT + { + T * ret = px; + px = 0; + return ret; + } + + T & operator*() const BOOST_SP_NOEXCEPT_WITH_ASSERT + { + BOOST_ASSERT( px != 0 ); + return *px; + } + + T * operator->() const BOOST_SP_NOEXCEPT_WITH_ASSERT + { + BOOST_ASSERT( px != 0 ); + return px; + } + +// implicit conversion to "bool" +#include + + void swap(intrusive_ptr & rhs) BOOST_SP_NOEXCEPT + { + T * tmp = px; + px = rhs.px; + rhs.px = tmp; + } + +private: + + T * px; +}; + +template inline bool operator==(intrusive_ptr const & a, intrusive_ptr const & b) BOOST_SP_NOEXCEPT +{ + return a.get() == b.get(); +} + +template inline bool operator!=(intrusive_ptr const & a, intrusive_ptr const & b) BOOST_SP_NOEXCEPT +{ + return a.get() != b.get(); +} + +template inline bool operator==(intrusive_ptr const & a, U * b) BOOST_SP_NOEXCEPT +{ + return a.get() == b; +} + +template inline bool operator!=(intrusive_ptr const & a, U * b) BOOST_SP_NOEXCEPT +{ + return a.get() != b; +} + +template inline bool operator==(T * a, intrusive_ptr const & b) BOOST_SP_NOEXCEPT +{ + return a == b.get(); +} + +template inline bool operator!=(T * a, intrusive_ptr const & b) BOOST_SP_NOEXCEPT +{ + return a != b.get(); +} + +#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96 + +// Resolve the ambiguity between our op!= and the one in rel_ops + +template inline bool operator!=(intrusive_ptr const & a, intrusive_ptr const & b) BOOST_SP_NOEXCEPT +{ + return a.get() != b.get(); +} + +#endif + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + +template inline bool operator==( intrusive_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT +{ + return p.get() == 0; +} + +template inline bool operator==( boost::detail::sp_nullptr_t, intrusive_ptr const & p ) BOOST_SP_NOEXCEPT +{ + return p.get() == 0; +} + +template inline bool operator!=( intrusive_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT +{ + return p.get() != 0; +} + +template inline bool operator!=( boost::detail::sp_nullptr_t, intrusive_ptr const & p ) BOOST_SP_NOEXCEPT +{ + return p.get() != 0; +} + +#endif + +template inline bool operator<(intrusive_ptr const & a, intrusive_ptr const & b) BOOST_SP_NOEXCEPT +{ + return std::less()(a.get(), b.get()); +} + +template void swap(intrusive_ptr & lhs, intrusive_ptr & rhs) BOOST_SP_NOEXCEPT +{ + lhs.swap(rhs); +} + +// mem_fn support + +template T * get_pointer(intrusive_ptr const & p) BOOST_SP_NOEXCEPT +{ + return p.get(); +} + +template intrusive_ptr static_pointer_cast(intrusive_ptr const & p) +{ + return static_cast(p.get()); +} + +template intrusive_ptr const_pointer_cast(intrusive_ptr const & p) +{ + return const_cast(p.get()); +} + +template intrusive_ptr dynamic_pointer_cast(intrusive_ptr const & p) +{ + return dynamic_cast(p.get()); +} + +// operator<< + +#if !defined(BOOST_NO_IOSTREAM) + +#if defined(BOOST_NO_TEMPLATED_IOSTREAMS) || ( defined(__GNUC__) && (__GNUC__ < 3) ) + +template std::ostream & operator<< (std::ostream & os, intrusive_ptr const & p) +{ + os << p.get(); + return os; +} + +#else + +// in STLport's no-iostreams mode no iostream symbols can be used +#ifndef _STLP_NO_IOSTREAMS + +# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300 && __SGI_STL_PORT) +// MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL +using std::basic_ostream; +template basic_ostream & operator<< (basic_ostream & os, intrusive_ptr const & p) +# else +template std::basic_ostream & operator<< (std::basic_ostream & os, intrusive_ptr const & p) +# endif +{ + os << p.get(); + return os; +} + +#endif // _STLP_NO_IOSTREAMS + +#endif // __GNUC__ < 3 + +#endif // !defined(BOOST_NO_IOSTREAM) + +// hash_value + +template< class T > struct hash; + +template< class T > std::size_t hash_value( boost::intrusive_ptr const & p ) BOOST_SP_NOEXCEPT +{ + return boost::hash< T* >()( p.get() ); +} + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_INTRUSIVE_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/intrusive_ref_counter.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/intrusive_ref_counter.hpp new file mode 100644 index 00000000000..c2f918d0a49 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/intrusive_ref_counter.hpp @@ -0,0 +1,188 @@ +/* + * Copyright Andrey Semashev 2007 - 2013. + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + */ +/*! + * \file intrusive_ref_counter.hpp + * \author Andrey Semashev + * \date 12.03.2009 + * + * This header contains a reference counter class for \c intrusive_ptr. + */ + +#ifndef BOOST_SMART_PTR_INTRUSIVE_REF_COUNTER_HPP_INCLUDED_ +#define BOOST_SMART_PTR_INTRUSIVE_REF_COUNTER_HPP_INCLUDED_ + +#include +#include +#include + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +#if defined(_MSC_VER) +#pragma warning(push) +// This is a bogus MSVC warning, which is flagged by friend declarations of intrusive_ptr_add_ref and intrusive_ptr_release in intrusive_ref_counter: +// 'name' : the inline specifier cannot be used when a friend declaration refers to a specialization of a function template +// Note that there is no inline specifier in the declarations. +#pragma warning(disable: 4396) +#endif + +namespace boost { + +namespace sp_adl_block { + +/*! + * \brief Thread unsafe reference counter policy for \c intrusive_ref_counter + * + * The policy instructs the \c intrusive_ref_counter base class to implement + * a reference counter suitable for single threaded use only. Pointers to the same + * object with this kind of reference counter must not be used by different threads. + */ +struct thread_unsafe_counter +{ + typedef unsigned int type; + + static unsigned int load(unsigned int const& counter) BOOST_SP_NOEXCEPT + { + return counter; + } + + static void increment(unsigned int& counter) BOOST_SP_NOEXCEPT + { + ++counter; + } + + static unsigned int decrement(unsigned int& counter) BOOST_SP_NOEXCEPT + { + return --counter; + } +}; + +/*! + * \brief Thread safe reference counter policy for \c intrusive_ref_counter + * + * The policy instructs the \c intrusive_ref_counter base class to implement + * a thread-safe reference counter, if the target platform supports multithreading. + */ +struct thread_safe_counter +{ + typedef boost::detail::atomic_count type; + + static unsigned int load(boost::detail::atomic_count const& counter) BOOST_SP_NOEXCEPT + { + return static_cast< unsigned int >(static_cast< long >(counter)); + } + + static void increment(boost::detail::atomic_count& counter) BOOST_SP_NOEXCEPT + { + ++counter; + } + + static unsigned int decrement(boost::detail::atomic_count& counter) BOOST_SP_NOEXCEPT + { + return static_cast< unsigned int >(--counter); + } +}; + +template< typename DerivedT, typename CounterPolicyT = thread_safe_counter > +class intrusive_ref_counter; + +template< typename DerivedT, typename CounterPolicyT > +void intrusive_ptr_add_ref(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_SP_NOEXCEPT; +template< typename DerivedT, typename CounterPolicyT > +void intrusive_ptr_release(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_SP_NOEXCEPT; + +/*! + * \brief A reference counter base class + * + * This base class can be used with user-defined classes to add support + * for \c intrusive_ptr. The class contains a reference counter defined by the \c CounterPolicyT. + * Upon releasing the last \c intrusive_ptr referencing the object + * derived from the \c intrusive_ref_counter class, operator \c delete + * is automatically called on the pointer to the object. + * + * The other template parameter, \c DerivedT, is the user's class that derives from \c intrusive_ref_counter. + */ +template< typename DerivedT, typename CounterPolicyT > +class intrusive_ref_counter +{ +private: + //! Reference counter type + typedef typename CounterPolicyT::type counter_type; + //! Reference counter + mutable counter_type m_ref_counter; + +public: + /*! + * Default constructor + * + * \post use_count() == 0 + */ + intrusive_ref_counter() BOOST_SP_NOEXCEPT : m_ref_counter(0) + { + } + + /*! + * Copy constructor + * + * \post use_count() == 0 + */ + intrusive_ref_counter(intrusive_ref_counter const&) BOOST_SP_NOEXCEPT : m_ref_counter(0) + { + } + + /*! + * Assignment + * + * \post The reference counter is not modified after assignment + */ + intrusive_ref_counter& operator= (intrusive_ref_counter const&) BOOST_SP_NOEXCEPT { return *this; } + + /*! + * \return The reference counter + */ + unsigned int use_count() const BOOST_SP_NOEXCEPT + { + return CounterPolicyT::load(m_ref_counter); + } + +protected: + /*! + * Destructor + */ + BOOST_DEFAULTED_FUNCTION(~intrusive_ref_counter(), {}) + + friend void intrusive_ptr_add_ref< DerivedT, CounterPolicyT >(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_SP_NOEXCEPT; + friend void intrusive_ptr_release< DerivedT, CounterPolicyT >(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_SP_NOEXCEPT; +}; + +template< typename DerivedT, typename CounterPolicyT > +inline void intrusive_ptr_add_ref(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_SP_NOEXCEPT +{ + CounterPolicyT::increment(p->m_ref_counter); +} + +template< typename DerivedT, typename CounterPolicyT > +inline void intrusive_ptr_release(const intrusive_ref_counter< DerivedT, CounterPolicyT >* p) BOOST_SP_NOEXCEPT +{ + if (CounterPolicyT::decrement(p->m_ref_counter) == 0) + delete static_cast< const DerivedT* >(p); +} + +} // namespace sp_adl_block + +using sp_adl_block::intrusive_ref_counter; +using sp_adl_block::thread_unsafe_counter; +using sp_adl_block::thread_safe_counter; + +} // namespace boost + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif + +#endif // BOOST_SMART_PTR_INTRUSIVE_REF_COUNTER_HPP_INCLUDED_ diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_shared.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_shared.hpp new file mode 100644 index 00000000000..dd9191c61d3 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_shared.hpp @@ -0,0 +1,21 @@ +#ifndef BOOST_SMART_PTR_MAKE_SHARED_HPP_INCLUDED +#define BOOST_SMART_PTR_MAKE_SHARED_HPP_INCLUDED + +// make_shared.hpp +// +// Copyright (c) 2007, 2008, 2012 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. + +#include + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( BOOST_NO_SFINAE ) +# include +# include +#endif + +#endif // #ifndef BOOST_SMART_PTR_MAKE_SHARED_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_shared_array.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_shared_array.hpp new file mode 100644 index 00000000000..2eaf4db71b8 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_shared_array.hpp @@ -0,0 +1,66 @@ +/* +Copyright 2012-2017 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_SMART_PTR_MAKE_SHARED_ARRAY_HPP +#define BOOST_SMART_PTR_MAKE_SHARED_ARRAY_HPP + +#include + +namespace boost { + +template +inline typename detail::sp_if_size_array::type +make_shared() +{ + return boost::allocate_shared(std::allocator::type>()); +} + +template +inline typename detail::sp_if_size_array::type +make_shared(const typename detail::sp_array_element::type& value) +{ + return boost::allocate_shared(std::allocator::type>(), value); +} + +template +inline typename detail::sp_if_array::type +make_shared(std::size_t size) +{ + return boost::allocate_shared(std::allocator::type>(), size); +} + +template +inline typename detail::sp_if_array::type +make_shared(std::size_t size, + const typename detail::sp_array_element::type& value) +{ + return boost::allocate_shared(std::allocator::type>(), size, value); +} + +template +inline typename detail::sp_if_size_array::type +make_shared_noinit() +{ + return allocate_shared_noinit(std::allocator::type>()); +} + +template +inline typename detail::sp_if_array::type +make_shared_noinit(std::size_t size) +{ + return allocate_shared_noinit(std::allocator::type>(), size); +} + +} /* boost */ + +#endif diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_shared_object.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_shared_object.hpp new file mode 100644 index 00000000000..c681602dca2 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_shared_object.hpp @@ -0,0 +1,801 @@ +#ifndef BOOST_SMART_PTR_MAKE_SHARED_OBJECT_HPP_INCLUDED +#define BOOST_SMART_PTR_MAKE_SHARED_OBJECT_HPP_INCLUDED + +// make_shared_object.hpp +// +// Copyright (c) 2007, 2008, 2012 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost +{ + +namespace detail +{ + +template< std::size_t N, std::size_t A > struct sp_aligned_storage +{ + union type + { + char data_[ N ]; + typename boost::type_with_alignment< A >::type align_; + }; +}; + +template< class T > class sp_ms_deleter +{ +private: + + typedef typename sp_aligned_storage< sizeof( T ), ::boost::alignment_of< T >::value >::type storage_type; + + bool initialized_; + storage_type storage_; + +private: + + void destroy() BOOST_SP_NOEXCEPT + { + if( initialized_ ) + { +#if defined( __GNUC__ ) + + // fixes incorrect aliasing warning + T * p = reinterpret_cast< T* >( storage_.data_ ); + p->~T(); + +#else + + reinterpret_cast< T* >( storage_.data_ )->~T(); + +#endif + + initialized_ = false; + } + } + +public: + + sp_ms_deleter() BOOST_SP_NOEXCEPT : initialized_( false ) + { + } + + template explicit sp_ms_deleter( A const & ) BOOST_SP_NOEXCEPT : initialized_( false ) + { + } + + // optimization: do not copy storage_ + sp_ms_deleter( sp_ms_deleter const & ) BOOST_SP_NOEXCEPT : initialized_( false ) + { + } + + ~sp_ms_deleter() BOOST_SP_NOEXCEPT + { + destroy(); + } + + void operator()( T * ) BOOST_SP_NOEXCEPT + { + destroy(); + } + + static void operator_fn( T* ) BOOST_SP_NOEXCEPT // operator() can't be static + { + } + + void * address() BOOST_SP_NOEXCEPT + { + return storage_.data_; + } + + void set_initialized() BOOST_SP_NOEXCEPT + { + initialized_ = true; + } +}; + +template< class T, class A > class sp_as_deleter +{ +private: + + typedef typename sp_aligned_storage< sizeof( T ), ::boost::alignment_of< T >::value >::type storage_type; + + storage_type storage_; + A a_; + bool initialized_; + +private: + + void destroy() BOOST_SP_NOEXCEPT + { + if( initialized_ ) + { + T * p = reinterpret_cast< T* >( storage_.data_ ); + +#if !defined( BOOST_NO_CXX11_ALLOCATOR ) + + std::allocator_traits::destroy( a_, p ); + +#else + + p->~T(); + +#endif + + initialized_ = false; + } + } + +public: + + sp_as_deleter( A const & a ) BOOST_SP_NOEXCEPT : a_( a ), initialized_( false ) + { + } + + // optimization: do not copy storage_ + sp_as_deleter( sp_as_deleter const & r ) BOOST_SP_NOEXCEPT : a_( r.a_), initialized_( false ) + { + } + + ~sp_as_deleter() BOOST_SP_NOEXCEPT + { + destroy(); + } + + void operator()( T * ) BOOST_SP_NOEXCEPT + { + destroy(); + } + + static void operator_fn( T* ) BOOST_SP_NOEXCEPT // operator() can't be static + { + } + + void * address() BOOST_SP_NOEXCEPT + { + return storage_.data_; + } + + void set_initialized() BOOST_SP_NOEXCEPT + { + initialized_ = true; + } +}; + +template< class T > struct sp_if_not_array +{ + typedef boost::shared_ptr< T > type; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< class T > struct sp_if_not_array< T[] > +{ +}; + +#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) + +template< class T, std::size_t N > struct sp_if_not_array< T[N] > +{ +}; + +#endif + +#endif + +} // namespace detail + +#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) +# define BOOST_SP_MSD( T ) boost::detail::sp_inplace_tag< boost::detail::sp_ms_deleter< T > >() +#else +# define BOOST_SP_MSD( T ) boost::detail::sp_ms_deleter< T >() +#endif + +// _noinit versions + +template< class T > typename boost::detail::sp_if_not_array< T >::type make_shared_noinit() +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T; + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A > typename boost::detail::sp_if_not_array< T >::type allocate_shared_noinit( A const & a ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T; + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +#if !defined( BOOST_NO_CXX11_VARIADIC_TEMPLATES ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + +// Variadic templates, rvalue reference + +template< class T, class... Args > typename boost::detail::sp_if_not_array< T >::type make_shared( Args && ... args ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( boost::detail::sp_forward( args )... ); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class... Args > typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, Args && ... args ) +{ +#if !defined( BOOST_NO_CXX11_ALLOCATOR ) + + typedef typename std::allocator_traits::template rebind_alloc A2; + A2 a2( a ); + + typedef boost::detail::sp_as_deleter< T, A2 > D; + + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_inplace_tag(), a2 ); + +#else + + typedef boost::detail::sp_ms_deleter< T > D; + + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_inplace_tag(), a ); + +#endif + + D * pd = static_cast< D* >( pt._internal_get_untyped_deleter() ); + void * pv = pd->address(); + +#if !defined( BOOST_NO_CXX11_ALLOCATOR ) + + std::allocator_traits::construct( a2, static_cast< T* >( pv ), boost::detail::sp_forward( args )... ); + +#else + + ::new( pv ) T( boost::detail::sp_forward( args )... ); + +#endif + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +#else // !defined( BOOST_NO_CXX11_VARIADIC_TEMPLATES ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + +// Common zero-argument versions + +template< class T > typename boost::detail::sp_if_not_array< T >::type make_shared() +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T(); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A > typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T(); + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +// C++03 version + +template< class T, class A1 > +typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1 > +typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2 > +typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2 > +typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3 > +typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3 > +typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4 > +typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4 > +typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5 > +typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ), + boost::forward( a5 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5 > +typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ), + boost::forward( a5 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5, class A6 > +typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ), + boost::forward( a5 ), + boost::forward( a6 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6 > +typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ), + boost::forward( a5 ), + boost::forward( a6 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > +typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ), + boost::forward( a5 ), + boost::forward( a6 ), + boost::forward( a7 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > +typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ), + boost::forward( a5 ), + boost::forward( a6 ), + boost::forward( a7 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > +typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7, BOOST_FWD_REF(A8) a8 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ), + boost::forward( a5 ), + boost::forward( a6 ), + boost::forward( a7 ), + boost::forward( a8 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > +typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7, BOOST_FWD_REF(A8) a8 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ), + boost::forward( a5 ), + boost::forward( a6 ), + boost::forward( a7 ), + boost::forward( a8 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > +typename boost::detail::sp_if_not_array< T >::type make_shared( BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7, BOOST_FWD_REF(A8) a8, BOOST_FWD_REF(A9) a9 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ), + boost::forward( a5 ), + boost::forward( a6 ), + boost::forward( a7 ), + boost::forward( a8 ), + boost::forward( a9 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > +typename boost::detail::sp_if_not_array< T >::type allocate_shared( A const & a, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(A4) a4, BOOST_FWD_REF(A5) a5, BOOST_FWD_REF(A6) a6, BOOST_FWD_REF(A7) a7, BOOST_FWD_REF(A8) a8, BOOST_FWD_REF(A9) a9 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = static_cast *>( pt._internal_get_untyped_deleter() ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::forward( a1 ), + boost::forward( a2 ), + boost::forward( a3 ), + boost::forward( a4 ), + boost::forward( a5 ), + boost::forward( a6 ), + boost::forward( a7 ), + boost::forward( a8 ), + boost::forward( a9 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +#endif // !defined( BOOST_NO_CXX11_VARIADIC_TEMPLATES ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + +#undef BOOST_SP_MSD + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_MAKE_SHARED_OBJECT_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_unique.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_unique.hpp new file mode 100644 index 00000000000..eed503392b8 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/make_unique.hpp @@ -0,0 +1,110 @@ +/* +Copyright 2012-2015 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_SMART_PTR_MAKE_UNIQUE_HPP +#define BOOST_SMART_PTR_MAKE_UNIQUE_HPP + +#include +#include +#include + +namespace boost { +namespace detail { + +template +struct up_if_object { + typedef std::unique_ptr type; +}; + +template +struct up_if_object { }; + +template +struct up_if_object { }; + +template +struct up_if_array { }; + +template +struct up_if_array { + typedef std::unique_ptr type; +}; + +template +struct up_remove_reference { + typedef T type; +}; + +template +struct up_remove_reference { + typedef T type; +}; + +template +struct up_remove_reference { + typedef T type; +}; + +template +struct up_element { }; + +template +struct up_element { + typedef T type; +}; + +} /* detail */ + +template +inline typename detail::up_if_object::type +make_unique() +{ + return std::unique_ptr(new T()); +} + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +template +inline typename detail::up_if_object::type +make_unique(Args&&... args) +{ + return std::unique_ptr(new T(std::forward(args)...)); +} +#endif + +template +inline typename detail::up_if_object::type +make_unique(typename detail::up_remove_reference::type&& value) +{ + return std::unique_ptr(new T(std::move(value))); +} + +template +inline typename detail::up_if_object::type +make_unique_noinit() +{ + return std::unique_ptr(new T); +} + +template +inline typename detail::up_if_array::type +make_unique(std::size_t size) +{ + return std::unique_ptr(new typename + detail::up_element::type[size]()); +} + +template +inline typename detail::up_if_array::type +make_unique_noinit(std::size_t size) +{ + return std::unique_ptr(new typename + detail::up_element::type[size]); +} + +} /* boost */ + +#endif diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/scoped_array.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/scoped_array.hpp new file mode 100644 index 00000000000..05dd05aea8d --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/scoped_array.hpp @@ -0,0 +1,132 @@ +#ifndef BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED +#define BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED + +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001, 2002 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. + +#include +#include +#include +#include +#include + +#include + +#include // for std::ptrdiff_t + +namespace boost +{ + +// Debug hooks + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + +void sp_array_constructor_hook(void * p); +void sp_array_destructor_hook(void * p); + +#endif + +// scoped_array extends scoped_ptr to arrays. Deletion of the array pointed to +// is guaranteed, either on destruction of the scoped_array or via an explicit +// reset(). Use shared_array or std::vector if your needs are more complex. + +template class scoped_array // noncopyable +{ +private: + + T * px; + + scoped_array(scoped_array const &); + scoped_array & operator=(scoped_array const &); + + typedef scoped_array this_type; + + void operator==( scoped_array const& ) const; + void operator!=( scoped_array const& ) const; + +public: + + typedef T element_type; + + explicit scoped_array( T * p = 0 ) BOOST_SP_NOEXCEPT : px( p ) + { +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + boost::sp_array_constructor_hook( px ); +#endif + } + + ~scoped_array() BOOST_SP_NOEXCEPT + { +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + boost::sp_array_destructor_hook( px ); +#endif + boost::checked_array_delete( px ); + } + + void reset(T * p = 0) BOOST_SP_NOEXCEPT_WITH_ASSERT + { + BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors + this_type(p).swap(*this); + } + + T & operator[](std::ptrdiff_t i) const BOOST_SP_NOEXCEPT_WITH_ASSERT + { + BOOST_ASSERT( px != 0 ); + BOOST_ASSERT( i >= 0 ); + return px[i]; + } + + T * get() const BOOST_SP_NOEXCEPT + { + return px; + } + +// implicit conversion to "bool" +#include + + void swap(scoped_array & b) BOOST_SP_NOEXCEPT + { + T * tmp = b.px; + b.px = px; + px = tmp; + } +}; + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + +template inline bool operator==( scoped_array const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT +{ + return p.get() == 0; +} + +template inline bool operator==( boost::detail::sp_nullptr_t, scoped_array const & p ) BOOST_SP_NOEXCEPT +{ + return p.get() == 0; +} + +template inline bool operator!=( scoped_array const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT +{ + return p.get() != 0; +} + +template inline bool operator!=( boost::detail::sp_nullptr_t, scoped_array const & p ) BOOST_SP_NOEXCEPT +{ + return p.get() != 0; +} + +#endif + +template inline void swap(scoped_array & a, scoped_array & b) BOOST_SP_NOEXCEPT +{ + a.swap(b); +} + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/scoped_ptr.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/scoped_ptr.hpp new file mode 100644 index 00000000000..5325eba5ffe --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/scoped_ptr.hpp @@ -0,0 +1,167 @@ +#ifndef BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED +#define BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED + +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001, 2002 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. + +#include +#include +#include +#include +#include +#include +#include + +#ifndef BOOST_NO_AUTO_PTR +# include // for std::auto_ptr +#endif + +#if defined( BOOST_SP_DISABLE_DEPRECATED ) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + +namespace boost +{ + +// Debug hooks + +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + +void sp_scalar_constructor_hook(void * p); +void sp_scalar_destructor_hook(void * p); + +#endif + +// scoped_ptr mimics a built-in pointer except that it guarantees deletion +// of the object pointed to, either on destruction of the scoped_ptr or via +// an explicit reset(). scoped_ptr is a simple solution for simple needs; +// use shared_ptr or std::auto_ptr if your needs are more complex. + +template class scoped_ptr // noncopyable +{ +private: + + T * px; + + scoped_ptr(scoped_ptr const &); + scoped_ptr & operator=(scoped_ptr const &); + + typedef scoped_ptr this_type; + + void operator==( scoped_ptr const& ) const; + void operator!=( scoped_ptr const& ) const; + +public: + + typedef T element_type; + + explicit scoped_ptr( T * p = 0 ) BOOST_SP_NOEXCEPT : px( p ) + { +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + boost::sp_scalar_constructor_hook( px ); +#endif + } + +#ifndef BOOST_NO_AUTO_PTR + + explicit scoped_ptr( std::auto_ptr p ) BOOST_SP_NOEXCEPT : px( p.release() ) + { +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + boost::sp_scalar_constructor_hook( px ); +#endif + } + +#endif + + ~scoped_ptr() BOOST_SP_NOEXCEPT + { +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + boost::sp_scalar_destructor_hook( px ); +#endif + boost::checked_delete( px ); + } + + void reset(T * p = 0) BOOST_SP_NOEXCEPT_WITH_ASSERT + { + BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors + this_type(p).swap(*this); + } + + T & operator*() const BOOST_SP_NOEXCEPT_WITH_ASSERT + { + BOOST_ASSERT( px != 0 ); + return *px; + } + + T * operator->() const BOOST_SP_NOEXCEPT_WITH_ASSERT + { + BOOST_ASSERT( px != 0 ); + return px; + } + + T * get() const BOOST_SP_NOEXCEPT + { + return px; + } + +// implicit conversion to "bool" +#include + + void swap(scoped_ptr & b) BOOST_SP_NOEXCEPT + { + T * tmp = b.px; + b.px = px; + px = tmp; + } +}; + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + +template inline bool operator==( scoped_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT +{ + return p.get() == 0; +} + +template inline bool operator==( boost::detail::sp_nullptr_t, scoped_ptr const & p ) BOOST_SP_NOEXCEPT +{ + return p.get() == 0; +} + +template inline bool operator!=( scoped_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT +{ + return p.get() != 0; +} + +template inline bool operator!=( boost::detail::sp_nullptr_t, scoped_ptr const & p ) BOOST_SP_NOEXCEPT +{ + return p.get() != 0; +} + +#endif + +template inline void swap(scoped_ptr & a, scoped_ptr & b) BOOST_SP_NOEXCEPT +{ + a.swap(b); +} + +// get_pointer(p) is a generic way to say p.get() + +template inline T * get_pointer(scoped_ptr const & p) BOOST_SP_NOEXCEPT +{ + return p.get(); +} + +} // namespace boost + +#if defined( BOOST_SP_DISABLE_DEPRECATED ) +#pragma GCC diagnostic pop +#endif + +#endif // #ifndef BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/shared_array.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/shared_array.hpp new file mode 100644 index 00000000000..3ffa7426c30 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/shared_array.hpp @@ -0,0 +1,293 @@ +#ifndef BOOST_SMART_PTR_SHARED_ARRAY_HPP_INCLUDED +#define BOOST_SMART_PTR_SHARED_ARRAY_HPP_INCLUDED + +// +// shared_array.hpp +// +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001, 2002, 2012 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. +// + +#include // for broken compiler workarounds + +#include // TR1 cyclic inclusion fix + +#include +#include + +#include +#include +#include +#include +#include + +#include // for std::ptrdiff_t +#include // for std::swap +#include // for std::less + +namespace boost +{ + +// +// shared_array +// +// shared_array extends shared_ptr to arrays. +// The array pointed to is deleted when the last shared_array pointing to it +// is destroyed or reset. +// + +template class shared_array +{ +private: + + // Borland 5.5.1 specific workarounds + typedef checked_array_deleter deleter; + typedef shared_array this_type; + +public: + + typedef T element_type; + + shared_array() BOOST_SP_NOEXCEPT : px( 0 ), pn() + { + } + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + + shared_array( boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT : px( 0 ), pn() + { + } + +#endif + + template + explicit shared_array( Y * p ): px( p ), pn( p, checked_array_deleter() ) + { + boost::detail::sp_assert_convertible< Y[], T[] >(); + } + + // + // Requirements: D's copy constructor must not throw + // + // shared_array will release p by calling d(p) + // + + template shared_array( Y * p, D d ): px( p ), pn( p, d ) + { + boost::detail::sp_assert_convertible< Y[], T[] >(); + } + + // As above, but with allocator. A's copy constructor shall not throw. + + template shared_array( Y * p, D d, A a ): px( p ), pn( p, d, a ) + { + boost::detail::sp_assert_convertible< Y[], T[] >(); + } + +// generated copy constructor, destructor are fine... + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + +// ... except in C++0x, move disables the implicit copy + + shared_array( shared_array const & r ) BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) + { + } + + shared_array( shared_array && r ) BOOST_SP_NOEXCEPT : px( r.px ), pn() + { + pn.swap( r.pn ); + r.px = 0; + } + +#endif + + // conversion + + template +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + shared_array( shared_array const & r, typename boost::detail::sp_enable_if_convertible< Y[], T[] >::type = boost::detail::sp_empty() ) + +#else + + shared_array( shared_array const & r ) + +#endif + BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) + { + boost::detail::sp_assert_convertible< Y[], T[] >(); + } + + // aliasing + + template< class Y > + shared_array( shared_array const & r, element_type * p ) BOOST_SP_NOEXCEPT : px( p ), pn( r.pn ) + { + } + + // assignment + + shared_array & operator=( shared_array const & r ) BOOST_SP_NOEXCEPT + { + this_type( r ).swap( *this ); + return *this; + } + +#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1400) + + template + shared_array & operator=( shared_array const & r ) BOOST_SP_NOEXCEPT + { + this_type( r ).swap( *this ); + return *this; + } + +#endif + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + shared_array & operator=( shared_array && r ) BOOST_SP_NOEXCEPT + { + this_type( static_cast< shared_array && >( r ) ).swap( *this ); + return *this; + } + + template + shared_array & operator=( shared_array && r ) BOOST_SP_NOEXCEPT + { + this_type( static_cast< shared_array && >( r ) ).swap( *this ); + return *this; + } + +#endif + + void reset() BOOST_SP_NOEXCEPT + { + this_type().swap( *this ); + } + + template void reset( Y * p ) // Y must be complete + { + BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors + this_type( p ).swap( *this ); + } + + template void reset( Y * p, D d ) + { + this_type( p, d ).swap( *this ); + } + + template void reset( Y * p, D d, A a ) + { + this_type( p, d, a ).swap( *this ); + } + + template void reset( shared_array const & r, element_type * p ) BOOST_SP_NOEXCEPT + { + this_type( r, p ).swap( *this ); + } + + T & operator[] (std::ptrdiff_t i) const BOOST_SP_NOEXCEPT_WITH_ASSERT + { + BOOST_ASSERT(px != 0); + BOOST_ASSERT(i >= 0); + return px[i]; + } + + T * get() const BOOST_SP_NOEXCEPT + { + return px; + } + +// implicit conversion to "bool" +#include + + bool unique() const BOOST_SP_NOEXCEPT + { + return pn.unique(); + } + + long use_count() const BOOST_SP_NOEXCEPT + { + return pn.use_count(); + } + + void swap(shared_array & other) BOOST_SP_NOEXCEPT + { + std::swap(px, other.px); + pn.swap(other.pn); + } + + void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT + { + return pn.get_deleter( ti ); + } + +private: + + template friend class shared_array; + + T * px; // contained pointer + detail::shared_count pn; // reference counter + +}; // shared_array + +template inline bool operator==(shared_array const & a, shared_array const & b) BOOST_SP_NOEXCEPT +{ + return a.get() == b.get(); +} + +template inline bool operator!=(shared_array const & a, shared_array const & b) BOOST_SP_NOEXCEPT +{ + return a.get() != b.get(); +} + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + +template inline bool operator==( shared_array const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT +{ + return p.get() == 0; +} + +template inline bool operator==( boost::detail::sp_nullptr_t, shared_array const & p ) BOOST_SP_NOEXCEPT +{ + return p.get() == 0; +} + +template inline bool operator!=( shared_array const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT +{ + return p.get() != 0; +} + +template inline bool operator!=( boost::detail::sp_nullptr_t, shared_array const & p ) BOOST_SP_NOEXCEPT +{ + return p.get() != 0; +} + +#endif + +template inline bool operator<(shared_array const & a, shared_array const & b) BOOST_SP_NOEXCEPT +{ + return std::less()(a.get(), b.get()); +} + +template void swap(shared_array & a, shared_array & b) BOOST_SP_NOEXCEPT +{ + a.swap(b); +} + +template< class D, class T > D * get_deleter( shared_array const & p ) BOOST_SP_NOEXCEPT +{ + return static_cast< D * >( p._internal_get_deleter( BOOST_SP_TYPEID(D) ) ); +} + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_SHARED_ARRAY_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/shared_ptr.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/shared_ptr.hpp new file mode 100644 index 00000000000..4ac0699ef67 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/shared_ptr.hpp @@ -0,0 +1,1184 @@ +#ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED +#define BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED + +// +// shared_ptr.hpp +// +// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999. +// Copyright (c) 2001-2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. +// + +#include // for broken compiler workarounds + +// In order to avoid circular dependencies with Boost.TR1 +// we make sure that our include of doesn't try to +// pull in the TR1 headers: that's why we use this header +// rather than including directly: +#include // std::auto_ptr + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if !defined(BOOST_SP_NO_ATOMIC_ACCESS) +#include +#endif + +#include // for std::swap +#include // for std::less +#include // for std::bad_cast +#include // for std::size_t + +#if !defined(BOOST_NO_IOSTREAM) +#if !defined(BOOST_NO_IOSFWD) +#include // for std::basic_ostream +#else +#include +#endif +#endif + +#if defined( BOOST_SP_DISABLE_DEPRECATED ) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + +namespace boost +{ + +template class shared_ptr; +template class weak_ptr; +template class enable_shared_from_this; +class enable_shared_from_raw; + +namespace movelib +{ + + template< class T, class D > class unique_ptr; + +} // namespace movelib + +namespace detail +{ + +// sp_element, element_type + +template< class T > struct sp_element +{ + typedef T type; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< class T > struct sp_element< T[] > +{ + typedef T type; +}; + +#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) + +template< class T, std::size_t N > struct sp_element< T[N] > +{ + typedef T type; +}; + +#endif + +#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +// sp_dereference, return type of operator* + +template< class T > struct sp_dereference +{ + typedef T & type; +}; + +template<> struct sp_dereference< void > +{ + typedef void type; +}; + +#if !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) + +template<> struct sp_dereference< void const > +{ + typedef void type; +}; + +template<> struct sp_dereference< void volatile > +{ + typedef void type; +}; + +template<> struct sp_dereference< void const volatile > +{ + typedef void type; +}; + +#endif // !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< class T > struct sp_dereference< T[] > +{ + typedef void type; +}; + +#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) + +template< class T, std::size_t N > struct sp_dereference< T[N] > +{ + typedef void type; +}; + +#endif + +#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +// sp_member_access, return type of operator-> + +template< class T > struct sp_member_access +{ + typedef T * type; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< class T > struct sp_member_access< T[] > +{ + typedef void type; +}; + +#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) + +template< class T, std::size_t N > struct sp_member_access< T[N] > +{ + typedef void type; +}; + +#endif + +#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +// sp_array_access, return type of operator[] + +template< class T > struct sp_array_access +{ + typedef void type; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< class T > struct sp_array_access< T[] > +{ + typedef T & type; +}; + +#if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) + +template< class T, std::size_t N > struct sp_array_access< T[N] > +{ + typedef T & type; +}; + +#endif + +#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +// sp_extent, for operator[] index check + +template< class T > struct sp_extent +{ + enum _vt { value = 0 }; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< class T, std::size_t N > struct sp_extent< T[N] > +{ + enum _vt { value = N }; +}; + +#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +// enable_shared_from_this support + +template< class X, class Y, class T > inline void sp_enable_shared_from_this( boost::shared_ptr const * ppx, Y const * py, boost::enable_shared_from_this< T > const * pe ) +{ + if( pe != 0 ) + { + pe->_internal_accept_owner( ppx, const_cast< Y* >( py ) ); + } +} + +template< class X, class Y > inline void sp_enable_shared_from_this( boost::shared_ptr * ppx, Y const * py, boost::enable_shared_from_raw const * pe ); + +#ifdef _MANAGED + +// Avoid C4793, ... causes native code generation + +struct sp_any_pointer +{ + template sp_any_pointer( T* ) {} +}; + +inline void sp_enable_shared_from_this( sp_any_pointer, sp_any_pointer, sp_any_pointer ) +{ +} + +#else // _MANAGED + +inline void sp_enable_shared_from_this( ... ) +{ +} + +#endif // _MANAGED + +#if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( BOOST_NO_AUTO_PTR ) + +// rvalue auto_ptr support based on a technique by Dave Abrahams + +template< class T, class R > struct sp_enable_if_auto_ptr +{ +}; + +template< class T, class R > struct sp_enable_if_auto_ptr< std::auto_ptr< T >, R > +{ + typedef R type; +}; + +#endif + +// sp_assert_convertible + +template< class Y, class T > inline void sp_assert_convertible() BOOST_SP_NOEXCEPT +{ +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + // static_assert( sp_convertible< Y, T >::value ); + typedef char tmp[ sp_convertible< Y, T >::value? 1: -1 ]; + (void)sizeof( tmp ); + +#else + + T* p = static_cast< Y* >( 0 ); + (void)p; + +#endif +} + +// pointer constructor helper + +template< class T, class Y > inline void sp_pointer_construct( boost::shared_ptr< T > * ppx, Y * p, boost::detail::shared_count & pn ) +{ + boost::detail::shared_count( p ).swap( pn ); + boost::detail::sp_enable_shared_from_this( ppx, p, p ); +} + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< class T, class Y > inline void sp_pointer_construct( boost::shared_ptr< T[] > * /*ppx*/, Y * p, boost::detail::shared_count & pn ) +{ + sp_assert_convertible< Y[], T[] >(); + boost::detail::shared_count( p, boost::checked_array_deleter< T >() ).swap( pn ); +} + +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 ) +{ + sp_assert_convertible< Y[N], T[N] >(); + boost::detail::shared_count( p, boost::checked_array_deleter< T >() ).swap( pn ); +} + +#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +// deleter constructor helper + +template< class T, class Y > inline void sp_deleter_construct( boost::shared_ptr< T > * ppx, Y * p ) +{ + boost::detail::sp_enable_shared_from_this( ppx, p, p ); +} + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< class T, class Y > inline void sp_deleter_construct( boost::shared_ptr< T[] > * /*ppx*/, Y * /*p*/ ) +{ + sp_assert_convertible< Y[], T[] >(); +} + +template< class T, std::size_t N, class Y > inline void sp_deleter_construct( boost::shared_ptr< T[N] > * /*ppx*/, Y * /*p*/ ) +{ + sp_assert_convertible< Y[N], T[N] >(); +} + +#endif // !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +struct sp_internal_constructor_tag +{ +}; + +} // namespace detail + + +// +// shared_ptr +// +// An enhanced relative of scoped_ptr with reference counted copy semantics. +// The object pointed to is deleted when the last shared_ptr pointing to it +// is destroyed or reset. +// + +template class shared_ptr +{ +private: + + // Borland 5.5.1 specific workaround + typedef shared_ptr this_type; + +public: + + typedef typename boost::detail::sp_element< T >::type element_type; + + BOOST_CONSTEXPR shared_ptr() BOOST_SP_NOEXCEPT : px( 0 ), pn() + { + } + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + + BOOST_CONSTEXPR shared_ptr( boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT : px( 0 ), pn() + { + } + +#endif + + BOOST_CONSTEXPR shared_ptr( boost::detail::sp_internal_constructor_tag, element_type * px_, boost::detail::shared_count const & pn_ ) BOOST_SP_NOEXCEPT : px( px_ ), pn( pn_ ) + { + } + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + BOOST_CONSTEXPR shared_ptr( boost::detail::sp_internal_constructor_tag, element_type * px_, boost::detail::shared_count && pn_ ) BOOST_SP_NOEXCEPT : px( px_ ), pn( std::move( pn_ ) ) + { + } + +#endif + + template + explicit shared_ptr( Y * p ): px( p ), pn() // Y must be complete + { + boost::detail::sp_pointer_construct( this, p, pn ); + } + + // + // Requirements: D's copy constructor must not throw + // + // shared_ptr will release p by calling d(p) + // + + template shared_ptr( Y * p, D d ): px( p ), pn( p, d ) + { + boost::detail::sp_deleter_construct( this, p ); + } + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + + template shared_ptr( boost::detail::sp_nullptr_t p, D d ): px( p ), pn( p, d ) + { + } + +#endif + + // As above, but with allocator. A's copy constructor shall not throw. + + template shared_ptr( Y * p, D d, A a ): px( p ), pn( p, d, a ) + { + boost::detail::sp_deleter_construct( this, p ); + } + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + + template shared_ptr( boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( p, d, a ) + { + } + +#endif + +// generated copy constructor, destructor are fine... + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + +// ... except in C++0x, move disables the implicit copy + + shared_ptr( shared_ptr const & r ) BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) + { + } + +#endif + + template + explicit shared_ptr( weak_ptr const & r ): pn( r.pn ) // may throw + { + boost::detail::sp_assert_convertible< Y, T >(); + + // it is now safe to copy r.px, as pn(r.pn) did not throw + px = r.px; + } + + template + shared_ptr( weak_ptr const & r, boost::detail::sp_nothrow_tag ) + BOOST_SP_NOEXCEPT : px( 0 ), pn( r.pn, boost::detail::sp_nothrow_tag() ) + { + if( !pn.empty() ) + { + px = r.px; + } + } + + template +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + shared_ptr( shared_ptr const & r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) + +#else + + shared_ptr( shared_ptr const & r ) + +#endif + BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) + { + boost::detail::sp_assert_convertible< Y, T >(); + } + + // aliasing + template< class Y > + shared_ptr( shared_ptr const & r, element_type * p ) BOOST_SP_NOEXCEPT : px( p ), pn( r.pn ) + { + } + +#ifndef BOOST_NO_AUTO_PTR + + template + explicit shared_ptr( std::auto_ptr & r ): px(r.get()), pn() + { + boost::detail::sp_assert_convertible< Y, T >(); + + Y * tmp = r.get(); + pn = boost::detail::shared_count( r ); + + boost::detail::sp_deleter_construct( this, tmp ); + } + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + template + shared_ptr( std::auto_ptr && r ): px(r.get()), pn() + { + boost::detail::sp_assert_convertible< Y, T >(); + + Y * tmp = r.get(); + pn = boost::detail::shared_count( r ); + + boost::detail::sp_deleter_construct( this, tmp ); + } + +#elif !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + + template + explicit shared_ptr( Ap r, typename boost::detail::sp_enable_if_auto_ptr::type = 0 ): px( r.get() ), pn() + { + typedef typename Ap::element_type Y; + + boost::detail::sp_assert_convertible< Y, T >(); + + Y * tmp = r.get(); + pn = boost::detail::shared_count( r ); + + boost::detail::sp_deleter_construct( this, tmp ); + } + +#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#endif // BOOST_NO_AUTO_PTR + +#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + template< class Y, class D > + shared_ptr( std::unique_ptr< Y, D > && r ): px( r.get() ), pn() + { + boost::detail::sp_assert_convertible< Y, T >(); + + typename std::unique_ptr< Y, D >::pointer tmp = r.get(); + + if( tmp != 0 ) + { + pn = boost::detail::shared_count( r ); + boost::detail::sp_deleter_construct( this, tmp ); + } + } + +#endif + + template< class Y, class D > + shared_ptr( boost::movelib::unique_ptr< Y, D > r ): px( r.get() ), pn() + { + boost::detail::sp_assert_convertible< Y, T >(); + + typename boost::movelib::unique_ptr< Y, D >::pointer tmp = r.get(); + + if( tmp != 0 ) + { + pn = boost::detail::shared_count( r ); + boost::detail::sp_deleter_construct( this, tmp ); + } + } + + // assignment + + shared_ptr & operator=( shared_ptr const & r ) BOOST_SP_NOEXCEPT + { + this_type(r).swap(*this); + return *this; + } + +#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1400) + + template + shared_ptr & operator=(shared_ptr const & r) BOOST_SP_NOEXCEPT + { + this_type(r).swap(*this); + return *this; + } + +#endif + +#ifndef BOOST_NO_AUTO_PTR + + template + shared_ptr & operator=( std::auto_ptr & r ) + { + this_type( r ).swap( *this ); + return *this; + } + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + template + shared_ptr & operator=( std::auto_ptr && r ) + { + this_type( static_cast< std::auto_ptr && >( r ) ).swap( *this ); + return *this; + } + +#elif !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + + template + typename boost::detail::sp_enable_if_auto_ptr< Ap, shared_ptr & >::type operator=( Ap r ) + { + this_type( r ).swap( *this ); + return *this; + } + +#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +#endif // BOOST_NO_AUTO_PTR + +#if !defined( BOOST_NO_CXX11_SMART_PTR ) && !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + template + shared_ptr & operator=( std::unique_ptr && r ) + { + this_type( static_cast< std::unique_ptr && >( r ) ).swap(*this); + return *this; + } + +#endif + + template + shared_ptr & operator=( boost::movelib::unique_ptr r ) + { + // this_type( static_cast< unique_ptr && >( r ) ).swap( *this ); + + boost::detail::sp_assert_convertible< Y, T >(); + + typename boost::movelib::unique_ptr< Y, D >::pointer p = r.get(); + + shared_ptr tmp; + + if( p != 0 ) + { + tmp.px = p; + tmp.pn = boost::detail::shared_count( r ); + + boost::detail::sp_deleter_construct( &tmp, p ); + } + + tmp.swap( *this ); + + return *this; + } + +// Move support + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + shared_ptr( shared_ptr && r ) BOOST_SP_NOEXCEPT : px( r.px ), pn() + { + pn.swap( r.pn ); + r.px = 0; + } + + template +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + shared_ptr( shared_ptr && r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) + +#else + + shared_ptr( shared_ptr && r ) + +#endif + BOOST_SP_NOEXCEPT : px( r.px ), pn() + { + boost::detail::sp_assert_convertible< Y, T >(); + + pn.swap( r.pn ); + r.px = 0; + } + + shared_ptr & operator=( shared_ptr && r ) BOOST_SP_NOEXCEPT + { + this_type( static_cast< shared_ptr && >( r ) ).swap( *this ); + return *this; + } + + template + shared_ptr & operator=( shared_ptr && r ) BOOST_SP_NOEXCEPT + { + this_type( static_cast< shared_ptr && >( r ) ).swap( *this ); + return *this; + } + + // aliasing move + template + shared_ptr( shared_ptr && r, element_type * p ) BOOST_SP_NOEXCEPT : px( p ), pn() + { + pn.swap( r.pn ); + r.px = 0; + } + +#endif + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + + shared_ptr & operator=( boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT + { + this_type().swap(*this); + return *this; + } + +#endif + + void reset() BOOST_SP_NOEXCEPT + { + this_type().swap(*this); + } + + template void reset( Y * p ) // Y must be complete + { + BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors + this_type( p ).swap( *this ); + } + + template void reset( Y * p, D d ) + { + this_type( p, d ).swap( *this ); + } + + template void reset( Y * p, D d, A a ) + { + this_type( p, d, a ).swap( *this ); + } + + template void reset( shared_ptr const & r, element_type * p ) BOOST_SP_NOEXCEPT + { + this_type( r, p ).swap( *this ); + } + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + template void reset( shared_ptr && r, element_type * p ) BOOST_SP_NOEXCEPT + { + this_type( static_cast< shared_ptr && >( r ), p ).swap( *this ); + } + +#endif + + typename boost::detail::sp_dereference< T >::type operator* () const BOOST_SP_NOEXCEPT_WITH_ASSERT + { + BOOST_ASSERT( px != 0 ); + return *px; + } + + typename boost::detail::sp_member_access< T >::type operator-> () const BOOST_SP_NOEXCEPT_WITH_ASSERT + { + BOOST_ASSERT( px != 0 ); + return px; + } + + typename boost::detail::sp_array_access< T >::type operator[] ( std::ptrdiff_t i ) const BOOST_SP_NOEXCEPT_WITH_ASSERT + { + BOOST_ASSERT( px != 0 ); + BOOST_ASSERT( i >= 0 && ( i < boost::detail::sp_extent< T >::value || boost::detail::sp_extent< T >::value == 0 ) ); + + return static_cast< typename boost::detail::sp_array_access< T >::type >( px[ i ] ); + } + + element_type * get() const BOOST_SP_NOEXCEPT + { + return px; + } + +// implicit conversion to "bool" +#include + + bool unique() const BOOST_SP_NOEXCEPT + { + return pn.unique(); + } + + long use_count() const BOOST_SP_NOEXCEPT + { + return pn.use_count(); + } + + void swap( shared_ptr & other ) BOOST_SP_NOEXCEPT + { + std::swap(px, other.px); + pn.swap(other.pn); + } + + template bool owner_before( shared_ptr const & rhs ) const BOOST_SP_NOEXCEPT + { + return pn < rhs.pn; + } + + template bool owner_before( weak_ptr const & rhs ) const BOOST_SP_NOEXCEPT + { + return pn < rhs.pn; + } + + void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT + { + return pn.get_deleter( ti ); + } + + void * _internal_get_local_deleter( boost::detail::sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT + { + return pn.get_local_deleter( ti ); + } + + void * _internal_get_untyped_deleter() const BOOST_SP_NOEXCEPT + { + return pn.get_untyped_deleter(); + } + + bool _internal_equiv( shared_ptr const & r ) const BOOST_SP_NOEXCEPT + { + return px == r.px && pn == r.pn; + } + + boost::detail::shared_count _internal_count() const BOOST_NOEXCEPT + { + return pn; + } + +// Tasteless as this may seem, making all members public allows member templates +// to work in the absence of member template friends. (Matthew Langston) + +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS + +private: + + template friend class shared_ptr; + template friend class weak_ptr; + + +#endif + + element_type * px; // contained pointer + boost::detail::shared_count pn; // reference counter + +}; // shared_ptr + +template inline bool operator==(shared_ptr const & a, shared_ptr const & b) BOOST_SP_NOEXCEPT +{ + return a.get() == b.get(); +} + +template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) BOOST_SP_NOEXCEPT +{ + return a.get() != b.get(); +} + +#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96 + +// Resolve the ambiguity between our op!= and the one in rel_ops + +template inline bool operator!=(shared_ptr const & a, shared_ptr const & b) BOOST_SP_NOEXCEPT +{ + return a.get() != b.get(); +} + +#endif + +#if !defined( BOOST_NO_CXX11_NULLPTR ) + +template inline bool operator==( shared_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT +{ + return p.get() == 0; +} + +template inline bool operator==( boost::detail::sp_nullptr_t, shared_ptr const & p ) BOOST_SP_NOEXCEPT +{ + return p.get() == 0; +} + +template inline bool operator!=( shared_ptr const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT +{ + return p.get() != 0; +} + +template inline bool operator!=( boost::detail::sp_nullptr_t, shared_ptr const & p ) BOOST_SP_NOEXCEPT +{ + return p.get() != 0; +} + +#endif + +template inline bool operator<(shared_ptr const & a, shared_ptr const & b) BOOST_SP_NOEXCEPT +{ + return a.owner_before( b ); +} + +template inline void swap(shared_ptr & a, shared_ptr & b) BOOST_SP_NOEXCEPT +{ + a.swap(b); +} + +template shared_ptr static_pointer_cast( shared_ptr const & r ) BOOST_SP_NOEXCEPT +{ + (void) static_cast< T* >( static_cast< U* >( 0 ) ); + + typedef typename shared_ptr::element_type E; + + E * p = static_cast< E* >( r.get() ); + return shared_ptr( r, p ); +} + +template shared_ptr const_pointer_cast( shared_ptr const & r ) BOOST_SP_NOEXCEPT +{ + (void) const_cast< T* >( static_cast< U* >( 0 ) ); + + typedef typename shared_ptr::element_type E; + + E * p = const_cast< E* >( r.get() ); + return shared_ptr( r, p ); +} + +template shared_ptr dynamic_pointer_cast( shared_ptr const & r ) BOOST_SP_NOEXCEPT +{ + (void) dynamic_cast< T* >( static_cast< U* >( 0 ) ); + + typedef typename shared_ptr::element_type E; + + E * p = dynamic_cast< E* >( r.get() ); + return p? shared_ptr( r, p ): shared_ptr(); +} + +template shared_ptr reinterpret_pointer_cast( shared_ptr const & r ) BOOST_SP_NOEXCEPT +{ + (void) reinterpret_cast< T* >( static_cast< U* >( 0 ) ); + + typedef typename shared_ptr::element_type E; + + E * p = reinterpret_cast< E* >( r.get() ); + return shared_ptr( r, p ); +} + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + +template shared_ptr static_pointer_cast( shared_ptr && r ) BOOST_SP_NOEXCEPT +{ + (void) static_cast< T* >( static_cast< U* >( 0 ) ); + + typedef typename shared_ptr::element_type E; + + E * p = static_cast< E* >( r.get() ); + return shared_ptr( std::move(r), p ); +} + +template shared_ptr const_pointer_cast( shared_ptr && r ) BOOST_SP_NOEXCEPT +{ + (void) const_cast< T* >( static_cast< U* >( 0 ) ); + + typedef typename shared_ptr::element_type E; + + E * p = const_cast< E* >( r.get() ); + return shared_ptr( std::move(r), p ); +} + +template shared_ptr dynamic_pointer_cast( shared_ptr && r ) BOOST_SP_NOEXCEPT +{ + (void) dynamic_cast< T* >( static_cast< U* >( 0 ) ); + + typedef typename shared_ptr::element_type E; + + E * p = dynamic_cast< E* >( r.get() ); + return p? shared_ptr( std::move(r), p ): shared_ptr(); +} + +template shared_ptr reinterpret_pointer_cast( shared_ptr && r ) BOOST_SP_NOEXCEPT +{ + (void) reinterpret_cast< T* >( static_cast< U* >( 0 ) ); + + typedef typename shared_ptr::element_type E; + + E * p = reinterpret_cast< E* >( r.get() ); + return shared_ptr( std::move(r), p ); +} + +#endif // !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + +// get_pointer() enables boost::mem_fn to recognize shared_ptr + +template inline typename shared_ptr::element_type * get_pointer(shared_ptr const & p) BOOST_SP_NOEXCEPT +{ + return p.get(); +} + +// operator<< + +#if !defined(BOOST_NO_IOSTREAM) + +#if defined(BOOST_NO_TEMPLATED_IOSTREAMS) || ( defined(__GNUC__) && (__GNUC__ < 3) ) + +template std::ostream & operator<< (std::ostream & os, shared_ptr const & p) +{ + os << p.get(); + return os; +} + +#else + +// in STLport's no-iostreams mode no iostream symbols can be used +#ifndef _STLP_NO_IOSTREAMS + +# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300 && __SGI_STL_PORT) +// MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL +using std::basic_ostream; +template basic_ostream & operator<< (basic_ostream & os, shared_ptr const & p) +# else +template std::basic_ostream & operator<< (std::basic_ostream & os, shared_ptr const & p) +# endif +{ + os << p.get(); + return os; +} + +#endif // _STLP_NO_IOSTREAMS + +#endif // __GNUC__ < 3 + +#endif // !defined(BOOST_NO_IOSTREAM) + +// get_deleter + +namespace detail +{ + +template D * basic_get_deleter( shared_ptr const & p ) BOOST_SP_NOEXCEPT +{ + return static_cast( p._internal_get_deleter(BOOST_SP_TYPEID(D)) ); +} + +template D * basic_get_local_deleter( D *, shared_ptr const & p ) BOOST_SP_NOEXCEPT; +template D const * basic_get_local_deleter( D const *, shared_ptr const & p ) BOOST_SP_NOEXCEPT; + +class esft2_deleter_wrapper +{ +private: + + shared_ptr deleter_; + +public: + + esft2_deleter_wrapper() + { + } + + template< class T > void set_deleter( shared_ptr const & deleter ) BOOST_SP_NOEXCEPT + { + deleter_ = deleter; + } + + template D* get_deleter() const BOOST_SP_NOEXCEPT + { + return boost::detail::basic_get_deleter( deleter_ ); + } + + template< class T> void operator()( T* ) BOOST_SP_NOEXCEPT_WITH_ASSERT + { + BOOST_ASSERT( deleter_.use_count() <= 1 ); + deleter_.reset(); + } +}; + +} // namespace detail + +template D * get_deleter( shared_ptr const & p ) BOOST_SP_NOEXCEPT +{ + D * d = boost::detail::basic_get_deleter( p ); + + if( d == 0 ) + { + d = boost::detail::basic_get_local_deleter( d, p ); + } + + if( d == 0 ) + { + boost::detail::esft2_deleter_wrapper *del_wrapper = boost::detail::basic_get_deleter(p); +// The following get_deleter method call is fully qualified because +// older versions of gcc (2.95, 3.2.3) fail to compile it when written del_wrapper->get_deleter() + if(del_wrapper) d = del_wrapper->::boost::detail::esft2_deleter_wrapper::get_deleter(); + } + + return d; +} + +// atomic access + +#if !defined(BOOST_SP_NO_ATOMIC_ACCESS) + +template inline bool atomic_is_lock_free( shared_ptr const * /*p*/ ) BOOST_SP_NOEXCEPT +{ + return false; +} + +template shared_ptr atomic_load( shared_ptr const * p ) BOOST_SP_NOEXCEPT +{ + boost::detail::spinlock_pool<2>::scoped_lock lock( p ); + return *p; +} + +template inline shared_ptr atomic_load_explicit( shared_ptr const * p, /*memory_order mo*/ M ) BOOST_SP_NOEXCEPT +{ + return atomic_load( p ); +} + +template void atomic_store( shared_ptr * p, shared_ptr r ) BOOST_SP_NOEXCEPT +{ + boost::detail::spinlock_pool<2>::scoped_lock lock( p ); + p->swap( r ); +} + +template inline void atomic_store_explicit( shared_ptr * p, shared_ptr r, /*memory_order mo*/ M ) BOOST_SP_NOEXCEPT +{ + atomic_store( p, r ); // std::move( r ) +} + +template shared_ptr atomic_exchange( shared_ptr * p, shared_ptr r ) BOOST_SP_NOEXCEPT +{ + boost::detail::spinlock & sp = boost::detail::spinlock_pool<2>::spinlock_for( p ); + + sp.lock(); + p->swap( r ); + sp.unlock(); + + return r; // return std::move( r ) +} + +template shared_ptr inline atomic_exchange_explicit( shared_ptr * p, shared_ptr r, /*memory_order mo*/ M ) BOOST_SP_NOEXCEPT +{ + return atomic_exchange( p, r ); // std::move( r ) +} + +template bool atomic_compare_exchange( shared_ptr * p, shared_ptr * v, shared_ptr w ) BOOST_SP_NOEXCEPT +{ + boost::detail::spinlock & sp = boost::detail::spinlock_pool<2>::spinlock_for( p ); + + sp.lock(); + + if( p->_internal_equiv( *v ) ) + { + p->swap( w ); + + sp.unlock(); + + return true; + } + else + { + shared_ptr tmp( *p ); + + sp.unlock(); + + tmp.swap( *v ); + return false; + } +} + +template inline bool atomic_compare_exchange_explicit( shared_ptr * p, shared_ptr * v, shared_ptr w, /*memory_order success*/ M, /*memory_order failure*/ M ) BOOST_SP_NOEXCEPT +{ + return atomic_compare_exchange( p, v, w ); // std::move( w ) +} + +#endif // !defined(BOOST_SP_NO_ATOMIC_ACCESS) + +// hash_value + +template< class T > struct hash; + +template< class T > std::size_t hash_value( boost::shared_ptr const & p ) BOOST_SP_NOEXCEPT +{ + return boost::hash< typename boost::shared_ptr::element_type* >()( p.get() ); +} + +} // namespace boost + +#include + +namespace boost +{ + +namespace detail +{ + +template D * basic_get_local_deleter( D *, shared_ptr const & p ) BOOST_SP_NOEXCEPT +{ + return static_cast( p._internal_get_local_deleter( BOOST_SP_TYPEID(local_sp_deleter) ) ); +} + +template D const * basic_get_local_deleter( D const *, shared_ptr const & p ) BOOST_SP_NOEXCEPT +{ + return static_cast( p._internal_get_local_deleter( BOOST_SP_TYPEID(local_sp_deleter) ) ); +} + +} // namespace detail + +} // namespace boost + +#if defined( BOOST_SP_DISABLE_DEPRECATED ) +#pragma GCC diagnostic pop +#endif + +#endif // #ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/weak_ptr.hpp b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/weak_ptr.hpp new file mode 100644 index 00000000000..54d9ef37812 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/smart_ptr/weak_ptr.hpp @@ -0,0 +1,254 @@ +#ifndef BOOST_SMART_PTR_WEAK_PTR_HPP_INCLUDED +#define BOOST_SMART_PTR_WEAK_PTR_HPP_INCLUDED + +// +// weak_ptr.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. +// + +#include // boost.TR1 include order fix +#include +#include +#include + +namespace boost +{ + +template class weak_ptr +{ +private: + + // Borland 5.5.1 specific workarounds + typedef weak_ptr this_type; + +public: + + typedef typename boost::detail::sp_element< T >::type element_type; + + BOOST_CONSTEXPR weak_ptr() BOOST_SP_NOEXCEPT : px(0), pn() + { + } + +// generated copy constructor, assignment, destructor are fine... + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + +// ... except in C++0x, move disables the implicit copy + + weak_ptr( weak_ptr const & r ) BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) + { + } + + weak_ptr & operator=( weak_ptr const & r ) BOOST_SP_NOEXCEPT + { + px = r.px; + pn = r.pn; + return *this; + } + +#endif + +// +// The "obvious" converting constructor implementation: +// +// template +// weak_ptr(weak_ptr const & r): px(r.px), pn(r.pn) +// { +// } +// +// has a serious problem. +// +// r.px may already have been invalidated. The px(r.px) +// conversion may require access to *r.px (virtual inheritance). +// +// It is not possible to avoid spurious access violations since +// in multithreaded programs r.px may be invalidated at any point. +// + + template +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + weak_ptr( weak_ptr const & r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) + +#else + + weak_ptr( weak_ptr const & r ) + +#endif + BOOST_SP_NOEXCEPT : px(r.lock().get()), pn(r.pn) + { + boost::detail::sp_assert_convertible< Y, T >(); + } + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + template +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + weak_ptr( weak_ptr && r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) + +#else + + weak_ptr( weak_ptr && r ) + +#endif + BOOST_SP_NOEXCEPT : px( r.lock().get() ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) + { + boost::detail::sp_assert_convertible< Y, T >(); + r.px = 0; + } + + // for better efficiency in the T == Y case + weak_ptr( weak_ptr && r ) + BOOST_SP_NOEXCEPT : px( r.px ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) + { + r.px = 0; + } + + // for better efficiency in the T == Y case + weak_ptr & operator=( weak_ptr && r ) BOOST_SP_NOEXCEPT + { + this_type( static_cast< weak_ptr && >( r ) ).swap( *this ); + return *this; + } + + +#endif + + template +#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) + + weak_ptr( shared_ptr const & r, typename boost::detail::sp_enable_if_convertible::type = boost::detail::sp_empty() ) + +#else + + weak_ptr( shared_ptr const & r ) + +#endif + BOOST_SP_NOEXCEPT : px( r.px ), pn( r.pn ) + { + boost::detail::sp_assert_convertible< Y, T >(); + } + +#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1300) + + template + weak_ptr & operator=( weak_ptr const & r ) BOOST_SP_NOEXCEPT + { + boost::detail::sp_assert_convertible< Y, T >(); + + px = r.lock().get(); + pn = r.pn; + + return *this; + } + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + + template + weak_ptr & operator=( weak_ptr && r ) BOOST_SP_NOEXCEPT + { + this_type( static_cast< weak_ptr && >( r ) ).swap( *this ); + return *this; + } + +#endif + + template + weak_ptr & operator=( shared_ptr const & r ) BOOST_SP_NOEXCEPT + { + boost::detail::sp_assert_convertible< Y, T >(); + + px = r.px; + pn = r.pn; + + return *this; + } + +#endif + + shared_ptr lock() const BOOST_SP_NOEXCEPT + { + return shared_ptr( *this, boost::detail::sp_nothrow_tag() ); + } + + long use_count() const BOOST_SP_NOEXCEPT + { + return pn.use_count(); + } + + bool expired() const BOOST_SP_NOEXCEPT + { + return pn.use_count() == 0; + } + + bool _empty() const BOOST_SP_NOEXCEPT // extension, not in std::weak_ptr + { + return pn.empty(); + } + + void reset() BOOST_SP_NOEXCEPT + { + this_type().swap(*this); + } + + void swap(this_type & other) BOOST_SP_NOEXCEPT + { + std::swap(px, other.px); + pn.swap(other.pn); + } + + template + void _internal_aliasing_assign(weak_ptr const & r, element_type * px2) BOOST_SP_NOEXCEPT + { + px = px2; + pn = r.pn; + } + + template bool owner_before( weak_ptr const & rhs ) const BOOST_SP_NOEXCEPT + { + return pn < rhs.pn; + } + + template bool owner_before( shared_ptr const & rhs ) const BOOST_SP_NOEXCEPT + { + return pn < rhs.pn; + } + +// Tasteless as this may seem, making all members public allows member templates +// to work in the absence of member template friends. (Matthew Langston) + +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS + +private: + + template friend class weak_ptr; + template friend class shared_ptr; + +#endif + + element_type * px; // contained pointer + boost::detail::weak_count pn; // reference counter + +}; // weak_ptr + +template inline bool operator<(weak_ptr const & a, weak_ptr const & b) BOOST_SP_NOEXCEPT +{ + return a.owner_before( b ); +} + +template void swap(weak_ptr & a, weak_ptr & b) BOOST_SP_NOEXCEPT +{ + a.swap(b); +} + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_WEAK_PTR_HPP_INCLUDED diff --git a/contrib/restricted/boost/smart_ptr/include/boost/weak_ptr.hpp b/contrib/restricted/boost/smart_ptr/include/boost/weak_ptr.hpp new file mode 100644 index 00000000000..fa8574beac4 --- /dev/null +++ b/contrib/restricted/boost/smart_ptr/include/boost/weak_ptr.hpp @@ -0,0 +1,18 @@ +#ifndef BOOST_WEAK_PTR_HPP_INCLUDED +#define BOOST_WEAK_PTR_HPP_INCLUDED + +// +// weak_ptr.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. +// + +#include + +#endif // #ifndef BOOST_WEAK_PTR_HPP_INCLUDED -- cgit v1.3