mirror of
				https://github.com/boostorg/smart_ptr.git
				synced 2025-10-31 07:41:38 +01:00 
			
		
		
		
	Compare commits
	
		
			86 Commits
		
	
	
		
			feature/re
			...
			boost-1.74
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 620620df3d | ||
|  | 0bd61c1089 | ||
|  | d1295a9974 | ||
|  | 6e8c15c02f | ||
|  | 7c0dcd338a | ||
|  | 8d79ceaf8a | ||
|  | d35cf29b99 | ||
|  | 72ca834ae8 | ||
|  | 8afe162910 | ||
|  | 5d31c1c443 | ||
|  | 3db4ad9a15 | ||
|  | d0655ab145 | ||
|  | 7c01e640f7 | ||
|  | 00db1e02c6 | ||
|  | 914b93430a | ||
|  | 15ffd7852b | ||
|  | c66c4f5ed1 | ||
|  | 7e9d8c39a3 | ||
|  | a0d08b17e0 | ||
|  | 108a86cdbd | ||
|  | d08bdc86e5 | ||
|  | f8dcf5f6f4 | ||
|  | d38f64ded9 | ||
|  | b66fe51566 | ||
|  | 1b5568d585 | ||
|  | fad0c20263 | ||
|  | 1c61e54b13 | ||
|  | a0fc1e6daa | ||
|  | 5dd84ea389 | ||
|  | bc677e9098 | ||
|  | 688cfed63e | ||
|  | c63dc266b9 | ||
|  | 6c181a0707 | ||
|  | 4047290b85 | ||
|  | dc6c76d7e9 | ||
|  | 5a18ffdc56 | ||
|  | 09fdd5ebfd | ||
|  | 911874e139 | ||
|  | c7c0eacb74 | ||
|  | 9ed9f43ca8 | ||
|  | 0ddf990869 | ||
|  | a08a5f3d41 | ||
|  | 77c2d4cad7 | ||
|  | fd612dc114 | ||
|  | e67ebef9a7 | ||
|  | 6f5b9c7b37 | ||
|  | 91f3aa0386 | ||
|  | 686a354f21 | ||
|  | efceb04665 | ||
|  | ca57860ae2 | ||
|  | 9dcd05f918 | ||
|  | 4b724ab3f8 | ||
|  | 58915ca2fe | ||
|  | 62b0e5cdf4 | ||
|  | 951ff783b5 | ||
|  | 6421394e70 | ||
|  | 121312cc22 | ||
|  | 1e5df9d551 | ||
|  | 496127ab99 | ||
|  | 2af343a2cb | ||
|  | c6b3700ef1 | ||
|  | 2a93d30e73 | ||
|  | 02cc561248 | ||
|  | 066b398114 | ||
|  | 9c43c69c14 | ||
|  | eb8998cd91 | ||
|  | df06c324a7 | ||
|  | 0ddfab493c | ||
|  | a2732e207a | ||
|  | 5be7523ebe | ||
|  | 2320dafc03 | ||
|  | 7ab4093f46 | ||
|  | 296c203135 | ||
|  | 2dd35e5fbc | ||
|  | 977544feda | ||
|  | 54b5498208 | ||
|  | da81452f1f | ||
|  | 7b9a969215 | ||
|  | cd562eb053 | ||
|  | 91cd83e5bf | ||
|  | 2fdb8c4b0a | ||
|  | e806b53433 | ||
|  | e0c7bd9a7e | ||
|  | 766ab05a12 | ||
|  | 05cbefd28e | ||
|  | bfbdf4f45f | 
							
								
								
									
										133
									
								
								.travis.yml
									
									
									
									
									
								
							
							
						
						
									
										133
									
								
								.travis.yml
									
									
									
									
									
								
							| @@ -1,12 +1,10 @@ | ||||
