@dittolive/ditto 4.4.5 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DittoReactNative.podspec +27 -0
- package/README.md +68 -51
- package/node/ditto.cjs.js +1639 -851
- package/node/ditto.darwin-arm64.node +0 -0
- package/node/ditto.darwin-x64.node +0 -0
- package/node/ditto.linux-arm.node +0 -0
- package/node/ditto.linux-x64.node +0 -0
- package/node/ditto.win32-x64.node +0 -0
- package/node/transports.darwin-arm64.node +0 -0
- package/node/transports.darwin-x64.node +0 -0
- package/package.json +34 -38
- package/react-native/android/CMakeLists.txt +37 -0
- package/react-native/android/build.gradle +203 -0
- package/react-native/android/cpp-adapter.cpp +254 -0
- package/react-native/android/gradle.properties +5 -0
- package/react-native/android/src/main/AndroidManifest.xml +4 -0
- package/react-native/android/src/main/java/com/dittolive/rnsdk/DittoRNSDKModule.java +85 -0
- package/react-native/android/src/main/java/com/dittolive/rnsdk/DittoRNSDKPackage.java +28 -0
- package/react-native/boost/boost/assert.hpp +85 -0
- package/react-native/boost/boost/config/abi/borland_prefix.hpp +27 -0
- package/react-native/boost/boost/config/abi/borland_suffix.hpp +12 -0
- package/react-native/boost/boost/config/abi/msvc_prefix.hpp +22 -0
- package/react-native/boost/boost/config/abi/msvc_suffix.hpp +8 -0
- package/react-native/boost/boost/config/abi_prefix.hpp +25 -0
- package/react-native/boost/boost/config/abi_suffix.hpp +25 -0
- package/react-native/boost/boost/config/assert_cxx03.hpp +211 -0
- package/react-native/boost/boost/config/assert_cxx11.hpp +209 -0
- package/react-native/boost/boost/config/assert_cxx14.hpp +47 -0
- package/react-native/boost/boost/config/assert_cxx17.hpp +62 -0
- package/react-native/boost/boost/config/assert_cxx20.hpp +59 -0
- package/react-native/boost/boost/config/assert_cxx98.hpp +23 -0
- package/react-native/boost/boost/config/auto_link.hpp +525 -0
- package/react-native/boost/boost/config/compiler/borland.hpp +339 -0
- package/react-native/boost/boost/config/compiler/clang.hpp +366 -0
- package/react-native/boost/boost/config/compiler/clang_version.hpp +83 -0
- package/react-native/boost/boost/config/compiler/codegear.hpp +385 -0
- package/react-native/boost/boost/config/compiler/comeau.hpp +59 -0
- package/react-native/boost/boost/config/compiler/common_edg.hpp +183 -0
- package/react-native/boost/boost/config/compiler/compaq_cxx.hpp +19 -0
- package/react-native/boost/boost/config/compiler/cray.hpp +446 -0
- package/react-native/boost/boost/config/compiler/diab.hpp +26 -0
- package/react-native/boost/boost/config/compiler/digitalmars.hpp +143 -0
- package/react-native/boost/boost/config/compiler/gcc.hpp +383 -0
- package/react-native/boost/boost/config/compiler/gcc_xml.hpp +114 -0
- package/react-native/boost/boost/config/compiler/greenhills.hpp +28 -0
- package/react-native/boost/boost/config/compiler/hp_acc.hpp +149 -0
- package/react-native/boost/boost/config/compiler/intel.hpp +577 -0
- package/react-native/boost/boost/config/compiler/kai.hpp +33 -0
- package/react-native/boost/boost/config/compiler/metrowerks.hpp +198 -0
- package/react-native/boost/boost/config/compiler/mpw.hpp +140 -0
- package/react-native/boost/boost/config/compiler/nvcc.hpp +61 -0
- package/react-native/boost/boost/config/compiler/pathscale.hpp +138 -0
- package/react-native/boost/boost/config/compiler/pgi.hpp +23 -0
- package/react-native/boost/boost/config/compiler/sgi_mipspro.hpp +29 -0
- package/react-native/boost/boost/config/compiler/sunpro_cc.hpp +222 -0
- package/react-native/boost/boost/config/compiler/vacpp.hpp +186 -0
- package/react-native/boost/boost/config/compiler/visualc.hpp +391 -0
- package/react-native/boost/boost/config/compiler/xlcpp.hpp +299 -0
- package/react-native/boost/boost/config/compiler/xlcpp_zos.hpp +173 -0
- package/react-native/boost/boost/config/detail/cxx_composite.hpp +203 -0
- package/react-native/boost/boost/config/detail/posix_features.hpp +95 -0
- package/react-native/boost/boost/config/detail/select_compiler_config.hpp +157 -0
- package/react-native/boost/boost/config/detail/select_platform_config.hpp +147 -0
- package/react-native/boost/boost/config/detail/select_stdlib_config.hpp +121 -0
- package/react-native/boost/boost/config/detail/suffix.hpp +1294 -0
- package/react-native/boost/boost/config/header_deprecated.hpp +26 -0
- package/react-native/boost/boost/config/helper_macros.hpp +37 -0
- package/react-native/boost/boost/config/no_tr1/cmath.hpp +28 -0
- package/react-native/boost/boost/config/no_tr1/complex.hpp +28 -0
- package/react-native/boost/boost/config/no_tr1/functional.hpp +28 -0
- package/react-native/boost/boost/config/no_tr1/memory.hpp +28 -0
- package/react-native/boost/boost/config/no_tr1/utility.hpp +28 -0
- package/react-native/boost/boost/config/platform/aix.hpp +33 -0
- package/react-native/boost/boost/config/platform/amigaos.hpp +15 -0
- package/react-native/boost/boost/config/platform/beos.hpp +26 -0
- package/react-native/boost/boost/config/platform/bsd.hpp +83 -0
- package/react-native/boost/boost/config/platform/cloudabi.hpp +18 -0
- package/react-native/boost/boost/config/platform/cray.hpp +18 -0
- package/react-native/boost/boost/config/platform/cygwin.hpp +71 -0
- package/react-native/boost/boost/config/platform/haiku.hpp +31 -0
- package/react-native/boost/boost/config/platform/hpux.hpp +87 -0
- package/react-native/boost/boost/config/platform/irix.hpp +31 -0
- package/react-native/boost/boost/config/platform/linux.hpp +106 -0
- package/react-native/boost/boost/config/platform/macos.hpp +87 -0
- package/react-native/boost/boost/config/platform/qnxnto.hpp +31 -0
- package/react-native/boost/boost/config/platform/solaris.hpp +31 -0
- package/react-native/boost/boost/config/platform/symbian.hpp +97 -0
- package/react-native/boost/boost/config/platform/vms.hpp +25 -0
- package/react-native/boost/boost/config/platform/vxworks.hpp +422 -0
- package/react-native/boost/boost/config/platform/wasm.hpp +23 -0
- package/react-native/boost/boost/config/platform/win32.hpp +90 -0
- package/react-native/boost/boost/config/platform/zos.hpp +32 -0
- package/react-native/boost/boost/config/pragma_message.hpp +31 -0
- package/react-native/boost/boost/config/requires_threads.hpp +92 -0
- package/react-native/boost/boost/config/stdlib/dinkumware.hpp +324 -0
- package/react-native/boost/boost/config/stdlib/libcomo.hpp +93 -0
- package/react-native/boost/boost/config/stdlib/libcpp.hpp +180 -0
- package/react-native/boost/boost/config/stdlib/libstdcpp3.hpp +482 -0
- package/react-native/boost/boost/config/stdlib/modena.hpp +79 -0
- package/react-native/boost/boost/config/stdlib/msl.hpp +98 -0
- package/react-native/boost/boost/config/stdlib/roguewave.hpp +208 -0
- package/react-native/boost/boost/config/stdlib/sgi.hpp +168 -0
- package/react-native/boost/boost/config/stdlib/stlport.hpp +258 -0
- package/react-native/boost/boost/config/stdlib/vacpp.hpp +74 -0
- package/react-native/boost/boost/config/stdlib/xlcpp_zos.hpp +61 -0
- package/react-native/boost/boost/config/user.hpp +133 -0
- package/react-native/boost/boost/config/warning_disable.hpp +47 -0
- package/react-native/boost/boost/config/workaround.hpp +305 -0
- package/react-native/boost/boost/config.hpp +67 -0
- package/react-native/boost/boost/cstdint.hpp +556 -0
- package/react-native/boost/boost/intrusive_ptr.hpp +18 -0
- package/react-native/boost/boost/smart_ptr/detail/atomic_count.hpp +103 -0
- package/react-native/boost/boost/smart_ptr/detail/atomic_count_gcc.hpp +79 -0
- package/react-native/boost/boost/smart_ptr/detail/atomic_count_gcc_atomic.hpp +63 -0
- package/react-native/boost/boost/smart_ptr/detail/atomic_count_gcc_x86.hpp +88 -0
- package/react-native/boost/boost/smart_ptr/detail/atomic_count_nt.hpp +66 -0
- package/react-native/boost/boost/smart_ptr/detail/atomic_count_pt.hpp +104 -0
- package/react-native/boost/boost/smart_ptr/detail/atomic_count_spin.hpp +69 -0
- package/react-native/boost/boost/smart_ptr/detail/atomic_count_std_atomic.hpp +67 -0
- package/react-native/boost/boost/smart_ptr/detail/atomic_count_sync.hpp +72 -0
- package/react-native/boost/boost/smart_ptr/detail/atomic_count_win32.hpp +70 -0
- package/react-native/boost/boost/smart_ptr/detail/local_counted_base.hpp +148 -0
- package/react-native/boost/boost/smart_ptr/detail/local_sp_deleter.hpp +91 -0
- package/react-native/boost/boost/smart_ptr/detail/operator_bool.hpp +64 -0
- package/react-native/boost/boost/smart_ptr/detail/requires_cxx11.hpp +23 -0
- package/react-native/boost/boost/smart_ptr/detail/shared_count.hpp +707 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_convertible.hpp +92 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base.hpp +92 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp +163 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_aix.hpp +152 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp +185 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_atomic.hpp +148 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp +170 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp +200 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp +194 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp +179 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp +186 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_nt.hpp +119 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_pt.hpp +147 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp +174 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_spin.hpp +141 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp +147 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_sync.hpp +165 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp +163 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_base_w32.hpp +140 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_counted_impl.hpp +309 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_disable_deprecated.hpp +40 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_forward.hpp +52 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_has_gcc_intrinsics.hpp +27 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_has_sync_intrinsics.hpp +69 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_interlocked.hpp +173 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_noexcept.hpp +48 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_nullptr_t.hpp +45 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_obsolete.hpp +32 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_thread_pause.hpp +51 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_thread_sleep.hpp +104 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_thread_yield.hpp +100 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_typeinfo_.hpp +58 -0
- package/react-native/boost/boost/smart_ptr/detail/sp_win32_sleep.hpp +49 -0
- package/react-native/boost/boost/smart_ptr/intrusive_ptr.hpp +409 -0
- package/react-native/boost/boost/smart_ptr/intrusive_ref_counter.hpp +188 -0
- package/react-native/cpp/include/Attachment.h +16 -0
- package/react-native/cpp/include/Authentication.h +23 -0
- package/react-native/cpp/include/Collection.h +13 -0
- package/react-native/cpp/include/DQL.h +21 -0
- package/react-native/cpp/include/Document.h +17 -0
- package/react-native/cpp/include/Identity.h +17 -0
- package/react-native/cpp/include/Lifecycle.h +16 -0
- package/react-native/cpp/include/LiveQuery.h +17 -0
- package/react-native/cpp/include/Logger.h +22 -0
- package/react-native/cpp/include/Misc.h +26 -0
- package/react-native/cpp/include/Presence.h +14 -0
- package/react-native/cpp/include/RetainableState.h +24 -0
- package/react-native/cpp/include/SmallPeerInfo.h +17 -0
- package/react-native/cpp/include/Transports.h +25 -0
- package/react-native/cpp/include/TypedArray.hpp +167 -0
- package/react-native/cpp/include/Utils.h +61 -0
- package/react-native/cpp/include/main.h +10 -0
- package/react-native/cpp/src/Attachment.cpp +86 -0
- package/react-native/cpp/src/Authentication.cpp +224 -0
- package/react-native/cpp/src/Collection.cpp +54 -0
- package/react-native/cpp/src/DQL.cpp +254 -0
- package/react-native/cpp/src/Document.cpp +146 -0
- package/react-native/cpp/src/Identity.cpp +123 -0
- package/react-native/cpp/src/Lifecycle.cpp +75 -0
- package/react-native/cpp/src/LiveQuery.cpp +64 -0
- package/react-native/cpp/src/Logger.cpp +200 -0
- package/react-native/cpp/src/Misc.cpp +271 -0
- package/react-native/cpp/src/Presence.cpp +77 -0
- package/react-native/cpp/src/RetainableState.cpp +15 -0
- package/react-native/cpp/src/SmallPeerInfo.cpp +108 -0
- package/react-native/cpp/src/Transports.cpp +270 -0
- package/react-native/cpp/src/TypedArray.cpp +303 -0
- package/react-native/cpp/src/Utils.cpp +138 -0
- package/react-native/cpp/src/main.cpp +149 -0
- package/react-native/dittoffi/dittoffi.h +4698 -0
- package/react-native/dittoffi/ifaddrs.cpp +385 -0
- package/react-native/dittoffi/ifaddrs.h +206 -0
- package/react-native/ios/DittoRNSDK.h +7 -0
- package/react-native/ios/DittoRNSDK.mm +107 -0
- package/react-native/ios/YeetJSIUtils.h +60 -0
- package/react-native/ios/YeetJSIUtils.mm +196 -0
- package/react-native/lib/commonjs/ditto.rn.js +93 -0
- package/react-native/lib/commonjs/ditto.rn.js.map +1 -0
- package/react-native/lib/commonjs/index.js +14 -0
- package/react-native/lib/commonjs/index.js.map +1 -0
- package/react-native/lib/module/ditto.rn.js +83 -0
- package/react-native/lib/module/ditto.rn.js.map +1 -0
- package/react-native/lib/module/index.js +13 -0
- package/react-native/lib/module/index.js.map +1 -0
- package/react-native/lib/typescript/ditto.rn.d.ts +15 -0
- package/react-native/lib/typescript/ditto.rn.d.ts.map +1 -0
- package/react-native/lib/typescript/index.d.ts +1 -0
- package/react-native/lib/typescript/index.d.ts.map +1 -0
- package/react-native/scripts/ruby/include_local_boost.rb +78 -0
- package/react-native/src/ditto.rn.ts +91 -0
- package/react-native/src/environment/environment.fallback.ts +4 -0
- package/react-native/src/index.ts +26 -0
- package/react-native/src/sources/@cbor-redux.ts +2 -0
- package/react-native/src/sources/@ditto.core.ts +1 -0
- package/react-native/src/sources/@environment.ts +2 -0
- package/react-native/src/sources/attachment-fetch-event.ts +54 -0
- package/react-native/src/sources/attachment-fetcher-manager.ts +129 -0
- package/react-native/src/sources/attachment-fetcher.ts +124 -0
- package/react-native/src/sources/attachment-token.ts +48 -0
- package/react-native/src/sources/attachment.ts +59 -0
- package/react-native/src/sources/augment.ts +89 -0
- package/react-native/src/sources/authenticator.ts +314 -0
- package/react-native/src/sources/base-pending-cursor-operation.ts +237 -0
- package/react-native/src/sources/base-pending-id-specific-operation.ts +109 -0
- package/react-native/src/sources/bridge.ts +549 -0
- package/react-native/src/sources/build-time-constants.ts +4 -0
- package/react-native/src/sources/cbor.ts +35 -0
- package/react-native/src/sources/collection-interface.ts +67 -0
- package/react-native/src/sources/collection.ts +212 -0
- package/react-native/src/sources/collections-event.ts +99 -0
- package/react-native/src/sources/counter.ts +77 -0
- package/react-native/src/sources/ditto.ts +945 -0
- package/react-native/src/sources/document-id.ts +159 -0
- package/react-native/src/sources/document-path.ts +303 -0
- package/react-native/src/sources/document.ts +192 -0
- package/react-native/src/sources/epilogue.ts +24 -0
- package/react-native/src/sources/error-codes.ts +52 -0
- package/react-native/src/sources/error.ts +203 -0
- package/react-native/src/sources/essentials.ts +53 -0
- package/react-native/src/sources/ffi-error.ts +117 -0
- package/react-native/src/sources/ffi.ts +1972 -0
- package/react-native/src/sources/identity.ts +163 -0
- package/react-native/src/sources/init.ts +70 -0
- package/react-native/src/sources/internal.ts +113 -0
- package/react-native/src/sources/keep-alive.ts +69 -0
- package/react-native/src/sources/key-path.ts +195 -0
- package/react-native/src/sources/live-query-event.ts +208 -0
- package/react-native/src/sources/live-query-manager.ts +101 -0
- package/react-native/src/sources/live-query.ts +164 -0
- package/react-native/src/sources/logger.ts +196 -0
- package/react-native/src/sources/observer-manager.ts +175 -0
- package/react-native/src/sources/observer.ts +77 -0
- package/react-native/src/sources/pending-collections-operation.ts +232 -0
- package/react-native/src/sources/pending-cursor-operation.ts +218 -0
- package/react-native/src/sources/pending-id-specific-operation.ts +216 -0
- package/react-native/src/sources/presence-manager.ts +160 -0
- package/react-native/src/sources/presence.ts +238 -0
- package/react-native/src/sources/query-result-item.ts +116 -0
- package/react-native/src/sources/query-result.ts +55 -0
- package/react-native/src/sources/register.ts +92 -0
- package/react-native/src/sources/small-peer-info.ts +176 -0
- package/react-native/src/sources/static-tcp-client.ts +6 -0
- package/react-native/src/sources/store-observer.ts +176 -0
- package/react-native/src/sources/store.ts +365 -0
- package/react-native/src/sources/subscription-manager.ts +98 -0
- package/react-native/src/sources/subscription.ts +88 -0
- package/react-native/src/sources/sync-subscription.ts +90 -0
- package/react-native/src/sources/sync.ts +495 -0
- package/react-native/src/sources/test-helpers.ts +24 -0
- package/react-native/src/sources/transport-conditions-manager.ts +104 -0
- package/react-native/src/sources/transport-config.ts +428 -0
- package/react-native/src/sources/update-result.ts +66 -0
- package/react-native/src/sources/update-results-map.ts +57 -0
- package/react-native/src/sources/websocket-client.ts +6 -0
- package/react-native/src/sources/write-transaction-collection.ts +122 -0
- package/react-native/src/sources/write-transaction-pending-cursor-operation.ts +101 -0
- package/react-native/src/sources/write-transaction-pending-id-specific-operation.ts +72 -0
- package/react-native/src/sources/write-transaction.ts +119 -0
- package/react-native.config.js +9 -0
- package/types/ditto.d.ts +1230 -798
- package/web/ditto.es6.js +1 -1
- package/web/ditto.umd.js +1 -1
- package/web/ditto.wasm +0 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED
|
|
2
|
+
#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED
|
|
3
|
+
|
|
4
|
+
//
|
|
5
|
+
// detail/sp_counted_base_vacpp_ppc.hpp - xlC(vacpp) on POWER
|
|
6
|
+
// based on: detail/sp_counted_base_w32.hpp
|
|
7
|
+
//
|
|
8
|
+
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
|
|
9
|
+
// Copyright 2004-2005 Peter Dimov
|
|
10
|
+
// Copyright 2006 Michael van der Westhuizen
|
|
11
|
+
// Copyright 2012 IBM Corp.
|
|
12
|
+
//
|
|
13
|
+
// Distributed under the Boost Software License, Version 1.0. (See
|
|
14
|
+
// accompanying file LICENSE_1_0.txt or copy at
|
|
15
|
+
// http://www.boost.org/LICENSE_1_0.txt)
|
|
16
|
+
//
|
|
17
|
+
//
|
|
18
|
+
// Lock-free algorithm by Alexander Terekhov
|
|
19
|
+
//
|
|
20
|
+
// Thanks to Ben Hitchings for the #weak + (#shared != 0)
|
|
21
|
+
// formulation
|
|
22
|
+
//
|
|
23
|
+
|
|
24
|
+
#include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
|
|
25
|
+
#include <boost/smart_ptr/detail/sp_obsolete.hpp>
|
|
26
|
+
#include <boost/config.hpp>
|
|
27
|
+
|
|
28
|
+
#if defined(BOOST_SP_REPORT_IMPLEMENTATION)
|
|
29
|
+
|
|
30
|
+
#include <boost/config/pragma_message.hpp>
|
|
31
|
+
BOOST_PRAGMA_MESSAGE("Using xlC/PowerPC sp_counted_base")
|
|
32
|
+
|
|
33
|
+
#endif
|
|
34
|
+
|
|
35
|
+
BOOST_SP_OBSOLETE()
|
|
36
|
+
|
|
37
|
+
extern "builtin" void __lwsync(void);
|
|
38
|
+
extern "builtin" void __isync(void);
|
|
39
|
+
extern "builtin" int __fetch_and_add(volatile int* addr, int val);
|
|
40
|
+
extern "builtin" int __compare_and_swap(volatile int*, int*, int);
|
|
41
|
+
|
|
42
|
+
namespace boost
|
|
43
|
+
{
|
|
44
|
+
|
|
45
|
+
namespace detail
|
|
46
|
+
{
|
|
47
|
+
|
|
48
|
+
inline void atomic_increment( int *pw )
|
|
49
|
+
{
|
|
50
|
+
// ++*pw;
|
|
51
|
+
__lwsync();
|
|
52
|
+
__fetch_and_add(pw, 1);
|
|
53
|
+
__isync();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
inline int atomic_decrement( int *pw )
|
|
57
|
+
{
|
|
58
|
+
// return --*pw;
|
|
59
|
+
__lwsync();
|
|
60
|
+
int originalValue = __fetch_and_add(pw, -1);
|
|
61
|
+
__isync();
|
|
62
|
+
|
|
63
|
+
return (originalValue - 1);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
inline int atomic_conditional_increment( int *pw )
|
|
67
|
+
{
|
|
68
|
+
// if( *pw != 0 ) ++*pw;
|
|
69
|
+
// return *pw;
|
|
70
|
+
|
|
71
|
+
__lwsync();
|
|
72
|
+
int v = *const_cast<volatile int*>(pw);
|
|
73
|
+
for (;;)
|
|
74
|
+
// loop until state is known
|
|
75
|
+
{
|
|
76
|
+
if (v == 0) return 0;
|
|
77
|
+
if (__compare_and_swap(pw, &v, v + 1))
|
|
78
|
+
{
|
|
79
|
+
__isync(); return (v + 1);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
class BOOST_SYMBOL_VISIBLE sp_counted_base
|
|
85
|
+
{
|
|
86
|
+
private:
|
|
87
|
+
|
|
88
|
+
sp_counted_base( sp_counted_base const & );
|
|
89
|
+
sp_counted_base & operator= ( sp_counted_base const & );
|
|
90
|
+
|
|
91
|
+
int use_count_; // #shared
|
|
92
|
+
int weak_count_; // #weak + (#shared != 0)
|
|
93
|
+
char pad[64] __attribute__((__aligned__(64)));
|
|
94
|
+
// pad to prevent false sharing
|
|
95
|
+
public:
|
|
96
|
+
|
|
97
|
+
sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
|
|
98
|
+
{
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
virtual ~sp_counted_base() // nothrow
|
|
102
|
+
{
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// dispose() is called when use_count_ drops to zero, to release
|
|
106
|
+
// the resources managed by *this.
|
|
107
|
+
|
|
108
|
+
virtual void dispose() = 0; // nothrow
|
|
109
|
+
|
|
110
|
+
// destroy() is called when weak_count_ drops to zero.
|
|
111
|
+
|
|
112
|
+
virtual void destroy() // nothrow
|
|
113
|
+
{
|
|
114
|
+
delete this;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0;
|
|
118
|
+
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0;
|
|
119
|
+
virtual void * get_untyped_deleter() = 0;
|
|
120
|
+
|
|
121
|
+
void add_ref_copy()
|
|
122
|
+
{
|
|
123
|
+
atomic_increment( &use_count_ );
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
bool add_ref_lock() // true on success
|
|
127
|
+
{
|
|
128
|
+
return atomic_conditional_increment( &use_count_ ) != 0;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
void release() // nothrow
|
|
132
|
+
{
|
|
133
|
+
if( atomic_decrement( &use_count_ ) == 0 )
|
|
134
|
+
{
|
|
135
|
+
dispose();
|
|
136
|
+
weak_release();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
void weak_add_ref() // nothrow
|
|
141
|
+
{
|
|
142
|
+
atomic_increment( &weak_count_ );
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
void weak_release() // nothrow
|
|
146
|
+
{
|
|
147
|
+
if( atomic_decrement( &weak_count_ ) == 0 )
|
|
148
|
+
{
|
|
149
|
+
destroy();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
long use_count() const // nothrow
|
|
154
|
+
{
|
|
155
|
+
return *const_cast<volatile int*>(&use_count_);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
} // namespace detail
|
|
160
|
+
|
|
161
|
+
} // namespace boost
|
|
162
|
+
|
|
163
|
+
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED
|
|
2
|
+
#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED
|
|
3
|
+
|
|
4
|
+
// MS compatible compilers support #pragma once
|
|
5
|
+
|
|
6
|
+
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
|
7
|
+
# pragma once
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
//
|
|
11
|
+
// detail/sp_counted_base_w32.hpp
|
|
12
|
+
//
|
|
13
|
+
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
|
|
14
|
+
// Copyright 2004-2005 Peter Dimov
|
|
15
|
+
//
|
|
16
|
+
// Distributed under the Boost Software License, Version 1.0. (See
|
|
17
|
+
// accompanying file LICENSE_1_0.txt or copy at
|
|
18
|
+
// http://www.boost.org/LICENSE_1_0.txt)
|
|
19
|
+
//
|
|
20
|
+
//
|
|
21
|
+
// Lock-free algorithm by Alexander Terekhov
|
|
22
|
+
//
|
|
23
|
+
// Thanks to Ben Hitchings for the #weak + (#shared != 0)
|
|
24
|
+
// formulation
|
|
25
|
+
//
|
|
26
|
+
|
|
27
|
+
#include <boost/smart_ptr/detail/sp_interlocked.hpp>
|
|
28
|
+
#include <boost/smart_ptr/detail/sp_typeinfo_.hpp>
|
|
29
|
+
#include <boost/config/workaround.hpp>
|
|
30
|
+
#include <boost/config.hpp>
|
|
31
|
+
|
|
32
|
+
#if defined(BOOST_SP_REPORT_IMPLEMENTATION)
|
|
33
|
+
|
|
34
|
+
#include <boost/config/pragma_message.hpp>
|
|
35
|
+
BOOST_PRAGMA_MESSAGE("Using Win32 sp_counted_base")
|
|
36
|
+
|
|
37
|
+
#endif
|
|
38
|
+
|
|
39
|
+
namespace boost
|
|
40
|
+
{
|
|
41
|
+
|
|
42
|
+
namespace detail
|
|
43
|
+
{
|
|
44
|
+
|
|
45
|
+
class BOOST_SYMBOL_VISIBLE sp_counted_base
|
|
46
|
+
{
|
|
47
|
+
private:
|
|
48
|
+
|
|
49
|
+
sp_counted_base( sp_counted_base const & );
|
|
50
|
+
sp_counted_base & operator= ( sp_counted_base const & );
|
|
51
|
+
|
|
52
|
+
long use_count_; // #shared
|
|
53
|
+
long weak_count_; // #weak + (#shared != 0)
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
|
|
57
|
+
sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
|
|
58
|
+
{
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
virtual ~sp_counted_base() // nothrow
|
|
62
|
+
{
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// dispose() is called when use_count_ drops to zero, to release
|
|
66
|
+
// the resources managed by *this.
|
|
67
|
+
|
|
68
|
+
virtual void dispose() = 0; // nothrow
|
|
69
|
+
|
|
70
|
+
// destroy() is called when weak_count_ drops to zero.
|
|
71
|
+
|
|
72
|
+
virtual void destroy() // nothrow
|
|
73
|
+
{
|
|
74
|
+
delete this;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0;
|
|
78
|
+
virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0;
|
|
79
|
+
virtual void * get_untyped_deleter() = 0;
|
|
80
|
+
|
|
81
|
+
void add_ref_copy()
|
|
82
|
+
{
|
|
83
|
+
BOOST_SP_INTERLOCKED_INCREMENT( &use_count_ );
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
bool add_ref_lock() // true on success
|
|
87
|
+
{
|
|
88
|
+
for( ;; )
|
|
89
|
+
{
|
|
90
|
+
long tmp = static_cast< long const volatile& >( use_count_ );
|
|
91
|
+
if( tmp == 0 ) return false;
|
|
92
|
+
|
|
93
|
+
#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1200 )
|
|
94
|
+
|
|
95
|
+
// work around a code generation bug
|
|
96
|
+
|
|
97
|
+
long tmp2 = tmp + 1;
|
|
98
|
+
if( BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp2, tmp ) == tmp2 - 1 ) return true;
|
|
99
|
+
|
|
100
|
+
#else
|
|
101
|
+
|
|
102
|
+
if( BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp + 1, tmp ) == tmp ) return true;
|
|
103
|
+
|
|
104
|
+
#endif
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
void release() // nothrow
|
|
109
|
+
{
|
|
110
|
+
if( BOOST_SP_INTERLOCKED_DECREMENT( &use_count_ ) == 0 )
|
|
111
|
+
{
|
|
112
|
+
dispose();
|
|
113
|
+
weak_release();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
void weak_add_ref() // nothrow
|
|
118
|
+
{
|
|
119
|
+
BOOST_SP_INTERLOCKED_INCREMENT( &weak_count_ );
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
void weak_release() // nothrow
|
|
123
|
+
{
|
|
124
|
+
if( BOOST_SP_INTERLOCKED_DECREMENT( &weak_count_ ) == 0 )
|
|
125
|
+
{
|
|
126
|
+
destroy();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
long use_count() const // nothrow
|
|
131
|
+
{
|
|
132
|
+
return static_cast<long const volatile &>( use_count_ );
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
} // namespace detail
|
|
137
|
+
|
|
138
|
+
} // namespace boost
|
|
139
|
+
|
|
140
|
+
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED
|
|
2
|
+
#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED
|
|
3
|
+
|
|
4
|
+
// MS compatible compilers support #pragma once
|
|
5
|
+
|
|
6
|
+
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
|
7
|
+
# pragma once
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
//
|
|
11
|
+
// detail/sp_counted_impl.hpp
|
|
12
|
+
//
|
|
13
|
+
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
|
|
14
|
+
// Copyright 2004-2005 Peter Dimov
|
|
15
|
+
//
|
|
16
|
+
// Distributed under the Boost Software License, Version 1.0. (See
|
|
17
|
+
// accompanying file LICENSE_1_0.txt or copy at
|
|
18
|
+
// http://www.boost.org/LICENSE_1_0.txt)
|
|
19
|
+
//
|
|
20
|
+
|
|
21
|
+
#if defined(BOOST_SP_USE_STD_ALLOCATOR) && defined(BOOST_SP_USE_QUICK_ALLOCATOR)
|
|
22
|
+
# error BOOST_SP_USE_STD_ALLOCATOR and BOOST_SP_USE_QUICK_ALLOCATOR are incompatible.
|
|
23
|
+
#endif
|
|
24
|
+
|
|
25
|
+
#include <boost/smart_ptr/detail/sp_counted_base.hpp>
|
|
26
|
+
#include <boost/smart_ptr/detail/sp_noexcept.hpp>
|
|
27
|
+
#include <boost/core/checked_delete.hpp>
|
|
28
|
+
#include <boost/core/addressof.hpp>
|
|
29
|
+
#include <boost/config.hpp>
|
|
30
|
+
|
|
31
|
+
#if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
|
|
32
|
+
#include <boost/smart_ptr/detail/quick_allocator.hpp>
|
|
33
|
+
#endif
|
|
34
|
+
|
|
35
|
+
#include <memory> // std::allocator, std::allocator_traits
|
|
36
|
+
#include <cstddef> // std::size_t
|
|
37
|
+
|
|
38
|
+
namespace boost
|
|
39
|
+
{
|
|
40
|
+
|
|
41
|
+
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
|
42
|
+
|
|
43
|
+
void sp_scalar_constructor_hook( void * px, std::size_t size, void * pn );
|
|
44
|
+
void sp_scalar_destructor_hook( void * px, std::size_t size, void * pn );
|
|
45
|
+
|
|
46
|
+
#endif
|
|
47
|
+
|
|
48
|
+
namespace detail
|
|
49
|
+
{
|
|
50
|
+
|
|
51
|
+
// get_local_deleter
|
|
52
|
+
|
|
53
|
+
template<class D> class local_sp_deleter;
|
|
54
|
+
|
|
55
|
+
template<class D> D * get_local_deleter( D * /*p*/ ) BOOST_SP_NOEXCEPT
|
|
56
|
+
{
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
template<class D> D * get_local_deleter( local_sp_deleter<D> * p ) BOOST_SP_NOEXCEPT;
|
|
61
|
+
|
|
62
|
+
//
|
|
63
|
+
|
|
64
|
+
template<class X> class BOOST_SYMBOL_VISIBLE sp_counted_impl_p: public sp_counted_base
|
|
65
|
+
{
|
|
66
|
+
private:
|
|
67
|
+
|
|
68
|
+
X * px_;
|
|
69
|
+
|
|
70
|
+
sp_counted_impl_p( sp_counted_impl_p const & );
|
|
71
|
+
sp_counted_impl_p & operator= ( sp_counted_impl_p const & );
|
|
72
|
+
|
|
73
|
+
typedef sp_counted_impl_p<X> this_type;
|
|
74
|
+
|
|
75
|
+
public:
|
|
76
|
+
|
|
77
|
+
explicit sp_counted_impl_p( X * px ): px_( px )
|
|
78
|
+
{
|
|
79
|
+
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
|
80
|
+
boost::sp_scalar_constructor_hook( px, sizeof(X), this );
|
|
81
|
+
#endif
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
void dispose() BOOST_SP_NOEXCEPT BOOST_OVERRIDE
|
|
85
|
+
{
|
|
86
|
+
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
|
87
|
+
boost::sp_scalar_destructor_hook( px_, sizeof(X), this );
|
|
88
|
+
#endif
|
|
89
|
+
boost::checked_delete( px_ );
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
void * get_deleter( sp_typeinfo_ const & ) BOOST_SP_NOEXCEPT BOOST_OVERRIDE
|
|
93
|
+
{
|
|
94
|
+
return 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
void * get_local_deleter( sp_typeinfo_ const & ) BOOST_SP_NOEXCEPT BOOST_OVERRIDE
|
|
98
|
+
{
|
|
99
|
+
return 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
void * get_untyped_deleter() BOOST_SP_NOEXCEPT BOOST_OVERRIDE
|
|
103
|
+
{
|
|
104
|
+
return 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
#if defined(BOOST_SP_USE_STD_ALLOCATOR)
|
|
108
|
+
|
|
109
|
+
void * operator new( std::size_t )
|
|
110
|
+
{
|
|
111
|
+
return std::allocator<this_type>().allocate( 1, static_cast<this_type *>(0) );
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
void operator delete( void * p )
|
|
115
|
+
{
|
|
116
|
+
std::allocator<this_type>().deallocate( static_cast<this_type *>(p), 1 );
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
#endif
|
|
120
|
+
|
|
121
|
+
#if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
|
|
122
|
+
|
|
123
|
+
void * operator new( std::size_t )
|
|
124
|
+
{
|
|
125
|
+
return quick_allocator<this_type>::alloc();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
void operator delete( void * p )
|
|
129
|
+
{
|
|
130
|
+
quick_allocator<this_type>::dealloc( p );
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
#endif
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
//
|
|
137
|
+
// Borland's Codeguard trips up over the -Vx- option here:
|
|
138
|
+
//
|
|
139
|
+
#ifdef __CODEGUARD__
|
|
140
|
+
# pragma option push -Vx-
|
|
141
|
+
#endif
|
|
142
|
+
|
|
143
|
+
template<class P, class D> class BOOST_SYMBOL_VISIBLE sp_counted_impl_pd: public sp_counted_base
|
|
144
|
+
{
|
|
145
|
+
private:
|
|
146
|
+
|
|
147
|
+
P ptr; // copy constructor must not throw
|
|
148
|
+
D del; // copy/move constructor must not throw
|
|
149
|
+
|
|
150
|
+
sp_counted_impl_pd( sp_counted_impl_pd const & );
|
|
151
|
+
sp_counted_impl_pd & operator= ( sp_counted_impl_pd const & );
|
|
152
|
+
|
|
153
|
+
typedef sp_counted_impl_pd<P, D> this_type;
|
|
154
|
+
|
|
155
|
+
public:
|
|
156
|
+
|
|
157
|
+
// pre: d(p) must not throw
|
|
158
|
+
|
|
159
|
+
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
|
160
|
+
|
|
161
|
+
sp_counted_impl_pd( P p, D & d ): ptr( p ), del( static_cast< D&& >( d ) )
|
|
162
|
+
{
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
#else
|
|
166
|
+
|
|
167
|
+
sp_counted_impl_pd( P p, D & d ): ptr( p ), del( d )
|
|
168
|
+
{
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
#endif
|
|
172
|
+
|
|
173
|
+
sp_counted_impl_pd( P p ): ptr( p ), del()
|
|
174
|
+
{
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
void dispose() BOOST_SP_NOEXCEPT BOOST_OVERRIDE
|
|
178
|
+
{
|
|
179
|
+
del( ptr );
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT BOOST_OVERRIDE
|
|
183
|
+
{
|
|
184
|
+
return ti == BOOST_SP_TYPEID_(D)? &reinterpret_cast<char&>( del ): 0;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT BOOST_OVERRIDE
|
|
188
|
+
{
|
|
189
|
+
return ti == BOOST_SP_TYPEID_(D)? boost::detail::get_local_deleter( boost::addressof( del ) ): 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
void * get_untyped_deleter() BOOST_SP_NOEXCEPT BOOST_OVERRIDE
|
|
193
|
+
{
|
|
194
|
+
return &reinterpret_cast<char&>( del );
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
#if defined(BOOST_SP_USE_STD_ALLOCATOR)
|
|
198
|
+
|
|
199
|
+
void * operator new( std::size_t )
|
|
200
|
+
{
|
|
201
|
+
return std::allocator<this_type>().allocate( 1, static_cast<this_type *>(0) );
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
void operator delete( void * p )
|
|
205
|
+
{
|
|
206
|
+
std::allocator<this_type>().deallocate( static_cast<this_type *>(p), 1 );
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
#endif
|
|
210
|
+
|
|
211
|
+
#if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
|
|
212
|
+
|
|
213
|
+
void * operator new( std::size_t )
|
|
214
|
+
{
|
|
215
|
+
return quick_allocator<this_type>::alloc();
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
void operator delete( void * p )
|
|
219
|
+
{
|
|
220
|
+
quick_allocator<this_type>::dealloc( p );
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
#endif
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
template<class P, class D, class A> class BOOST_SYMBOL_VISIBLE sp_counted_impl_pda: public sp_counted_base
|
|
227
|
+
{
|
|
228
|
+
private:
|
|
229
|
+
|
|
230
|
+
P p_; // copy constructor must not throw
|
|
231
|
+
D d_; // copy/move constructor must not throw
|
|
232
|
+
A a_; // copy constructor must not throw
|
|
233
|
+
|
|
234
|
+
sp_counted_impl_pda( sp_counted_impl_pda const & );
|
|
235
|
+
sp_counted_impl_pda & operator= ( sp_counted_impl_pda const & );
|
|
236
|
+
|
|
237
|
+
typedef sp_counted_impl_pda<P, D, A> this_type;
|
|
238
|
+
|
|
239
|
+
public:
|
|
240
|
+
|
|
241
|
+
// pre: d( p ) must not throw
|
|
242
|
+
|
|
243
|
+
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
|
244
|
+
|
|
245
|
+
sp_counted_impl_pda( P p, D & d, A a ): p_( p ), d_( static_cast< D&& >( d ) ), a_( a )
|
|
246
|
+
{
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
#else
|
|
250
|
+
|
|
251
|
+
sp_counted_impl_pda( P p, D & d, A a ): p_( p ), d_( d ), a_( a )
|
|
252
|
+
{
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
#endif
|
|
256
|
+
|
|
257
|
+
sp_counted_impl_pda( P p, A a ): p_( p ), d_( a ), a_( a )
|
|
258
|
+
{
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
void dispose() BOOST_SP_NOEXCEPT BOOST_OVERRIDE
|
|
262
|
+
{
|
|
263
|
+
d_( p_ );
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
void destroy() BOOST_SP_NOEXCEPT BOOST_OVERRIDE
|
|
267
|
+
{
|
|
268
|
+
#if !defined( BOOST_NO_CXX11_ALLOCATOR )
|
|
269
|
+
|
|
270
|
+
typedef typename std::allocator_traits<A>::template rebind_alloc< this_type > A2;
|
|
271
|
+
|
|
272
|
+
#else
|
|
273
|
+
|
|
274
|
+
typedef typename A::template rebind< this_type >::other A2;
|
|
275
|
+
|
|
276
|
+
#endif
|
|
277
|
+
|
|
278
|
+
A2 a2( a_ );
|
|
279
|
+
|
|
280
|
+
this->~this_type();
|
|
281
|
+
|
|
282
|
+
a2.deallocate( this, 1 );
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT BOOST_OVERRIDE
|
|
286
|
+
{
|
|
287
|
+
return ti == BOOST_SP_TYPEID_( D )? &reinterpret_cast<char&>( d_ ): 0;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT BOOST_OVERRIDE
|
|
291
|
+
{
|
|
292
|
+
return ti == BOOST_SP_TYPEID_( D )? boost::detail::get_local_deleter( boost::addressof( d_ ) ): 0;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
void * get_untyped_deleter() BOOST_SP_NOEXCEPT BOOST_OVERRIDE
|
|
296
|
+
{
|
|
297
|
+
return &reinterpret_cast<char&>( d_ );
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
#ifdef __CODEGUARD__
|
|
302
|
+
# pragma option pop
|
|
303
|
+
#endif
|
|
304
|
+
|
|
305
|
+
} // namespace detail
|
|
306
|
+
|
|
307
|
+
} // namespace boost
|
|
308
|
+
|
|
309
|
+
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#ifndef BOOST_SMART_PTR_DETAIL_SP_DISABLE_DEPRECATED_HPP_INCLUDED
|
|
2
|
+
#define BOOST_SMART_PTR_DETAIL_SP_DISABLE_DEPRECATED_HPP_INCLUDED
|
|
3
|
+
|
|
4
|
+
// MS compatible compilers support #pragma once
|
|
5
|
+
|
|
6
|
+
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
|
7
|
+
# pragma once
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
//
|
|
11
|
+
// boost/smart_ptr/detail/sp_disable_deprecated.hpp
|
|
12
|
+
//
|
|
13
|
+
// Copyright 2015 Peter Dimov
|
|
14
|
+
//
|
|
15
|
+
// Distributed under the Boost Software License, Version 1.0.
|
|
16
|
+
// See accompanying file LICENSE_1_0.txt or copy at
|
|
17
|
+
// http://www.boost.org/LICENSE_1_0.txt)
|
|
18
|
+
//
|
|
19
|
+
|
|
20
|
+
#include <boost/config.hpp>
|
|
21
|
+
|
|
22
|
+
#if defined( __GNUC__ ) && ( defined( __GXX_EXPERIMENTAL_CXX0X__ ) || ( __cplusplus >= 201103L ) )
|
|
23
|
+
|
|
24
|
+
# if defined( BOOST_GCC )
|
|
25
|
+
|
|
26
|
+
# if BOOST_GCC >= 40600
|
|
27
|
+
# define BOOST_SP_DISABLE_DEPRECATED
|
|
28
|
+
# endif
|
|
29
|
+
|
|
30
|
+
# elif defined( __clang__ ) && defined( __has_warning )
|
|
31
|
+
|
|
32
|
+
# if __has_warning( "-Wdeprecated-declarations" )
|
|
33
|
+
# define BOOST_SP_DISABLE_DEPRECATED
|
|
34
|
+
# endif
|
|
35
|
+
|
|
36
|
+
# endif
|
|
37
|
+
|
|
38
|
+
#endif
|
|
39
|
+
|
|
40
|
+
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_DISABLE_DEPRECATED_HPP_INCLUDED
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#ifndef BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED
|
|
2
|
+
#define BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED
|
|
3
|
+
|
|
4
|
+
// MS compatible compilers support #pragma once
|
|
5
|
+
|
|
6
|
+
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
|
7
|
+
# pragma once
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
// detail/sp_forward.hpp
|
|
11
|
+
//
|
|
12
|
+
// Copyright 2008,2012 Peter Dimov
|
|
13
|
+
//
|
|
14
|
+
// Distributed under the Boost Software License, Version 1.0.
|
|
15
|
+
// See accompanying file LICENSE_1_0.txt or copy at
|
|
16
|
+
// http://www.boost.org/LICENSE_1_0.txt
|
|
17
|
+
|
|
18
|
+
#include <boost/config.hpp>
|
|
19
|
+
|
|
20
|
+
namespace boost
|
|
21
|
+
{
|
|
22
|
+
|
|
23
|
+
namespace detail
|
|
24
|
+
{
|
|
25
|
+
|
|
26
|
+
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
|
|
27
|
+
|
|
28
|
+
#if defined( BOOST_GCC ) && __GNUC__ * 100 + __GNUC_MINOR__ <= 404
|
|
29
|
+
|
|
30
|
+
// GCC 4.4 supports an outdated version of rvalue references and creates a copy of the forwarded object.
|
|
31
|
+
// This results in warnings 'returning reference to temporary'. Therefore we use a special version similar to std::forward.
|
|
32
|
+
template< class T > T&& sp_forward( T && t ) BOOST_NOEXCEPT
|
|
33
|
+
{
|
|
34
|
+
return t;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
#else
|
|
38
|
+
|
|
39
|
+
template< class T > T&& sp_forward( T & t ) BOOST_NOEXCEPT
|
|
40
|
+
{
|
|
41
|
+
return static_cast< T&& >( t );
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
#endif
|
|
45
|
+
|
|
46
|
+
#endif
|
|
47
|
+
|
|
48
|
+
} // namespace detail
|
|
49
|
+
|
|
50
|
+
} // namespace boost
|
|
51
|
+
|
|
52
|
+
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_FORWARD_HPP_INCLUDED
|