| # Copyright 2016-2019 Peter Dimov | ||||
| # Copyright 2016-2020 Peter Dimov | ||||
| # Distributed under the Boost Software License, Version 1.0. | ||||
| # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) | ||||
|  | ||||
| language: cpp | ||||
|  | ||||
| sudo: false | ||||
|  | ||||
| dist: trusty | ||||
| dist: xenial | ||||
|  | ||||
| branches: | ||||
|   only: | ||||
| @@ -25,8 +23,23 @@ matrix: | ||||
|  | ||||
|   include: | ||||
|     - os: linux | ||||
|       arch: arm64 | ||||
|       compiler: g++ | ||||
|       env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11 | ||||
|       env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11,14 | ||||
|  | ||||
|     - os: linux | ||||
|       arch: ppc64le | ||||
|       compiler: g++ | ||||
|       env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11,14 | ||||
|  | ||||
|     - os: linux | ||||
|       arch: s390x | ||||
|       compiler: g++ | ||||
|       env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11,14 | ||||
|  | ||||
|     - os: freebsd | ||||
|       compiler: clang++ | ||||
|       env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,17,2a | ||||
|  | ||||
|     - os: linux | ||||
|       compiler: g++-4.4 | ||||
| @@ -147,6 +160,28 @@ matrix: | ||||
|           sources: | ||||
|             - ubuntu-toolchain-r-test | ||||
|  | ||||
|     - os: linux | ||||
|       dist: bionic | ||||
|       compiler: g++-10 | ||||
|       env: TOOLSET=gcc COMPILER=g++-10 CXXSTD=03,11,14 | ||||
|       addons: | ||||
|         apt: | ||||
|           packages: | ||||
|             - g++-10 | ||||
|           sources: | ||||
|             - ubuntu-toolchain-r-test | ||||
|  | ||||
|     - os: linux | ||||
|       dist: bionic | ||||
|       compiler: g++-10 | ||||
|       env: TOOLSET=gcc COMPILER=g++-10 CXXSTD=17,2a | ||||
|       addons: | ||||
|         apt: | ||||
|           packages: | ||||
|             - g++-10 | ||||
|           sources: | ||||
|             - ubuntu-toolchain-r-test | ||||
|  | ||||
|     - os: linux | ||||
|       compiler: g++-7 | ||||
|       env: UBSAN=1 TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17 UBSAN_OPTIONS=print_stacktrace=1 LINKFLAGS=-fuse-ld=gold | ||||
| @@ -158,10 +193,7 @@ matrix: | ||||
|             - ubuntu-toolchain-r-test | ||||
|  | ||||
|     - os: linux | ||||
|       compiler: clang++ | ||||
|       env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11 | ||||
|  | ||||
|     - os: linux | ||||
|       dist: trusty | ||||
|       compiler: /usr/bin/clang++ | ||||
|       env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11 | ||||
|       addons: | ||||
| @@ -170,6 +202,7 @@ matrix: | ||||
|             - clang-3.3 | ||||
|  | ||||
|     - os: linux | ||||
|       dist: trusty | ||||
|       compiler: /usr/bin/clang++ | ||||
|       env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11 | ||||
|       addons: | ||||
| @@ -179,15 +212,13 @@ matrix: | ||||
|  | ||||
|     - os: linux | ||||
|       compiler: clang++-3.5 | ||||
|       env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11,14,1z | ||||
|       env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11 | ||||
|       addons: | ||||
|         apt: | ||||
|           packages: | ||||
|             - clang-3.5 | ||||
|             - libstdc++-4.9-dev | ||||
|           sources: | ||||
|             - ubuntu-toolchain-r-test | ||||
|             - llvm-toolchain-precise-3.5 | ||||
|  | ||||
|     - os: linux | ||||
|       compiler: clang++-3.6 | ||||
| @@ -198,7 +229,6 @@ matrix: | ||||
|             - clang-3.6 | ||||
|           sources: | ||||
|             - ubuntu-toolchain-r-test | ||||
|             - llvm-toolchain-precise-3.6 | ||||
|  | ||||
|     - os: linux | ||||
|       compiler: clang++-3.7 | ||||
| @@ -209,7 +239,6 @@ matrix: | ||||
|             - clang-3.7 | ||||
|           sources: | ||||
|             - ubuntu-toolchain-r-test | ||||
|             - llvm-toolchain-precise-3.7 | ||||
|  | ||||
|     - os: linux | ||||
|       compiler: clang++-3.8 | ||||
| @@ -218,10 +247,8 @@ matrix: | ||||
|         apt: | ||||
|           packages: | ||||
|             - clang-3.8 | ||||
|             - libstdc++-4.9-dev | ||||
|           sources: | ||||
|             - ubuntu-toolchain-r-test | ||||
|             - llvm-toolchain-precise-3.8 | ||||
|  | ||||
|     - os: linux | ||||
|       compiler: clang++-3.9 | ||||
| @@ -230,10 +257,8 @@ matrix: | ||||
|         apt: | ||||
|           packages: | ||||
|             - clang-3.9 | ||||
|             - libstdc++-4.9-dev | ||||
|           sources: | ||||
|             - ubuntu-toolchain-r-test | ||||
|             - llvm-toolchain-precise-3.9 | ||||
|  | ||||
|     - os: linux | ||||
|       compiler: clang++-4.0 | ||||
| @@ -244,7 +269,6 @@ matrix: | ||||
|             - clang-4.0 | ||||
|           sources: | ||||
|             - ubuntu-toolchain-r-test | ||||
|             - llvm-toolchain-trusty-4.0 | ||||
|  | ||||
|     - os: linux | ||||
|       compiler: clang++-5.0 | ||||
| @@ -255,7 +279,6 @@ matrix: | ||||
|             - clang-5.0 | ||||
|           sources: | ||||
|             - ubuntu-toolchain-r-test | ||||
|             - llvm-toolchain-trusty-5.0 | ||||
|  | ||||
|     - os: linux | ||||
|       compiler: clang++-6.0 | ||||
| @@ -266,7 +289,6 @@ matrix: | ||||
|             - clang-6.0 | ||||
|           sources: | ||||
|             - ubuntu-toolchain-r-test | ||||
|             - llvm-toolchain-trusty-6.0 | ||||
|  | ||||
|     - os: linux | ||||
|       compiler: clang++-7 | ||||
| @@ -277,7 +299,7 @@ matrix: | ||||
|             - clang-7 | ||||
|           sources: | ||||
|             - ubuntu-toolchain-r-test | ||||
|             - llvm-toolchain-trusty-7 | ||||
|             - llvm-toolchain-xenial-7 | ||||
|  | ||||
|     - os: linux | ||||
|       compiler: clang++-8 | ||||
| @@ -288,21 +310,47 @@ matrix: | ||||
|             - clang-8 | ||||
|           sources: | ||||
|             - ubuntu-toolchain-r-test | ||||
|             - llvm-toolchain-trusty-8 | ||||
|             - llvm-toolchain-xenial-8 | ||||
|  | ||||
|     - os: linux | ||||
|       compiler: clang++-7 | ||||
|       env: UBSAN=1 TOOLSET=clang COMPILER=clang++-7 CXXSTD=03,11,14,17,2a UBSAN_OPTIONS=print_stacktrace=1 | ||||
|       dist: xenial | ||||
|       compiler: clang++-9 | ||||
|       env: TOOLSET=clang COMPILER=clang++-9 CXXSTD=03,11,14,17,2a | ||||
|       addons: | ||||
|         apt: | ||||
|           packages: | ||||
|             - clang-7 | ||||
|             - libstdc++-5-dev | ||||
|             - clang-9 | ||||
|           sources: | ||||
|             - ubuntu-toolchain-r-test | ||||
|             - llvm-toolchain-trusty-7 | ||||
|             - sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main' | ||||
|               key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' | ||||
|  | ||||
|     - os: linux | ||||
|       dist: xenial | ||||
|       compiler: clang++-10 | ||||
|       env: TOOLSET=clang COMPILER=clang++-10 CXXSTD=03,11,14,17,2a | ||||
|       addons: | ||||
|         apt: | ||||
|           packages: | ||||
|             - clang-10 | ||||
|           sources: | ||||
|             - ubuntu-toolchain-r-test | ||||
|             - sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main' | ||||
|               key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key' | ||||
|  | ||||
|     - os: linux | ||||
|       compiler: clang++-8 | ||||
|       env: UBSAN=1 TOOLSET=clang COMPILER=clang++-8 CXXSTD=03,11,14,17,2a UBSAN_OPTIONS=print_stacktrace=1 | ||||
|       addons: | ||||
|         apt: | ||||
|           packages: | ||||
|             - clang-8 | ||||
|           sources: | ||||
|             - ubuntu-toolchain-r-test | ||||
|             - llvm-toolchain-xenial-8 | ||||
|  | ||||
|     - os: linux | ||||
|       dist: trusty | ||||
|       compiler: clang++-libc++ | ||||
|       env: TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,1z | ||||
|       addons: | ||||
| @@ -311,6 +359,7 @@ matrix: | ||||
|             - libc++-dev | ||||
|  | ||||
|     - os: linux | ||||
|       dist: trusty | ||||
|       compiler: clang++-libc++ | ||||
|       env: UBSAN=1 TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,1z UBSAN_OPTIONS=print_stacktrace=1 | ||||
|       addons: | ||||
| @@ -322,6 +371,17 @@ matrix: | ||||
|       compiler: clang++ | ||||
|       env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z | ||||
|  | ||||
|     - os: osx | ||||
|       compiler: clang++ | ||||
|       env: UBSAN=1 TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z UBSAN_OPTIONS=print_stacktrace=1 | ||||
|  | ||||
|     - os: linux | ||||
|       env: CMAKE_TEST=1 | ||||
|       script: | ||||
|         - mkdir __build__ && cd __build__ | ||||
|         - cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES=smart_ptr -DBUILD_TESTING=ON .. | ||||
|         - ctest --output-on-failure -R boost_smart_ptr | ||||
|  | ||||
|     - os: linux | ||||
|       compiler: g++ | ||||
|       env: CMAKE_SUBDIR_TEST=1 | ||||
| @@ -331,6 +391,18 @@ matrix: | ||||
|       - cmake --build . | ||||
|       - cmake --build . --target check | ||||
|  | ||||
|     - os: linux | ||||
|       env: CMAKE_INSTALL_TEST=1 | ||||
|       script: | ||||
|         - pip install --user cmake | ||||
|         - mkdir __build__ && cd __build__ | ||||
|         - cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES=smart_ptr -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=~/.local .. | ||||
|         - cmake --build . --target install | ||||
|         - cd ../libs/smart_ptr/test/cmake_install_test && mkdir __build__ && cd __build__ | ||||
|         - cmake -DCMAKE_INSTALL_PREFIX=~/.local .. | ||||
|         - cmake --build . | ||||
|         - cmake --build . --target check | ||||
|  | ||||
| install: | ||||
|   - BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true | ||||
|   - cd .. | ||||
| @@ -352,7 +424,10 @@ install: | ||||
|   - git submodule init tools/build | ||||
|   - git submodule init libs/headers | ||||
|   - git submodule init tools/boost_install | ||||
|   - git submodule update --jobs 3 | ||||
|   - git submodule init tools/cmake | ||||
|   - git submodule init libs/preprocessor | ||||
|   - git submodule init libs/bind | ||||
|   - git submodule update # no --jobs 3 on non-amd64 | ||||
|   - cp -r $TRAVIS_BUILD_DIR/* libs/smart_ptr | ||||
|   - ./bootstrap.sh | ||||
|   - ./b2 headers | ||||
|   | ||||
| @@ -1,12 +1,10 @@ | ||||
| # Copyright 2018 Mike Dev | ||||
| # Copyright 2018-2020 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 | ||||
|  | ||||
| # Partial (add_subdirectory only) and experimental CMake support | ||||
| # Subject to change; please do not rely on the contents of this file yet | ||||
| cmake_minimum_required(VERSION 3.5...3.16) | ||||
|  | ||||
| cmake_minimum_required(VERSION 3.5) | ||||
| project(BoostSmartPtr LANGUAGES CXX) | ||||
| project(boost_smart_ptr VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) | ||||
|  | ||||
| add_library(boost_smart_ptr INTERFACE) | ||||
| add_library(Boost::smart_ptr ALIAS boost_smart_ptr) | ||||
| @@ -14,13 +12,18 @@ add_library(Boost::smart_ptr ALIAS boost_smart_ptr) | ||||
| target_include_directories(boost_smart_ptr INTERFACE include) | ||||
|  | ||||
| target_link_libraries(boost_smart_ptr | ||||
|     INTERFACE | ||||
|         Boost::assert | ||||
|         Boost::config | ||||
|         Boost::core | ||||
|         Boost::move | ||||
|         Boost::predef | ||||
|         Boost::static_assert | ||||
|         Boost::throw_exception | ||||
|         Boost::type_traits | ||||
|   INTERFACE | ||||
|     Boost::assert | ||||
|     Boost::config | ||||
|     Boost::core | ||||
|     Boost::move | ||||
|     Boost::static_assert | ||||
|     Boost::throw_exception | ||||
|     Boost::type_traits | ||||
| ) | ||||
|  | ||||
| if(BUILD_TESTING) | ||||
|  | ||||
|   add_subdirectory(test) | ||||
|  | ||||
| endif() | ||||
|   | ||||
| @@ -70,6 +70,7 @@ install: | ||||
|   - git submodule init tools/build | ||||
|   - git submodule init libs/headers | ||||
|   - git submodule init tools/boost_install | ||||
|   - git submodule init libs/bind | ||||
|   - git submodule update --jobs 3 | ||||
|   - xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\smart_ptr\ | ||||
|   - cmd /c bootstrap | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| <style> | ||||
|  | ||||
| *:not(pre)>code { background: none; color: #600000; } | ||||
| :not(pre):not([class^=L])>code { background: none; color: #600000; } | ||||
| table tr.even, table tr.alt, table tr:nth-of-type(even) { background: none; } | ||||
|  | ||||
| </style> | ||||
|   | ||||
| @@ -18,40 +18,26 @@ Greg Colvin, Beman Dawes, Peter Dimov, Glen Fernandes | ||||
| :leveloffset: +1 | ||||
|  | ||||
| include::smart_ptr/introduction.adoc[] | ||||
|  | ||||
| include::smart_ptr/changelog.adoc[] | ||||
|  | ||||
| include::smart_ptr/scoped_ptr.adoc[] | ||||
|  | ||||
| include::smart_ptr/scoped_array.adoc[] | ||||
|  | ||||
| include::smart_ptr/shared_ptr.adoc[] | ||||
|  | ||||
| include::smart_ptr/weak_ptr.adoc[] | ||||
|  | ||||
| include::smart_ptr/make_shared.adoc[] | ||||
|  | ||||
| include::smart_ptr/enable_shared_from_this.adoc[] | ||||
|  | ||||
| include::smart_ptr/enable_shared_from.adoc[] | ||||
|  | ||||
| include::smart_ptr/make_unique.adoc[] | ||||
|  | ||||
| include::smart_ptr/allocate_unique.adoc[] | ||||
|  | ||||
| include::smart_ptr/intrusive_ptr.adoc[] | ||||
|  | ||||
| include::smart_ptr/intrusive_ref_counter.adoc[] | ||||
|  | ||||
| include::smart_ptr/local_shared_ptr.adoc[] | ||||
|  | ||||
| include::smart_ptr/make_local_shared.adoc[] | ||||
|  | ||||
| include::smart_ptr/pointer_cast.adoc[] | ||||
|  | ||||
| include::smart_ptr/pointer_to_other.adoc[] | ||||
|  | ||||
| include::smart_ptr/atomic_shared_ptr.adoc[] | ||||
| include::smart_ptr/owner_less.adoc[] | ||||
| include::smart_ptr/owner_equal_to.adoc[] | ||||
| include::smart_ptr/owner_hash.adoc[] | ||||
|  | ||||
| // appendix | ||||
| include::smart_ptr/techniques.adoc[] | ||||
| @@ -73,7 +59,7 @@ This documentation is | ||||
| * Copyright 1999 Greg Colvin | ||||
| * Copyright 1999 Beman Dawes | ||||
| * Copyright 2002 Darin Adler | ||||
| * Copyright 2003-2017 Peter Dimov | ||||
| * Copyright 2003-2020 Peter Dimov | ||||
| * Copyright 2005, 2006 Ion Gaztañaga | ||||
| * Copyright 2008 Frank Mori Hess | ||||
| * Copyright 2012-2017 Glen Fernandes | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| //// | ||||
| Copyright 2019 Peter Dimov | ||||
| Copyright 2019, 2020 Peter Dimov | ||||
|  | ||||
| Distributed under the Boost Software License, Version 1.0. | ||||
|  | ||||
| @@ -13,6 +13,15 @@ http://www.boost.org/LICENSE_1_0.txt | ||||
| :toc-title: | ||||
| :idprefix: changelog_ | ||||
|  | ||||
| ## Changes in 1.74.0 | ||||
|  | ||||
| * Added `owner_equals` to `shared_ptr`, `weak_ptr`, `local_shared_ptr` | ||||
| * Added `owner_hash_value` to `shared_ptr`, `weak_ptr` | ||||
| * Added `owner_equal_to`, `owner_hash` | ||||
| * Added `std::hash` specializations for `shared_ptr`, `local_shared_ptr` | ||||
| * Added `boost::hash` support to, and `std::hash`, `std::equal_to` | ||||
|   specializations for, `weak_ptr` | ||||
|  | ||||
| ## Changes in 1.72.0 | ||||
|  | ||||
| * Added `allocate_unique` | ||||
|   | ||||
| @@ -31,7 +31,7 @@ This library provides six smart pointer class templates: | ||||
| * `<<scoped_ptr,scoped_ptr>>`, used to contain ownership of a dynamically allocated object to the current scope; | ||||
| * `<<scoped_array,scoped_array>>`, which provides scoped ownership for a dynamically allocated array; | ||||
| * `<<shared_ptr,shared_ptr>>`, a versatile tool for managing shared ownership of an object or array; | ||||
| * `<<weak_ptr,weak_ptr>>`, a non-owning observer to a shared_ptr-managed object that can be promoted temporarily to shared_ptr; | ||||
| * `<<weak_ptr,weak_ptr>>`, a non-owning observer to a `shared_ptr`-managed object that can be promoted temporarily to `shared_ptr`; | ||||
| * `<<intrusive_ptr,intrusive_ptr>>`, a pointer to objects with an embedded reference count; | ||||
| * `<<local_shared_ptr,local_shared_ptr>>`, providing shared ownership within a single thread. | ||||
|  | ||||
| @@ -39,10 +39,11 @@ This library provides six smart pointer class templates: | ||||
|  | ||||
| In addition, the library contains the following supporting utility functions and classes: | ||||
|  | ||||
| * `<<make_shared,make_shared>>`, a factory function for creating objects that returns a `shared_ptr`; | ||||
| * `<<make_shared,make_shared>>` and `allocate_shared`, factory functions for creating objects that return a `shared_ptr`; | ||||
| * `<<make_unique,make_unique>>`, a factory function returning `std::unique_ptr`; | ||||
| * `<<allocate_unique,allocate_unique>>`, a factory function for creating objects using an allocator that returns a `std::unique_ptr`; | ||||
| * `<<enable_shared_from_this,enable_shared_from_this>>`, a helper base class that enables the acquisition of a `shared_ptr` pointing to `this`; | ||||
| * `<<enable_shared_from,enable_shared_from>>`, a newer and better replacement for `enable_shared_from_this`; | ||||
| * `<<pointer_to_other,pointer_to_other>>`, a helper trait for converting one smart pointer type to another; | ||||
| * `<<pointer_cast,static_pointer_cast>>` and companions, generic smart pointer casts; | ||||
| * `<<intrusive_ref_counter,intrusive_ref_counter>>`, a helper base class containing a reference count. | ||||
|   | ||||
| @@ -174,7 +174,8 @@ template<class Y> intrusive_ptr(intrusive_ptr<Y> && r); | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Postconditions:: `get()` equals the old value of `r.get()`. `r.get() == 0`. | ||||
| Postconditions:: | ||||
|   `get()` equals the old value of `r.get()`. `r.get() == 0`. | ||||
|  | ||||
| ### destructor | ||||
|  | ||||
| @@ -185,7 +186,8 @@ Postconditions:: `get()` equals the old value of `r.get()`. `r.get() == 0`. | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Effects:: `if(get() != 0) intrusive_ptr_release(get());`. | ||||
| Effects:: | ||||
|   `if(get() != 0) intrusive_ptr_release(get());`. | ||||
|  | ||||
| ### assignment | ||||
|  | ||||
| @@ -245,7 +247,8 @@ void reset(T * r, bool add_ref); | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Effects:: Equivalent to `intrusive_ptr(r, add_ref).swap(*this)`. | ||||
| Effects:: | ||||
|   Equivalent to `intrusive_ptr(r, add_ref).swap(*this)`. | ||||
|  | ||||
| ### indirection | ||||
|  | ||||
| @@ -278,7 +281,8 @@ T * get() const noexcept; | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: the stored pointer. | ||||
| Returns:: | ||||
|   the stored pointer. | ||||
|  | ||||
| ### detach | ||||
|  | ||||
| @@ -325,7 +329,8 @@ void swap(intrusive_ptr & b) noexcept; | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Effects:: Exchanges the contents of the two smart pointers. | ||||
| Effects:: | ||||
|   Exchanges the contents of the two smart pointers. | ||||
|  | ||||
| ## Free Functions | ||||
|  | ||||
| @@ -412,7 +417,8 @@ template<class T> void swap(intrusive_ptr<T> & a, intrusive_ptr<T> & b) noexcept | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Effects:: Equivalent to `a.swap(b)`. | ||||
| Effects:: | ||||
|   Equivalent to `a.swap(b)`. | ||||
|  | ||||
| ### get_pointer | ||||
|  | ||||
| @@ -437,7 +443,8 @@ template<class T, class U> | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: `intrusive_ptr<T>(static_cast<T*>(r.get()))`. | ||||
| Returns:: | ||||
|   `intrusive_ptr<T>(static_cast<T*>(r.get()))`. | ||||
|  | ||||
| ### const_pointer_cast | ||||
|  | ||||
| @@ -449,7 +456,8 @@ template<class T, class U> | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: `intrusive_ptr<T>(const_cast<T*>(r.get()))`. | ||||
| Returns:: | ||||
|   `intrusive_ptr<T>(const_cast<T*>(r.get()))`. | ||||
|  | ||||
| ### dynamic_pointer_cast | ||||
|  | ||||
| @@ -461,7 +469,8 @@ template<class T, class U> | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: `intrusive_ptr<T>(dynamic_cast<T*>(r.get()))`. | ||||
| Returns:: | ||||
|   `intrusive_ptr<T>(dynamic_cast<T*>(r.get()))`. | ||||
|  | ||||
| ### operator<< | ||||
|  | ||||
|   | ||||
| @@ -111,7 +111,8 @@ intrusive_ref_counter& operator=(const intrusive_ref_counter& v) noexcept; | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Effects:: Does nothing, reference counter is not modified. | ||||
| Effects:: | ||||
|   Does nothing, reference counter is not modified. | ||||
|  | ||||
| ### use_count | ||||
|  | ||||
| @@ -137,7 +138,8 @@ template<class Derived, class CounterPolicy> | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Effects:: Increments the reference counter. | ||||
| Effects:: | ||||
|   Increments the reference counter. | ||||
|  | ||||
| ### intrusive_ptr_release | ||||
|  | ||||
|   | ||||
| @@ -124,7 +124,7 @@ namespace boost { | ||||
|     template<class Y> void reset(local_shared_ptr<Y> && r, element_type * p) noexcept; | ||||
|  | ||||
|     // accessors | ||||
|      | ||||
|  | ||||
|     T & operator*() const noexcept; // only valid when T is not an array type | ||||
|     T * operator->() const noexcept; // only valid when T is not an array type | ||||
|  | ||||
| @@ -143,12 +143,16 @@ namespace boost { | ||||
|     template<class Y> operator weak_ptr<Y>() const noexcept; | ||||
|  | ||||
|     // swap | ||||
|      | ||||
|  | ||||
|     void swap(local_shared_ptr & b) noexcept; | ||||
|  | ||||
|     // owner_before | ||||
|      | ||||
|     template<class Y> bool owner_before(local_shared_ptr<Y> const & rhs) const noexcept; | ||||
|  | ||||
|     template<class Y> bool owner_before(local_shared_ptr<Y> const & r) const noexcept; | ||||
|  | ||||
|     // owner_equals | ||||
|  | ||||
|     template<class Y> bool owner_equals(local_shared_ptr<Y> const & r) const noexcept; | ||||
|   }; | ||||
|  | ||||
|   // comparisons | ||||
| @@ -459,7 +463,8 @@ template<class Y> void reset(local_shared_ptr<Y> && r, element_type * p) noexcep | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Effects:: Equivalent to `local_shared_ptr(std::move(r), p).swap(*this)`. | ||||
| Effects:: | ||||
|   Equivalent to `local_shared_ptr(std::move(r), p).swap(*this)`. | ||||
|  | ||||
| ### indirection | ||||
| ``` | ||||
| @@ -497,7 +502,8 @@ element_type * get() const noexcept; | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: The stored pointer. | ||||
| Returns:: | ||||
|   The stored pointer. | ||||
|  | ||||
| ### local_use_count | ||||
| ``` | ||||
| @@ -506,7 +512,8 @@ long local_use_count() const noexcept; | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: The number of `local_shared_ptr` objects, `*this` included, that share ownership with `*this`, or 0 when `*this` is empty. | ||||
| Returns:: | ||||
|   The number of `local_shared_ptr` objects, `*this` included, that share ownership with `*this`, or 0 when `*this` is empty. | ||||
|  | ||||
| ### conversions | ||||
| ``` | ||||
| @@ -538,16 +545,28 @@ void swap(local_shared_ptr & b) noexcept; | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Effects:: Exchanges the contents of the two smart pointers. | ||||
| Effects:: | ||||
|   Exchanges the contents of the two smart pointers. | ||||
|  | ||||
| ### owner_before | ||||
| ``` | ||||
| template<class Y> bool owner_before(local_shared_ptr<Y> const & rhs) const noexcept; | ||||
| template<class Y> bool owner_before(local_shared_ptr<Y> const & r) const noexcept; | ||||
| ``` | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Effects:: See the description of `operator<`. | ||||
| Returns:: | ||||
|   See the description of `operator<`. | ||||
|  | ||||
| ### owner_equals | ||||
| ``` | ||||
| template<class Y> bool owner_equals(local_shared_ptr<Y> const & r) const noexcept; | ||||
| ``` | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: | ||||
|   `true` if and only if `*this` and `r` share ownership or are both empty. | ||||
|  | ||||
| ## Free Functions | ||||
|  | ||||
| @@ -631,7 +650,8 @@ template<class T> void swap(local_shared_ptr<T> & a, local_shared_ptr<T> & b) no | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Effects:: Equivalent to `a.swap(b)`. | ||||
| Effects:: | ||||
|   Equivalent to `a.swap(b)`. | ||||
|  | ||||
| ### get_pointer | ||||
| ``` | ||||
|   | ||||
| @@ -106,7 +106,7 @@ template<class T> | ||||
| + | ||||
| Constraints:: `T` is not an array. | ||||
| Returns:: `std::unique_ptr<T>(new T)`. | ||||
| Example:: `auto p = make_unique_noinit<double[1024]>();` | ||||
| Example:: `auto p = make_unique_noinit<std::array<double, 1024> >();` | ||||
|  | ||||
| ``` | ||||
| template<class T> | ||||
|   | ||||
							
								
								
									
										45
									
								
								doc/smart_ptr/owner_equal_to.adoc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								doc/smart_ptr/owner_equal_to.adoc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,45 @@ | ||||
| //// | ||||
| Copyright 2020 Peter Dimov | ||||
| Distributed under the Boost Software License, Version 1.0. | ||||
| https://www.boost.org/LICENSE_1_0.txt | ||||
| //// | ||||
|  | ||||
| [#owner_equal_to] | ||||
| # owner_equal_to | ||||
| :toc: | ||||
| :toc-title: | ||||
| :idprefix: owner_equal_to_ | ||||
|  | ||||
| ## Description | ||||
|  | ||||
| `owner_equal_to<T>` is a helper function object that compares two smart | ||||
| pointer objects using `owner_equals`. | ||||
|  | ||||
| ## Synopsis | ||||
|  | ||||
| `owner_equal_to` is defined in `<boost/smart_ptr/owner_equal_to.hpp>`. | ||||
|  | ||||
| ``` | ||||
| namespace boost { | ||||
|  | ||||
|   template<class T = void> struct owner_equal_to | ||||
|   { | ||||
|     typedef bool result_type; | ||||
|     typedef T first_argument_type; | ||||
|     typedef T second_argument_type; | ||||
|  | ||||
|     template<class U, class V> bool operator()( U const & u, V const & v ) const noexcept; | ||||
|   }; | ||||
| } | ||||
| ``` | ||||
|  | ||||
| ## Members | ||||
|  | ||||
| ``` | ||||
| template<class U, class V> bool operator()( U const & u, V const & v ) const noexcept; | ||||
| ``` | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: | ||||
|   `u.owner_equals( v )`. | ||||
							
								
								
									
										56
									
								
								doc/smart_ptr/owner_hash.adoc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								doc/smart_ptr/owner_hash.adoc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,56 @@ | ||||
| //// | ||||
| Copyright 2020 Peter Dimov | ||||
| Distributed under the Boost Software License, Version 1.0. | ||||
| https://www.boost.org/LICENSE_1_0.txt | ||||
| //// | ||||
|  | ||||
| [#owner_hash] | ||||
| # owner_hash | ||||
| :toc: | ||||
| :toc-title: | ||||
| :idprefix: owner_hash_to_ | ||||
|  | ||||
| ## Description | ||||
|  | ||||
| `owner_hash<T>` is a helper function object that takes a smart pointer `p` | ||||
| and returns `p.owner_hash_value()`. It's useful for creating unordered | ||||
| containers of `shared_ptr` that use ownership-based equality, instead of | ||||
| the default pointer value equality. (It can be used with `weak_ptr` too, | ||||
| but there's no need, because `boost::hash` and `std::hash` for `weak_ptr` | ||||
| already use ownership-based equality.) | ||||
|  | ||||
| ## Example | ||||
|  | ||||
| ``` | ||||
| std::unordered_set< boost::shared_ptr<void>, | ||||
|   boost::owner_hash< boost::shared_ptr<void> >, | ||||
|   boost::owner_equal_to< boost::shared_ptr<void> > > set; | ||||
| ``` | ||||
|  | ||||
| ## Synopsis | ||||
|  | ||||
| `owner_hash` is defined in `<boost/smart_ptr/owner_hash.hpp>`. | ||||
|  | ||||
| ``` | ||||
| namespace boost { | ||||
|  | ||||
|   template<class T> struct owner_hash | ||||
|   { | ||||
|     typedef std::size_t result_type; | ||||
|     typedef T argument_type; | ||||
|  | ||||
|     std::size_t operator()( T const & p ) const noexcept; | ||||
|   }; | ||||
| } | ||||
| ``` | ||||
|  | ||||
| ## Members | ||||
|  | ||||
| ``` | ||||
| std::size_t operator()( T const & p ) const noexcept; | ||||
| ``` | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: | ||||
|   `p.owner_hash_value()`. | ||||
							
								
								
									
										50
									
								
								doc/smart_ptr/owner_less.adoc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								doc/smart_ptr/owner_less.adoc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | ||||
| //// | ||||
| Copyright 2020 Peter Dimov | ||||
| Distributed under the Boost Software License, Version 1.0. | ||||
| https://www.boost.org/LICENSE_1_0.txt | ||||
| //// | ||||
|  | ||||
| [#owner_less] | ||||
| # owner_less | ||||
| :toc: | ||||
| :toc-title: | ||||
| :idprefix: owner_less_ | ||||
|  | ||||
| ## Description | ||||
|  | ||||
| `owner_less<T>` is a helper function object that compares two smart | ||||
| pointer objects using `owner_before`. It is only provided for compatibility | ||||
| with {cpp}11 and corresponds to the standard component of the same name. | ||||
|  | ||||
| When using Boost smart pointers, the use of `owner_less` is unnecessary, as | ||||
| the supplied `operator<` overloads (and, correspondingly, `std::less`) return | ||||
| the same result. | ||||
|  | ||||
| ## Synopsis | ||||
|  | ||||
| `owner_less` is defined in `<boost/smart_ptr/owner_less.hpp>`. | ||||
|  | ||||
| ``` | ||||
| namespace boost { | ||||
|  | ||||
|   template<class T = void> struct owner_less | ||||
|   { | ||||
|     typedef bool result_type; | ||||
|     typedef T first_argument_type; | ||||
|     typedef T second_argument_type; | ||||
|  | ||||
|     template<class U, class V> bool operator()( U const & u, V const & v ) const noexcept; | ||||
|   }; | ||||
| } | ||||
| ``` | ||||
|  | ||||
| ## Members | ||||
|  | ||||
| ``` | ||||
| template<class U, class V> bool operator()( U const & u, V const & v ) const noexcept; | ||||
| ``` | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: | ||||
|   `u.owner_before( v )`. | ||||
| @@ -178,8 +178,13 @@ namespace boost { | ||||
|  | ||||
|     void swap(shared_ptr & b) noexcept; | ||||
|  | ||||
|     template<class Y> bool owner_before(shared_ptr<Y> const & rhs) const noexcept; | ||||
|     template<class Y> bool owner_before(weak_ptr<Y> const & rhs) const noexcept; | ||||
|     template<class Y> bool owner_before(shared_ptr<Y> const & r) const noexcept; | ||||
|     template<class Y> bool owner_before(weak_ptr<Y> const & r) const noexcept; | ||||
|  | ||||
|     template<class Y> bool owner_equals(shared_ptr<Y> const & r) const noexcept; | ||||
|     template<class Y> bool owner_equals(weak_ptr<Y> const & r) const noexcept; | ||||
|  | ||||
|     std::size_t owner_hash_value() const noexcept; | ||||
|   }; | ||||
|  | ||||
|   template<class T, class U> | ||||
| @@ -560,7 +565,8 @@ template<class Y> void reset(shared_ptr<Y> && r, element_type * p) noexcept; | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Effects:: Equivalent to `shared_ptr(std::move(r), p).swap(*this)`. | ||||
| Effects:: | ||||
|   Equivalent to `shared_ptr(std::move(r), p).swap(*this)`. | ||||
|  | ||||
| ### indirection | ||||
| ``` | ||||
| @@ -598,7 +604,8 @@ element_type * get() const noexcept; | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: The stored pointer. | ||||
| Returns:: | ||||
|   The stored pointer. | ||||
|  | ||||
| ### unique | ||||
| ``` | ||||
| @@ -607,7 +614,8 @@ bool unique() const noexcept; | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: `use_count() == 1`. | ||||
| Returns:: | ||||
|   `use_count() == 1`. | ||||
|  | ||||
| ### use_count | ||||
| ``` | ||||
| @@ -616,7 +624,8 @@ long use_count() const noexcept; | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: The number of `shared_ptr` objects, `*this` included, that share ownership with `*this`, or 0 when `*this` is empty. | ||||
| Returns:: | ||||
|   The number of `shared_ptr` objects, `*this` included, that share ownership with `*this`, or 0 when `*this` is empty. | ||||
|  | ||||
| ### conversions | ||||
| ``` | ||||
| @@ -641,19 +650,45 @@ void swap(shared_ptr & b) noexcept; | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Effects:: Exchanges the contents of the two smart pointers. | ||||
| Effects:: | ||||
|   Exchanges the contents of the two smart pointers. | ||||
|  | ||||
| ### owner_before | ||||
| ``` | ||||
| template<class Y> bool owner_before(shared_ptr<Y> const & rhs) const noexcept; | ||||
| template<class Y> bool owner_before(shared_ptr<Y> const & r) const noexcept; | ||||
| ``` | ||||
| ``` | ||||
| template<class Y> bool owner_before(weak_ptr<Y> const & rhs) const noexcept; | ||||
| template<class Y> bool owner_before(weak_ptr<Y> const & r) const noexcept; | ||||
| ``` | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Effects:: See the description of `operator<`. | ||||
| Returns:: | ||||
|   See the description of `operator<`. | ||||
|  | ||||
| ### owner_equals | ||||
| ``` | ||||
| template<class Y> bool owner_equals(shared_ptr<Y> const & r) const noexcept; | ||||
| ``` | ||||
| ``` | ||||
| template<class Y> bool owner_equals(weak_ptr<Y> const & r) const noexcept; | ||||
| ``` | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: | ||||
|   `true` if and only if `*this` and `r` share ownership or are both empty. | ||||
|  | ||||
| ### owner_hash_value | ||||
| ``` | ||||
| std::size_t owner_hash_value() const noexcept; | ||||
| ``` | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: | ||||
|   An unspecified hash value such that two instances that share ownership | ||||
|   have the same hash value. | ||||
|  | ||||
| ## Free Functions | ||||
|  | ||||
| @@ -721,7 +756,8 @@ template<class T> void swap(shared_ptr<T> & a, shared_ptr<T> & b) noexcept; | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Effects:: Equivalent to `a.swap(b)`. | ||||
| Effects:: | ||||
|   Equivalent to `a.swap(b)`. | ||||
|  | ||||
| ### get_pointer | ||||
| ``` | ||||
| @@ -805,7 +841,8 @@ template<class D, class T> | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: If `*this` owns a deleter `d` of type (cv-unqualified) `D`, returns `&d`; otherwise returns 0. | ||||
| Returns:: | ||||
|   If `*this` owns a deleter `d` of type (cv-unqualified) `D`, returns `&d`; otherwise returns 0. | ||||
|  | ||||
| ### Atomic Access | ||||
|  | ||||
|   | ||||
| @@ -112,6 +112,11 @@ namespace boost { | ||||
|  | ||||
|     template<class Y> bool owner_before( weak_ptr<Y> const & r ) const noexcept; | ||||
|     template<class Y> bool owner_before( shared_ptr<Y> const & r ) const noexcept; | ||||
|  | ||||
|     template<class Y> bool owner_equals( weak_ptr<Y> const & r ) const noexcept; | ||||
|     template<class Y> bool owner_equals( shared_ptr<Y> const & r ) const noexcept; | ||||
|  | ||||
|     std::size_t owner_hash_value() const noexcept; | ||||
|   }; | ||||
|  | ||||
|   template<class T, class U> | ||||
| @@ -185,7 +190,8 @@ NOTE: These constructors are an extension, not present in `std::weak_ptr`. | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Effects:: Destroys this `weak_ptr` but has no effect on the object its stored pointer points to. | ||||
| Effects:: | ||||
|   Destroys this `weak_ptr` but has no effect on the object its stored pointer points to. | ||||
|  | ||||
| ### assignment | ||||
| ``` | ||||
| @@ -214,7 +220,8 @@ long use_count() const noexcept; | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: 0 if `*this` is empty; otherwise, the number of `shared_ptr` objects that share ownership with `*this`. | ||||
| Returns:: | ||||
|   0 if `*this` is empty; otherwise, the number of `shared_ptr` objects that share ownership with `*this`. | ||||
|  | ||||
| ### expired | ||||
| ``` | ||||
| @@ -223,7 +230,8 @@ bool expired() const noexcept; | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: `use_count() == 0`. | ||||
| Returns:: | ||||
|   `use_count() == 0`. | ||||
|  | ||||
| ### empty | ||||
| ``` | ||||
| @@ -243,7 +251,8 @@ shared_ptr<T> lock() const noexcept; | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: `expired()? shared_ptr<T>(): shared_ptr<T>(*this)`. | ||||
| Returns:: | ||||
|   `expired()? shared_ptr<T>(): shared_ptr<T>(*this)`. | ||||
|  | ||||
| ### reset | ||||
| ``` | ||||
| @@ -252,7 +261,8 @@ void reset() noexcept; | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Effects:: Equivalent to `weak_ptr().swap(*this)`. | ||||
| Effects:: | ||||
|   Equivalent to `weak_ptr().swap(*this)`. | ||||
|  | ||||
| ### swap | ||||
| ``` | ||||
| @@ -261,8 +271,10 @@ void swap(weak_ptr & b) noexcept; | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Effects:: Exchanges the contents of the two smart pointers. | ||||
| Effects:: | ||||
|   Exchanges the contents of the two smart pointers. | ||||
|  | ||||
| ### owner_before | ||||
| ``` | ||||
| template<class Y> bool owner_before( weak_ptr<Y> const & r ) const noexcept; | ||||
| ``` | ||||
| @@ -272,7 +284,32 @@ template<class Y> bool owner_before( shared_ptr<Y> const & r ) const noexcept; | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: See the description of `operator<`. | ||||
| Returns:: | ||||
|   See the description of `operator<`. | ||||
|  | ||||
| ### owner_equals | ||||
| ``` | ||||
| template<class Y> bool owner_equals( weak_ptr<Y> const & r ) const noexcept; | ||||
| ``` | ||||
| ``` | ||||
| template<class Y> bool owner_equals( shared_ptr<Y> const & r ) const noexcept; | ||||
| ``` | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: | ||||
|   `true` if and only if `*this` and `r` share ownership or are both empty. | ||||
|  | ||||
| ### owner_hash_value | ||||
| ``` | ||||
| std::size_t owner_hash_value() const noexcept; | ||||
| ``` | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Returns:: | ||||
|   An unspecified hash value such that two instances that share ownership | ||||
|   have the same hash value. | ||||
|  | ||||
| ## Free Functions | ||||
|  | ||||
| @@ -298,7 +335,8 @@ template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b) noexcept; | ||||
| [none] | ||||
| * {blank} | ||||
| + | ||||
| Effects:: Equivalent to `a.swap(b)`. | ||||
| Effects:: | ||||
|   Equivalent to `a.swap(b)`. | ||||
|  | ||||
| ## Frequently Asked Questions | ||||
|  | ||||
|   | ||||
| @@ -73,7 +73,7 @@ void * operator new(size_t n) throw(bad_alloc) | ||||
|     return p; | ||||
| } | ||||
|  | ||||
| #if !defined(__BORLANDC__) || (__BORLANDC__ > 0x551) | ||||
| #if !defined(BOOST_BORLANDC) || (BOOST_BORLANDC > 0x551) | ||||
|  | ||||
| void * operator new(size_t n, nothrow_t const &) throw() | ||||
| { | ||||
| @@ -95,7 +95,7 @@ void * operator new[](size_t n) throw(bad_alloc) | ||||
|     return p; | ||||
| } | ||||
|  | ||||
| #if !defined(__BORLANDC__) || (__BORLANDC__ > 0x551) | ||||
| #if !defined(BOOST_BORLANDC) || (BOOST_BORLANDC > 0x551) | ||||
|  | ||||
| void * operator new[](size_t n, nothrow_t const &) throw() | ||||
| { | ||||
| @@ -205,7 +205,7 @@ void operator delete(void * p) throw() | ||||
|     free(pm); | ||||
| } | ||||
|  | ||||
| #if !defined(__BORLANDC__) || (__BORLANDC__ > 0x551) | ||||
| #if !defined(BOOST_BORLANDC) || (BOOST_BORLANDC > 0x551) | ||||
|  | ||||
| void operator delete(void * p, nothrow_t const &) throw() | ||||
| { | ||||
| @@ -231,7 +231,7 @@ void operator delete[](void * p) throw() | ||||
|     free(pm); | ||||
| } | ||||
|  | ||||
| #if !defined(__BORLANDC__) || (__BORLANDC__ > 0x551) | ||||
| #if !defined(BOOST_BORLANDC) || (BOOST_BORLANDC > 0x551) | ||||
|  | ||||
| void operator delete[](void * p, nothrow_t const &) throw() | ||||
| { | ||||
|   | ||||
| @@ -21,168 +21,6 @@ | ||||
| //  template<class F> int lw_thread_create( lw_thread_t & th, F f ); | ||||
| //  void lw_thread_join( lw_thread_t th ); | ||||
|  | ||||
|  | ||||
| #include <boost/config.hpp> | ||||
| #include <memory> | ||||
| #include <cerrno> | ||||
|  | ||||
| #if defined( BOOST_HAS_PTHREADS ) | ||||
|  | ||||
| #include <pthread.h> | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
| namespace detail | ||||
| { | ||||
|  | ||||
| typedef ::pthread_t lw_thread_t; | ||||
|  | ||||
| inline int lw_thread_create_( lw_thread_t* thread, const pthread_attr_t* attr, void* (*start_routine)( void* ), void* arg ) | ||||
| { | ||||
|     return ::pthread_create( thread, attr, start_routine, arg ); | ||||
| } | ||||
|  | ||||
| inline void lw_thread_join( lw_thread_t th ) | ||||
| { | ||||
|     ::pthread_join( th, 0 ); | ||||
| } | ||||
|  | ||||
| } // namespace detail | ||||
| } // namespace boost | ||||
|  | ||||
| #else // defined( BOOST_HAS_PTHREADS ) | ||||
|  | ||||
| #include <windows.h> | ||||
| #include <process.h> | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
| namespace detail | ||||
| { | ||||
|  | ||||
| typedef HANDLE lw_thread_t; | ||||
|  | ||||
| inline int lw_thread_create_( lw_thread_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; | ||||
|     } | ||||
| } | ||||
|  | ||||
| inline void lw_thread_join( lw_thread_t thread ) | ||||
| { | ||||
|     ::WaitForSingleObject( thread, INFINITE ); | ||||
|     ::CloseHandle( thread ); | ||||
| } | ||||
|  | ||||
| } // namespace detail | ||||
| } // namespace boost | ||||
|  | ||||
| #endif // defined( BOOST_HAS_PTHREADS ) | ||||
|  | ||||
|  | ||||
| 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<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) ); | ||||
|  | ||||
| #else | ||||
|  | ||||
|     std::unique_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) ); | ||||
|  | ||||
| #endif | ||||
|  | ||||
|     pt->run(); | ||||
|  | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| #else | ||||
|  | ||||
| unsigned __stdcall lw_thread_routine( void * pv ) | ||||
| { | ||||
| #if defined(BOOST_NO_CXX11_SMART_PTR) | ||||
|  | ||||
|     std::auto_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) ); | ||||
|  | ||||
| #else | ||||
|  | ||||
|     std::unique_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) ); | ||||
|  | ||||
| #endif | ||||
|  | ||||
|     pt->run(); | ||||
|  | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| #endif | ||||
|  | ||||
| template<class F> class lw_thread_impl: public lw_abstract_thread | ||||
| { | ||||
| public: | ||||
|  | ||||
|     explicit lw_thread_impl( F f ): f_( f ) | ||||
|     { | ||||
|     } | ||||
|  | ||||
|     void run() | ||||
|     { | ||||
|         f_(); | ||||
|     } | ||||
|  | ||||
| private: | ||||
|  | ||||
|     F f_; | ||||
| }; | ||||
|  | ||||
| template<class F> int lw_thread_create( lw_thread_t & th, F f ) | ||||
| { | ||||
| #if defined(BOOST_NO_CXX11_SMART_PTR) | ||||
|  | ||||
|     std::auto_ptr<lw_abstract_thread> p( new lw_thread_impl<F>( f ) ); | ||||
|  | ||||
| #else | ||||
|  | ||||
|     std::unique_ptr<lw_abstract_thread> p( new lw_thread_impl<F>( f ) ); | ||||
|  | ||||
| #endif | ||||
|  | ||||
|     int r = lw_thread_create_( &th, 0, lw_thread_routine, p.get() ); | ||||
|  | ||||
|     if( r == 0 ) | ||||
|     { | ||||
|         p.release(); | ||||
|     } | ||||
|  | ||||
|     return r; | ||||
| } | ||||
|  | ||||
| } // namespace detail | ||||
| } // namespace boost | ||||
| #include <boost/smart_ptr/detail/lightweight_thread.hpp> | ||||
|  | ||||
| #endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED | ||||
|   | ||||
| @@ -21,11 +21,12 @@ public: | ||||
|         count_ = shared_count(base); | ||||
|     } | ||||
|  | ||||
|     virtual void local_cb_destroy() BOOST_SP_NOEXCEPT { | ||||
|     void local_cb_destroy() BOOST_SP_NOEXCEPT BOOST_OVERRIDE { | ||||
|         shared_count().swap(count_); | ||||
|     } | ||||
|  | ||||
|     virtual shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT { | ||||
|     shared_count local_cb_get_shared_count() const | ||||
|         BOOST_SP_NOEXCEPT BOOST_OVERRIDE { | ||||
|         return count_; | ||||
|     } | ||||
|  | ||||
| @@ -73,7 +74,7 @@ inline typename enable_if_<is_unbounded_array<T>::value, | ||||
| allocate_local_shared(const A& allocator, std::size_t count) | ||||
| { | ||||
|     typedef typename detail::sp_array_element<T>::type element; | ||||
|     typedef typename detail::sp_bind_allocator<A, element>::type other; | ||||
|     typedef typename allocator_rebind<A, element>::type other; | ||||
|     typedef detail::lsp_array_state<other> state; | ||||
|     typedef detail::sp_array_base<state> base; | ||||
|     detail::sp_array_result<other, base> result(allocator, count); | ||||
| @@ -96,7 +97,7 @@ allocate_local_shared(const A& allocator) | ||||
|         count = extent<T>::value | ||||
|     }; | ||||
|     typedef typename detail::sp_array_element<T>::type element; | ||||
|     typedef typename detail::sp_bind_allocator<A, element>::type other; | ||||
|     typedef typename allocator_rebind<A, element>::type other; | ||||
|     typedef detail::lsp_size_array_state<other, count> state; | ||||
|     typedef detail::sp_array_base<state> base; | ||||
|     detail::sp_array_result<other, base> result(allocator, count); | ||||
| @@ -117,7 +118,7 @@ allocate_local_shared(const A& allocator, std::size_t count, | ||||
|     const typename remove_extent<T>::type& value) | ||||
| { | ||||
|     typedef typename detail::sp_array_element<T>::type element; | ||||
|     typedef typename detail::sp_bind_allocator<A, element>::type other; | ||||
|     typedef typename allocator_rebind<A, element>::type other; | ||||
|     typedef detail::lsp_array_state<other> state; | ||||
|     typedef detail::sp_array_base<state> base; | ||||
|     detail::sp_array_result<other, base> result(allocator, count); | ||||
| @@ -141,7 +142,7 @@ allocate_local_shared(const A& allocator, | ||||
|         count = extent<T>::value | ||||
|     }; | ||||
|     typedef typename detail::sp_array_element<T>::type element; | ||||
|     typedef typename detail::sp_bind_allocator<A, element>::type other; | ||||
|     typedef typename allocator_rebind<A, element>::type other; | ||||
|     typedef detail::lsp_size_array_state<other, count> state; | ||||
|     typedef detail::sp_array_base<state> base; | ||||
|     detail::sp_array_result<other, base> result(allocator, count); | ||||
|   | ||||
| @@ -8,6 +8,7 @@ Distributed under the Boost Software License, Version 1.0. | ||||
| #ifndef BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP | ||||
| #define BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP | ||||
|  | ||||
| #include <boost/core/allocator_access.hpp> | ||||
| #include <boost/core/alloc_construct.hpp> | ||||
| #include <boost/core/first_scalar.hpp> | ||||
| #include <boost/smart_ptr/shared_ptr.hpp> | ||||
| @@ -57,18 +58,6 @@ struct sp_align_up { | ||||
|     }; | ||||
| }; | ||||
|  | ||||
| #if !defined(BOOST_NO_CXX11_ALLOCATOR) | ||||
| template<class A, class T> | ||||
| struct sp_bind_allocator { | ||||
|     typedef typename std::allocator_traits<A>::template rebind_alloc<T> type; | ||||
| }; | ||||
| #else | ||||
| template<class A, class T> | ||||
| struct sp_bind_allocator { | ||||
|     typedef typename A::template rebind<T>::other type; | ||||
| }; | ||||
| #endif | ||||
|  | ||||
| template<class T> | ||||
| BOOST_CONSTEXPR inline std::size_t | ||||
| sp_objects(std::size_t size) BOOST_SP_NOEXCEPT | ||||
| @@ -171,7 +160,7 @@ public: | ||||
|     } | ||||
|  | ||||
| private: | ||||
|     typename sp_bind_allocator<A, type>::type other_; | ||||
|     typename boost::allocator_rebind<A, type>::type other_; | ||||
|     std::size_t size_; | ||||
| }; | ||||
|  | ||||
| @@ -206,28 +195,29 @@ public: | ||||
|         return state_; | ||||
|     } | ||||
|  | ||||
|     virtual void dispose() BOOST_SP_NOEXCEPT { | ||||
|     void dispose() BOOST_SP_NOEXCEPT BOOST_OVERRIDE { | ||||
|         boost::alloc_destroy_n(state_.allocator(), | ||||
|             boost::first_scalar(sp_array_start<type>(this)), | ||||
|             state_.size() * sp_array_count<type>::value); | ||||
|     } | ||||
|  | ||||
|     virtual void destroy() BOOST_SP_NOEXCEPT { | ||||
|     void destroy() BOOST_SP_NOEXCEPT BOOST_OVERRIDE { | ||||
|         sp_array_creator<allocator, sp_array_base> other(state_.allocator(), | ||||
|             state_.size()); | ||||
|         this->~sp_array_base(); | ||||
|         other.destroy(this); | ||||
|     } | ||||
|  | ||||
|     virtual void* get_deleter(const sp_typeinfo_&) BOOST_SP_NOEXCEPT { | ||||
|     void* get_deleter(const sp_typeinfo_&) BOOST_SP_NOEXCEPT BOOST_OVERRIDE { | ||||
|         return 0; | ||||
|     } | ||||
|  | ||||
|     virtual void* get_local_deleter(const sp_typeinfo_&) BOOST_SP_NOEXCEPT { | ||||
|     void* get_local_deleter(const sp_typeinfo_&) | ||||
|         BOOST_SP_NOEXCEPT BOOST_OVERRIDE { | ||||
|         return 0; | ||||
|     } | ||||
|  | ||||
|     virtual void* get_untyped_deleter() BOOST_SP_NOEXCEPT { | ||||
|     void* get_untyped_deleter() BOOST_SP_NOEXCEPT BOOST_OVERRIDE { | ||||
|         return 0; | ||||
|     } | ||||
|  | ||||
| @@ -272,7 +262,7 @@ inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type | ||||
| allocate_shared(const A& allocator, std::size_t count) | ||||
| { | ||||
|     typedef typename detail::sp_array_element<T>::type element; | ||||
|     typedef typename detail::sp_bind_allocator<A, element>::type other; | ||||
|     typedef typename allocator_rebind<A, element>::type other; | ||||
|     typedef detail::sp_array_state<other> state; | ||||
|     typedef detail::sp_array_base<state> base; | ||||
|     detail::sp_array_result<other, base> result(allocator, count); | ||||
| @@ -292,7 +282,7 @@ allocate_shared(const A& allocator) | ||||
|         count = extent<T>::value | ||||
|     }; | ||||
|     typedef typename detail::sp_array_element<T>::type element; | ||||
|     typedef typename detail::sp_bind_allocator<A, element>::type other; | ||||
|     typedef typename allocator_rebind<A, element>::type other; | ||||
|     typedef detail::sp_size_array_state<other, extent<T>::value> state; | ||||
|     typedef detail::sp_array_base<state> base; | ||||
|     detail::sp_array_result<other, base> result(allocator, count); | ||||
| @@ -310,7 +300,7 @@ allocate_shared(const A& allocator, std::size_t count, | ||||
|     const typename remove_extent<T>::type& value) | ||||
| { | ||||
|     typedef typename detail::sp_array_element<T>::type element; | ||||
|     typedef typename detail::sp_bind_allocator<A, element>::type other; | ||||
|     typedef typename allocator_rebind<A, element>::type other; | ||||
|     typedef detail::sp_array_state<other> state; | ||||
|     typedef detail::sp_array_base<state> base; | ||||
|     detail::sp_array_result<other, base> result(allocator, count); | ||||
| @@ -331,7 +321,7 @@ allocate_shared(const A& allocator, | ||||
|         count = extent<T>::value | ||||
|     }; | ||||
|     typedef typename detail::sp_array_element<T>::type element; | ||||
|     typedef typename detail::sp_bind_allocator<A, element>::type other; | ||||
|     typedef typename allocator_rebind<A, element>::type other; | ||||
|     typedef detail::sp_size_array_state<other, extent<T>::value> state; | ||||
|     typedef detail::sp_array_base<state> base; | ||||
|     detail::sp_array_result<other, base> result(allocator, count); | ||||
|   | ||||
| @@ -10,6 +10,7 @@ Distributed under the Boost Software License, Version 1.0. | ||||
|  | ||||
| #include <boost/smart_ptr/detail/sp_noexcept.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_nullptr_t.hpp> | ||||
| #include <boost/core/allocator_access.hpp> | ||||
| #include <boost/core/alloc_construct.hpp> | ||||
| #include <boost/core/empty_value.hpp> | ||||
| #include <boost/core/first_scalar.hpp> | ||||
| @@ -61,30 +62,6 @@ struct sp_alloc_value { | ||||
|         boost::remove_extent<T>::type>::type type; | ||||
| }; | ||||
|  | ||||
| #if !defined(BOOST_NO_CXX11_ALLOCATOR) | ||||
| template<class A, class T> | ||||
| struct sp_alloc_to { | ||||
|     typedef typename std::allocator_traits<A>::template rebind_alloc<T> type; | ||||
| }; | ||||
| #else | ||||
| template<class A, class T> | ||||
| struct sp_alloc_to { | ||||
|     typedef typename A::template rebind<T>::other type; | ||||
| }; | ||||
| #endif | ||||
|  | ||||
| #if !defined(BOOST_NO_CXX11_ALLOCATOR) | ||||
| template<class A> | ||||
| struct sp_alloc_type { | ||||
|     typedef typename std::allocator_traits<A>::pointer type; | ||||
| }; | ||||
| #else | ||||
| template<class A> | ||||
| struct sp_alloc_type { | ||||
|     typedef typename A::pointer type; | ||||
| }; | ||||
| #endif | ||||
|  | ||||
| template<class T, class P> | ||||
| class sp_alloc_ptr { | ||||
| public: | ||||
| @@ -296,7 +273,7 @@ operator!=(detail::sp_nullptr_t, | ||||
|  | ||||
| template<class A> | ||||
| inline void | ||||
| sp_alloc_clear(A& a, typename sp_alloc_type<A>::type p, std::size_t, | ||||
| sp_alloc_clear(A& a, typename boost::allocator_pointer<A>::type p, std::size_t, | ||||
|     boost::false_type) | ||||
| { | ||||
|     boost::alloc_destroy(a, boost::to_address(p)); | ||||
| @@ -304,8 +281,8 @@ sp_alloc_clear(A& a, typename sp_alloc_type<A>::type p, std::size_t, | ||||
|  | ||||
| template<class A> | ||||
| inline void | ||||
| sp_alloc_clear(A& a, typename sp_alloc_type<A>::type p, std::size_t n, | ||||
|     boost::true_type) | ||||
| sp_alloc_clear(A& a, typename boost::allocator_pointer<A>::type p, | ||||
|     std::size_t n, boost::true_type) | ||||
| { | ||||
| #if defined(BOOST_MSVC) && BOOST_MSVC < 1800 | ||||
|     if (!p) { | ||||
| @@ -320,15 +297,15 @@ sp_alloc_clear(A& a, typename sp_alloc_type<A>::type p, std::size_t n, | ||||
|  | ||||
| template<class T, class A> | ||||
| class alloc_deleter | ||||
|     : empty_value<typename detail::sp_alloc_to<A, | ||||
|     : empty_value<typename allocator_rebind<A, | ||||
|         typename detail::sp_alloc_value<T>::type>::type> { | ||||
|     typedef typename detail::sp_alloc_to<A, | ||||
|     typedef typename allocator_rebind<A, | ||||
|         typename detail::sp_alloc_value<T>::type>::type allocator; | ||||
|     typedef empty_value<allocator> base; | ||||
|  | ||||
| public: | ||||
|     typedef detail::sp_alloc_ptr<T, | ||||
|         typename detail::sp_alloc_type<allocator>::type> pointer; | ||||
|         typename allocator_pointer<allocator>::type> pointer; | ||||
|  | ||||
|     explicit alloc_deleter(const allocator& a) BOOST_SP_NOEXCEPT | ||||
|         : base(empty_init_t(), a) { } | ||||
| @@ -349,7 +326,7 @@ namespace detail { | ||||
| template<class T, class A> | ||||
| class sp_alloc_make { | ||||
| public: | ||||
|     typedef typename sp_alloc_to<A, | ||||
|     typedef typename boost::allocator_rebind<A, | ||||
|         typename sp_alloc_value<T>::type>::type allocator; | ||||
|  | ||||
| private: | ||||
| @@ -384,7 +361,7 @@ public: | ||||
|     } | ||||
|  | ||||
| private: | ||||
|     typedef typename sp_alloc_type<allocator>::type pointer; | ||||
|     typedef typename boost::allocator_pointer<allocator>::type pointer; | ||||
|  | ||||
|     allocator a_; | ||||
|     std::size_t n_; | ||||
|   | ||||
| @@ -20,7 +20,7 @@ | ||||
| #include <boost/config.hpp> | ||||
| #include <exception> | ||||
|  | ||||
| #ifdef __BORLANDC__ | ||||
| #ifdef BOOST_BORLANDC | ||||
| # pragma warn -8026     // Functions with excep. spec. are not expanded inline | ||||
| #endif | ||||
|  | ||||
| @@ -33,7 +33,7 @@ namespace boost | ||||
| // is compiled with -ps, the compiler issues an error. | ||||
| // Hence, the temporary #pragma option -pc below. | ||||
|  | ||||
| #if defined(__BORLANDC__) && __BORLANDC__ <= 0x564 | ||||
| #if defined(BOOST_BORLANDC) && BOOST_BORLANDC <= 0x564 | ||||
| # pragma option push -pc | ||||
| #endif | ||||
|  | ||||
| @@ -47,7 +47,7 @@ class bad_weak_ptr: public std::exception | ||||
| { | ||||
| public: | ||||
|  | ||||
|     virtual char const * what() const BOOST_NOEXCEPT_OR_NOTHROW | ||||
|     char const * what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE | ||||
|     { | ||||
|         return "tr1::bad_weak_ptr"; | ||||
|     } | ||||
| @@ -57,13 +57,13 @@ public: | ||||
| # pragma clang diagnostic pop | ||||
| #endif | ||||
|  | ||||
| #if defined(__BORLANDC__) && __BORLANDC__ <= 0x564 | ||||
| #if defined(BOOST_BORLANDC) && BOOST_BORLANDC <= 0x564 | ||||
| # pragma option pop | ||||
| #endif | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| #ifdef __BORLANDC__ | ||||
| #ifdef BOOST_BORLANDC | ||||
| # pragma warn .8026     // Functions with excep. spec. are not expanded inline | ||||
| #endif | ||||
|  | ||||
|   | ||||
| @@ -43,8 +43,9 @@ | ||||
| //    Memory Ordering: acquire/release | ||||
| // | ||||
|  | ||||
| #include <boost/smart_ptr/detail/sp_has_gcc_intrinsics.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_has_sync_intrinsics.hpp> | ||||
| #include <boost/config.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_has_sync.hpp> | ||||
|  | ||||
| #if defined( BOOST_AC_DISABLE_THREADS ) | ||||
| # include <boost/smart_ptr/detail/atomic_count_nt.hpp> | ||||
| @@ -73,15 +74,18 @@ | ||||
| #elif defined( BOOST_DISABLE_THREADS ) && !defined( BOOST_SP_ENABLE_THREADS ) && !defined( BOOST_DISABLE_WIN32 ) | ||||
| # include <boost/smart_ptr/detail/atomic_count_nt.hpp> | ||||
|  | ||||
| #elif defined( BOOST_SP_HAS_GCC_INTRINSICS ) | ||||
| # include <boost/smart_ptr/detail/atomic_count_gcc_atomic.hpp> | ||||
|  | ||||
| #elif !defined( BOOST_NO_CXX11_HDR_ATOMIC ) | ||||
| # include <boost/smart_ptr/detail/atomic_count_std_atomic.hpp> | ||||
|  | ||||
| #elif defined( BOOST_SP_HAS_SYNC_INTRINSICS ) | ||||
| # include <boost/smart_ptr/detail/atomic_count_sync.hpp> | ||||
|  | ||||
| #elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) && !defined( __PATHSCALE__ ) | ||||
| # include <boost/smart_ptr/detail/atomic_count_gcc_x86.hpp> | ||||
|  | ||||
| #elif defined( BOOST_SP_HAS_SYNC ) | ||||
| # include <boost/smart_ptr/detail/atomic_count_sync.hpp> | ||||
|  | ||||
| #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) | ||||
| # include <boost/smart_ptr/detail/atomic_count_win32.hpp> | ||||
|  | ||||
|   | ||||
| @@ -23,6 +23,13 @@ | ||||
| # include <bits/atomicity.h> | ||||
| #endif | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using libstdc++ atomic_count") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
							
								
								
									
										63
									
								
								include/boost/smart_ptr/detail/atomic_count_gcc_atomic.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								include/boost/smart_ptr/detail/atomic_count_gcc_atomic.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,63 @@ | ||||
| #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_ATOMIC_HPP_INCLUDED | ||||
| #define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_ATOMIC_HPP_INCLUDED | ||||
|  | ||||
| // boost/detail/atomic_count_gcc_atomic.hpp | ||||
| // | ||||
| // atomic_count for g++ 4.7+ | ||||
| // | ||||
| // Copyright 2007, 2020 Peter Dimov | ||||
| // | ||||
| // Distributed under the Boost Software License, Version 1.0. | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
|  | ||||
| #include <boost/cstdint.hpp> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using __atomic atomic_count") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
| namespace detail | ||||
| { | ||||
|  | ||||
| class atomic_count | ||||
| { | ||||
| public: | ||||
|  | ||||
|     explicit atomic_count( long v ): value_( static_cast< boost::int_least32_t >( v ) ) | ||||
|     { | ||||
|     } | ||||
|  | ||||
|     long operator++() | ||||
|     { | ||||
|         return __atomic_add_fetch( &value_, +1, __ATOMIC_ACQ_REL ); | ||||
|     } | ||||
|  | ||||
|     long operator--() | ||||
|     { | ||||
|         return __atomic_add_fetch( &value_, -1, __ATOMIC_ACQ_REL ); | ||||
|     } | ||||
|  | ||||
|     operator long() const | ||||
|     { | ||||
|         return __atomic_load_n( &value_, __ATOMIC_ACQUIRE ); | ||||
|     } | ||||
|  | ||||
| private: | ||||
|  | ||||
|     atomic_count(atomic_count const &); | ||||
|     atomic_count & operator=(atomic_count const &); | ||||
|  | ||||
|     boost::int_least32_t value_; | ||||
| }; | ||||
|  | ||||
| } // namespace detail | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| #endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_ATOMIC_HPP_INCLUDED | ||||
| @@ -13,6 +13,17 @@ | ||||
| //  http://www.boost.org/LICENSE_1_0.txt) | ||||
| // | ||||
|  | ||||
| #include <boost/smart_ptr/detail/sp_obsolete.hpp> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using g++/x86 atomic_count") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| BOOST_SP_OBSOLETE() | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -15,6 +15,13 @@ | ||||
| //  http://www.boost.org/LICENSE_1_0.txt | ||||
| // | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using single-threaded, non-atomic atomic_count") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -14,6 +14,13 @@ | ||||
| #include <boost/assert.hpp> | ||||
| #include <pthread.h> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using pthread_mutex atomic_count") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| // | ||||
| //  The generic pthread_mutex-based implementation sometimes leads to | ||||
| //    inefficiencies. Example: a class with two atomic_count members | ||||
|   | ||||
| @@ -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 <atomic.h> | ||||
|  | ||||
| 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<uint32_t const volatile &>( 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 | ||||
| @@ -13,6 +13,13 @@ | ||||
|  | ||||
| #include <boost/smart_ptr/detail/spinlock_pool.hpp> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using spinlock-based atomic_count") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -16,6 +16,13 @@ | ||||
| #include <atomic> | ||||
| #include <cstdint> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using std::atomic atomic_count") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -15,10 +15,19 @@ | ||||
| //  http://www.boost.org/LICENSE_1_0.txt) | ||||
| // | ||||
|  | ||||
| #include <boost/cstdint.hpp> | ||||
|  | ||||
| #if defined( __ia64__ ) && defined( __INTEL_COMPILER ) | ||||
| # include <ia64intrin.h> | ||||
| #endif | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using __sync atomic_count") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
| @@ -29,7 +38,9 @@ class atomic_count | ||||
| { | ||||
| public: | ||||
|  | ||||
|     explicit atomic_count( long v ) : value_( v ) {} | ||||
|     explicit atomic_count( long v ): value_( static_cast< boost::int_least32_t >( v ) ) | ||||
|     { | ||||
|     } | ||||
|  | ||||
|     long operator++() | ||||
|     { | ||||
| @@ -51,7 +62,7 @@ private: | ||||
|     atomic_count(atomic_count const &); | ||||
|     atomic_count & operator=(atomic_count const &); | ||||
|  | ||||
|     mutable long value_; | ||||
|     mutable boost::int_least32_t value_; | ||||
| }; | ||||
|  | ||||
| } // namespace detail | ||||
|   | ||||
| @@ -19,6 +19,13 @@ | ||||
|  | ||||
| #include <boost/smart_ptr/detail/sp_interlocked.hpp> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using Win32 atomic_count") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
							
								
								
									
										188
									
								
								include/boost/smart_ptr/detail/lightweight_thread.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										188
									
								
								include/boost/smart_ptr/detail/lightweight_thread.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,188 @@ | ||||
| #ifndef BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED | ||||
| #define BOOST_SMART_PTR_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, 2018 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 /*...*/ lw_thread_t; // as pthread_t | ||||
| //  template<class F> int lw_thread_create( lw_thread_t & th, F f ); | ||||
| //  void lw_thread_join( lw_thread_t th ); | ||||
|  | ||||
|  | ||||
| #include <boost/config.hpp> | ||||
| #include <memory> | ||||
| #include <cerrno> | ||||
|  | ||||
| #if defined( BOOST_HAS_PTHREADS ) | ||||
|  | ||||
| #include <pthread.h> | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
| namespace detail | ||||
| { | ||||
|  | ||||
| typedef ::pthread_t lw_thread_t; | ||||
|  | ||||
| inline int lw_thread_create_( lw_thread_t* thread, const pthread_attr_t* attr, void* (*start_routine)( void* ), void* arg ) | ||||
| { | ||||
|     return ::pthread_create( thread, attr, start_routine, arg ); | ||||
| } | ||||
|  | ||||
| inline void lw_thread_join( lw_thread_t th ) | ||||
| { | ||||
|     ::pthread_join( th, 0 ); | ||||
| } | ||||
|  | ||||
| } // namespace detail | ||||
| } // namespace boost | ||||
|  | ||||
| #else // defined( BOOST_HAS_PTHREADS ) | ||||
|  | ||||
| #include <windows.h> | ||||
| #include <process.h> | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
| namespace detail | ||||
| { | ||||
|  | ||||
| typedef HANDLE lw_thread_t; | ||||
|  | ||||
| inline int lw_thread_create_( lw_thread_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; | ||||
|     } | ||||
| } | ||||
|  | ||||
| inline void lw_thread_join( lw_thread_t thread ) | ||||
| { | ||||
|     ::WaitForSingleObject( thread, INFINITE ); | ||||
|     ::CloseHandle( thread ); | ||||
| } | ||||
|  | ||||
| } // namespace detail | ||||
| } // namespace boost | ||||
|  | ||||
| #endif // defined( BOOST_HAS_PTHREADS ) | ||||
|  | ||||
|  | ||||
| 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<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) ); | ||||
|  | ||||
| #else | ||||
|  | ||||
|     std::unique_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) ); | ||||
|  | ||||
| #endif | ||||
|  | ||||
|     pt->run(); | ||||
|  | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| #else | ||||
|  | ||||
| unsigned __stdcall lw_thread_routine( void * pv ) | ||||
| { | ||||
| #if defined(BOOST_NO_CXX11_SMART_PTR) | ||||
|  | ||||
|     std::auto_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) ); | ||||
|  | ||||
| #else | ||||
|  | ||||
|     std::unique_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) ); | ||||
|  | ||||
| #endif | ||||
|  | ||||
|     pt->run(); | ||||
|  | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| #endif | ||||
|  | ||||
| template<class F> class lw_thread_impl: public lw_abstract_thread | ||||
| { | ||||
| public: | ||||
|  | ||||
|     explicit lw_thread_impl( F f ): f_( f ) | ||||
|     { | ||||
|     } | ||||
|  | ||||
|     void run() | ||||
|     { | ||||
|         f_(); | ||||
|     } | ||||
|  | ||||
| private: | ||||
|  | ||||
|     F f_; | ||||
| }; | ||||
|  | ||||
| template<class F> int lw_thread_create( lw_thread_t & th, F f ) | ||||
| { | ||||
| #if defined(BOOST_NO_CXX11_SMART_PTR) | ||||
|  | ||||
|     std::auto_ptr<lw_abstract_thread> p( new lw_thread_impl<F>( f ) ); | ||||
|  | ||||
| #else | ||||
|  | ||||
|     std::unique_ptr<lw_abstract_thread> p( new lw_thread_impl<F>( f ) ); | ||||
|  | ||||
| #endif | ||||
|  | ||||
|     int r = lw_thread_create_( &th, 0, lw_thread_routine, p.get() ); | ||||
|  | ||||
|     if( r == 0 ) | ||||
|     { | ||||
|         p.release(); | ||||
|     } | ||||
|  | ||||
|     return r; | ||||
| } | ||||
|  | ||||
| } // namespace detail | ||||
| } // namespace boost | ||||
|  | ||||
| #endif // #ifndef BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED | ||||
| @@ -113,12 +113,12 @@ public: | ||||
|  | ||||
| #endif | ||||
|  | ||||
|     virtual void local_cb_destroy() BOOST_SP_NOEXCEPT | ||||
|     void local_cb_destroy() BOOST_SP_NOEXCEPT BOOST_OVERRIDE | ||||
|     { | ||||
|         delete this; | ||||
|     } | ||||
|  | ||||
|     virtual boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT | ||||
|     boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT BOOST_OVERRIDE | ||||
|     { | ||||
|         return pn_; | ||||
|     } | ||||
| @@ -130,12 +130,12 @@ public: | ||||
|  | ||||
|     shared_count pn_; | ||||
|  | ||||
|     virtual void local_cb_destroy() BOOST_SP_NOEXCEPT | ||||
|     void local_cb_destroy() BOOST_SP_NOEXCEPT BOOST_OVERRIDE | ||||
|     { | ||||
|         shared_count().swap( pn_ ); | ||||
|     } | ||||
|  | ||||
|     virtual boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT | ||||
|     boost::detail::shared_count local_cb_get_shared_count() const BOOST_SP_NOEXCEPT BOOST_OVERRIDE | ||||
|     { | ||||
|         return pn_; | ||||
|     } | ||||
|   | ||||
| @@ -18,32 +18,29 @@ | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
| // | ||||
|  | ||||
| #ifdef __BORLANDC__ | ||||
| #if defined(__BORLANDC__) && !defined(__clang__) | ||||
| # pragma warn -8027     // Functions containing try are not expanded inline | ||||
| #endif | ||||
|  | ||||
| #include <boost/config.hpp> | ||||
| #include <boost/checked_delete.hpp> | ||||
| #include <boost/throw_exception.hpp> | ||||
| #include <boost/smart_ptr/bad_weak_ptr.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_counted_base.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_counted_impl.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_disable_deprecated.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_noexcept.hpp> | ||||
| #include <boost/checked_delete.hpp> | ||||
| #include <boost/throw_exception.hpp> | ||||
| #include <boost/core/addressof.hpp> | ||||
| #include <boost/config.hpp> | ||||
| #include <boost/config/workaround.hpp> | ||||
| // In order to avoid circular dependencies with Boost.TR1 | ||||
| // we make sure that our include of <memory> doesn't try to | ||||
| // pull in the TR1 headers: that's why we use this header  | ||||
| // rather than including <memory> directly: | ||||
| #include <boost/config/no_tr1/memory.hpp>  // std::auto_ptr | ||||
| #include <functional>       // std::less | ||||
| #include <boost/cstdint.hpp> | ||||
| #include <memory>            // std::auto_ptr | ||||
| #include <functional>        // std::less | ||||
| #include <cstddef>           // std::size_t | ||||
|  | ||||
| #ifdef BOOST_NO_EXCEPTIONS | ||||
| # include <new>              // std::bad_alloc | ||||
| #endif | ||||
|  | ||||
| #include <boost/core/addressof.hpp> | ||||
|  | ||||
| #if defined( BOOST_SP_DISABLE_DEPRECATED ) | ||||
| #pragma GCC diagnostic push | ||||
| #pragma GCC diagnostic ignored "-Wdeprecated-declarations" | ||||
| @@ -103,6 +100,14 @@ template< class D > struct sp_convert_reference< D& > | ||||
|     typedef sp_reference_wrapper< D > type; | ||||
| }; | ||||
|  | ||||
| template<class T> std::size_t sp_hash_pointer( T* p ) BOOST_NOEXCEPT | ||||
| { | ||||
|     boost::uintptr_t v = reinterpret_cast<boost::uintptr_t>( p ); | ||||
|  | ||||
|     // match boost::hash<T*> | ||||
|     return static_cast<std::size_t>( v + ( v >> 3 ) ); | ||||
| } | ||||
|  | ||||
| class weak_count; | ||||
|  | ||||
| class shared_count | ||||
| @@ -489,16 +494,20 @@ public: | ||||
|         return pi_ == 0; | ||||
|     } | ||||
|  | ||||
|     friend inline bool operator==(shared_count const & a, shared_count const & b) BOOST_SP_NOEXCEPT | ||||
|     bool operator==( shared_count const & r ) const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return a.pi_ == b.pi_; | ||||
|         return pi_ == r.pi_; | ||||
|     } | ||||
|  | ||||
|     friend inline bool operator<(shared_count const & a, shared_count const & b) BOOST_SP_NOEXCEPT | ||||
|     bool operator==( weak_count const & r ) const BOOST_SP_NOEXCEPT; | ||||
|  | ||||
|     bool operator<( shared_count const & r ) const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return std::less<sp_counted_base *>()( a.pi_, b.pi_ ); | ||||
|         return std::less<sp_counted_base *>()( pi_, r.pi_ ); | ||||
|     } | ||||
|  | ||||
|     bool operator<( weak_count const & r ) const BOOST_SP_NOEXCEPT; | ||||
|  | ||||
|     void * get_deleter( sp_typeinfo_ const & ti ) const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return pi_? pi_->get_deleter( ti ): 0; | ||||
| @@ -513,6 +522,11 @@ public: | ||||
|     { | ||||
|         return pi_? pi_->get_untyped_deleter(): 0; | ||||
|     } | ||||
|  | ||||
|     std::size_t hash_value() const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return sp_hash_pointer( pi_ ); | ||||
|     } | ||||
| }; | ||||
|  | ||||
|  | ||||
| @@ -620,14 +634,29 @@ public: | ||||
|         return pi_ == 0; | ||||
|     } | ||||
|  | ||||
|     friend inline bool operator==(weak_count const & a, weak_count const & b) BOOST_SP_NOEXCEPT | ||||
|     bool operator==( weak_count const & r ) const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return a.pi_ == b.pi_; | ||||
|         return pi_ == r.pi_; | ||||
|     } | ||||
|  | ||||
|     friend inline bool operator<(weak_count const & a, weak_count const & b) BOOST_SP_NOEXCEPT | ||||
|     bool operator==( shared_count const & r ) const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return std::less<sp_counted_base *>()(a.pi_, b.pi_); | ||||
|         return pi_ == r.pi_; | ||||
|     } | ||||
|  | ||||
|     bool operator<( weak_count const & r ) const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return std::less<sp_counted_base *>()( pi_, r.pi_ ); | ||||
|     } | ||||
|  | ||||
|     bool operator<( shared_count const & r ) const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return std::less<sp_counted_base *>()( pi_, r.pi_ ); | ||||
|     } | ||||
|  | ||||
|     std::size_t hash_value() const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return sp_hash_pointer( pi_ ); | ||||
|     } | ||||
| }; | ||||
|  | ||||
| @@ -653,6 +682,16 @@ inline shared_count::shared_count( weak_count const & r, sp_nothrow_tag ) BOOST_ | ||||
|     } | ||||
| } | ||||
|  | ||||
| inline bool shared_count::operator==( weak_count const & r ) const BOOST_SP_NOEXCEPT | ||||
| { | ||||
|     return pi_ == r.pi_; | ||||
| } | ||||
|  | ||||
| inline bool shared_count::operator<( weak_count const & r ) const BOOST_SP_NOEXCEPT | ||||
| { | ||||
|     return std::less<sp_counted_base *>()( pi_, r.pi_ ); | ||||
| } | ||||
|  | ||||
| } // namespace detail | ||||
|  | ||||
| } // namespace boost | ||||
| @@ -661,7 +700,7 @@ inline shared_count::shared_count( weak_count const & r, sp_nothrow_tag ) BOOST_ | ||||
| #pragma GCC diagnostic pop | ||||
| #endif | ||||
|  | ||||
| #ifdef __BORLANDC__ | ||||
| #if defined(__BORLANDC__) && !defined(__clang__) | ||||
| # pragma warn .8027     // Functions containing try are not expanded inline | ||||
| #endif | ||||
|  | ||||
|   | ||||
| @@ -26,7 +26,7 @@ | ||||
| # define BOOST_SP_NO_SP_CONVERTIBLE | ||||
| #endif | ||||
|  | ||||
| #if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x630 ) | ||||
| #if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( BOOST_BORLANDC ) && ( BOOST_BORLANDC < 0x630 ) | ||||
| # define BOOST_SP_NO_SP_CONVERTIBLE | ||||
| #endif | ||||
|  | ||||
|   | ||||
| @@ -17,14 +17,9 @@ | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
| // | ||||
|  | ||||
| #include <boost/smart_ptr/detail/sp_has_gcc_intrinsics.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_has_sync_intrinsics.hpp> | ||||
| #include <boost/config.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_has_sync.hpp> | ||||
|  | ||||
| #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 <boost/smart_ptr/detail/sp_counted_base_nt.hpp> | ||||
| @@ -41,18 +36,24 @@ | ||||
| #elif defined( BOOST_DISABLE_THREADS ) && !defined( BOOST_SP_ENABLE_THREADS ) && !defined( BOOST_DISABLE_WIN32 ) | ||||
| # include <boost/smart_ptr/detail/sp_counted_base_nt.hpp> | ||||
|  | ||||
| #elif defined( BOOST_SP_HAS_CLANG_C11_ATOMICS ) | ||||
| # include <boost/smart_ptr/detail/sp_counted_base_clang.hpp> | ||||
| #elif defined( BOOST_SP_HAS_GCC_INTRINSICS ) | ||||
| # include <boost/smart_ptr/detail/sp_counted_base_gcc_atomic.hpp> | ||||
|  | ||||
| #elif !defined( BOOST_NO_CXX11_HDR_ATOMIC ) | ||||
| # include <boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp> | ||||
|  | ||||
| #elif defined( __SNC__ ) | ||||
| # include <boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp> | ||||
| #elif defined( __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 ) | ||||
| # include <boost/smart_ptr/detail/sp_counted_base_sync.hpp> | ||||
|  | ||||
| #elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) && !defined(__PATHSCALE__) | ||||
| # include <boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp> | ||||
|  | ||||
| #elif defined( BOOST_SP_HAS_SYNC_INTRINSICS ) | ||||
| # include <boost/smart_ptr/detail/sp_counted_base_sync.hpp> | ||||
|  | ||||
| #elif defined( __SNC__ ) | ||||
| # include <boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp> | ||||
|  | ||||
| #elif defined(__HP_aCC) && defined(__ia64) | ||||
| # include <boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp> | ||||
|  | ||||
| @@ -71,9 +72,6 @@ | ||||
| #elif defined( __GNUC__ ) && ( defined( __mips__ ) || defined( _mips ) ) && !defined(__PATHSCALE__) && !defined( __mips16 ) | ||||
| # include <boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp> | ||||
|  | ||||
| #elif defined( BOOST_SP_HAS_SYNC ) | ||||
| # include <boost/smart_ptr/detail/sp_counted_base_sync.hpp> | ||||
|  | ||||
| #elif defined(__GNUC__) && ( defined( __sparcv9 ) || ( defined( __sparcv8 ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 402 ) ) ) | ||||
| # include <boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp> | ||||
|  | ||||
| @@ -91,6 +89,4 @@ | ||||
|  | ||||
| #endif | ||||
|  | ||||
| #undef BOOST_SP_HAS_CLANG_C11_ATOMICS | ||||
|  | ||||
| #endif  // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED | ||||
|   | ||||
| @@ -16,9 +16,19 @@ | ||||
| // | ||||
|  | ||||
| #include <boost/smart_ptr/detail/sp_typeinfo_.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_obsolete.hpp> | ||||
| #include <boost/config.hpp> | ||||
| #include <machine/sys/inline.h> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using HP aCC++/HP-UX/IA64 sp_counted_base") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| BOOST_SP_OBSOLETE() | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -25,6 +25,13 @@ | ||||
| #include <builtins.h> | ||||
| #include <sys/atomic_op.h> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using AIX sp_counted_base") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -1,152 +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 <boost/smart_ptr/detail/sp_typeinfo_.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_noexcept.hpp> | ||||
| #include <boost/config.hpp> | ||||
| #include <boost/cstdint.hpp> | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
| namespace detail | ||||
| { | ||||
|  | ||||
| typedef _Atomic( boost::int_least32_t ) atomic_int_least32_t; | ||||
|  | ||||
| inline void atomic_increment( atomic_int_least32_t * pw ) BOOST_SP_NOEXCEPT | ||||
| { | ||||
|     __c11_atomic_fetch_add( pw, 1, __ATOMIC_RELAXED ); | ||||
| } | ||||
|  | ||||
| inline boost::int_least32_t atomic_decrement( atomic_int_least32_t * pw ) BOOST_SP_NOEXCEPT | ||||
| { | ||||
|     return __c11_atomic_fetch_sub( pw, 1, __ATOMIC_ACQ_REL ); | ||||
| } | ||||
|  | ||||
| inline boost::int_least32_t atomic_conditional_increment( atomic_int_least32_t * pw ) BOOST_SP_NOEXCEPT | ||||
| { | ||||
|     // 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 BOOST_SYMBOL_VISIBLE 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() BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         __c11_atomic_init( &use_count_, 1 ); | ||||
|         __c11_atomic_init( &weak_count_, 1 ); | ||||
|     } | ||||
|  | ||||
|     virtual ~sp_counted_base() /*BOOST_SP_NOEXCEPT*/ | ||||
|     { | ||||
|     } | ||||
|  | ||||
|     // dispose() is called when use_count_ drops to zero, to release | ||||
|     // the resources managed by *this. | ||||
|  | ||||
|     virtual void dispose() BOOST_SP_NOEXCEPT = 0; // nothrow | ||||
|  | ||||
|     // destroy() is called when weak_count_ drops to zero. | ||||
|  | ||||
|     virtual void destroy() BOOST_SP_NOEXCEPT // nothrow | ||||
|     { | ||||
|         delete this; | ||||
|     } | ||||
|  | ||||
|     virtual void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0; | ||||
|     virtual void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0; | ||||
|     virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT = 0; | ||||
|  | ||||
|     void add_ref_copy() BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         atomic_increment( &use_count_ ); | ||||
|     } | ||||
|  | ||||
|     bool add_ref_lock() BOOST_SP_NOEXCEPT // true on success | ||||
|     { | ||||
|         return atomic_conditional_increment( &use_count_ ) != 0; | ||||
|     } | ||||
|  | ||||
|     void release() BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         if( atomic_decrement( &use_count_ ) == 1 ) | ||||
|         { | ||||
|             dispose(); | ||||
|             weak_release(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void weak_add_ref() BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         atomic_increment( &weak_count_ ); | ||||
|     } | ||||
|  | ||||
|     void weak_release() BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         if( atomic_decrement( &weak_count_ ) == 1 ) | ||||
|         { | ||||
|             destroy(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     long use_count() const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         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 | ||||
| @@ -25,8 +25,18 @@ | ||||
| // | ||||
|  | ||||
| #include <boost/smart_ptr/detail/sp_typeinfo_.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_obsolete.hpp> | ||||
| #include <boost/config.hpp> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using CodeWarrior/PowerPC sp_counted_base") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| BOOST_SP_OBSOLETE() | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -1,161 +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 <boost/smart_ptr/detail/sp_typeinfo_.hpp> | ||||
| #include <boost/config.hpp> | ||||
|  | ||||
| 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 BOOST_SYMBOL_VISIBLE 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<int const volatile &>( use_count_ ); | ||||
|     } | ||||
| }; | ||||
|  | ||||
| } // namespace detail | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| #endif  // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_CW_X86_HPP_INCLUDED | ||||
							
								
								
									
										148
									
								
								include/boost/smart_ptr/detail/sp_counted_base_gcc_atomic.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										148
									
								
								include/boost/smart_ptr/detail/sp_counted_base_gcc_atomic.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,148 @@ | ||||
| #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_ATOMIC_HPP_INCLUDED | ||||
| #define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_GCC_ATOMIC_HPP_INCLUDED | ||||
|  | ||||
| // MS compatible compilers support #pragma once | ||||
|  | ||||
| #if defined(_MSC_VER) && (_MSC_VER >= 1020) | ||||
| # pragma once | ||||
| #endif | ||||
|  | ||||
| // detail/sp_counted_base_gcc_atomic.hpp - g++ 4.7+ __atomic intrinsics | ||||
| // | ||||
| // Copyright 2007, 2020 Peter Dimov | ||||
| // Distributed under the Boost Software License, Version 1.0. | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
|  | ||||
| #include <boost/smart_ptr/detail/sp_typeinfo_.hpp> | ||||
| #include <boost/config.hpp> | ||||
| #include <boost/cstdint.hpp> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using __atomic sp_counted_base") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
| namespace detail | ||||
| { | ||||
|  | ||||
| inline void atomic_increment( boost::uint_least32_t * pw ) | ||||
| { | ||||
|     __atomic_fetch_add( pw, 1, __ATOMIC_RELAXED ); | ||||
| } | ||||
|  | ||||
| inline boost::uint_least32_t atomic_decrement( boost::uint_least32_t * pw ) | ||||
| { | ||||
|     return __atomic_fetch_sub( pw, 1, __ATOMIC_ACQ_REL ); | ||||
| } | ||||
|  | ||||
| inline boost::uint_least32_t atomic_conditional_increment( boost::uint_least32_t * pw ) | ||||
| { | ||||
|     // long r = *pw; | ||||
|     // if( r != 0 ) ++*pw; | ||||
|     // return r; | ||||
|  | ||||
|     boost::uint_least32_t r = __atomic_load_n( pw, __ATOMIC_RELAXED ); | ||||
|  | ||||
|     for( ;; ) | ||||
|     { | ||||
|         if( r == 0 ) | ||||
|         { | ||||
|             return r; | ||||
|         } | ||||
|  | ||||
|         if( __atomic_compare_exchange_n( pw, &r, r + 1, true, __ATOMIC_RELAXED, __ATOMIC_RELAXED ) ) | ||||
|         { | ||||
|             return r; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| inline boost::uint_least32_t atomic_load( boost::uint_least32_t const * pw ) | ||||
| { | ||||
|     return __atomic_load_n( pw, __ATOMIC_ACQUIRE ); | ||||
| } | ||||
|  | ||||
| class BOOST_SYMBOL_VISIBLE sp_counted_base | ||||
| { | ||||
| private: | ||||
|  | ||||
|     sp_counted_base( sp_counted_base const & ); | ||||
|     sp_counted_base & operator= ( sp_counted_base const & ); | ||||
|  | ||||
|     boost::uint_least32_t use_count_;        // #shared | ||||
|     boost::uint_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 atomic_load( &use_count_ ); | ||||
|     } | ||||
| }; | ||||
|  | ||||
| } // namespace detail | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| #endif  // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED | ||||
| @@ -17,8 +17,18 @@ | ||||
| // | ||||
|  | ||||
| #include <boost/smart_ptr/detail/sp_typeinfo_.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_obsolete.hpp> | ||||
| #include <boost/config.hpp> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using g++/IA64 sp_counted_base") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| BOOST_SP_OBSOLETE() | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -21,8 +21,18 @@ | ||||
| // | ||||
|  | ||||
| #include <boost/smart_ptr/detail/sp_typeinfo_.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_obsolete.hpp> | ||||
| #include <boost/config.hpp> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using g++/MIPS sp_counted_base") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| BOOST_SP_OBSOLETE() | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -25,8 +25,18 @@ | ||||
| // | ||||
|  | ||||
| #include <boost/smart_ptr/detail/sp_typeinfo_.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_obsolete.hpp> | ||||
| #include <boost/config.hpp> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using g++/PowerPC sp_counted_base") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| BOOST_SP_OBSOLETE() | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -20,9 +20,19 @@ | ||||
| //  Thanks to Michael van der Westhuizen | ||||
|  | ||||
| #include <boost/smart_ptr/detail/sp_typeinfo_.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_obsolete.hpp> | ||||
| #include <boost/config.hpp> | ||||
| #include <inttypes.h> // int32_t | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using g++/Sparc sp_counted_base") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| BOOST_SP_OBSOLETE() | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -25,8 +25,18 @@ | ||||
| // | ||||
|  | ||||
| #include <boost/smart_ptr/detail/sp_typeinfo_.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_obsolete.hpp> | ||||
| #include <boost/config.hpp> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using g++/x86 sp_counted_base") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| BOOST_SP_OBSOLETE() | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -23,6 +23,13 @@ | ||||
| #include <boost/config.hpp> | ||||
| #include <boost/cstdint.hpp> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using single-threaded, non-atomic sp_counted_base") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -24,6 +24,13 @@ | ||||
| #include <boost/cstdint.hpp> | ||||
| #include <pthread.h> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using pthread_mutex sp_counted_base") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
| # pragma once | ||||
| #endif | ||||
|  | ||||
| //  detail/sp_counted_base_gcc_sparc.hpp - g++ on Sparc V8+ | ||||
| //  detail/sp_counted_base_gcc_snc_ps3.hpp - PS3 Cell | ||||
| // | ||||
| //  Copyright (c) 2006 Piotr Wyderski | ||||
| //  Copyright (c) 2006 Tomas Puverle | ||||
| @@ -20,9 +20,19 @@ | ||||
| //  Thanks to Michael van der Westhuizen | ||||
|  | ||||
| #include <boost/smart_ptr/detail/sp_typeinfo_.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_obsolete.hpp> | ||||
| #include <boost/config.hpp> | ||||
| #include <inttypes.h> // uint32_t | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using PS3 sp_counted_base") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| BOOST_SP_OBSOLETE() | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -1,116 +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 <boost/smart_ptr/detail/sp_typeinfo_.hpp> | ||||
| #include <boost/config.hpp> | ||||
| #include <atomic.h> | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
| namespace detail | ||||
| { | ||||
|  | ||||
| class BOOST_SYMBOL_VISIBLE 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<long const volatile &>( use_count_ ); | ||||
|     } | ||||
| }; | ||||
|  | ||||
| } // namespace detail | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| #endif  // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_SOLARIS_HPP_INCLUDED | ||||
| @@ -22,6 +22,13 @@ | ||||
| #include <boost/smart_ptr/detail/spinlock_pool.hpp> | ||||
| #include <boost/config.hpp> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using spinlock-based sp_counted_base") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -21,6 +21,13 @@ | ||||
| #include <atomic> | ||||
| #include <cstdint> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using std::atomic sp_counted_base") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -23,6 +23,13 @@ | ||||
| # include <ia64intrin.h> | ||||
| #endif | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using __sync sp_counted_base") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -22,8 +22,18 @@ | ||||
| // | ||||
|  | ||||
| #include <boost/smart_ptr/detail/sp_typeinfo_.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_obsolete.hpp> | ||||
| #include <boost/config.hpp> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using xlC/PowerPC sp_counted_base") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| BOOST_SP_OBSOLETE() | ||||
|  | ||||
| extern "builtin" void __lwsync(void); | ||||
| extern "builtin" void __isync(void); | ||||
| extern "builtin" int __fetch_and_add(volatile int* addr, int val); | ||||
|   | ||||
| @@ -29,6 +29,13 @@ | ||||
| #include <boost/config/workaround.hpp> | ||||
| #include <boost/config.hpp> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using Win32 sp_counted_base") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -18,25 +18,21 @@ | ||||
| // http://www.boost.org/LICENSE_1_0.txt) | ||||
| // | ||||
|  | ||||
| #include <boost/config.hpp> | ||||
|  | ||||
| #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 <boost/checked_delete.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_counted_base.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_noexcept.hpp> | ||||
| #include <boost/checked_delete.hpp> | ||||
| #include <boost/core/addressof.hpp> | ||||
| #include <boost/config.hpp> | ||||
|  | ||||
| #if defined(BOOST_SP_USE_QUICK_ALLOCATOR) | ||||
| #include <boost/smart_ptr/detail/quick_allocator.hpp> | ||||
| #endif | ||||
|  | ||||
| #if defined(BOOST_SP_USE_STD_ALLOCATOR) | ||||
| #include <memory>           // std::allocator | ||||
| #endif | ||||
|  | ||||
| #include <memory>           // std::allocator, std::allocator_traits | ||||
| #include <cstddef>          // std::size_t | ||||
|  | ||||
| namespace boost | ||||
| @@ -85,7 +81,7 @@ public: | ||||
| #endif | ||||
|     } | ||||
|  | ||||
|     virtual void dispose() BOOST_SP_NOEXCEPT | ||||
|     void dispose() BOOST_SP_NOEXCEPT BOOST_OVERRIDE | ||||
|     { | ||||
| #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) | ||||
|         boost::sp_scalar_destructor_hook( px_, sizeof(X), this ); | ||||
| @@ -93,17 +89,17 @@ public: | ||||
|         boost::checked_delete( px_ ); | ||||
|     } | ||||
|  | ||||
|     virtual void * get_deleter( sp_typeinfo_ const & ) BOOST_SP_NOEXCEPT | ||||
|     void * get_deleter( sp_typeinfo_ const & ) BOOST_SP_NOEXCEPT BOOST_OVERRIDE | ||||
|     { | ||||
|         return 0; | ||||
|     } | ||||
|  | ||||
|     virtual void * get_local_deleter( sp_typeinfo_ const & ) BOOST_SP_NOEXCEPT | ||||
|     void * get_local_deleter( sp_typeinfo_ const & ) BOOST_SP_NOEXCEPT BOOST_OVERRIDE | ||||
|     { | ||||
|         return 0; | ||||
|     } | ||||
|  | ||||
|     virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT | ||||
|     void * get_untyped_deleter() BOOST_SP_NOEXCEPT BOOST_OVERRIDE | ||||
|     { | ||||
|         return 0; | ||||
|     } | ||||
| @@ -168,22 +164,22 @@ public: | ||||
|     { | ||||
|     } | ||||
|  | ||||
|     virtual void dispose() BOOST_SP_NOEXCEPT | ||||
|     void dispose() BOOST_SP_NOEXCEPT BOOST_OVERRIDE | ||||
|     { | ||||
|         del( ptr ); | ||||
|     } | ||||
|  | ||||
|     virtual void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT | ||||
|     void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT BOOST_OVERRIDE | ||||
|     { | ||||
|         return ti == BOOST_SP_TYPEID_(D)? &reinterpret_cast<char&>( del ): 0; | ||||
|     } | ||||
|  | ||||
|     virtual void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT | ||||
|     void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT BOOST_OVERRIDE | ||||
|     { | ||||
|         return ti == BOOST_SP_TYPEID_(D)? boost::detail::get_local_deleter( boost::addressof( del ) ): 0; | ||||
|     } | ||||
|  | ||||
|     virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT | ||||
|     void * get_untyped_deleter() BOOST_SP_NOEXCEPT BOOST_OVERRIDE | ||||
|     { | ||||
|         return &reinterpret_cast<char&>( del ); | ||||
|     } | ||||
| @@ -242,12 +238,12 @@ public: | ||||
|     { | ||||
|     } | ||||
|  | ||||
|     virtual void dispose() BOOST_SP_NOEXCEPT | ||||
|     void dispose() BOOST_SP_NOEXCEPT BOOST_OVERRIDE | ||||
|     { | ||||
|         d_( p_ ); | ||||
|     } | ||||
|  | ||||
|     virtual void destroy() BOOST_SP_NOEXCEPT | ||||
|     void destroy() BOOST_SP_NOEXCEPT BOOST_OVERRIDE | ||||
|     { | ||||
| #if !defined( BOOST_NO_CXX11_ALLOCATOR ) | ||||
|  | ||||
| @@ -266,17 +262,17 @@ public: | ||||
|         a2.deallocate( this, 1 ); | ||||
|     } | ||||
|  | ||||
|     virtual void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT | ||||
|     void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT BOOST_OVERRIDE | ||||
|     { | ||||
|         return ti == BOOST_SP_TYPEID_( D )? &reinterpret_cast<char&>( d_ ): 0; | ||||
|     } | ||||
|  | ||||
|     virtual void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT | ||||
|     void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT BOOST_OVERRIDE | ||||
|     { | ||||
|         return ti == BOOST_SP_TYPEID_( D )? boost::detail::get_local_deleter( boost::addressof( d_ ) ): 0; | ||||
|     } | ||||
|  | ||||
|     virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT | ||||
|     void * get_untyped_deleter() BOOST_SP_NOEXCEPT BOOST_OVERRIDE | ||||
|     { | ||||
|         return &reinterpret_cast<char&>( d_ ); | ||||
|     } | ||||
|   | ||||
							
								
								
									
										27
									
								
								include/boost/smart_ptr/detail/sp_has_gcc_intrinsics.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								include/boost/smart_ptr/detail/sp_has_gcc_intrinsics.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| #ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_GCC_INTRINSICS_HPP_INCLUDED | ||||
| #define BOOST_SMART_PTR_DETAIL_SP_HAS_GCC_INTRINSICS_HPP_INCLUDED | ||||
|  | ||||
| // MS compatible compilers support #pragma once | ||||
|  | ||||
| #if defined(_MSC_VER) && (_MSC_VER >= 1020) | ||||
| # pragma once | ||||
| #endif | ||||
|  | ||||
|  | ||||
| // boost/smart_ptr/detail/sp_has_gcc_intrinsics.hpp | ||||
| // | ||||
| // Copyright 2020 Peter Dimov | ||||
| // Distributed under the Boost Software License, Version 1.0. | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
| // | ||||
| // Defines the BOOST_SP_HAS_GCC_INTRINSICS macro if the __atomic_* | ||||
| // intrinsics are available. | ||||
|  | ||||
|  | ||||
| #if defined( __ATOMIC_RELAXED ) && defined( __ATOMIC_ACQUIRE ) && defined( __ATOMIC_RELEASE ) && defined( __ATOMIC_ACQ_REL ) | ||||
|  | ||||
| # define BOOST_SP_HAS_GCC_INTRINSICS | ||||
|  | ||||
| #endif | ||||
|  | ||||
| #endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_GCC_INTRINSICS_HPP_INCLUDED | ||||
| @@ -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 | ||||
							
								
								
									
										69
									
								
								include/boost/smart_ptr/detail/sp_has_sync_intrinsics.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								include/boost/smart_ptr/detail/sp_has_sync_intrinsics.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,69 @@ | ||||
| #ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_INTRINSICS_HPP_INCLUDED | ||||
| #define BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_INTRINSICS_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_intrinsics.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_INTRINSICS macro if the __sync_* intrinsics | ||||
| //  are available. | ||||
| // | ||||
|  | ||||
| #if !defined( BOOST_SP_NO_SYNC_INTRINSICS ) && !defined( BOOST_SP_NO_SYNC ) | ||||
|  | ||||
| #if defined( __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 ) && !defined( __c2__ ) | ||||
|  | ||||
| # define BOOST_SP_HAS_SYNC_INTRINSICS | ||||
|  | ||||
| #elif defined( __IBMCPP__ ) && ( __IBMCPP__ >= 1210 ) && !defined( __COMPILER_VER__ ) | ||||
|  | ||||
| # define BOOST_SP_HAS_SYNC_INTRINSICS | ||||
|  | ||||
| #elif defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) && !defined( __c2__ ) | ||||
|  | ||||
| #define BOOST_SP_HAS_SYNC_INTRINSICS | ||||
|  | ||||
| #if defined( __arm__ )  || defined( __armel__ ) | ||||
| #undef BOOST_SP_HAS_SYNC_INTRINSICS | ||||
| #endif | ||||
|  | ||||
| #if defined( __hppa ) || defined( __hppa__ ) | ||||
| #undef BOOST_SP_HAS_SYNC_INTRINSICS | ||||
| #endif | ||||
|  | ||||
| #if defined( __m68k__ ) | ||||
| #undef BOOST_SP_HAS_SYNC_INTRINSICS | ||||
| #endif | ||||
|  | ||||
| #if defined( __sh__ ) | ||||
| #undef BOOST_SP_HAS_SYNC_INTRINSICS | ||||
| #endif | ||||
|  | ||||
| #if defined( __sparc__ ) | ||||
| #undef BOOST_SP_HAS_SYNC_INTRINSICS | ||||
| #endif | ||||
|  | ||||
| #if defined( __INTEL_COMPILER ) && !defined( __ia64__ ) && ( __INTEL_COMPILER < 1110 ) | ||||
| #undef BOOST_SP_HAS_SYNC_INTRINSICS | ||||
| #endif | ||||
|  | ||||
| #if defined(__PATHSCALE__) && ((__PATHCC__ == 4) && (__PATHCC_MINOR__ < 9))  | ||||
| #undef BOOST_SP_HAS_SYNC_INTRINSICS | ||||
| #endif | ||||
|  | ||||
| #endif | ||||
|  | ||||
| #endif // #if !defined( BOOST_SP_NO_SYNC_INTRINSICS ) && !defined( BOOST_SP_NO_SYNC ) | ||||
|  | ||||
| #endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_HAS_SYNC_INTRINSICS_HPP_INCLUDED | ||||
							
								
								
									
										32
									
								
								include/boost/smart_ptr/detail/sp_obsolete.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								include/boost/smart_ptr/detail/sp_obsolete.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,32 @@ | ||||
| #ifndef BOOST_SMART_PTR_DETAIL_SP_OBSOLETE_HPP_INCLUDED | ||||
| #define BOOST_SMART_PTR_DETAIL_SP_OBSOLETE_HPP_INCLUDED | ||||
|  | ||||
| // MS compatible compilers support #pragma once | ||||
|  | ||||
| #if defined(_MSC_VER) && (_MSC_VER >= 1020) | ||||
| # pragma once | ||||
| #endif | ||||
|  | ||||
|  | ||||
| // boost/smart_ptr/detail/sp_obsolete.hpp | ||||
| // | ||||
| // Copyright 2020 Peter Dimov | ||||
| // Distributed under the Boost Software License, Version 1.0. | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
| // | ||||
| // Defines the BOOST_SP_OBSOLETE macro that emits a deprecation | ||||
| // message. | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
|  | ||||
| #if !defined( BOOST_SP_NO_OBSOLETE_MESSAGE ) | ||||
|  | ||||
| #define BOOST_SP_OBSOLETE() BOOST_PRAGMA_MESSAGE("This platform-specific implementation is presumed obsolete and is slated for removal. If you want it retained, please open an issue in https://github.com/boostorg/smart_ptr.") | ||||
|  | ||||
| #else | ||||
|  | ||||
| #define BOOST_SP_OBSOLETE() | ||||
|  | ||||
| #endif | ||||
|  | ||||
| #endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_OBSOLETE_HPP_INCLUDED | ||||
							
								
								
									
										51
									
								
								include/boost/smart_ptr/detail/sp_thread_pause.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								include/boost/smart_ptr/detail/sp_thread_pause.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,51 @@ | ||||
| #ifndef BOOST_SMART_PTR_DETAIL_SP_THREAD_PAUSE_HPP_INCLUDED | ||||
| #define BOOST_SMART_PTR_DETAIL_SP_THREAD_PAUSE_HPP_INCLUDED | ||||
|  | ||||
| // MS compatible compilers support #pragma once | ||||
|  | ||||
| #if defined(_MSC_VER) && (_MSC_VER >= 1020) | ||||
| # pragma once | ||||
| #endif | ||||
|  | ||||
| // boost/smart_ptr/detail/sp_thread_pause.hpp | ||||
| // | ||||
| // inline void bost::detail::sp_thread_pause(); | ||||
| // | ||||
| //   Emits a "pause" instruction. | ||||
| // | ||||
| // Copyright 2008, 2020 Peter Dimov | ||||
| // Distributed under the Boost Software License, Version 1.0 | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
|  | ||||
| #if defined(_MSC_VER) && _MSC_VER >= 1310 && ( defined(_M_IX86) || defined(_M_X64) ) && !defined(__c2__) | ||||
|  | ||||
| extern "C" void _mm_pause(); | ||||
|  | ||||
| #define BOOST_SP_PAUSE _mm_pause(); | ||||
|  | ||||
| #elif defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) ) | ||||
|  | ||||
| #define BOOST_SP_PAUSE __asm__ __volatile__( "rep; nop" : : : "memory" ); | ||||
|  | ||||
| #else | ||||
|  | ||||
| #define BOOST_SP_PAUSE | ||||
|  | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
| namespace detail | ||||
| { | ||||
|  | ||||
| inline void sp_thread_pause() | ||||
| { | ||||
|     BOOST_SP_PAUSE | ||||
| } | ||||
|  | ||||
| } // namespace detail | ||||
| } // namespace boost | ||||
|  | ||||
| #undef BOOST_SP_PAUSE | ||||
|  | ||||
| #endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_THREAD_PAUSE_HPP_INCLUDED | ||||
							
								
								
									
										104
									
								
								include/boost/smart_ptr/detail/sp_thread_sleep.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										104
									
								
								include/boost/smart_ptr/detail/sp_thread_sleep.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,104 @@ | ||||
| #ifndef BOOST_SMART_PTR_DETAIL_SP_THREAD_SLEEP_HPP_INCLUDED | ||||
| #define BOOST_SMART_PTR_DETAIL_SP_THREAD_SLEEP_HPP_INCLUDED | ||||
|  | ||||
| // MS compatible compilers support #pragma once | ||||
|  | ||||
| #if defined(_MSC_VER) && (_MSC_VER >= 1020) | ||||
| # pragma once | ||||
| #endif | ||||
|  | ||||
| // boost/smart_ptr/detail/sp_thread_sleep.hpp | ||||
| // | ||||
| // inline void bost::detail::sp_thread_sleep(); | ||||
| // | ||||
| //   Cease execution for a while to yield to other threads, | ||||
| //   as if by calling nanosleep() with an appropriate interval. | ||||
| // | ||||
| // Copyright 2008, 2020 Peter Dimov | ||||
| // Distributed under the Boost Software License, Version 1.0 | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
|  | ||||
| #include <boost/config.hpp> | ||||
| #include <boost/config/pragma_message.hpp> | ||||
|  | ||||
| #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|   BOOST_PRAGMA_MESSAGE("Using Sleep(1) in sp_thread_sleep") | ||||
| #endif | ||||
|  | ||||
| #include <boost/smart_ptr/detail/sp_win32_sleep.hpp> | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
| namespace detail | ||||
| { | ||||
|  | ||||
| inline void sp_thread_sleep() | ||||
| { | ||||
|     Sleep( 1 ); | ||||
| } | ||||
|  | ||||
| } // namespace detail | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| #elif defined(BOOST_HAS_NANOSLEEP) | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|   BOOST_PRAGMA_MESSAGE("Using nanosleep() in sp_thread_sleep") | ||||
| #endif | ||||
|  | ||||
| #include <time.h> | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
| namespace detail | ||||
| { | ||||
|  | ||||
| inline void sp_thread_sleep() | ||||
| { | ||||
|     // 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 | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|   BOOST_PRAGMA_MESSAGE("Using sp_thread_yield() in sp_thread_sleep") | ||||
| #endif | ||||
|  | ||||
| #include <boost/smart_ptr/detail/sp_thread_yield.hpp> | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
| namespace detail | ||||
| { | ||||
|  | ||||
| inline void sp_thread_sleep() | ||||
| { | ||||
|     sp_thread_yield(); | ||||
| } | ||||
|  | ||||
| } // namespace detail | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| #endif | ||||
|  | ||||
| #endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_THREAD_SLEEP_HPP_INCLUDED | ||||
							
								
								
									
										100
									
								
								include/boost/smart_ptr/detail/sp_thread_yield.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										100
									
								
								include/boost/smart_ptr/detail/sp_thread_yield.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,100 @@ | ||||
| #ifndef BOOST_SMART_PTR_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED | ||||
| #define BOOST_SMART_PTR_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED | ||||
|  | ||||
| // MS compatible compilers support #pragma once | ||||
|  | ||||
| #if defined(_MSC_VER) && (_MSC_VER >= 1020) | ||||
| # pragma once | ||||
| #endif | ||||
|  | ||||
| // boost/smart_ptr/detail/sp_thread_yield.hpp | ||||
| // | ||||
| // inline void bost::detail::sp_thread_yield(); | ||||
| // | ||||
| //   Gives up the remainder of the time slice, | ||||
| //   as if by calling sched_yield(). | ||||
| // | ||||
| // Copyright 2008, 2020 Peter Dimov | ||||
| // Distributed under the Boost Software License, Version 1.0 | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
|  | ||||
| #include <boost/config.hpp> | ||||
| #include <boost/config/pragma_message.hpp> | ||||
|  | ||||
| #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|   BOOST_PRAGMA_MESSAGE("Using Sleep(0) in sp_thread_yield") | ||||
| #endif | ||||
|  | ||||
| #include <boost/smart_ptr/detail/sp_win32_sleep.hpp> | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
| namespace detail | ||||
| { | ||||
|  | ||||
| inline void sp_thread_yield() | ||||
| { | ||||
|     Sleep( 0 ); | ||||
| } | ||||
|  | ||||
| } // namespace detail | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| #elif defined(BOOST_HAS_SCHED_YIELD) | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|   BOOST_PRAGMA_MESSAGE("Using sched_yield() in sp_thread_yield") | ||||
| #endif | ||||
|  | ||||
| #ifndef _AIX | ||||
| # include <sched.h> | ||||
| #else | ||||
|   // AIX's sched.h defines ::var which sometimes conflicts with Lambda's var | ||||
|   extern "C" int sched_yield(void); | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
| namespace detail | ||||
| { | ||||
|  | ||||
| inline void sp_thread_yield() | ||||
| { | ||||
|     sched_yield(); | ||||
| } | ||||
|  | ||||
| } // namespace detail | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| #else | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|   BOOST_PRAGMA_MESSAGE("Using sp_thread_pause() in sp_thread_yield") | ||||
| #endif | ||||
|  | ||||
| #include <boost/smart_ptr/detail/sp_thread_pause.hpp> | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
| namespace detail | ||||
| { | ||||
|  | ||||
| inline void sp_thread_yield() | ||||
| { | ||||
|     sp_thread_pause(); | ||||
| } | ||||
|  | ||||
| } // namespace detail | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| #endif | ||||
|  | ||||
| #endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_THREAD_YIELD_HPP_INCLUDED | ||||
							
								
								
									
										49
									
								
								include/boost/smart_ptr/detail/sp_win32_sleep.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								include/boost/smart_ptr/detail/sp_win32_sleep.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | ||||
| #ifndef BOOST_SMART_PTR_DETAIL_SP_WIN32_SLEEP_HPP_INCLUDED | ||||
| #define BOOST_SMART_PTR_DETAIL_SP_WIN32_SLEEP_HPP_INCLUDED | ||||
|  | ||||
| // MS compatible compilers support #pragma once | ||||
|  | ||||
| #if defined(_MSC_VER) && (_MSC_VER >= 1020) | ||||
| # pragma once | ||||
| #endif | ||||
|  | ||||
| // boost/smart_ptr/detail/sp_win32_sleep.hpp | ||||
| // | ||||
| // Declares the Win32 Sleep() function. | ||||
| // | ||||
| // Copyright 2008, 2020 Peter Dimov | ||||
| // Distributed under the Boost Software License, Version 1.0 | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
|  | ||||
| #if defined( BOOST_USE_WINDOWS_H ) | ||||
| # include <windows.h> | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
| namespace detail | ||||
| { | ||||
|  | ||||
| #if !defined( BOOST_USE_WINDOWS_H ) | ||||
|  | ||||
| #if defined(__clang__) && defined(__x86_64__) | ||||
| // clang x64 warns that __stdcall is ignored | ||||
| # define BOOST_SP_STDCALL | ||||
| #else | ||||
| # define BOOST_SP_STDCALL __stdcall | ||||
| #endif | ||||
|  | ||||
| #if defined(__LP64__) // Cygwin 64 | ||||
|   extern "C" __declspec(dllimport) void BOOST_SP_STDCALL Sleep( unsigned int ms ); | ||||
| #else | ||||
|   extern "C" __declspec(dllimport) void BOOST_SP_STDCALL Sleep( unsigned long ms ); | ||||
| #endif | ||||
|  | ||||
| #undef BOOST_SP_STDCALL | ||||
|  | ||||
| #endif // !defined( BOOST_USE_WINDOWS_H ) | ||||
|  | ||||
| } // namespace detail | ||||
| } // namespace boost | ||||
|  | ||||
| #endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_WIN32_SLEEP_HPP_INCLUDED | ||||
| @@ -28,28 +28,26 @@ | ||||
| //  #define BOOST_DETAIL_SPINLOCK_INIT <unspecified> | ||||
| // | ||||
|  | ||||
| #include <boost/smart_ptr/detail/sp_has_gcc_intrinsics.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_has_sync_intrinsics.hpp> | ||||
| #include <boost/config.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_has_sync.hpp> | ||||
|  | ||||
| #if defined( BOOST_SP_USE_STD_ATOMIC ) | ||||
| # if !defined( __clang__ ) | ||||
| #   include <boost/smart_ptr/detail/spinlock_std_atomic.hpp> | ||||
| # else | ||||
| //  Clang (at least up to 3.4) can't compile spinlock_pool when | ||||
| //  using std::atomic, so substitute the __sync implementation instead. | ||||
| #   include <boost/smart_ptr/detail/spinlock_sync.hpp> | ||||
| # endif | ||||
| #  include <boost/smart_ptr/detail/spinlock_std_atomic.hpp> | ||||
|  | ||||
| #elif defined( BOOST_SP_USE_PTHREADS ) | ||||
| #  include <boost/smart_ptr/detail/spinlock_pt.hpp> | ||||
|  | ||||
| #elif defined( BOOST_SP_HAS_GCC_INTRINSICS ) | ||||
| #  include <boost/smart_ptr/detail/spinlock_gcc_atomic.hpp> | ||||
|  | ||||
| #elif !defined( BOOST_NO_CXX11_HDR_ATOMIC ) | ||||
| #  include <boost/smart_ptr/detail/spinlock_std_atomic.hpp> | ||||
|  | ||||
| #elif defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ ) | ||||
| #  include <boost/smart_ptr/detail/spinlock_gcc_arm.hpp> | ||||
|  | ||||
| #elif defined( BOOST_SP_HAS_SYNC ) | ||||
| #elif defined( BOOST_SP_HAS_SYNC_INTRINSICS ) | ||||
| #  include <boost/smart_ptr/detail/spinlock_sync.hpp> | ||||
|  | ||||
| #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) | ||||
|   | ||||
| @@ -11,6 +11,13 @@ | ||||
|  | ||||
| #include <boost/smart_ptr/detail/yield_k.hpp> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using g++/ARM spinlock") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| #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" | ||||
|   | ||||
							
								
								
									
										85
									
								
								include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								include/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,85 @@ | ||||
| #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ATOMIC_HPP_INCLUDED | ||||
| #define BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ATOMIC_HPP_INCLUDED | ||||
|  | ||||
| // MS compatible compilers support #pragma once | ||||
|  | ||||
| #if defined(_MSC_VER) && (_MSC_VER >= 1020) | ||||
| # pragma once | ||||
| #endif | ||||
|  | ||||
| // Copyright 2008, 2020 Peter Dimov | ||||
| // Distributed under the Boost Software License, Version 1.0. | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
|  | ||||
| #include <boost/smart_ptr/detail/yield_k.hpp> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using __atomic spinlock") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
| namespace detail | ||||
| { | ||||
|  | ||||
| class spinlock | ||||
| { | ||||
| public: | ||||
|  | ||||
|     unsigned char v_; | ||||
|  | ||||
| public: | ||||
|  | ||||
|     bool try_lock() | ||||
|     { | ||||
|         return __atomic_test_and_set( &v_, __ATOMIC_ACQUIRE ) == 0; | ||||
|     } | ||||
|  | ||||
|     void lock() | ||||
|     { | ||||
|         for( unsigned k = 0; !try_lock(); ++k ) | ||||
|         { | ||||
|             boost::detail::yield( k ); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     void unlock() | ||||
|     { | ||||
|         __atomic_clear( &v_, __ATOMIC_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 {0} | ||||
|  | ||||
| #endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ATOMIC_HPP_INCLUDED | ||||
| @@ -17,6 +17,13 @@ | ||||
|  | ||||
| #include <boost/assert.hpp> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using single-threaded spinlock emulation") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -17,6 +17,13 @@ | ||||
|  | ||||
| #include <pthread.h> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using pthread_mutex spinlock emulation") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -19,6 +19,13 @@ | ||||
| #include <boost/config.hpp> | ||||
| #include <atomic> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using std::atomic spinlock") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
|   | ||||
| @@ -21,6 +21,13 @@ | ||||
| # include <ia64intrin.h> | ||||
| #endif | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using __sync spinlock") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
| @@ -31,7 +38,7 @@ class spinlock | ||||
| { | ||||
| public: | ||||
|  | ||||
|     int v_; | ||||
|     unsigned char v_; | ||||
|  | ||||
| public: | ||||
|  | ||||
|   | ||||
| @@ -18,6 +18,13 @@ | ||||
| #include <boost/smart_ptr/detail/sp_interlocked.hpp> | ||||
| #include <boost/smart_ptr/detail/yield_k.hpp> | ||||
|  | ||||
| #if defined(BOOST_SP_REPORT_IMPLEMENTATION) | ||||
|  | ||||
| #include <boost/config/pragma_message.hpp> | ||||
| BOOST_PRAGMA_MESSAGE("Using Win32 spinlock") | ||||
|  | ||||
| #endif | ||||
|  | ||||
| // BOOST_COMPILER_FENCE | ||||
|  | ||||
| #if defined(__INTEL_COMPILER) | ||||
|   | ||||
| @@ -7,107 +7,22 @@ | ||||
| # pragma once | ||||
| #endif | ||||
|  | ||||
| // boost/smart_ptr/detail/yield_k.hpp | ||||
| // | ||||
| //  yield_k.hpp | ||||
| // Copyright 2008, 2020 Peter Dimov | ||||
| // | ||||
| //  Copyright (c) 2008 Peter Dimov | ||||
| // inline void boost::detail::yield( unsigned k ); | ||||
| // | ||||
| //  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 | ||||
| //   Typical use: | ||||
| //   for( unsigned k = 0; !try_lock(); ++k ) yield( k ); | ||||
| // | ||||
| // Distributed under the Boost Software License, Version 1.0. | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
|  | ||||
| #include <boost/smart_ptr/detail/sp_thread_pause.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_thread_sleep.hpp> | ||||
| #include <boost/config.hpp> | ||||
|  | ||||
| // 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 <windows.h> | ||||
| #endif | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
| namespace detail | ||||
| { | ||||
|  | ||||
| #if !defined( BOOST_USE_WINDOWS_H ) | ||||
|  | ||||
| #if defined(__clang__) && defined(__x86_64__) | ||||
| // clang x64 warns that __stdcall is ignored | ||||
| # define BOOST_SP_STDCALL | ||||
| #else | ||||
| # define BOOST_SP_STDCALL __stdcall | ||||
| #endif | ||||
|  | ||||
| #if defined(__LP64__) // Cygwin 64 | ||||
|   extern "C" __declspec(dllimport) void BOOST_SP_STDCALL Sleep( unsigned int ms ); | ||||
| #else | ||||
|   extern "C" __declspec(dllimport) void BOOST_SP_STDCALL Sleep( unsigned long ms ); | ||||
| #endif | ||||
|  | ||||
| #undef BOOST_SP_STDCALL | ||||
|  | ||||
| #endif // !defined( BOOST_USE_WINDOWS_H ) | ||||
|  | ||||
| inline void yield( unsigned k ) BOOST_NOEXCEPT | ||||
| { | ||||
|     if( k < 4 ) | ||||
|     { | ||||
|     } | ||||
| #if defined( BOOST_SMT_PAUSE ) | ||||
|     else if( k < 16 ) | ||||
|     { | ||||
|         BOOST_SMT_PAUSE | ||||
|     } | ||||
| #endif | ||||
|     else if( k < 32 ) | ||||
|     { | ||||
|         Sleep( 0 ); | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         Sleep( 1 ); | ||||
|     } | ||||
| } | ||||
|  | ||||
| } // namespace detail | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| #elif defined( BOOST_HAS_PTHREADS ) | ||||
|  | ||||
| #ifndef _AIX | ||||
| #include <sched.h> | ||||
| #else | ||||
|    // AIX's sched.h defines ::var which sometimes conflicts with Lambda's var | ||||
|        extern "C" int sched_yield(void); | ||||
| #endif | ||||
|  | ||||
| #include <time.h> | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
| @@ -116,31 +31,16 @@ namespace detail | ||||
|  | ||||
| inline void yield( unsigned k ) | ||||
| { | ||||
|     if( k < 4 ) | ||||
|     // Experiments on Windows and Fedora 32 show that a single pause, | ||||
|     // followed by an immediate sp_thread_sleep(), is best. | ||||
|  | ||||
|     if( k == 0 ) | ||||
|     { | ||||
|     } | ||||
| #if defined( BOOST_SMT_PAUSE ) | ||||
|     else if( k < 16 ) | ||||
|     { | ||||
|         BOOST_SMT_PAUSE | ||||
|     } | ||||
| #endif | ||||
|     else if( k < 32 || k & 1 ) | ||||
|     { | ||||
|         sched_yield(); | ||||
|         sp_thread_pause(); | ||||
|     } | ||||
|     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 ); | ||||
|         sp_thread_sleep(); | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -148,22 +48,4 @@ inline void yield( unsigned k ) | ||||
|  | ||||
| } // 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 | ||||
|   | ||||
| @@ -3,7 +3,7 @@ | ||||
|  | ||||
| //  enable_shared_from.hpp | ||||
| // | ||||
| //  Copyright 2019 Peter Dimov | ||||
| //  Copyright 2019, 2020 Peter Dimov | ||||
| // | ||||
| //  Distributed under the Boost Software License, Version 1.0. | ||||
| //  See accompanying file LICENSE_1_0.txt or copy at | ||||
| @@ -19,17 +19,21 @@ namespace boost | ||||
|  | ||||
| class enable_shared_from: public enable_shared_from_this<enable_shared_from> | ||||
| { | ||||
| private: | ||||
|  | ||||
|     using enable_shared_from_this<enable_shared_from>::shared_from_this; | ||||
|     using enable_shared_from_this<enable_shared_from>::weak_from_this; | ||||
| }; | ||||
|  | ||||
|  | ||||
| template<class T> shared_ptr<T> shared_from( T * p ) | ||||
| { | ||||
|     return shared_ptr<T>( p->enable_shared_from::shared_from_this(), p ); | ||||
|     return shared_ptr<T>( p->enable_shared_from_this<enable_shared_from>::shared_from_this(), p ); | ||||
| } | ||||
|  | ||||
| template<class T> weak_ptr<T> weak_from( T * p ) BOOST_SP_NOEXCEPT | ||||
| { | ||||
|     return weak_ptr<T>( p->enable_shared_from::weak_from_this(), p ); | ||||
|     return weak_ptr<T>( p->enable_shared_from_this<enable_shared_from>::weak_from_this(), p ); | ||||
| } | ||||
|  | ||||
| } // namespace boost | ||||
|   | ||||
| @@ -385,4 +385,23 @@ template< class T > std::size_t hash_value( boost::intrusive_ptr<T> const & p ) | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| // std::hash | ||||
|  | ||||
| #if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) | ||||
|  | ||||
| namespace std | ||||
| { | ||||
|  | ||||
| template<class T> struct hash< ::boost::intrusive_ptr<T> > | ||||
| { | ||||
|     std::size_t operator()( ::boost::intrusive_ptr<T> const & p ) const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return std::hash< T* >()( p.get() ); | ||||
|     } | ||||
| }; | ||||
|  | ||||
| } // namespace std | ||||
|  | ||||
| #endif // #if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) | ||||
|  | ||||
| #endif  // #ifndef BOOST_SMART_PTR_INTRUSIVE_PTR_HPP_INCLUDED | ||||
|   | ||||
| @@ -494,6 +494,13 @@ public: | ||||
|     { | ||||
|         return std::less< boost::detail::local_counted_base* >()( pn, r.pn ); | ||||
|     } | ||||
|  | ||||
|     // owner_equals | ||||
|  | ||||
|     template<class Y> bool owner_equals( local_shared_ptr<Y> const & r ) const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return pn == r.pn; | ||||
|     } | ||||
| }; | ||||
|  | ||||
| template<class T, class U> inline bool operator==( local_shared_ptr<T> const & a, local_shared_ptr<U> const & b ) BOOST_SP_NOEXCEPT | ||||
| @@ -681,4 +688,23 @@ template< class T > std::size_t hash_value( local_shared_ptr<T> const & p ) BOOS | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| // std::hash | ||||
|  | ||||
| #if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) | ||||
|  | ||||
| namespace std | ||||
| { | ||||
|  | ||||
| template<class T> struct hash< ::boost::local_shared_ptr<T> > | ||||
| { | ||||
|     std::size_t operator()( ::boost::local_shared_ptr<T> const & p ) const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return std::hash< typename ::boost::local_shared_ptr<T>::element_type* >()( p.get() ); | ||||
|     } | ||||
| }; | ||||
|  | ||||
| } // namespace std | ||||
|  | ||||
| #endif // #if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) | ||||
|  | ||||
| #endif  // #ifndef BOOST_SMART_PTR_LOCAL_SHARED_PTR_HPP_INCLUDED | ||||
|   | ||||
| @@ -187,7 +187,7 @@ template< class T > struct sp_if_not_array< T[] > | ||||
| { | ||||
| }; | ||||
|  | ||||
| #if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) | ||||
| #if !defined( BOOST_BORLANDC ) || !BOOST_WORKAROUND( BOOST_BORLANDC, < 0x600 ) | ||||
|  | ||||
| template< class T, std::size_t N > struct sp_if_not_array< T[N] > | ||||
| { | ||||
|   | ||||
							
								
								
									
										27
									
								
								include/boost/smart_ptr/owner_equal_to.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								include/boost/smart_ptr/owner_equal_to.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| #ifndef BOOST_SMART_PTR_OWNER_EQUAL_TO_HPP_INCLUDED | ||||
| #define BOOST_SMART_PTR_OWNER_EQUAL_TO_HPP_INCLUDED | ||||
|  | ||||
| // Copyright 2020 Peter Dimov | ||||
| // Distributed under the Boost Software License, Version 1.0. | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
|  | ||||
| #include <boost/config.hpp> | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
| template<class T = void> struct owner_equal_to | ||||
| { | ||||
|     typedef bool result_type; | ||||
|     typedef T first_argument_type; | ||||
|     typedef T second_argument_type; | ||||
|  | ||||
|     template<class U, class V> bool operator()( U const & u, V const & v ) const BOOST_NOEXCEPT | ||||
|     { | ||||
|         return u.owner_equals( v ); | ||||
|     } | ||||
| }; | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| #endif  // #ifndef BOOST_SMART_PTR_OWNER_EQUAL_TO_HPP_INCLUDED | ||||
							
								
								
									
										27
									
								
								include/boost/smart_ptr/owner_hash.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								include/boost/smart_ptr/owner_hash.hpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| #ifndef BOOST_SMART_PTR_OWNER_HASH_HPP_INCLUDED | ||||
| #define BOOST_SMART_PTR_OWNER_HASH_HPP_INCLUDED | ||||
|  | ||||
| // Copyright 2020 Peter Dimov | ||||
| // Distributed under the Boost Software License, Version 1.0. | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
|  | ||||
| #include <boost/config.hpp> | ||||
| #include <cstddef> | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
| template<class T> struct owner_hash | ||||
| { | ||||
|     typedef std::size_t result_type; | ||||
|     typedef T argument_type; | ||||
|  | ||||
|     std::size_t operator()( T const & t ) const BOOST_NOEXCEPT | ||||
|     { | ||||
|         return t.owner_hash_value(); | ||||
|     } | ||||
| }; | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| #endif  // #ifndef BOOST_SMART_PTR_OWNER_HASH_HPP_INCLUDED | ||||
| @@ -14,6 +14,8 @@ | ||||
| //  See http://www.boost.org/libs/smart_ptr/ for documentation. | ||||
| // | ||||
|  | ||||
| #include <boost/config.hpp> | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
|  | ||||
| @@ -23,7 +25,7 @@ template<class T = void> struct owner_less | ||||
|     typedef T first_argument_type; | ||||
|     typedef T second_argument_type; | ||||
|  | ||||
|     template<class U, class V> bool operator()( U const & u, V const & v ) const | ||||
|     template<class U, class V> bool operator()( U const & u, V const & v ) const BOOST_NOEXCEPT | ||||
|     { | ||||
|         return u.owner_before( v ); | ||||
|     } | ||||
|   | ||||
| @@ -14,23 +14,16 @@ | ||||
| //  See http://www.boost.org/libs/smart_ptr/ for documentation. | ||||
| // | ||||
|  | ||||
| #include <boost/config.hpp>   // for broken compiler workarounds | ||||
|  | ||||
| // In order to avoid circular dependencies with Boost.TR1 | ||||
| // we make sure that our include of <memory> doesn't try to | ||||
| // pull in the TR1 headers: that's why we use this header  | ||||
| // rather than including <memory> directly: | ||||
| #include <boost/config/no_tr1/memory.hpp>  // std::auto_ptr | ||||
|  | ||||
| #include <boost/assert.hpp> | ||||
| #include <boost/checked_delete.hpp> | ||||
| #include <boost/throw_exception.hpp> | ||||
| #include <boost/smart_ptr/detail/shared_count.hpp> | ||||
| #include <boost/config/workaround.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_convertible.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_nullptr_t.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_disable_deprecated.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_noexcept.hpp> | ||||
| #include <boost/checked_delete.hpp> | ||||
| #include <boost/throw_exception.hpp> | ||||
| #include <boost/assert.hpp> | ||||
| #include <boost/config.hpp> | ||||
| #include <boost/config/workaround.hpp> | ||||
|  | ||||
| #if !defined(BOOST_SP_NO_ATOMIC_ACCESS) | ||||
| #include <boost/smart_ptr/detail/spinlock_pool.hpp> | ||||
| @@ -40,6 +33,7 @@ | ||||
| #include <functional>           // for std::less | ||||
| #include <typeinfo>             // for std::bad_cast | ||||
| #include <cstddef>              // for std::size_t | ||||
| #include <memory>               // for std::auto_ptr | ||||
|  | ||||
| #if !defined(BOOST_NO_IOSTREAM) | ||||
| #if !defined(BOOST_NO_IOSFWD) | ||||
| @@ -86,7 +80,7 @@ template< class T > struct sp_element< T[] > | ||||
|     typedef T type; | ||||
| }; | ||||
|  | ||||
| #if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) | ||||
| #if !defined( BOOST_BORLANDC ) || !BOOST_WORKAROUND( BOOST_BORLANDC, < 0x600 ) | ||||
|  | ||||
| template< class T, std::size_t N > struct sp_element< T[N] > | ||||
| { | ||||
| @@ -135,7 +129,7 @@ template< class T > struct sp_dereference< T[] > | ||||
|     typedef void type; | ||||
| }; | ||||
|  | ||||
| #if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) | ||||
| #if !defined( BOOST_BORLANDC ) || !BOOST_WORKAROUND( BOOST_BORLANDC, < 0x600 ) | ||||
|  | ||||
| template< class T, std::size_t N > struct sp_dereference< T[N] > | ||||
| { | ||||
| @@ -160,7 +154,7 @@ template< class T > struct sp_member_access< T[] > | ||||
|     typedef void type; | ||||
| }; | ||||
|  | ||||
| #if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) | ||||
| #if !defined( BOOST_BORLANDC ) || !BOOST_WORKAROUND( BOOST_BORLANDC, < 0x600 ) | ||||
|  | ||||
| template< class T, std::size_t N > struct sp_member_access< T[N] > | ||||
| { | ||||
| @@ -185,7 +179,7 @@ template< class T > struct sp_array_access< T[] > | ||||
|     typedef T & type; | ||||
| }; | ||||
|  | ||||
| #if !defined( __BORLANDC__ ) || !BOOST_WORKAROUND( __BORLANDC__, < 0x600 ) | ||||
| #if !defined( BOOST_BORLANDC ) || !BOOST_WORKAROUND( BOOST_BORLANDC, < 0x600 ) | ||||
|  | ||||
| template< class T, std::size_t N > struct sp_array_access< T[N] > | ||||
| { | ||||
| @@ -777,6 +771,21 @@ public: | ||||
|         return pn < rhs.pn; | ||||
|     } | ||||
|  | ||||
|     template<class Y> bool owner_equals( shared_ptr<Y> const & rhs ) const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return pn == rhs.pn; | ||||
|     } | ||||
|  | ||||
|     template<class Y> bool owner_equals( weak_ptr<Y> const & rhs ) const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return pn == rhs.pn; | ||||
|     } | ||||
|  | ||||
|     std::size_t owner_hash_value() const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return pn.hash_value(); | ||||
|     } | ||||
|  | ||||
|     void * _internal_get_deleter( boost::detail::sp_typeinfo_ const & ti ) const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return pn.get_deleter( ti ); | ||||
| @@ -1155,6 +1164,25 @@ template< class T > std::size_t hash_value( boost::shared_ptr<T> const & p ) BOO | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| // std::hash | ||||
|  | ||||
| #if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) | ||||
|  | ||||
| namespace std | ||||
| { | ||||
|  | ||||
| template<class T> struct hash< ::boost::shared_ptr<T> > | ||||
| { | ||||
|     std::size_t operator()( ::boost::shared_ptr<T> const & p ) const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return std::hash< typename ::boost::shared_ptr<T>::element_type* >()( p.get() ); | ||||
|     } | ||||
| }; | ||||
|  | ||||
| } // namespace std | ||||
|  | ||||
| #endif // #if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) | ||||
|  | ||||
| #include <boost/smart_ptr/detail/local_sp_deleter.hpp> | ||||
|  | ||||
| namespace boost | ||||
| @@ -1175,6 +1203,13 @@ template<class D, class T> D const * basic_get_local_deleter( D const *, shared_ | ||||
|  | ||||
| } // namespace detail | ||||
|  | ||||
| #if defined(__cpp_deduction_guides) | ||||
|  | ||||
| template<class T> shared_ptr( weak_ptr<T> ) -> shared_ptr<T>; | ||||
| template<class T, class D> shared_ptr( std::unique_ptr<T, D> ) -> shared_ptr<T>; | ||||
|  | ||||
| #endif | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| #if defined( BOOST_SP_DISABLE_DEPRECATED ) | ||||
|   | ||||
| @@ -13,10 +13,11 @@ | ||||
| //  See http://www.boost.org/libs/smart_ptr/ for documentation. | ||||
| // | ||||
|  | ||||
| #include <memory> // boost.TR1 include order fix | ||||
| #include <boost/smart_ptr/detail/shared_count.hpp> | ||||
| #include <boost/smart_ptr/shared_ptr.hpp> | ||||
| #include <boost/smart_ptr/detail/sp_noexcept.hpp> | ||||
| #include <memory> | ||||
| #include <cstddef> | ||||
|  | ||||
| namespace boost | ||||
| { | ||||
| @@ -237,6 +238,21 @@ public: | ||||
|         return pn < rhs.pn; | ||||
|     } | ||||
|  | ||||
|     template<class Y> bool owner_equals( weak_ptr<Y> const & rhs ) const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return pn == rhs.pn; | ||||
|     } | ||||
|  | ||||
|     template<class Y> bool owner_equals( shared_ptr<Y> const & rhs ) const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return pn == rhs.pn; | ||||
|     } | ||||
|  | ||||
|     std::size_t owner_hash_value() const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return pn.hash_value(); | ||||
|     } | ||||
|  | ||||
| // Tasteless as this may seem, making all members public allows member templates | ||||
| // to work in the absence of member template friends. (Matthew Langston) | ||||
|  | ||||
| @@ -264,6 +280,46 @@ template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b) BOOST_SP_NOEXCEPT | ||||
|     a.swap(b); | ||||
| } | ||||
|  | ||||
| #if defined(__cpp_deduction_guides) | ||||
|  | ||||
| template<class T> weak_ptr( shared_ptr<T> ) -> weak_ptr<T>; | ||||
|  | ||||
| #endif | ||||
|  | ||||
| // hash_value | ||||
|  | ||||
| template< class T > std::size_t hash_value( boost::weak_ptr<T> const & p ) BOOST_SP_NOEXCEPT | ||||
| { | ||||
|     return p.owner_hash_value(); | ||||
| } | ||||
|  | ||||
| } // namespace boost | ||||
|  | ||||
| // std::hash, std::equal_to | ||||
|  | ||||
| namespace std | ||||
| { | ||||
|  | ||||
| #if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) | ||||
|  | ||||
| template<class T> struct hash< ::boost::weak_ptr<T> > | ||||
| { | ||||
|     std::size_t operator()( ::boost::weak_ptr<T> const & p ) const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return p.owner_hash_value(); | ||||
|     } | ||||
| }; | ||||
|  | ||||
| #endif // #if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) | ||||
|  | ||||
| template<class T> struct equal_to< ::boost::weak_ptr<T> > | ||||
| { | ||||
|     bool operator()( ::boost::weak_ptr<T> const & a, ::boost::weak_ptr<T> const & b ) const BOOST_SP_NOEXCEPT | ||||
|     { | ||||
|         return a.owner_equals( b ); | ||||
|     } | ||||
| }; | ||||
|  | ||||
| } // namespace std | ||||
|  | ||||
| #endif  // #ifndef BOOST_SMART_PTR_WEAK_PTR_HPP_INCLUDED | ||||
|   | ||||
							
								
								
									
										15
									
								
								test/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								test/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| # Copyright 2018, 2019 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(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST) | ||||
|  | ||||
| if(HAVE_BOOST_TEST) | ||||
|  | ||||
| # for lw_thread_test.cpp | ||||
| set(THREADS_PREFER_PTHREAD_FLAG ON) | ||||
| find_package(Threads) | ||||
|  | ||||
| boost_test_jamfile(FILE Jamfile LINK_LIBRARIES Boost::smart_ptr Boost::core Boost::align Boost::atomic Boost::container_hash Boost::bind Threads::Threads) | ||||
|  | ||||
| endif() | ||||
							
								
								
									
										119
									
								
								test/Jamfile
									
									
									
									
									
								
							
							
						
						
									
										119
									
								
								test/Jamfile
									
									
									
									
									
								
							| @@ -57,10 +57,11 @@ run yield_k_test.cpp : : : <threading>multi : yield_k_test.mt ; | ||||
| run spinlock_test.cpp ; | ||||
| run spinlock_try_test.cpp ; | ||||
| run spinlock_try_test.cpp : : : <threading>multi : spinlock_try_test.mt ; | ||||
| run spinlock_pool_test.cpp : : : | ||||
|     # msvc-8.0, 9.0 optimizer codegen bug for `x % 41` | ||||
|     <toolset>msvc-8.0,<variant>release:<build>no | ||||
|     <toolset>msvc-9.0,<variant>release:<build>no ; | ||||
| run spinlock_pool_test.cpp | ||||
|   : : : | ||||
|   # msvc-8.0, 9.0 optimizer codegen bug for `x % 41` | ||||
|   <toolset>msvc-8.0,<variant>release:<build>no | ||||
|   <toolset>msvc-9.0,<variant>release:<build>no ; | ||||
|  | ||||
| run make_shared_test.cpp ; | ||||
| run make_shared_move_emulation_test.cpp ; | ||||
| @@ -78,7 +79,10 @@ run sp_recursive_assign_test.cpp ; | ||||
| run sp_recursive_assign2_test.cpp ; | ||||
| run sp_recursive_assign_rv_test.cpp ; | ||||
| run sp_recursive_assign2_rv_test.cpp ; | ||||
| compile-fail auto_ptr_lv_fail.cpp : <toolset>gcc-4.4.7:<build>no ; | ||||
|  | ||||
| compile-fail auto_ptr_lv_fail.cpp | ||||
|   : <toolset>gcc-4.4.7:<build>no ; | ||||
|  | ||||
| run atomic_count_test2.cpp ; | ||||
| run sp_typeinfo_test.cpp ; | ||||
| compile make_shared_fp_test.cpp ; | ||||
| @@ -158,23 +162,33 @@ compile-fail array_fail_dereference.cpp ; | ||||
| compile-fail array_fail_member_access.cpp ; | ||||
| compile-fail array_fail_array_access.cpp ; | ||||
|  | ||||
| run make_shared_array_test.cpp : : : <toolset>msvc-8.0:<build>no ; | ||||
| run make_shared_arrays_test.cpp ; # <cxxflags>-fno-deduce-init-list no longer needed for gcc-4.6 | ||||
| run make_shared_array_throws_test.cpp : : : <toolset>msvc-8.0:<build>no ; | ||||
| run make_shared_array_esft_test.cpp : : : <toolset>msvc-8.0:<build>no ; | ||||
| run make_shared_array_noinit_test.cpp : : : <toolset>msvc-8.0:<build>no ; | ||||
| run make_shared_array_value_test.cpp : : : <toolset>msvc-8.0:<build>no ; | ||||
| run make_shared_array_test.cpp | ||||
|   : : : <toolset>msvc-8.0:<build>no ; | ||||
| run make_shared_arrays_test.cpp ; | ||||
| run make_shared_array_throws_test.cpp | ||||
|   : : : <toolset>msvc-8.0:<build>no ; | ||||
| run make_shared_array_esft_test.cpp | ||||
|   : : : <toolset>msvc-8.0:<build>no ; | ||||
| run make_shared_array_noinit_test.cpp | ||||
|   : : : <toolset>msvc-8.0:<build>no ; | ||||
| run make_shared_array_value_test.cpp | ||||
|   : : : <toolset>msvc-8.0:<build>no ; | ||||
| run allocate_shared_array_test.cpp ; | ||||
| run allocate_shared_arrays_test.cpp ; # <cxxflags>-fno-deduce-init-list no longer needed for gcc-4.6 | ||||
| run allocate_shared_array_throws_test.cpp : : : <toolset>msvc-8.0:<build>no ; | ||||
| run allocate_shared_array_esft_test.cpp : : : <toolset>msvc-8.0:<build>no ; | ||||
| run allocate_shared_array_noinit_test.cpp : : : <toolset>msvc-8.0:<build>no ; | ||||
| run allocate_shared_array_value_test.cpp : : : <toolset>msvc-8.0:<build>no ; | ||||
| run allocate_shared_arrays_test.cpp ; | ||||
| run allocate_shared_array_throws_test.cpp | ||||
|   : : : <toolset>msvc-8.0:<build>no ; | ||||
| run allocate_shared_array_esft_test.cpp | ||||
|   : : : <toolset>msvc-8.0:<build>no ; | ||||
| run allocate_shared_array_noinit_test.cpp | ||||
|   : : : <toolset>msvc-8.0:<build>no ; | ||||
| run allocate_shared_array_value_test.cpp | ||||
|   : : : <toolset>msvc-8.0:<build>no ; | ||||
| run allocate_shared_array_construct_test.cpp ; | ||||
|  | ||||
| run make_unique_test.cpp ; | ||||
| run make_unique_args_test.cpp ; | ||||
| run make_unique_value_test.cpp : : : <toolset>gcc-4.6:<cxxflags>-fno-deduce-init-list ; | ||||
| run make_unique_value_test.cpp | ||||
|   : : : <toolset>gcc-4.6:<cxxflags>-fno-deduce-init-list ; | ||||
| run make_unique_noinit_test.cpp ; | ||||
| run make_unique_throws_test.cpp ; | ||||
| run make_unique_array_test.cpp ; | ||||
| @@ -236,7 +250,8 @@ run shared_ptr_fn_test.cpp ; | ||||
| run get_deleter_test2.cpp ; | ||||
| run get_deleter_test3.cpp ; | ||||
| run get_deleter_array_test2.cpp ; | ||||
| run get_deleter_array_test3.cpp : : : <toolset>msvc-8.0:<build>no ; | ||||
| run get_deleter_array_test3.cpp | ||||
|   : : : <toolset>msvc-8.0:<build>no ; | ||||
|  | ||||
| run sp_convertible_test2.cpp ; | ||||
|  | ||||
| @@ -258,13 +273,15 @@ run allocate_local_shared_test.cpp ; | ||||
| run allocate_local_shared_esft_test.cpp ; | ||||
|  | ||||
| run make_local_shared_array_test.cpp ; | ||||
| run make_local_shared_arrays_test.cpp : : : <toolset>gcc-4.6.3_0x:<cxxflags>-fno-deduce-init-list ; | ||||
| run make_local_shared_arrays_test.cpp | ||||
|   : : : <toolset>gcc-4.6.3_0x:<cxxflags>-fno-deduce-init-list ; | ||||
| run make_local_shared_array_throws_test.cpp ; | ||||
| run make_local_shared_array_esft_test.cpp ; | ||||
| run make_local_shared_array_noinit_test.cpp ; | ||||
| run make_local_shared_array_value_test.cpp ; | ||||
| run allocate_local_shared_array_test.cpp ; | ||||
| run allocate_local_shared_arrays_test.cpp : : : <toolset>gcc-4.6.3_0x:<cxxflags>-fno-deduce-init-list ; | ||||
| run allocate_local_shared_arrays_test.cpp | ||||
|   : : : <toolset>gcc-4.6.3_0x:<cxxflags>-fno-deduce-init-list ; | ||||
| run allocate_local_shared_array_throws_test.cpp ; | ||||
| run allocate_local_shared_array_esft_test.cpp ; | ||||
| run allocate_local_shared_array_noinit_test.cpp ; | ||||
| @@ -275,9 +292,11 @@ run local_sp_fn_test.cpp ; | ||||
| run lsp_convertible_test.cpp ; | ||||
| run lsp_convertible_test2.cpp ; | ||||
|  | ||||
| run make_shared_array_tmp_test.cpp : : : <toolset>msvc-8.0:<build>no ; | ||||
| run make_shared_array_tmp_test.cpp | ||||
|   : : : <toolset>msvc-8.0:<build>no ; | ||||
|  | ||||
| run lw_thread_test.cpp : : : <threading>multi ; | ||||
| run lw_thread_test.cpp | ||||
|   : : : <threading>multi ; | ||||
|  | ||||
| compile sp_windows_h_test.cpp ; | ||||
| compile spinlock_windows_h_test.cpp ; | ||||
| @@ -333,3 +352,59 @@ run allocate_unique_noinit_test.cpp ; | ||||
| run allocate_unique_test.cpp ; | ||||
| run allocate_unique_throws_test.cpp ; | ||||
| run allocate_unique_value_test.cpp ; | ||||
|  | ||||
| run sp_guides_test.cpp ; | ||||
| run sp_guides_test2.cpp ; | ||||
| run wp_guides_test.cpp ; | ||||
|  | ||||
| compile-fail shared_from_fail.cpp ; | ||||
| compile-fail weak_from_fail.cpp ; | ||||
|  | ||||
| compile sp_override_test.cpp ; | ||||
| compile sp_pedantic_test.cpp | ||||
|   : <warnings>pedantic | ||||
|     <toolset>msvc:<warnings-as-errors>on | ||||
|     <toolset>gcc:<warnings-as-errors>on | ||||
|     <toolset>clang:<warnings-as-errors>on ; | ||||
|  | ||||
| run sp_owner_before_test.cpp ; | ||||
| run sp_owner_equals_test.cpp ; | ||||
| run lsp_owner_before_test.cpp ; | ||||
| run lsp_owner_equals_test.cpp ; | ||||
|  | ||||
| run owner_equal_to_test.cpp ; | ||||
| run owner_equal_to_test2.cpp ; | ||||
|  | ||||
| run owner_less_test2.cpp ; | ||||
|  | ||||
| run ip_hash_test2.cpp ; | ||||
| run sp_hash_test4.cpp ; | ||||
| run lsp_hash_test.cpp ; | ||||
| run lsp_hash_test2.cpp ; | ||||
|  | ||||
| run atomic_count_mt_test.cpp | ||||
|   : : : <threading>multi ; | ||||
|  | ||||
| run spinlock_mt_test.cpp | ||||
|   : : : <threading>multi ; | ||||
|  | ||||
| run spinlock_pool_mt_test.cpp | ||||
|   : : : <threading>multi ; | ||||
|  | ||||
| run shared_ptr_mt_test.cpp | ||||
|   : : : <threading>multi ; | ||||
|  | ||||
| run weak_ptr_mt_test.cpp | ||||
|   : : : <threading>multi ; | ||||
|  | ||||
| compile sp_report_implementation.cpp ; | ||||
|  | ||||
| run sp_owner_hash_value_test.cpp ; | ||||
|  | ||||
| run wp_hash_test.cpp ; | ||||
| run wp_hash_test2.cpp ; | ||||
|  | ||||
| run wp_unordered_test.cpp ; | ||||
|  | ||||
| run owner_hash_test.cpp ; | ||||
| run sp_unordered_test.cpp ; | ||||
|   | ||||
							
								
								
									
										40
									
								
								test/atomic_count_mt_test.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								test/atomic_count_mt_test.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | ||||
| // Copyright 2018, 2020 Peter Dimov | ||||
| // Distributed under the Boost Software License, Version 1.0. | ||||
| // https://www.boost.org/LICENSE_1_0.txt) | ||||
|  | ||||
| #include <boost/smart_ptr/detail/atomic_count.hpp> | ||||
| #include <boost/smart_ptr/detail/lightweight_thread.hpp> | ||||
| #include <boost/bind/bind.hpp> | ||||
| #include <boost/core/lightweight_test.hpp> | ||||
|  | ||||
| static boost::detail::atomic_count count( 0 ); | ||||
|  | ||||
| void f( int n ) | ||||
| { | ||||
|     for( int i = 0; i < n; ++i ) | ||||
|     { | ||||
|         ++count; | ||||
|     } | ||||
| } | ||||
|  | ||||
| int main() | ||||
| { | ||||
|     int const N = 100000; // iterations | ||||
|     int const M = 8;      // threads | ||||
|  | ||||
|     boost::detail::lw_thread_t th[ M ] = {}; | ||||
|  | ||||
|     for( int i = 0; i < M; ++i ) | ||||
|     { | ||||
|         boost::detail::lw_thread_create( th[ i ], boost::bind( f, N ) ); | ||||
|     } | ||||
|  | ||||
|     for( int i = 0; i < M; ++i ) | ||||
|     { | ||||
|         boost::detail::lw_thread_join( th[ i ] ); | ||||
|     } | ||||
|  | ||||
|     BOOST_TEST_EQ( count, N * M ); | ||||
|  | ||||
|     return boost::report_errors(); | ||||
| } | ||||
							
								
								
									
										18
									
								
								test/cmake_install_test/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								test/cmake_install_test/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| # Copyright 2018, 2019 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 | ||||
|  | ||||
| cmake_minimum_required(VERSION 3.5...3.16) | ||||
|  | ||||
| project(cmake_subdir_test LANGUAGES CXX) | ||||
|  | ||||
| find_package(boost_smart_ptr REQUIRED) | ||||
| find_package(boost_core REQUIRED) | ||||
|  | ||||
| add_executable(quick ../quick.cpp) | ||||
| target_link_libraries(quick Boost::smart_ptr Boost::core) | ||||
|  | ||||
| enable_testing() | ||||
| add_test(quick quick) | ||||
|  | ||||
| add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>) | ||||
| @@ -2,7 +2,7 @@ | ||||
| # 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 | ||||
|  | ||||
| cmake_minimum_required(VERSION 3.5) | ||||
| cmake_minimum_required(VERSION 3.5...3.16) | ||||
|  | ||||
| project(cmake_subdir_test LANGUAGES CXX) | ||||
|  | ||||
| @@ -11,7 +11,6 @@ add_subdirectory(../../../assert boostorg/assert) | ||||
| add_subdirectory(../../../config boostorg/config) | ||||
| add_subdirectory(../../../core boostorg/core) | ||||
| add_subdirectory(../../../move boostorg/move) | ||||
| add_subdirectory(../../../predef boostorg/predef) | ||||
| add_subdirectory(../../../static_assert boostorg/static_assert) | ||||
| add_subdirectory(../../../throw_exception boostorg/throw_exception) | ||||
| add_subdirectory(../../../type_traits boostorg/type_traits) | ||||
|   | ||||
							
								
								
									
										67
									
								
								test/ip_hash_test2.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								test/ip_hash_test2.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,67 @@ | ||||
| // Copyright 2011, 2020 Peter Dimov | ||||
| // Distributed under the Boost Software License, Version 1.0. | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
|  | ||||
| #include <boost/intrusive_ptr.hpp> | ||||
| #include <boost/core/lightweight_test.hpp> | ||||
| #include <boost/config.hpp> | ||||
| #include <functional> | ||||
|  | ||||
| #if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) | ||||
|  | ||||
| int main() {} | ||||
|  | ||||
| #else | ||||
|  | ||||
| class base | ||||
| { | ||||
| private: | ||||
|  | ||||
|     int use_count_; | ||||
|  | ||||
|     base(base const &); | ||||
|     base & operator=(base const &); | ||||
|  | ||||
| protected: | ||||
|  | ||||
|     base(): use_count_(0) | ||||
|     { | ||||
|     } | ||||
|  | ||||
|     virtual ~base() | ||||
|     { | ||||
|     } | ||||
|  | ||||
| public: | ||||
|  | ||||
|     long use_count() const | ||||
|     { | ||||
|         return use_count_; | ||||
|     } | ||||
|  | ||||
|     inline friend void intrusive_ptr_add_ref(base * p) | ||||
|     { | ||||
|         ++p->use_count_; | ||||
|     } | ||||
|  | ||||
|     inline friend void intrusive_ptr_release(base * p) | ||||
|     { | ||||
|         if(--p->use_count_ == 0) delete p; | ||||
|     } | ||||
| }; | ||||
|  | ||||
| struct X: public base | ||||
| { | ||||
| }; | ||||
|  | ||||
| int main() | ||||
| { | ||||
|     boost::intrusive_ptr<X> p1, p2( new X ); | ||||
|  | ||||
|     BOOST_TEST_EQ( std::hash< boost::intrusive_ptr<X> >()( p1 ), std::hash< X* >()( p1.get() ) ); | ||||
|     BOOST_TEST_EQ( std::hash< boost::intrusive_ptr<X> >()( p2 ), std::hash< X* >()( p2.get() ) ); | ||||
|  | ||||
|     return boost::report_errors(); | ||||
| } | ||||
|  | ||||
| #endif // #if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) | ||||
							
								
								
									
										66
									
								
								test/lsp_hash_test.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								test/lsp_hash_test.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,66 @@ | ||||
| // Copyright 2011, 2020 Peter Dimov | ||||
| // Distributed under the Boost Software License, Version 1.0. | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
|  | ||||
| #include <boost/smart_ptr/local_shared_ptr.hpp> | ||||
| #include <boost/functional/hash.hpp> | ||||
| #include <boost/core/lightweight_test.hpp> | ||||
|  | ||||
| int main() | ||||
| { | ||||
|     { | ||||
|         boost::hash< boost::local_shared_ptr<int> > hasher; | ||||
|  | ||||
|         boost::local_shared_ptr<int> p1, p2( p1 ), p3( new int ), p4( p3 ), p5( new int ); | ||||
|  | ||||
|         BOOST_TEST_EQ( p1, p2 ); | ||||
|         BOOST_TEST_EQ( hasher( p1 ), hasher( p2 ) ); | ||||
|  | ||||
|         BOOST_TEST_NE( p1, p3 ); | ||||
|         BOOST_TEST_NE( hasher( p1 ), hasher( p3 ) ); | ||||
|  | ||||
|         BOOST_TEST_EQ( p3, p4 ); | ||||
|         BOOST_TEST_EQ( hasher( p3 ), hasher( p4 ) ); | ||||
|  | ||||
|         BOOST_TEST_NE( p3, p5 ); | ||||
|         BOOST_TEST_NE( hasher( p3 ), hasher( p5 ) ); | ||||
|     } | ||||
|  | ||||
|     { | ||||
|         boost::hash< boost::local_shared_ptr<int[]> > hasher; | ||||
|  | ||||
|         boost::local_shared_ptr<int[]> p1, p2( p1 ), p3( new int[1] ), p4( p3 ), p5( new int[1] ); | ||||
|  | ||||
|         BOOST_TEST_EQ( p1, p2 ); | ||||
|         BOOST_TEST_EQ( hasher( p1 ), hasher( p2 ) ); | ||||
|  | ||||
|         BOOST_TEST_NE( p1, p3 ); | ||||
|         BOOST_TEST_NE( hasher( p1 ), hasher( p3 ) ); | ||||
|  | ||||
|         BOOST_TEST_EQ( p3, p4 ); | ||||
|         BOOST_TEST_EQ( hasher( p3 ), hasher( p4 ) ); | ||||
|  | ||||
|         BOOST_TEST_NE( p3, p5 ); | ||||
|         BOOST_TEST_NE( hasher( p3 ), hasher( p5 ) ); | ||||
|     } | ||||
|  | ||||
|     { | ||||
|         boost::hash< boost::local_shared_ptr<int[1]> > hasher; | ||||
|  | ||||
|         boost::local_shared_ptr<int[1]> p1, p2( p1 ), p3( new int[1] ), p4( p3 ), p5( new int[1] ); | ||||
|  | ||||
|         BOOST_TEST_EQ( p1, p2 ); | ||||
|         BOOST_TEST_EQ( hasher( p1 ), hasher( p2 ) ); | ||||
|  | ||||
|         BOOST_TEST_NE( p1, p3 ); | ||||
|         BOOST_TEST_NE( hasher( p1 ), hasher( p3 ) ); | ||||
|  | ||||
|         BOOST_TEST_EQ( p3, p4 ); | ||||
|         BOOST_TEST_EQ( hasher( p3 ), hasher( p4 ) ); | ||||
|  | ||||
|         BOOST_TEST_NE( p3, p5 ); | ||||
|         BOOST_TEST_NE( hasher( p3 ), hasher( p5 ) ); | ||||
|     } | ||||
|  | ||||
|     return boost::report_errors(); | ||||
| } | ||||
							
								
								
									
										42
									
								
								test/lsp_hash_test2.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								test/lsp_hash_test2.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | ||||
| // Copyright 2011, 2020 Peter Dimov | ||||
| // Distributed under the Boost Software License, Version 1.0. | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
|  | ||||
| #include <boost/smart_ptr/local_shared_ptr.hpp> | ||||
| #include <boost/core/lightweight_test.hpp> | ||||
| #include <boost/config.hpp> | ||||
| #include <functional> | ||||
|  | ||||
| #if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) | ||||
|  | ||||
| int main() {} | ||||
|  | ||||
| #else | ||||
|  | ||||
| int main() | ||||
| { | ||||
|     { | ||||
|         boost::local_shared_ptr<int> p1, p2( new int ); | ||||
|  | ||||
|         BOOST_TEST_EQ( std::hash< boost::local_shared_ptr<int> >()( p1 ), std::hash< int* >()( p1.get() ) ); | ||||
|         BOOST_TEST_EQ( std::hash< boost::local_shared_ptr<int> >()( p2 ), std::hash< int* >()( p2.get() ) ); | ||||
|     } | ||||
|  | ||||
|     { | ||||
|         boost::local_shared_ptr<int[]> p1, p2( new int[1] ); | ||||
|  | ||||
|         BOOST_TEST_EQ( std::hash< boost::local_shared_ptr<int[]> >()( p1 ), std::hash< int* >()( p1.get() ) ); | ||||
|         BOOST_TEST_EQ( std::hash< boost::local_shared_ptr<int[]> >()( p2 ), std::hash< int* >()( p2.get() ) ); | ||||
|     } | ||||
|  | ||||
|     { | ||||
|         boost::local_shared_ptr<int[1]> p1, p2( new int[1] ); | ||||
|  | ||||
|         BOOST_TEST_EQ( std::hash< boost::local_shared_ptr<int[1]> >()( p1 ), std::hash< int* >()( p1.get() ) ); | ||||
|         BOOST_TEST_EQ( std::hash< boost::local_shared_ptr<int[1]> >()( p2 ), std::hash< int* >()( p2.get() ) ); | ||||
|     } | ||||
|  | ||||
|     return boost::report_errors(); | ||||
| } | ||||
|  | ||||
| #endif // #if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) | ||||
							
								
								
									
										103
									
								
								test/lsp_owner_before_test.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										103
									
								
								test/lsp_owner_before_test.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,103 @@ | ||||
| // Copyright 2020 Peter Dimov | ||||
| // Distributed under the Boost Software License, Version 1.0. | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
|  | ||||
| #include <boost/smart_ptr/local_shared_ptr.hpp> | ||||
| #include <boost/core/lightweight_test.hpp> | ||||
|  | ||||
| int main() | ||||
| { | ||||
|     { | ||||
|         boost::local_shared_ptr<int> p1( new int ); | ||||
|         boost::local_shared_ptr<int> p2( p1 ); | ||||
|  | ||||
|         BOOST_TEST( !p1.owner_before( p2 ) ); | ||||
|         BOOST_TEST( !p2.owner_before( p1 ) ); | ||||
|  | ||||
|         boost::local_shared_ptr<int> p3( new int ); | ||||
|  | ||||
|         BOOST_TEST( p1.owner_before( p3 ) || p3.owner_before( p1 ) ); | ||||
|  | ||||
|         boost::local_shared_ptr<int> p4; | ||||
|         boost::local_shared_ptr<int> p5; | ||||
|  | ||||
|         BOOST_TEST( !p4.owner_before( p5 ) ); | ||||
|         BOOST_TEST( !p5.owner_before( p4 ) ); | ||||
|  | ||||
|         BOOST_TEST( p4.owner_before( p3 ) || p3.owner_before( p4 ) ); | ||||
|  | ||||
|         boost::local_shared_ptr<int> p6( static_cast<int*>(0) ); | ||||
|  | ||||
|         BOOST_TEST( p4.owner_before( p6 ) || p6.owner_before( p4 ) ); | ||||
|  | ||||
|         boost::local_shared_ptr<void> p7( p1 ); | ||||
|  | ||||
|         BOOST_TEST( !p1.owner_before( p7 ) ); | ||||
|         BOOST_TEST( !p7.owner_before( p1 ) ); | ||||
|  | ||||
|         boost::local_shared_ptr<void> p8; | ||||
|  | ||||
|         BOOST_TEST( p1.owner_before( p8 ) || p8.owner_before( p1 ) ); | ||||
|  | ||||
|         BOOST_TEST( !p4.owner_before( p8 ) ); | ||||
|         BOOST_TEST( !p8.owner_before( p4 ) ); | ||||
| /* | ||||
|         boost::local_weak_ptr<int> q1( p1 ); | ||||
|  | ||||
|         BOOST_TEST( !p1.owner_before( q1 ) ); | ||||
|         BOOST_TEST( !q1.owner_before( p1 ) ); | ||||
|  | ||||
|         boost::local_weak_ptr<int> q2( p1 ); | ||||
|  | ||||
|         BOOST_TEST( !q1.owner_before( q2 ) ); | ||||
|         BOOST_TEST( !q2.owner_before( q1 ) ); | ||||
|  | ||||
|         boost::local_weak_ptr<int> q3( p3 ); | ||||
|  | ||||
|         BOOST_TEST( p1.owner_before( q3 ) || q3.owner_before( p1 ) ); | ||||
|         BOOST_TEST( q1.owner_before( q3 ) || q3.owner_before( q1 ) ); | ||||
|  | ||||
|         boost::local_weak_ptr<int> q4; | ||||
|  | ||||
|         BOOST_TEST( !p4.owner_before( q4 ) ); | ||||
|         BOOST_TEST( !q4.owner_before( p4 ) ); | ||||
|  | ||||
|         BOOST_TEST( q1.owner_before( q4 ) || q4.owner_before( q1 ) ); | ||||
|  | ||||
|         boost::local_weak_ptr<void> q5; | ||||
|  | ||||
|         BOOST_TEST( !q4.owner_before( q5 ) ); | ||||
|         BOOST_TEST( !q5.owner_before( q4 ) ); | ||||
|  | ||||
|         boost::local_weak_ptr<void> q7( p7 ); | ||||
|  | ||||
|         BOOST_TEST( !p1.owner_before( q7 ) ); | ||||
|         BOOST_TEST( !q7.owner_before( p1 ) ); | ||||
|  | ||||
|         BOOST_TEST( !q1.owner_before( q7 ) ); | ||||
|         BOOST_TEST( !q7.owner_before( q1 ) ); | ||||
|  | ||||
|         p1.reset(); | ||||
|         p2.reset(); | ||||
|         p3.reset(); | ||||
|         p7.reset(); | ||||
|  | ||||
|         BOOST_TEST( q1.expired() ); | ||||
|         BOOST_TEST( q2.expired() ); | ||||
|         BOOST_TEST( q3.expired() ); | ||||
|         BOOST_TEST( q7.expired() ); | ||||
|  | ||||
|         BOOST_TEST( !q1.owner_before( q2 ) ); | ||||
|         BOOST_TEST( !q2.owner_before( q1 ) ); | ||||
|  | ||||
|         BOOST_TEST( !q1.owner_before( q7 ) ); | ||||
|         BOOST_TEST( !q7.owner_before( q1 ) ); | ||||
|  | ||||
|         BOOST_TEST( q1.owner_before( q3 ) || q3.owner_before( q1 ) ); | ||||
|  | ||||
|         BOOST_TEST( q1.owner_before( q4 ) || q4.owner_before( q1 ) ); | ||||
| */ | ||||
|     } | ||||
|  | ||||
|     return boost::report_errors(); | ||||
| } | ||||
							
								
								
									
										113
									
								
								test/lsp_owner_equals_test.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										113
									
								
								test/lsp_owner_equals_test.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,113 @@ | ||||
| // Copyright 2020 Peter Dimov | ||||
| // Distributed under the Boost Software License, Version 1.0. | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
|  | ||||
| #include <boost/smart_ptr/local_shared_ptr.hpp> | ||||
| #include <boost/core/lightweight_test.hpp> | ||||
|  | ||||
| int main() | ||||
| { | ||||
|     { | ||||
|         boost::local_shared_ptr<int> p1( new int ); | ||||
|         boost::local_shared_ptr<int> p2( p1 ); | ||||
|  | ||||
|         BOOST_TEST( p1.owner_equals( p2 ) ); | ||||
|         BOOST_TEST( p2.owner_equals( p1 ) ); | ||||
|  | ||||
|         boost::local_shared_ptr<int> p3( new int ); | ||||
|  | ||||
|         BOOST_TEST( !p1.owner_equals( p3 ) ); | ||||
|         BOOST_TEST( !p3.owner_equals( p1 ) ); | ||||
|  | ||||
|         boost::local_shared_ptr<int> p4; | ||||
|         boost::local_shared_ptr<int> p5; | ||||
|  | ||||
|         BOOST_TEST( p4.owner_equals( p5 ) ); | ||||
|         BOOST_TEST( p5.owner_equals( p4 ) ); | ||||
|  | ||||
|         BOOST_TEST( !p4.owner_equals( p3 ) ); | ||||
|         BOOST_TEST( !p3.owner_equals( p4 ) ); | ||||
|  | ||||
|         boost::local_shared_ptr<int> p6( static_cast<int*>(0) ); | ||||
|  | ||||
|         BOOST_TEST( !p4.owner_equals( p6 ) ); | ||||
|         BOOST_TEST( !p6.owner_equals( p4 ) ); | ||||
|  | ||||
|         boost::local_shared_ptr<void> p7( p1 ); | ||||
|  | ||||
|         BOOST_TEST( p1.owner_equals( p7 ) ); | ||||
|         BOOST_TEST( p7.owner_equals( p1 ) ); | ||||
|  | ||||
|         boost::local_shared_ptr<void> p8; | ||||
|  | ||||
|         BOOST_TEST( !p1.owner_equals( p8 ) ); | ||||
|         BOOST_TEST( !p8.owner_equals( p1 ) ); | ||||
|  | ||||
|         BOOST_TEST( p4.owner_equals( p8 ) ); | ||||
|         BOOST_TEST( p8.owner_equals( p4 ) ); | ||||
| /* | ||||
|         boost::local_weak_ptr<int> q1( p1 ); | ||||
|  | ||||
|         BOOST_TEST( p1.owner_equals( q1 ) ); | ||||
|         BOOST_TEST( q1.owner_equals( p1 ) ); | ||||
|  | ||||
|         boost::local_weak_ptr<int> q2( p1 ); | ||||
|  | ||||
|         BOOST_TEST( q1.owner_equals( q2 ) ); | ||||
|         BOOST_TEST( q2.owner_equals( q1 ) ); | ||||
|  | ||||
|         boost::local_weak_ptr<int> q3( p3 ); | ||||
|  | ||||
|         BOOST_TEST( !p1.owner_equals( q3 ) ); | ||||
|         BOOST_TEST( !q3.owner_equals( p1 ) ); | ||||
|  | ||||
|         BOOST_TEST( !q1.owner_equals( q3 ) ); | ||||
|         BOOST_TEST( !q3.owner_equals( q1 ) ); | ||||
|  | ||||
|         boost::local_weak_ptr<int> q4; | ||||
|  | ||||
|         BOOST_TEST( p4.owner_equals( q4 ) ); | ||||
|         BOOST_TEST( q4.owner_equals( p4 ) ); | ||||
|  | ||||
|         BOOST_TEST( !q1.owner_equals( q4 ) ); | ||||
|         BOOST_TEST( !q4.owner_equals( q1 ) ); | ||||
|  | ||||
|         boost::local_weak_ptr<void> q5; | ||||
|  | ||||
|         BOOST_TEST( q4.owner_equals( q5 ) ); | ||||
|         BOOST_TEST( q5.owner_equals( q4 ) ); | ||||
|  | ||||
|         boost::local_weak_ptr<void> q7( p7 ); | ||||
|  | ||||
|         BOOST_TEST( p1.owner_equals( q7 ) ); | ||||
|         BOOST_TEST( q7.owner_equals( p1 ) ); | ||||
|  | ||||
|         BOOST_TEST( q1.owner_equals( q7 ) ); | ||||
|         BOOST_TEST( q7.owner_equals( q1 ) ); | ||||
|  | ||||
|         p1.reset(); | ||||
|         p2.reset(); | ||||
|         p3.reset(); | ||||
|         p7.reset(); | ||||
|  | ||||
|         BOOST_TEST( q1.expired() ); | ||||
|         BOOST_TEST( q2.expired() ); | ||||
|         BOOST_TEST( q3.expired() ); | ||||
|         BOOST_TEST( q7.expired() ); | ||||
|  | ||||
|         BOOST_TEST( q1.owner_equals( q2 ) ); | ||||
|         BOOST_TEST( q2.owner_equals( q1 ) ); | ||||
|  | ||||
|         BOOST_TEST( q1.owner_equals( q7 ) ); | ||||
|         BOOST_TEST( q7.owner_equals( q1 ) ); | ||||
|  | ||||
|         BOOST_TEST( !q1.owner_equals( q3 ) ); | ||||
|         BOOST_TEST( !q3.owner_equals( q1 ) ); | ||||
|  | ||||
|         BOOST_TEST( !q1.owner_equals( q4 ) ); | ||||
|         BOOST_TEST( !q4.owner_equals( q1 ) ); | ||||
| */ | ||||
|     } | ||||
|  | ||||
|     return boost::report_errors(); | ||||
| } | ||||
							
								
								
									
										116
									
								
								test/owner_equal_to_test.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										116
									
								
								test/owner_equal_to_test.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,116 @@ | ||||
| // Copyright 2020 Peter Dimov | ||||
| // Distributed under the Boost Software License, Version 1.0. | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
|  | ||||
| #include <boost/smart_ptr/owner_equal_to.hpp> | ||||
| #include <boost/shared_ptr.hpp> | ||||
| #include <boost/weak_ptr.hpp> | ||||
| #include <boost/core/lightweight_test.hpp> | ||||
|  | ||||
| int main() | ||||
| { | ||||
|     boost::owner_equal_to<> const eq = {}; | ||||
|  | ||||
|     { | ||||
|         boost::shared_ptr<int> p1( new int ); | ||||
|         boost::shared_ptr<int> p2( p1 ); | ||||
|  | ||||
|         BOOST_TEST( eq( p1, p2 ) ); | ||||
|         BOOST_TEST( eq( p2, p1 ) ); | ||||
|  | ||||
|         boost::shared_ptr<int> p3( new int ); | ||||
|  | ||||
|         BOOST_TEST( !eq( p1, p3 ) ); | ||||
|         BOOST_TEST( !eq( p3, p1 ) ); | ||||
|  | ||||
|         boost::shared_ptr<int> p4; | ||||
|         boost::shared_ptr<int> p5; | ||||
|  | ||||
|         BOOST_TEST( eq( p4, p5 ) ); | ||||
|         BOOST_TEST( eq( p5, p4 ) ); | ||||
|  | ||||
|         BOOST_TEST( !eq( p4, p3 ) ); | ||||
|         BOOST_TEST( !eq( p3, p4 ) ); | ||||
|  | ||||
|         boost::shared_ptr<int> p6( static_cast<int*>(0) ); | ||||
|  | ||||
|         BOOST_TEST( !eq( p4, p6 ) ); | ||||
|         BOOST_TEST( !eq( p6, p4 ) ); | ||||
|  | ||||
|         boost::shared_ptr<void> p7( p1 ); | ||||
|  | ||||
|         BOOST_TEST( eq( p1, p7 ) ); | ||||
|         BOOST_TEST( eq( p7, p1 ) ); | ||||
|  | ||||
|         boost::shared_ptr<void> p8; | ||||
|  | ||||
|         BOOST_TEST( !eq( p1, p8 ) ); | ||||
|         BOOST_TEST( !eq( p8, p1 ) ); | ||||
|  | ||||
|         BOOST_TEST( eq( p4, p8 ) ); | ||||
|         BOOST_TEST( eq( p8, p4 ) ); | ||||
|  | ||||
|         boost::weak_ptr<int> q1( p1 ); | ||||
|  | ||||
|         BOOST_TEST( eq( p1, q1 ) ); | ||||
|         BOOST_TEST( eq( q1, p1 ) ); | ||||
|  | ||||
|         boost::weak_ptr<int> q2( p1 ); | ||||
|  | ||||
|         BOOST_TEST( eq( q1, q2 ) ); | ||||
|         BOOST_TEST( eq( q2, q1 ) ); | ||||
|  | ||||
|         boost::weak_ptr<int> q3( p3 ); | ||||
|  | ||||
|         BOOST_TEST( !eq( p1, q3 ) ); | ||||
|         BOOST_TEST( !eq( q3, p1 ) ); | ||||
|  | ||||
|         BOOST_TEST( !eq( q1, q3 ) ); | ||||
|         BOOST_TEST( !eq( q3, q1 ) ); | ||||
|  | ||||
|         boost::weak_ptr<int> q4; | ||||
|  | ||||
|         BOOST_TEST( eq( p4, q4 ) ); | ||||
|         BOOST_TEST( eq( q4, p4 ) ); | ||||
|  | ||||
|         BOOST_TEST( !eq( q1, q4 ) ); | ||||
|         BOOST_TEST( !eq( q4, q1 ) ); | ||||
|  | ||||
|         boost::weak_ptr<void> q5; | ||||
|  | ||||
|         BOOST_TEST( eq( q4, q5 ) ); | ||||
|         BOOST_TEST( eq( q5, q4 ) ); | ||||
|  | ||||
|         boost::weak_ptr<void> q7( p7 ); | ||||
|  | ||||
|         BOOST_TEST( eq( p1, q7 ) ); | ||||
|         BOOST_TEST( eq( q7, p1 ) ); | ||||
|  | ||||
|         BOOST_TEST( eq( q1, q7 ) ); | ||||
|         BOOST_TEST( eq( q7, q1 ) ); | ||||
|  | ||||
|         p1.reset(); | ||||
|         p2.reset(); | ||||
|         p3.reset(); | ||||
|         p7.reset(); | ||||
|  | ||||
|         BOOST_TEST( q1.expired() ); | ||||
|         BOOST_TEST( q2.expired() ); | ||||
|         BOOST_TEST( q3.expired() ); | ||||
|         BOOST_TEST( q7.expired() ); | ||||
|  | ||||
|         BOOST_TEST( eq( q1, q2 ) ); | ||||
|         BOOST_TEST( eq( q2, q1 ) ); | ||||
|  | ||||
|         BOOST_TEST( eq( q1, q7 ) ); | ||||
|         BOOST_TEST( eq( q7, q1 ) ); | ||||
|  | ||||
|         BOOST_TEST( !eq( q1, q3 ) ); | ||||
|         BOOST_TEST( !eq( q3, q1 ) ); | ||||
|  | ||||
|         BOOST_TEST( !eq( q1, q4 ) ); | ||||
|         BOOST_TEST( !eq( q4, q1 ) ); | ||||
|     } | ||||
|  | ||||
|     return boost::report_errors(); | ||||
| } | ||||
							
								
								
									
										116
									
								
								test/owner_equal_to_test2.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										116
									
								
								test/owner_equal_to_test2.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,116 @@ | ||||
| // Copyright 2020 Peter Dimov | ||||
| // Distributed under the Boost Software License, Version 1.0. | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
|  | ||||
| #include <boost/smart_ptr/owner_equal_to.hpp> | ||||
| #include <boost/smart_ptr/local_shared_ptr.hpp> | ||||
| #include <boost/core/lightweight_test.hpp> | ||||
|  | ||||
| int main() | ||||
| { | ||||
|     boost::owner_equal_to<> const eq = {}; | ||||
|  | ||||
|     { | ||||
|         boost::local_shared_ptr<int> p1( new int ); | ||||
|         boost::local_shared_ptr<int> p2( p1 ); | ||||
|  | ||||
|         BOOST_TEST( eq( p1, p2 ) ); | ||||
|         BOOST_TEST( eq( p2, p1 ) ); | ||||
|  | ||||
|         boost::local_shared_ptr<int> p3( new int ); | ||||
|  | ||||
|         BOOST_TEST( !eq( p1, p3 ) ); | ||||
|         BOOST_TEST( !eq( p3, p1 ) ); | ||||
|  | ||||
|         boost::local_shared_ptr<int> p4; | ||||
|         boost::local_shared_ptr<int> p5; | ||||
|  | ||||
|         BOOST_TEST( eq( p4, p5 ) ); | ||||
|         BOOST_TEST( eq( p5, p4 ) ); | ||||
|  | ||||
|         BOOST_TEST( !eq( p4, p3 ) ); | ||||
|         BOOST_TEST( !eq( p3, p4 ) ); | ||||
|  | ||||
|         boost::local_shared_ptr<int> p6( static_cast<int*>(0) ); | ||||
|  | ||||
|         BOOST_TEST( !eq( p4, p6 ) ); | ||||
|         BOOST_TEST( !eq( p6, p4 ) ); | ||||
|  | ||||
|         boost::local_shared_ptr<void> p7( p1 ); | ||||
|  | ||||
|         BOOST_TEST( eq( p1, p7 ) ); | ||||
|         BOOST_TEST( eq( p7, p1 ) ); | ||||
|  | ||||
|         boost::local_shared_ptr<void> p8; | ||||
|  | ||||
|         BOOST_TEST( !eq( p1, p8 ) ); | ||||
|         BOOST_TEST( !eq( p8, p1 ) ); | ||||
|  | ||||
|         BOOST_TEST( eq( p4, p8 ) ); | ||||
|         BOOST_TEST( eq( p8, p4 ) ); | ||||
| /* | ||||
|         boost::local_weak_ptr<int> q1( p1 ); | ||||
|  | ||||
|         BOOST_TEST( eq( p1, q1 ) ); | ||||
|         BOOST_TEST( eq( q1, p1 ) ); | ||||
|  | ||||
|         boost::local_weak_ptr<int> q2( p1 ); | ||||
|  | ||||
|         BOOST_TEST( eq( q1, q2 ) ); | ||||
|         BOOST_TEST( eq( q2, q1 ) ); | ||||
|  | ||||
|         boost::local_weak_ptr<int> q3( p3 ); | ||||
|  | ||||
|         BOOST_TEST( !eq( p1, q3 ) ); | ||||
|         BOOST_TEST( !eq( q3, p1 ) ); | ||||
|  | ||||
|         BOOST_TEST( !eq( q1, q3 ) ); | ||||
|         BOOST_TEST( !eq( q3, q1 ) ); | ||||
|  | ||||
|         boost::local_weak_ptr<int> q4; | ||||
|  | ||||
|         BOOST_TEST( eq( p4, q4 ) ); | ||||
|         BOOST_TEST( eq( q4, p4 ) ); | ||||
|  | ||||
|         BOOST_TEST( !eq( q1, q4 ) ); | ||||
|         BOOST_TEST( !eq( q4, q1 ) ); | ||||
|  | ||||
|         boost::local_weak_ptr<void> q5; | ||||
|  | ||||
|         BOOST_TEST( eq( q4, q5 ) ); | ||||
|         BOOST_TEST( eq( q5, q4 ) ); | ||||
|  | ||||
|         boost::local_weak_ptr<void> q7( p7 ); | ||||
|  | ||||
|         BOOST_TEST( eq( p1, q7 ) ); | ||||
|         BOOST_TEST( eq( q7, p1 ) ); | ||||
|  | ||||
|         BOOST_TEST( eq( q1, q7 ) ); | ||||
|         BOOST_TEST( eq( q7, q1 ) ); | ||||
|  | ||||
|         p1.reset(); | ||||
|         p2.reset(); | ||||
|         p3.reset(); | ||||
|         p7.reset(); | ||||
|  | ||||
|         BOOST_TEST( q1.expired() ); | ||||
|         BOOST_TEST( q2.expired() ); | ||||
|         BOOST_TEST( q3.expired() ); | ||||
|         BOOST_TEST( q7.expired() ); | ||||
|  | ||||
|         BOOST_TEST( eq( q1, q2 ) ); | ||||
|         BOOST_TEST( eq( q2, q1 ) ); | ||||
|  | ||||
|         BOOST_TEST( eq( q1, q7 ) ); | ||||
|         BOOST_TEST( eq( q7, q1 ) ); | ||||
|  | ||||
|         BOOST_TEST( !eq( q1, q3 ) ); | ||||
|         BOOST_TEST( !eq( q3, q1 ) ); | ||||
|  | ||||
|         BOOST_TEST( !eq( q1, q4 ) ); | ||||
|         BOOST_TEST( !eq( q4, q1 ) ); | ||||
| */ | ||||
|     } | ||||
|  | ||||
|     return boost::report_errors(); | ||||
| } | ||||
							
								
								
									
										88
									
								
								test/owner_hash_test.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										88
									
								
								test/owner_hash_test.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,88 @@ | ||||
| // Copyright 2020 Peter Dimov | ||||
| // Distributed under the Boost Software License, Version 1.0. | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
|  | ||||
| #include <boost/smart_ptr/owner_hash.hpp> | ||||
| #include <boost/shared_ptr.hpp> | ||||
| #include <boost/weak_ptr.hpp> | ||||
| #include <boost/core/lightweight_test.hpp> | ||||
|  | ||||
| template<class T> std::size_t hash_( T const& t ) | ||||
| { | ||||
|     return boost::owner_hash<T>()( t ); | ||||
| } | ||||
|  | ||||
| int main() | ||||
| { | ||||
|     boost::shared_ptr<int> p1( new int ); | ||||
|     boost::shared_ptr<int> p2( p1 ); | ||||
|  | ||||
|     BOOST_TEST_EQ( hash_( p1 ), hash_( p2 ) ); | ||||
|  | ||||
|     boost::shared_ptr<int> p3( new int ); | ||||
|  | ||||
|     BOOST_TEST_NE( hash_( p1 ), hash_( p3 ) ); | ||||
|  | ||||
|     boost::shared_ptr<int> p4; | ||||
|     boost::shared_ptr<int> p5; | ||||
|  | ||||
|     BOOST_TEST_EQ( hash_( p4 ), hash_( p5 ) ); | ||||
|     BOOST_TEST_NE( hash_( p4 ), hash_( p3 ) ); | ||||
|  | ||||
|     boost::shared_ptr<int> p6( static_cast<int*>(0) ); | ||||
|  | ||||
|     BOOST_TEST_NE( hash_( p4 ), hash_( p6 ) ); | ||||
|  | ||||
|     boost::shared_ptr<void> p7( p1 ); | ||||
|  | ||||
|     BOOST_TEST_EQ( hash_( p1 ), hash_( p7 ) ); | ||||
|  | ||||
|     boost::shared_ptr<void> p8; | ||||
|  | ||||
|     BOOST_TEST_NE( hash_( p1 ), hash_( p8 ) ); | ||||
|     BOOST_TEST_EQ( hash_( p4 ), hash_( p8 ) ); | ||||
|  | ||||
|     boost::weak_ptr<int> q1( p1 ); | ||||
|  | ||||
|     BOOST_TEST_EQ( hash_( p1 ), hash_( q1 ) ); | ||||
|  | ||||
|     boost::weak_ptr<int> q2( p1 ); | ||||
|  | ||||
|     BOOST_TEST_EQ( hash_( q1 ), hash_( q2 ) ); | ||||
|  | ||||
|     boost::weak_ptr<int> q3( p3 ); | ||||
|  | ||||
|     BOOST_TEST_NE( hash_( p1 ), hash_( q3 ) ); | ||||
|     BOOST_TEST_NE( hash_( q1 ), hash_( q3 ) ); | ||||
|  | ||||
|     boost::weak_ptr<int> q4; | ||||
|  | ||||
|     BOOST_TEST_EQ( hash_( p4 ), hash_( q4 ) ); | ||||
|     BOOST_TEST_NE( hash_( q1 ), hash_( q4 ) ); | ||||
|  | ||||
|     boost::weak_ptr<void> q5; | ||||
|  | ||||
|     BOOST_TEST_EQ( hash_( q4 ), hash_( q5 ) ); | ||||
|  | ||||
|     boost::weak_ptr<void> q7( p7 ); | ||||
|  | ||||
|     BOOST_TEST_EQ( hash_( p1 ), hash_( q7 ) ); | ||||
|     BOOST_TEST_EQ( hash_( q1 ), hash_( q7 ) ); | ||||
|  | ||||
|     p1.reset(); | ||||
|     p2.reset(); | ||||
|     p3.reset(); | ||||
|     p7.reset(); | ||||
|  | ||||
|     BOOST_TEST( q1.expired() ); | ||||
|     BOOST_TEST( q2.expired() ); | ||||
|     BOOST_TEST( q3.expired() ); | ||||
|     BOOST_TEST( q7.expired() ); | ||||
|  | ||||
|     BOOST_TEST_EQ( hash_( q1 ), hash_( q2 ) ); | ||||
|     BOOST_TEST_EQ( hash_( q1 ), hash_( q7 ) ); | ||||
|     BOOST_TEST_NE( hash_( q1 ), hash_( q3 ) ); | ||||
|     BOOST_TEST_NE( hash_( q1 ), hash_( q4 ) ); | ||||
|  | ||||
|     return boost::report_errors(); | ||||
| } | ||||
							
								
								
									
										106
									
								
								test/owner_less_test2.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										106
									
								
								test/owner_less_test2.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,106 @@ | ||||
| // Copyright 2020 Peter Dimov | ||||
| // Distributed under the Boost Software License, Version 1.0. | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
|  | ||||
| #include <boost/smart_ptr/owner_less.hpp> | ||||
| #include <boost/smart_ptr/local_shared_ptr.hpp> | ||||
| #include <boost/core/lightweight_test.hpp> | ||||
|  | ||||
| int main() | ||||
| { | ||||
|     boost::owner_less<> const lt = {}; | ||||
|  | ||||
|     { | ||||
|         boost::local_shared_ptr<int> p1( new int ); | ||||
|         boost::local_shared_ptr<int> p2( p1 ); | ||||
|  | ||||
|         BOOST_TEST( !lt( p1, p2 ) ); | ||||
|         BOOST_TEST( !lt( p2, p1 ) ); | ||||
|  | ||||
|         boost::local_shared_ptr<int> p3( new int ); | ||||
|  | ||||
|         BOOST_TEST( lt( p1, p3 ) || lt( p3, p1 ) ); | ||||
|  | ||||
|         boost::local_shared_ptr<int> p4; | ||||
|         boost::local_shared_ptr<int> p5; | ||||
|  | ||||
|         BOOST_TEST( !lt( p4, p5 ) ); | ||||
|         BOOST_TEST( !lt( p5, p4 ) ); | ||||
|  | ||||
|         BOOST_TEST( lt( p4, p3 ) || lt( p3, p4 ) ); | ||||
|  | ||||
|         boost::local_shared_ptr<int> p6( static_cast<int*>(0) ); | ||||
|  | ||||
|         BOOST_TEST( lt( p4, p6 ) || lt( p6, p4 ) ); | ||||
|  | ||||
|         boost::local_shared_ptr<void> p7( p1 ); | ||||
|  | ||||
|         BOOST_TEST( !lt( p1, p7 ) ); | ||||
|         BOOST_TEST( !lt( p7, p1 ) ); | ||||
|  | ||||
|         boost::local_shared_ptr<void> p8; | ||||
|  | ||||
|         BOOST_TEST( lt( p1, p8 ) || lt( p8, p1 ) ); | ||||
|  | ||||
|         BOOST_TEST( !lt( p4, p8 ) ); | ||||
|         BOOST_TEST( !lt( p8, p4 ) ); | ||||
| /* | ||||
|         boost::local_weak_ptr<int> q1( p1 ); | ||||
|  | ||||
|         BOOST_TEST( !lt( p1, q1 ) ); | ||||
|         BOOST_TEST( !lt( q1, p1 ) ); | ||||
|  | ||||
|         boost::local_weak_ptr<int> q2( p1 ); | ||||
|  | ||||
|         BOOST_TEST( !lt( q1, q2 ) ); | ||||
|         BOOST_TEST( !lt( q2, q1 ) ); | ||||
|  | ||||
|         boost::local_weak_ptr<int> q3( p3 ); | ||||
|  | ||||
|         BOOST_TEST( lt( p1, q3 ) || lt( q3, p1 ) ); | ||||
|         BOOST_TEST( lt( q1, q3 ) || lt( q3, q1 ) ); | ||||
|  | ||||
|         boost::local_weak_ptr<int> q4; | ||||
|  | ||||
|         BOOST_TEST( !lt( p4, q4 ) ); | ||||
|         BOOST_TEST( !lt( q4, p4 ) ); | ||||
|  | ||||
|         BOOST_TEST( lt( q1, q4 ) || lt( q4, q1 ) ); | ||||
|  | ||||
|         boost::local_weak_ptr<void> q5; | ||||
|  | ||||
|         BOOST_TEST( !lt( q4, q5 ) ); | ||||
|         BOOST_TEST( !lt( q5, q4 ) ); | ||||
|  | ||||
|         boost::local_weak_ptr<void> q7( p7 ); | ||||
|  | ||||
|         BOOST_TEST( !lt( p1, q7 ) ); | ||||
|         BOOST_TEST( !lt( q7, p1 ) ); | ||||
|  | ||||
|         BOOST_TEST( !lt( q1, q7 ) ); | ||||
|         BOOST_TEST( !lt( q7, q1 ) ); | ||||
|  | ||||
|         p1.reset(); | ||||
|         p2.reset(); | ||||
|         p3.reset(); | ||||
|         p7.reset(); | ||||
|  | ||||
|         BOOST_TEST( q1.expired() ); | ||||
|         BOOST_TEST( q2.expired() ); | ||||
|         BOOST_TEST( q3.expired() ); | ||||
|         BOOST_TEST( q7.expired() ); | ||||
|  | ||||
|         BOOST_TEST( !lt( q1, q2 ) ); | ||||
|         BOOST_TEST( !lt( q2, q1 ) ); | ||||
|  | ||||
|         BOOST_TEST( !lt( q1, q7 ) ); | ||||
|         BOOST_TEST( !lt( q7, q1 ) ); | ||||
|  | ||||
|         BOOST_TEST( lt( q1, q3 ) || lt( q3, q1 ) ); | ||||
|  | ||||
|         BOOST_TEST( lt( q1, q4 ) || lt( q4, q1 ) ); | ||||
| */ | ||||
|     } | ||||
|  | ||||
|     return boost::report_errors(); | ||||
| } | ||||
							
								
								
									
										22
									
								
								test/shared_from_fail.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								test/shared_from_fail.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| // Copyright 2020 Peter Dimov | ||||
| // Distributed under the Boost Software License, Version 1.0. | ||||
| // https://www.boost.org/LICENSE_1_0.txt | ||||
|  | ||||
| #include <boost/shared_ptr.hpp> | ||||
| #include <boost/smart_ptr/enable_shared_from.hpp> | ||||
|  | ||||
| struct X: public boost::enable_shared_from | ||||
| { | ||||
| }; | ||||
|  | ||||
| #if defined(__clang__) && defined(_MSC_VER) | ||||
| // clang-cl claims that it accepts this code for compatibility | ||||
| // with msvc, but no version of msvc accepts it | ||||
| #  pragma clang diagnostic error "-Wmicrosoft-using-decl" | ||||
| #endif | ||||
|  | ||||
| int main() | ||||
| { | ||||
|     boost::shared_ptr<X> px( new X ); | ||||
|     px->shared_from_this(); | ||||
| } | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user