forked from boostorg/smart_ptr
		
	Compare commits
	
		
			26 Commits
		
	
	
		
			feature/mo
			...
			esp-idf-co
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 8c5caaf594 | |||
| 6eaae5f10b | |||
| 
						 | 
					59b5b17e81 | ||
| 
						 | 
					f2ab3b21f0 | ||
| 
						 | 
					e04196b6a1 | ||
| 
						 | 
					95eaa2d7c3 | ||
| 
						 | 
					2e31d0d633 | ||
| 
						 | 
					b8cb132ab4 | ||
| 
						 | 
					f4d7116241 | ||
| 
						 | 
					f2cc84a23c | ||
| 
						 | 
					f12a33813d | ||
| 
						 | 
					cfde4f7407 | ||
| 
						 | 
					b8d340b495 | ||
| 
						 | 
					6716193d9c | ||
| 
						 | 
					8f40bff2f6 | ||
| 
						 | 
					1ef8f4e72d | ||
| 
						 | 
					f651a49d96 | ||
| 
						 | 
					598314b8e1 | ||
| 
						 | 
					72221d1da0 | ||
| 
						 | 
					2cbeb5b185 | ||
| 
						 | 
					67e657c228 | ||
| 
						 | 
					eba3cf92e7 | ||
| 
						 | 
					8340a13539 | ||
| 
						 | 
					fec5fb97c8 | ||
| 
						 | 
					b52d7548b3 | ||
| 
						 | 
					594c7485a5 | 
							
								
								
									
										271
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										271
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							@@ -17,72 +17,65 @@ jobs:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        include:
 | 
			
		||||
          - toolset: gcc-4.7
 | 
			
		||||
            cxxstd: "03,11"
 | 
			
		||||
            os: ubuntu-16.04
 | 
			
		||||
            install: g++-4.7
 | 
			
		||||
          - toolset: gcc-4.8
 | 
			
		||||
            cxxstd: "03,11"
 | 
			
		||||
            os: ubuntu-16.04
 | 
			
		||||
            install: g++-4.8
 | 
			
		||||
          - toolset: gcc-4.9
 | 
			
		||||
            cxxstd: "03,11"
 | 
			
		||||
            os: ubuntu-16.04
 | 
			
		||||
            install: g++-4.9
 | 
			
		||||
            os: ubuntu-18.04
 | 
			
		||||
            install: g++-4.8-multilib
 | 
			
		||||
            address-model: 32,64
 | 
			
		||||
          - toolset: gcc-5
 | 
			
		||||
            cxxstd: "03,11,14,1z"
 | 
			
		||||
            os: ubuntu-16.04
 | 
			
		||||
            os: ubuntu-18.04
 | 
			
		||||
            install: g++-5-multilib
 | 
			
		||||
            address-model: 32,64
 | 
			
		||||
          - toolset: gcc-6
 | 
			
		||||
            cxxstd: "03,11,14,1z"
 | 
			
		||||
            os: ubuntu-16.04
 | 
			
		||||
            install: g++-6
 | 
			
		||||
            os: ubuntu-18.04
 | 
			
		||||
            install: g++-6-multilib
 | 
			
		||||
            address-model: 32,64
 | 
			
		||||
          - toolset: gcc-7
 | 
			
		||||
            cxxstd: "03,11,14,17"
 | 
			
		||||
            os: ubuntu-18.04
 | 
			
		||||
            install: g++-7-multilib
 | 
			
		||||
            address-model: 32,64
 | 
			
		||||
          - toolset: gcc-8
 | 
			
		||||
            cxxstd: "03,11,14,17,2a"
 | 
			
		||||
            os: ubuntu-18.04
 | 
			
		||||
            install: g++-8
 | 
			
		||||
            install: g++-8-multilib
 | 
			
		||||
            address-model: 32,64
 | 
			
		||||
          - toolset: gcc-9
 | 
			
		||||
            cxxstd: "03,11,14,17,2a"
 | 
			
		||||
            os: ubuntu-18.04
 | 
			
		||||
            os: ubuntu-20.04
 | 
			
		||||
            install: g++-9-multilib
 | 
			
		||||
            address-model: 32,64
 | 
			
		||||
          - toolset: gcc-10
 | 
			
		||||
            cxxstd: "03,11,14,17,2a"
 | 
			
		||||
            os: ubuntu-18.04
 | 
			
		||||
          - toolset: clang
 | 
			
		||||
            compiler: clang++-3.5
 | 
			
		||||
            cxxstd: "03,11"
 | 
			
		||||
            os: ubuntu-16.04
 | 
			
		||||
            install: clang-3.5
 | 
			
		||||
          - toolset: clang
 | 
			
		||||
            compiler: clang++-3.6
 | 
			
		||||
            cxxstd: "03,11,14"
 | 
			
		||||
            os: ubuntu-16.04
 | 
			
		||||
            install: clang-3.6
 | 
			
		||||
          - toolset: clang
 | 
			
		||||
            compiler: clang++-3.7
 | 
			
		||||
            cxxstd: "03,11,14"
 | 
			
		||||
            os: ubuntu-16.04
 | 
			
		||||
            install: clang-3.7
 | 
			
		||||
          - toolset: clang
 | 
			
		||||
            compiler: clang++-3.8
 | 
			
		||||
            cxxstd: "03,11,14"
 | 
			
		||||
            os: ubuntu-16.04
 | 
			
		||||
            install: clang-3.8
 | 
			
		||||
            os: ubuntu-20.04
 | 
			
		||||
            install: g++-10-multilib
 | 
			
		||||
            address-model: 32,64
 | 
			
		||||
          - toolset: gcc-11
 | 
			
		||||
            cxxstd: "03,11,14,17,20"
 | 
			
		||||
            os: ubuntu-20.04
 | 
			
		||||
            install: g++-11-multilib
 | 
			
		||||
            address-model: 32,64
 | 
			
		||||
          - toolset: gcc-12
 | 
			
		||||
            cxxstd: "03,11,14,17,20"
 | 
			
		||||
            os: ubuntu-22.04
 | 
			
		||||
            install: g++-12-multilib
 | 
			
		||||
            address-model: 32,64
 | 
			
		||||
          - toolset: clang
 | 
			
		||||
            compiler: clang++-3.9
 | 
			
		||||
            cxxstd: "03,11,14"
 | 
			
		||||
            os: ubuntu-16.04
 | 
			
		||||
            os: ubuntu-18.04
 | 
			
		||||
            install: clang-3.9
 | 
			
		||||
          - toolset: clang
 | 
			
		||||
            compiler: clang++-4.0
 | 
			
		||||
            cxxstd: "03,11,14"
 | 
			
		||||
            os: ubuntu-16.04
 | 
			
		||||
            os: ubuntu-18.04
 | 
			
		||||
            install: clang-4.0
 | 
			
		||||
          - toolset: clang
 | 
			
		||||
            compiler: clang++-5.0
 | 
			
		||||
            cxxstd: "03,11,14,1z"
 | 
			
		||||
            os: ubuntu-16.04
 | 
			
		||||
            os: ubuntu-18.04
 | 
			
		||||
            install: clang-5.0
 | 
			
		||||
          - toolset: clang
 | 
			
		||||
            compiler: clang++-6.0
 | 
			
		||||
@@ -96,13 +89,14 @@ jobs:
 | 
			
		||||
            install: clang-7
 | 
			
		||||
          - toolset: clang
 | 
			
		||||
            compiler: clang++-8
 | 
			
		||||
            cxxstd: "03,11,14,17,2a"
 | 
			
		||||
            cxxstd: "03,11,14,17"
 | 
			
		||||
            os: ubuntu-20.04
 | 
			
		||||
            install: clang-8
 | 
			
		||||
          - toolset: clang
 | 
			
		||||
            compiler: clang++-9
 | 
			
		||||
            cxxstd: "03,11,14,17,2a"
 | 
			
		||||
            os: ubuntu-20.04
 | 
			
		||||
            install: clang-9
 | 
			
		||||
          - toolset: clang
 | 
			
		||||
            compiler: clang++-10
 | 
			
		||||
            cxxstd: "03,11,14,17,2a"
 | 
			
		||||
@@ -111,6 +105,20 @@ jobs:
 | 
			
		||||
            compiler: clang++-11
 | 
			
		||||
            cxxstd: "03,11,14,17,2a"
 | 
			
		||||
            os: ubuntu-20.04
 | 
			
		||||
          - toolset: clang
 | 
			
		||||
            compiler: clang++-12
 | 
			
		||||
            cxxstd: "03,11,14,17,20"
 | 
			
		||||
            os: ubuntu-20.04
 | 
			
		||||
          - toolset: clang
 | 
			
		||||
            compiler: clang++-13
 | 
			
		||||
            cxxstd: "03,11,14,17,20"
 | 
			
		||||
            os: ubuntu-22.04
 | 
			
		||||
            install: clang-13
 | 
			
		||||
          - toolset: clang
 | 
			
		||||
            compiler: clang++-14
 | 
			
		||||
            cxxstd: "03,11,14,17,20"
 | 
			
		||||
            os: ubuntu-22.04
 | 
			
		||||
            install: clang-14
 | 
			
		||||
          - toolset: clang
 | 
			
		||||
            cxxstd: "03,11,14,17,2a"
 | 
			
		||||
            os: macos-10.15
 | 
			
		||||
@@ -154,21 +162,29 @@ jobs:
 | 
			
		||||
      - name: Run tests
 | 
			
		||||
        run: |
 | 
			
		||||
          cd ../boost-root
 | 
			
		||||
          ./b2 -j3 libs/$LIBRARY/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} variant=debug,release
 | 
			
		||||
          ./b2 -j3 libs/$LIBRARY/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} ${ADDRMD:+address-model=$ADDRMD} variant=debug,release
 | 
			
		||||
 | 
			
		||||
  windows:
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        include:
 | 
			
		||||
          - toolset: msvc-14.1
 | 
			
		||||
            cxxstd: "14,17,latest"
 | 
			
		||||
            addrmd: 32,64
 | 
			
		||||
            os: windows-2016
 | 
			
		||||
          - toolset: msvc-14.2
 | 
			
		||||
            cxxstd: "14,17,latest"
 | 
			
		||||
          - toolset: msvc-14.0
 | 
			
		||||
            cxxstd: 14,latest
 | 
			
		||||
            addrmd: 32,64
 | 
			
		||||
            os: windows-2019
 | 
			
		||||
          - toolset: msvc-14.2
 | 
			
		||||
            cxxstd: "14,17,20,latest"
 | 
			
		||||
            addrmd: 32,64
 | 
			
		||||
            os: windows-2019
 | 
			
		||||
          - toolset: msvc-14.3
 | 
			
		||||
            cxxstd: "14,17,20,latest"
 | 
			
		||||
            addrmd: 32,64
 | 
			
		||||
            os: windows-2022
 | 
			
		||||
          - toolset: clang-win
 | 
			
		||||
            cxxstd: "14,17,latest"
 | 
			
		||||
            addrmd: 32,64
 | 
			
		||||
            os: windows-2022
 | 
			
		||||
          - toolset: gcc
 | 
			
		||||
            cxxstd: "03,11,14,17,2a"
 | 
			
		||||
            addrmd: 64
 | 
			
		||||
@@ -205,4 +221,163 @@ jobs:
 | 
			
		||||
        shell: cmd
 | 
			
		||||
        run: |
 | 
			
		||||
          cd ../boost-root
 | 
			
		||||
          b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release
 | 
			
		||||
          b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release embed-manifest-via=linker
 | 
			
		||||
 | 
			
		||||
  posix-cmake-subdir:
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        include:
 | 
			
		||||
          - os: ubuntu-18.04
 | 
			
		||||
          - os: ubuntu-20.04
 | 
			
		||||
          - os: ubuntu-22.04
 | 
			
		||||
          - os: macos-10.15
 | 
			
		||||
 | 
			
		||||
    runs-on: ${{matrix.os}}
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
 | 
			
		||||
      - name: Install packages
 | 
			
		||||
        if: matrix.install
 | 
			
		||||
        run: sudo apt install ${{matrix.install}}
 | 
			
		||||
 | 
			
		||||
      - name: Setup Boost
 | 
			
		||||
        run: |
 | 
			
		||||
          echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
 | 
			
		||||
          LIBRARY=${GITHUB_REPOSITORY#*/}
 | 
			
		||||
          echo LIBRARY: $LIBRARY
 | 
			
		||||
          echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
 | 
			
		||||
          echo GITHUB_BASE_REF: $GITHUB_BASE_REF
 | 
			
		||||
          echo GITHUB_REF: $GITHUB_REF
 | 
			
		||||
          REF=${GITHUB_BASE_REF:-$GITHUB_REF}
 | 
			
		||||
          REF=${REF#refs/heads/}
 | 
			
		||||
          echo REF: $REF
 | 
			
		||||
          BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
 | 
			
		||||
          echo BOOST_BRANCH: $BOOST_BRANCH
 | 
			
		||||
          cd ..
 | 
			
		||||
          git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
 | 
			
		||||
          cd boost-root
 | 
			
		||||
          cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
 | 
			
		||||
          git submodule update --init tools/boostdep
 | 
			
		||||
          python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
 | 
			
		||||
 | 
			
		||||
      - name: Use library with add_subdirectory
 | 
			
		||||
        run: |
 | 
			
		||||
          cd ../boost-root/libs/$LIBRARY/test/cmake_subdir_test
 | 
			
		||||
          mkdir __build__ && cd __build__
 | 
			
		||||
          cmake ..
 | 
			
		||||
          cmake --build .
 | 
			
		||||
          ctest --output-on-failure --no-tests=error
 | 
			
		||||
 | 
			
		||||
  posix-cmake-install:
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        include:
 | 
			
		||||
          - os: ubuntu-18.04
 | 
			
		||||
          - os: ubuntu-20.04
 | 
			
		||||
          - os: ubuntu-22.04
 | 
			
		||||
          - os: macos-10.15
 | 
			
		||||
 | 
			
		||||
    runs-on: ${{matrix.os}}
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
 | 
			
		||||
      - name: Install packages
 | 
			
		||||
        if: matrix.install
 | 
			
		||||
        run: sudo apt install ${{matrix.install}}
 | 
			
		||||
 | 
			
		||||
      - name: Setup Boost
 | 
			
		||||
        run: |
 | 
			
		||||
          echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
 | 
			
		||||
          LIBRARY=${GITHUB_REPOSITORY#*/}
 | 
			
		||||
          echo LIBRARY: $LIBRARY
 | 
			
		||||
          echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
 | 
			
		||||
          echo GITHUB_BASE_REF: $GITHUB_BASE_REF
 | 
			
		||||
          echo GITHUB_REF: $GITHUB_REF
 | 
			
		||||
          REF=${GITHUB_BASE_REF:-$GITHUB_REF}
 | 
			
		||||
          REF=${REF#refs/heads/}
 | 
			
		||||
          echo REF: $REF
 | 
			
		||||
          BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
 | 
			
		||||
          echo BOOST_BRANCH: $BOOST_BRANCH
 | 
			
		||||
          cd ..
 | 
			
		||||
          git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
 | 
			
		||||
          cd boost-root
 | 
			
		||||
          cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
 | 
			
		||||
          git submodule update --init tools/boostdep
 | 
			
		||||
          python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
 | 
			
		||||
 | 
			
		||||
      - name: Configure
 | 
			
		||||
        run: |
 | 
			
		||||
          cd ../boost-root
 | 
			
		||||
          mkdir __build__ && cd __build__
 | 
			
		||||
          cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DCMAKE_INSTALL_PREFIX=~/.local ..
 | 
			
		||||
 | 
			
		||||
      - name: Install
 | 
			
		||||
        run: |
 | 
			
		||||
          cd ../boost-root/__build__
 | 
			
		||||
          cmake --build . --target install
 | 
			
		||||
 | 
			
		||||
      - name: Use the installed library
 | 
			
		||||
        run: |
 | 
			
		||||
          cd ../boost-root/libs/$LIBRARY/test/cmake_install_test && mkdir __build__ && cd __build__
 | 
			
		||||
          cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
 | 
			
		||||
          cmake --build .
 | 
			
		||||
          ctest --output-on-failure --no-tests=error
 | 
			
		||||
 | 
			
		||||
  posix-cmake-test:
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        include:
 | 
			
		||||
          - os: ubuntu-18.04
 | 
			
		||||
          - os: ubuntu-20.04
 | 
			
		||||
          - os: ubuntu-22.04
 | 
			
		||||
          - os: macos-10.15
 | 
			
		||||
 | 
			
		||||
    runs-on: ${{matrix.os}}
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v2
 | 
			
		||||
 | 
			
		||||
      - name: Install packages
 | 
			
		||||
        if: matrix.install
 | 
			
		||||
        run: sudo apt install ${{matrix.install}}
 | 
			
		||||
 | 
			
		||||
      - name: Setup Boost
 | 
			
		||||
        run: |
 | 
			
		||||
          echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
 | 
			
		||||
          LIBRARY=${GITHUB_REPOSITORY#*/}
 | 
			
		||||
          echo LIBRARY: $LIBRARY
 | 
			
		||||
          echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
 | 
			
		||||
          echo GITHUB_BASE_REF: $GITHUB_BASE_REF
 | 
			
		||||
          echo GITHUB_REF: $GITHUB_REF
 | 
			
		||||
          REF=${GITHUB_BASE_REF:-$GITHUB_REF}
 | 
			
		||||
          REF=${REF#refs/heads/}
 | 
			
		||||
          echo REF: $REF
 | 
			
		||||
          BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
 | 
			
		||||
          echo BOOST_BRANCH: $BOOST_BRANCH
 | 
			
		||||
          cd ..
 | 
			
		||||
          git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
 | 
			
		||||
          cd boost-root
 | 
			
		||||
          cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
 | 
			
		||||
          git submodule update --init tools/boostdep
 | 
			
		||||
          python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
 | 
			
		||||
 | 
			
		||||
      - name: Configure
 | 
			
		||||
        run: |
 | 
			
		||||
          cd ../boost-root
 | 
			
		||||
          mkdir __build__ && cd __build__
 | 
			
		||||
          cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON ..
 | 
			
		||||
 | 
			
		||||
      - name: Build tests
 | 
			
		||||
        run: |
 | 
			
		||||
          cd ../boost-root/__build__
 | 
			
		||||
          cmake --build . --target tests
 | 
			
		||||
 | 
			
		||||
      - name: Run tests
 | 
			
		||||
        run: |
 | 
			
		||||
          cd ../boost-root/__build__
 | 
			
		||||
          ctest --output-on-failure --no-tests=error
 | 
			
		||||
 
 | 
			
		||||
@@ -160,6 +160,7 @@ matrix:
 | 
			
		||||
      script:
 | 
			
		||||
        - mkdir __build__ && cd __build__
 | 
			
		||||
        - cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES=smart_ptr -DBUILD_TESTING=ON ..
 | 
			
		||||
        - cmake --build . --target tests -- -k
 | 
			
		||||
        - ctest --output-on-failure -R boost_smart_ptr
 | 
			
		||||
 | 
			
		||||
    - os: linux
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,8 @@
 | 
			
		||||
# Distributed under the Boost Software License, Version 1.0.
 | 
			
		||||
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
 | 
			
		||||
 | 
			
		||||
if(NOT DEFINED IDF_TARGET)
 | 
			
		||||
 | 
			
		||||
cmake_minimum_required(VERSION 3.5...3.16)
 | 
			
		||||
 | 
			
		||||
project(boost_smart_ptr VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
 | 
			
		||||
@@ -27,3 +29,25 @@ if(BUILD_TESTING)
 | 
			
		||||
  add_subdirectory(test)
 | 
			
		||||
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
else()
 | 
			
		||||
 | 
			
		||||
FILE(GLOB_RECURSE headers include/*.h include/*.hpp)
 | 
			
		||||
 | 
			
		||||
idf_component_register(
 | 
			
		||||
    SRCS
 | 
			
		||||
        ${headers}
 | 
			
		||||
    INCLUDE_DIRS
 | 
			
		||||
        include
 | 
			
		||||
    REQUIRES
 | 
			
		||||
        boost_assert
 | 
			
		||||
        boost_config
 | 
			
		||||
        boost_core
 | 
			
		||||
        boost_move
 | 
			
		||||
        boost_static_assert
 | 
			
		||||
        boost_throw_exception
 | 
			
		||||
        boost_type_traits
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								appveyor.yml
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								appveyor.yml
									
									
									
									
									
								
							@@ -24,14 +24,10 @@ environment:
 | 
			
		||||
      TOOLSET: msvc-14.1
 | 
			
		||||
      CXXSTD: 14,17
 | 
			
		||||
      ADDRMD: 32,64
 | 
			
		||||
    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
 | 
			
		||||
      TOOLSET: clang-win
 | 
			
		||||
      CXXSTD: 14,17
 | 
			
		||||
      ADDRMD: 64
 | 
			
		||||
    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
 | 
			
		||||
      TOOLSET: msvc-14.2
 | 
			
		||||
      TOOLSET: clang-win
 | 
			
		||||
      CXXSTD: 14,17,latest
 | 
			
		||||
      ADDRMD: 32,64
 | 
			
		||||
      ADDRMD: 64
 | 
			
		||||
    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
 | 
			
		||||
      ADDPATH: C:\cygwin\bin;
 | 
			
		||||
      TOOLSET: gcc
 | 
			
		||||
@@ -83,4 +79,4 @@ test_script:
 | 
			
		||||
  - PATH=%ADDPATH%%PATH%
 | 
			
		||||
  - if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
 | 
			
		||||
  - if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
 | 
			
		||||
  - b2 -j3 libs/smart_ptr/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% variant=debug,release
 | 
			
		||||
  - b2 -j3 libs/smart_ptr/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% variant=debug,release embed-manifest-via=linker
 | 
			
		||||
 
 | 
			
		||||
@@ -14,6 +14,8 @@ Greg Colvin, Beman Dawes, Peter Dimov, Glen Fernandes
 | 
			
		||||
:idprefix:
 | 
			
		||||
:listing-caption: Code Example
 | 
			
		||||
:docinfo: private-footer
 | 
			
		||||
:source-highlighter: rouge
 | 
			
		||||
:source-language: c++
 | 
			
		||||
 | 
			
		||||
:leveloffset: +1
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
////
 | 
			
		||||
Copyright 2019 Glen Joseph Fernandes (glenjofe@gmail.com)
 | 
			
		||||
Copyright 2019-2021 Glen Joseph Fernandes (glenjofe@gmail.com)
 | 
			
		||||
 | 
			
		||||
Distributed under the Boost Software License, Version 1.0.
 | 
			
		||||
 | 
			
		||||
@@ -85,6 +85,11 @@ namespace boost {
 | 
			
		||||
  template<class T, class A>
 | 
			
		||||
    std::unique_ptr<remove_extent_t<T>[], alloc_noinit_deleter<T, A>>
 | 
			
		||||
      allocate_unique_noinit(const A& a);
 | 
			
		||||
 | 
			
		||||
  template<class T, class U, class A>
 | 
			
		||||
    allocator_pointer_t<allocator_rebind_t<A, remove_cv_t<remove_extent_t<T>>>>
 | 
			
		||||
      get_allocator_pointer(const std::unique_ptr<T,
 | 
			
		||||
        alloc_deleter<U, A>>& p) noexcept;
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@@ -269,6 +274,18 @@ Returns:: A `std::unique_ptr` to a sequence of `extent_v<T>`
 | 
			
		||||
default-initialized objects of type `remove_extent_t<T>`.
 | 
			
		||||
Example:: `auto p = allocate_unique_noinit<double[1024]>(a);`
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
template<class T, class U, class A>
 | 
			
		||||
  allocator_pointer_t<allocator_rebind_t<A, remove_cv_t<remove_extent_t<T>>>>
 | 
			
		||||
    get_allocator_pointer(const std::unique_ptr<T,
 | 
			
		||||
      alloc_deleter<U, A>>& p) noexcept;
 | 
			
		||||
```
 | 
			
		||||
[none]
 | 
			
		||||
* {blank}
 | 
			
		||||
+
 | 
			
		||||
Returns:: The allocator pointer to the allocation.
 | 
			
		||||
Example:: `auto r = boost::get_allocator_ptr(p);`
 | 
			
		||||
 | 
			
		||||
## Deleter
 | 
			
		||||
 | 
			
		||||
Class template `alloc_deleter` is the deleter used by the `allocate_unique`
 | 
			
		||||
 
 | 
			
		||||
@@ -13,6 +13,10 @@ http://www.boost.org/LICENSE_1_0.txt
 | 
			
		||||
:toc-title:
 | 
			
		||||
:idprefix: changelog_
 | 
			
		||||
 | 
			
		||||
## Changes in 1.79.0
 | 
			
		||||
 | 
			
		||||
* Added `get_allocator_pointer`
 | 
			
		||||
 | 
			
		||||
## Changes in 1.74.0
 | 
			
		||||
 | 
			
		||||
* Added `owner_equals` to `shared_ptr`, `weak_ptr`, `local_shared_ptr`
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright 2019 Glen Joseph Fernandes
 | 
			
		||||
Copyright 2019-2021 Glen Joseph Fernandes
 | 
			
		||||
(glenjofe@gmail.com)
 | 
			
		||||
 | 
			
		||||
Distributed under the Boost Software License, Version 1.0.
 | 
			
		||||
@@ -477,6 +477,15 @@ allocate_unique(const A& alloc,
 | 
			
		||||
    return c.release();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template<class T, class U, class A>
 | 
			
		||||
inline typename allocator_pointer<typename allocator_rebind<A,
 | 
			
		||||
    typename detail::sp_alloc_value<T>::type>::type>::type
 | 
			
		||||
get_allocator_pointer(const std::unique_ptr<T,
 | 
			
		||||
    alloc_deleter<U, A> >& p) BOOST_NOEXCEPT
 | 
			
		||||
{
 | 
			
		||||
    return p.get().ptr();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} /* boost */
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@
 | 
			
		||||
#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/core/checked_delete.hpp>
 | 
			
		||||
#include <boost/throw_exception.hpp>
 | 
			
		||||
#include <boost/core/addressof.hpp>
 | 
			
		||||
#include <boost/config.hpp>
 | 
			
		||||
@@ -388,7 +388,7 @@ public:
 | 
			
		||||
        typedef typename sp_convert_reference<D>::type D2;
 | 
			
		||||
 | 
			
		||||
        D2 d2( static_cast<D&&>( r.get_deleter() ) );
 | 
			
		||||
        pi_ = new sp_counted_impl_pd< typename std::unique_ptr<Y, D>::pointer, D2 >( r.get(), static_cast< D2&& >( d2 ) );
 | 
			
		||||
        pi_ = new sp_counted_impl_pd< typename std::unique_ptr<Y, D>::pointer, D2 >( r.get(), d2 );
 | 
			
		||||
 | 
			
		||||
#ifdef BOOST_NO_EXCEPTIONS
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -35,8 +35,6 @@ BOOST_PRAGMA_MESSAGE("Using CodeWarrior/PowerPC sp_counted_base")
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
BOOST_SP_OBSOLETE()
 | 
			
		||||
 | 
			
		||||
namespace boost
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
@@ -64,7 +62,11 @@ inline long atomic_decrement( register long * pw )
 | 
			
		||||
 | 
			
		||||
    asm
 | 
			
		||||
    {
 | 
			
		||||
#if defined(__PPCZen__) || defined(__PPCe500__) || defined(__PPCe500v2__)
 | 
			
		||||
    msync
 | 
			
		||||
#else
 | 
			
		||||
    sync
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
loop:
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,7 @@
 | 
			
		||||
 | 
			
		||||
#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/checked_delete.hpp>
 | 
			
		||||
#include <boost/core/addressof.hpp>
 | 
			
		||||
#include <boost/config.hpp>
 | 
			
		||||
 | 
			
		||||
@@ -156,13 +156,15 @@ public:
 | 
			
		||||
 | 
			
		||||
    // pre: d(p) must not throw
 | 
			
		||||
 | 
			
		||||
    sp_counted_impl_pd( P p, D & d ): ptr( p ), del( d )
 | 
			
		||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
 | 
			
		||||
 | 
			
		||||
    sp_counted_impl_pd( P p, D & d ): ptr( p ), del( static_cast< D&& >( d ) )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
    sp_counted_impl_pd( P p, D && d ): ptr( p ), del( static_cast< D&& >( d ) )
 | 
			
		||||
    sp_counted_impl_pd( P p, D & d ): ptr( p ), del( d )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -226,7 +228,7 @@ template<class P, class D, class A> class BOOST_SYMBOL_VISIBLE sp_counted_impl_p
 | 
			
		||||
private:
 | 
			
		||||
 | 
			
		||||
    P p_; // copy constructor must not throw
 | 
			
		||||
    D d_; // copy constructor must not throw
 | 
			
		||||
    D d_; // copy/move constructor must not throw
 | 
			
		||||
    A a_; // copy constructor must not throw
 | 
			
		||||
 | 
			
		||||
    sp_counted_impl_pda( sp_counted_impl_pda const & );
 | 
			
		||||
@@ -238,10 +240,20 @@ public:
 | 
			
		||||
 | 
			
		||||
    // pre: d( p ) must not throw
 | 
			
		||||
 | 
			
		||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
 | 
			
		||||
 | 
			
		||||
    sp_counted_impl_pda( P p, D & d, A a ): p_( p ), d_( static_cast< D&& >( d ) ), a_( a )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
    sp_counted_impl_pda( P p, D & d, A a ): p_( p ), d_( d ), a_( a )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    sp_counted_impl_pda( P p, A a ): p_( p ), d_( a ), a_( a )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@
 | 
			
		||||
 | 
			
		||||
#include <boost/config.hpp>
 | 
			
		||||
#include <boost/assert.hpp>
 | 
			
		||||
#include <boost/checked_delete.hpp>
 | 
			
		||||
#include <boost/core/checked_delete.hpp>
 | 
			
		||||
#include <boost/smart_ptr/detail/sp_nullptr_t.hpp>
 | 
			
		||||
#include <boost/smart_ptr/detail/sp_noexcept.hpp>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@
 | 
			
		||||
 | 
			
		||||
#include <boost/config.hpp>
 | 
			
		||||
#include <boost/assert.hpp>
 | 
			
		||||
#include <boost/checked_delete.hpp>
 | 
			
		||||
#include <boost/core/checked_delete.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>
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@
 | 
			
		||||
#include <memory>             // TR1 cyclic inclusion fix
 | 
			
		||||
 | 
			
		||||
#include <boost/assert.hpp>
 | 
			
		||||
#include <boost/checked_delete.hpp>
 | 
			
		||||
#include <boost/core/checked_delete.hpp>
 | 
			
		||||
 | 
			
		||||
#include <boost/smart_ptr/shared_ptr.hpp>
 | 
			
		||||
#include <boost/smart_ptr/detail/shared_count.hpp>
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@
 | 
			
		||||
#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/core/checked_delete.hpp>
 | 
			
		||||
#include <boost/throw_exception.hpp>
 | 
			
		||||
#include <boost/assert.hpp>
 | 
			
		||||
#include <boost/config.hpp>
 | 
			
		||||
@@ -374,39 +374,81 @@ public:
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //
 | 
			
		||||
    // Requirements: D's copy constructor must not throw
 | 
			
		||||
    // Requirements: D's copy/move constructors must not throw
 | 
			
		||||
    //
 | 
			
		||||
    // shared_ptr will release p by calling d(p)
 | 
			
		||||
    //
 | 
			
		||||
 | 
			
		||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
 | 
			
		||||
 | 
			
		||||
    template<class Y, class D> shared_ptr( Y * p, D d ): px( p ), pn( p, static_cast< D&& >( d ) )
 | 
			
		||||
    {
 | 
			
		||||
        boost::detail::sp_deleter_construct( this, p );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
    template<class Y, class D> shared_ptr( Y * p, D d ): px( p ), pn( p, d )
 | 
			
		||||
    {
 | 
			
		||||
        boost::detail::sp_deleter_construct( this, p );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
 | 
			
		||||
 | 
			
		||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
 | 
			
		||||
 | 
			
		||||
    template<class D> shared_ptr( boost::detail::sp_nullptr_t p, D d ): px( p ), pn( p, static_cast< D&& >( d ) )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
    template<class D> shared_ptr( boost::detail::sp_nullptr_t p, D d ): px( p ), pn( p, d )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    // As above, but with allocator. A's copy constructor shall not throw.
 | 
			
		||||
 | 
			
		||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
 | 
			
		||||
 | 
			
		||||
    template<class Y, class D, class A> shared_ptr( Y * p, D d, A a ): px( p ), pn( p, static_cast< D&& >( d ), a )
 | 
			
		||||
    {
 | 
			
		||||
        boost::detail::sp_deleter_construct( this, p );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
    template<class Y, class D, class A> shared_ptr( Y * p, D d, A a ): px( p ), pn( p, d, a )
 | 
			
		||||
    {
 | 
			
		||||
        boost::detail::sp_deleter_construct( this, p );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
 | 
			
		||||
 | 
			
		||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
 | 
			
		||||
 | 
			
		||||
    template<class D, class A> shared_ptr( boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( p, static_cast< D&& >( d ), a )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
    template<class D, class A> shared_ptr( boost::detail::sp_nullptr_t p, D d, A a ): px( p ), pn( p, d, a )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
//  generated copy constructor, destructor are fine...
 | 
			
		||||
 | 
			
		||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
 | 
			
		||||
@@ -625,9 +667,8 @@ public:
 | 
			
		||||
 | 
			
		||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
 | 
			
		||||
 | 
			
		||||
    shared_ptr( shared_ptr && r ) BOOST_SP_NOEXCEPT : px( r.px ), pn()
 | 
			
		||||
    shared_ptr( shared_ptr && r ) BOOST_SP_NOEXCEPT : px( r.px ), pn( static_cast< boost::detail::shared_count && >( r.pn ) )
 | 
			
		||||
    {
 | 
			
		||||
        pn.swap( r.pn );
 | 
			
		||||
        r.px = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -641,11 +682,9 @@ public:
 | 
			
		||||
    shared_ptr( shared_ptr<Y> && r )
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
    BOOST_SP_NOEXCEPT : px( r.px ), pn()
 | 
			
		||||
    BOOST_SP_NOEXCEPT : px( r.px ), pn( static_cast< boost::detail::shared_count && >( r.pn ) )
 | 
			
		||||
    {
 | 
			
		||||
        boost::detail::sp_assert_convertible< Y, T >();
 | 
			
		||||
 | 
			
		||||
        pn.swap( r.pn );
 | 
			
		||||
        r.px = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -693,6 +732,20 @@ public:
 | 
			
		||||
        this_type( p ).swap( *this );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
 | 
			
		||||
 | 
			
		||||
    template<class Y, class D> void reset( Y * p, D d )
 | 
			
		||||
    {
 | 
			
		||||
        this_type( p, static_cast< D&& >( d ) ).swap( *this );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    template<class Y, class D, class A> void reset( Y * p, D d, A a )
 | 
			
		||||
    {
 | 
			
		||||
        this_type( p, static_cast< D&& >( d ), a ).swap( *this );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
    template<class Y, class D> void reset( Y * p, D d )
 | 
			
		||||
    {
 | 
			
		||||
        this_type( p, d ).swap( *this );
 | 
			
		||||
@@ -703,6 +756,8 @@ public:
 | 
			
		||||
        this_type( p, d, a ).swap( *this );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    template<class Y> void reset( shared_ptr<Y> const & r, element_type * p ) BOOST_SP_NOEXCEPT
 | 
			
		||||
    {
 | 
			
		||||
        this_type( r, p ).swap( *this );
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								test/Jamfile
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								test/Jamfile
									
									
									
									
									
								
							@@ -81,7 +81,7 @@ 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 ;
 | 
			
		||||
  : <toolset>gcc-4.4.7:<build>no <toolset>gcc-4.4:<build>no ;
 | 
			
		||||
 | 
			
		||||
run atomic_count_test2.cpp ;
 | 
			
		||||
run sp_typeinfo_test.cpp ;
 | 
			
		||||
@@ -331,9 +331,9 @@ run weak_ptr_alias_move_test.cpp ;
 | 
			
		||||
 | 
			
		||||
run sp_typeinfo_test.cpp : : : <rtti>off : sp_typeinfo_test_no_rtti ;
 | 
			
		||||
 | 
			
		||||
run get_deleter_test.cpp : : : <rtti>off <toolset>gcc-4.4.7,<cxxstd>0x:<build>no : get_deleter_test_no_rtti ;
 | 
			
		||||
run get_deleter_test2.cpp : : : <rtti>off <toolset>gcc-4.4.7,<cxxstd>0x:<build>no : get_deleter_test2_no_rtti ;
 | 
			
		||||
run get_deleter_test3.cpp : : : <rtti>off <toolset>gcc-4.4.7,<cxxstd>0x:<build>no : get_deleter_test3_no_rtti ;
 | 
			
		||||
run get_deleter_test.cpp  : : : <rtti>off <toolset>gcc-4.4.7,<cxxstd>0x:<build>no <toolset>gcc-4.4,<cxxstd>0x:<build>no : get_deleter_test_no_rtti ;
 | 
			
		||||
run get_deleter_test2.cpp : : : <rtti>off <toolset>gcc-4.4.7,<cxxstd>0x:<build>no <toolset>gcc-4.4,<cxxstd>0x:<build>no : get_deleter_test2_no_rtti ;
 | 
			
		||||
run get_deleter_test3.cpp : : : <rtti>off <toolset>gcc-4.4.7,<cxxstd>0x:<build>no <toolset>gcc-4.4,<cxxstd>0x:<build>no : get_deleter_test3_no_rtti ;
 | 
			
		||||
 | 
			
		||||
run shared_from_test.cpp ;
 | 
			
		||||
run weak_from_test.cpp ;
 | 
			
		||||
@@ -352,6 +352,7 @@ run allocate_unique_noinit_test.cpp ;
 | 
			
		||||
run allocate_unique_test.cpp ;
 | 
			
		||||
run allocate_unique_throws_test.cpp ;
 | 
			
		||||
run allocate_unique_value_test.cpp ;
 | 
			
		||||
run get_allocator_pointer_test.cpp ;
 | 
			
		||||
 | 
			
		||||
run sp_guides_test.cpp ;
 | 
			
		||||
run sp_guides_test2.cpp ;
 | 
			
		||||
@@ -410,3 +411,4 @@ run owner_hash_test.cpp ;
 | 
			
		||||
run sp_unordered_test.cpp ;
 | 
			
		||||
 | 
			
		||||
run sp_unique_ptr_test2.cpp ;
 | 
			
		||||
run sp_move_only_deleter.cpp ;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										250
									
								
								test/get_allocator_pointer_test.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										250
									
								
								test/get_allocator_pointer_test.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,250 @@
 | 
			
		||||
/*
 | 
			
		||||
Copyright 2021 Glen Joseph Fernandes
 | 
			
		||||
(glenjofe@gmail.com)
 | 
			
		||||
 | 
			
		||||
Distributed under the Boost Software License, Version 1.0.
 | 
			
		||||
(http://www.boost.org/LICENSE_1_0.txt)
 | 
			
		||||
*/
 | 
			
		||||
#include <boost/config.hpp>
 | 
			
		||||
#if (!defined(BOOST_LIBSTDCXX_VERSION) || \
 | 
			
		||||
    BOOST_LIBSTDCXX_VERSION >= 46000) && \
 | 
			
		||||
    !defined(BOOST_NO_CXX11_SMART_PTR)
 | 
			
		||||
#include <boost/smart_ptr/allocate_unique.hpp>
 | 
			
		||||
#include <boost/core/lightweight_test.hpp>
 | 
			
		||||
 | 
			
		||||
template<class T>
 | 
			
		||||
class point {
 | 
			
		||||
public:
 | 
			
		||||
    point()
 | 
			
		||||
        : state_()
 | 
			
		||||
        , ptr_() { }
 | 
			
		||||
 | 
			
		||||
    point(int count, T* value)
 | 
			
		||||
        : state_(count)
 | 
			
		||||
        , ptr_(value) { }
 | 
			
		||||
 | 
			
		||||
    operator bool() const {
 | 
			
		||||
        return static_cast<bool>(ptr_);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    T* operator->() const {
 | 
			
		||||
        return ptr_;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    int state() const {
 | 
			
		||||
        return state_;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    int state_;
 | 
			
		||||
    T* ptr_;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
template<class T = void>
 | 
			
		||||
class creator {
 | 
			
		||||
public:
 | 
			
		||||
    typedef T value_type;
 | 
			
		||||
    typedef point<T> pointer;
 | 
			
		||||
    typedef std::ptrdiff_t difference_type;
 | 
			
		||||
 | 
			
		||||
    creator()
 | 
			
		||||
        : state_() { }
 | 
			
		||||
 | 
			
		||||
    explicit creator(int value)
 | 
			
		||||
        : state_(value) { }
 | 
			
		||||
 | 
			
		||||
    template<class U>
 | 
			
		||||
    creator(const creator<U>& other)
 | 
			
		||||
        : state_(other.state()) { }
 | 
			
		||||
 | 
			
		||||
    pointer allocate(std::size_t size) {
 | 
			
		||||
        return pointer(state_,
 | 
			
		||||
            static_cast<T*>(::operator new(sizeof(T) * size)));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void deallocate(pointer ptr, std::size_t) {
 | 
			
		||||
        ::operator delete(ptr.operator->());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    int state() const {
 | 
			
		||||
        return state_;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    int state_;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
template<class T, class U>
 | 
			
		||||
inline bool
 | 
			
		||||
operator==(const creator<T>&, const creator<U>&)
 | 
			
		||||
{
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template<class T, class U>
 | 
			
		||||
inline bool
 | 
			
		||||
operator!=(const creator<T>&, const creator<U>&)
 | 
			
		||||
{
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int main()
 | 
			
		||||
{
 | 
			
		||||
    {
 | 
			
		||||
        std::unique_ptr<int,
 | 
			
		||||
            boost::alloc_deleter<int, creator<> > > result =
 | 
			
		||||
            boost::allocate_unique<int>(creator<>(1));
 | 
			
		||||
        point<int> ptr = boost::get_allocator_pointer(result);
 | 
			
		||||
        BOOST_TEST_EQ(ptr.state(), 1);
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
        std::unique_ptr<const int,
 | 
			
		||||
            boost::alloc_deleter<const int, creator<> > > result =
 | 
			
		||||
            boost::allocate_unique<const int>(creator<>(2));
 | 
			
		||||
        point<int> ptr = boost::get_allocator_pointer(result);
 | 
			
		||||
        BOOST_TEST_EQ(ptr.state(), 2);
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
        std::unique_ptr<int[],
 | 
			
		||||
            boost::alloc_deleter<int[], creator<> > > result =
 | 
			
		||||
            boost::allocate_unique<int[]>(creator<>(3), 3);
 | 
			
		||||
        point<int> ptr = boost::get_allocator_pointer(result);
 | 
			
		||||
        BOOST_TEST_EQ(ptr.state(), 3);
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
        std::unique_ptr<int[],
 | 
			
		||||
            boost::alloc_deleter<int[3], creator<> > > result =
 | 
			
		||||
            boost::allocate_unique<int[3]>(creator<>(4));
 | 
			
		||||
        point<int> ptr = boost::get_allocator_pointer(result);
 | 
			
		||||
        BOOST_TEST_EQ(ptr.state(), 4);
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
        std::unique_ptr<int[][2],
 | 
			
		||||
            boost::alloc_deleter<int[][2], creator<> > > result =
 | 
			
		||||
            boost::allocate_unique<int[][2]>(creator<>(5), 2);
 | 
			
		||||
        point<int[2]> ptr = boost::get_allocator_pointer(result);
 | 
			
		||||
        BOOST_TEST_EQ(ptr.state(), 5);
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
        std::unique_ptr<int[][2],
 | 
			
		||||
            boost::alloc_deleter<int[2][2], creator<> > > result =
 | 
			
		||||
            boost::allocate_unique<int[2][2]>(creator<>(6));
 | 
			
		||||
        point<int[2]> ptr = boost::get_allocator_pointer(result);
 | 
			
		||||
        BOOST_TEST_EQ(ptr.state(), 6);
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
        std::unique_ptr<const int[],
 | 
			
		||||
            boost::alloc_deleter<const int[], creator<> > > result =
 | 
			
		||||
            boost::allocate_unique<const int[]>(creator<>(7), 3);
 | 
			
		||||
        point<int> ptr = boost::get_allocator_pointer(result);
 | 
			
		||||
        BOOST_TEST_EQ(ptr.state(), 7);
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
        std::unique_ptr<const int[],
 | 
			
		||||
            boost::alloc_deleter<const int[3], creator<> > > result =
 | 
			
		||||
            boost::allocate_unique<const int[3]>(creator<>(8));
 | 
			
		||||
        point<int> ptr = boost::get_allocator_pointer(result);
 | 
			
		||||
        BOOST_TEST_EQ(ptr.state(), 8);
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
        std::unique_ptr<const int[][2],
 | 
			
		||||
            boost::alloc_deleter<const int[][2], creator<> > > result =
 | 
			
		||||
            boost::allocate_unique<const int[][2]>(creator<>(9), 2);
 | 
			
		||||
        point<int[2]> ptr = boost::get_allocator_pointer(result);
 | 
			
		||||
        BOOST_TEST_EQ(ptr.state(), 9);
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
        std::unique_ptr<const int[][2],
 | 
			
		||||
            boost::alloc_deleter<const int[2][2], creator<> > > result =
 | 
			
		||||
            boost::allocate_unique<const int[2][2]>(creator<>(10));
 | 
			
		||||
        point<int[2]> ptr = boost::get_allocator_pointer(result);
 | 
			
		||||
        BOOST_TEST_EQ(ptr.state(), 10);
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
        std::unique_ptr<int,
 | 
			
		||||
            boost::alloc_deleter<int,
 | 
			
		||||
            boost::noinit_adaptor<creator<> > > > result =
 | 
			
		||||
            boost::allocate_unique_noinit<int>(creator<>(11));
 | 
			
		||||
        point<int> ptr = boost::get_allocator_pointer(result);
 | 
			
		||||
        BOOST_TEST_EQ(ptr.state(), 11);
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
        std::unique_ptr<const int,
 | 
			
		||||
            boost::alloc_deleter<const int,
 | 
			
		||||
            boost::noinit_adaptor<creator<> > > > result =
 | 
			
		||||
            boost::allocate_unique_noinit<const int>(creator<>(12));
 | 
			
		||||
        point<int> ptr = boost::get_allocator_pointer(result);
 | 
			
		||||
        BOOST_TEST_EQ(ptr.state(), 12);
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
        std::unique_ptr<int[],
 | 
			
		||||
            boost::alloc_deleter<int[],
 | 
			
		||||
            boost::noinit_adaptor<creator<> > > > result =
 | 
			
		||||
            boost::allocate_unique_noinit<int[]>(creator<>(13), 3);
 | 
			
		||||
        point<int> ptr = boost::get_allocator_pointer(result);
 | 
			
		||||
        BOOST_TEST_EQ(ptr.state(), 13);
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
        std::unique_ptr<int[],
 | 
			
		||||
            boost::alloc_deleter<int[3],
 | 
			
		||||
            boost::noinit_adaptor<creator<> > > > result =
 | 
			
		||||
            boost::allocate_unique_noinit<int[3]>(creator<>(14));
 | 
			
		||||
        point<int> ptr = boost::get_allocator_pointer(result);
 | 
			
		||||
        BOOST_TEST_EQ(ptr.state(), 14);
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
        std::unique_ptr<int[][2],
 | 
			
		||||
            boost::alloc_deleter<int[][2],
 | 
			
		||||
            boost::noinit_adaptor<creator<> > > > result =
 | 
			
		||||
            boost::allocate_unique_noinit<int[][2]>(creator<>(15), 2);
 | 
			
		||||
        point<int[2]> ptr = boost::get_allocator_pointer(result);
 | 
			
		||||
        BOOST_TEST_EQ(ptr.state(), 15);
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
        std::unique_ptr<int[][2],
 | 
			
		||||
            boost::alloc_deleter<int[2][2],
 | 
			
		||||
            boost::noinit_adaptor<creator<> > > > result =
 | 
			
		||||
            boost::allocate_unique_noinit<int[2][2]>(creator<>(16));
 | 
			
		||||
        point<int[2]> ptr = boost::get_allocator_pointer(result);
 | 
			
		||||
        BOOST_TEST_EQ(ptr.state(), 16);
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
        std::unique_ptr<const int[],
 | 
			
		||||
            boost::alloc_deleter<const int[],
 | 
			
		||||
            boost::noinit_adaptor<creator<> > > > result =
 | 
			
		||||
            boost::allocate_unique_noinit<const int[]>(creator<>(17), 3);
 | 
			
		||||
        point<int> ptr = boost::get_allocator_pointer(result);
 | 
			
		||||
        BOOST_TEST_EQ(ptr.state(), 17);
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
        std::unique_ptr<const int[],
 | 
			
		||||
            boost::alloc_deleter<const int[3],
 | 
			
		||||
            boost::noinit_adaptor<creator<> > > > result =
 | 
			
		||||
            boost::allocate_unique_noinit<const int[3]>(creator<>(18));
 | 
			
		||||
        point<int> ptr = boost::get_allocator_pointer(result);
 | 
			
		||||
        BOOST_TEST_EQ(ptr.state(), 18);
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
        std::unique_ptr<const int[][2],
 | 
			
		||||
            boost::alloc_deleter<const int[][2],
 | 
			
		||||
            boost::noinit_adaptor<creator<> > > > result =
 | 
			
		||||
            boost::allocate_unique_noinit<const int[][2]>(creator<>(19), 2);
 | 
			
		||||
        point<int[2]> ptr = boost::get_allocator_pointer(result);
 | 
			
		||||
        BOOST_TEST_EQ(ptr.state(), 19);
 | 
			
		||||
    }
 | 
			
		||||
    {
 | 
			
		||||
        std::unique_ptr<const int[][2],
 | 
			
		||||
            boost::alloc_deleter<const int[2][2],
 | 
			
		||||
            boost::noinit_adaptor<creator<> > > > result =
 | 
			
		||||
            boost::allocate_unique_noinit<const int[2][2]>(creator<>(20));
 | 
			
		||||
        point<int[2]> ptr = boost::get_allocator_pointer(result);
 | 
			
		||||
        BOOST_TEST_EQ(ptr.state(), 20);
 | 
			
		||||
    }
 | 
			
		||||
    return boost::report_errors();
 | 
			
		||||
}
 | 
			
		||||
#else
 | 
			
		||||
int main()
 | 
			
		||||
{
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
							
								
								
									
										153
									
								
								test/sp_move_only_deleter.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										153
									
								
								test/sp_move_only_deleter.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,153 @@
 | 
			
		||||
// Copyright 2021 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/core/lightweight_test.hpp>
 | 
			
		||||
#include <boost/config.hpp>
 | 
			
		||||
#include <boost/config/pragma_message.hpp>
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <utility>
 | 
			
		||||
 | 
			
		||||
#if defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
 | 
			
		||||
 | 
			
		||||
BOOST_PRAGMA_MESSAGE("Skipping test because BOOST_NO_CXX11_RVALUE_REFERENCES is defined")
 | 
			
		||||
int main() {}
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
struct Y
 | 
			
		||||
{
 | 
			
		||||
    static int instances;
 | 
			
		||||
 | 
			
		||||
    bool deleted_;
 | 
			
		||||
 | 
			
		||||
    Y(): deleted_( false )
 | 
			
		||||
    {
 | 
			
		||||
        ++instances;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ~Y()
 | 
			
		||||
    {
 | 
			
		||||
        BOOST_TEST( deleted_ );
 | 
			
		||||
        --instances;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
 | 
			
		||||
    Y( Y const & );
 | 
			
		||||
    Y & operator=( Y const & );
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
int Y::instances = 0;
 | 
			
		||||
 | 
			
		||||
struct YD
 | 
			
		||||
{
 | 
			
		||||
    bool moved_;
 | 
			
		||||
 | 
			
		||||
    YD(): moved_( false )
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    YD( YD&& r ): moved_( false )
 | 
			
		||||
    {
 | 
			
		||||
        r.moved_ = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void operator()( Y* p ) const
 | 
			
		||||
    {
 | 
			
		||||
        BOOST_TEST( !moved_ );
 | 
			
		||||
 | 
			
		||||
        if( p )
 | 
			
		||||
        {
 | 
			
		||||
            p->deleted_ = true;
 | 
			
		||||
            delete p;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
 | 
			
		||||
    YD( YD const & );
 | 
			
		||||
    YD & operator=( YD const & );
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
int main()
 | 
			
		||||
{
 | 
			
		||||
    BOOST_TEST( Y::instances == 0 );
 | 
			
		||||
 | 
			
		||||
    {
 | 
			
		||||
        YD del;
 | 
			
		||||
        boost::shared_ptr<Y> p( new Y, std::move( del ) );
 | 
			
		||||
 | 
			
		||||
        BOOST_TEST( Y::instances == 1 );
 | 
			
		||||
        BOOST_TEST( del.moved_ );
 | 
			
		||||
 | 
			
		||||
        p.reset( new Y, YD() );
 | 
			
		||||
 | 
			
		||||
        BOOST_TEST( Y::instances == 1 );
 | 
			
		||||
 | 
			
		||||
        p = boost::shared_ptr<Y>( new Y, YD() );
 | 
			
		||||
 | 
			
		||||
        BOOST_TEST( Y::instances == 1 );
 | 
			
		||||
 | 
			
		||||
        YD del2;
 | 
			
		||||
        p.reset( new Y, std::move( del2 ) );
 | 
			
		||||
 | 
			
		||||
        BOOST_TEST( Y::instances == 1 );
 | 
			
		||||
        BOOST_TEST( del2.moved_ );
 | 
			
		||||
 | 
			
		||||
        p.reset();
 | 
			
		||||
        BOOST_TEST( Y::instances == 0 );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    {
 | 
			
		||||
        YD del;
 | 
			
		||||
        boost::shared_ptr<Y> p( new Y, std::move( del ), std::allocator<Y>() );
 | 
			
		||||
 | 
			
		||||
        BOOST_TEST( Y::instances == 1 );
 | 
			
		||||
        BOOST_TEST( del.moved_ );
 | 
			
		||||
 | 
			
		||||
        p.reset( new Y, YD(), std::allocator<Y>() );
 | 
			
		||||
 | 
			
		||||
        BOOST_TEST( Y::instances == 1 );
 | 
			
		||||
 | 
			
		||||
        p = boost::shared_ptr<Y>( new Y, YD(), std::allocator<Y>() );
 | 
			
		||||
 | 
			
		||||
        BOOST_TEST( Y::instances == 1 );
 | 
			
		||||
 | 
			
		||||
        YD del2;
 | 
			
		||||
        p.reset( new Y, std::move( del2 ), std::allocator<Y>() );
 | 
			
		||||
 | 
			
		||||
        BOOST_TEST( Y::instances == 1 );
 | 
			
		||||
        BOOST_TEST( del2.moved_ );
 | 
			
		||||
 | 
			
		||||
        p.reset();
 | 
			
		||||
        BOOST_TEST( Y::instances == 0 );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#if !defined( BOOST_NO_CXX11_NULLPTR )
 | 
			
		||||
 | 
			
		||||
    {
 | 
			
		||||
        boost::shared_ptr<Y> p( nullptr, YD() );
 | 
			
		||||
 | 
			
		||||
        YD del;
 | 
			
		||||
        p = boost::shared_ptr<Y>( nullptr, std::move( del ) );
 | 
			
		||||
 | 
			
		||||
        BOOST_TEST( del.moved_ );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    {
 | 
			
		||||
        boost::shared_ptr<Y> p( nullptr, YD(), std::allocator<Y>() );
 | 
			
		||||
 | 
			
		||||
        YD del;
 | 
			
		||||
        p = boost::shared_ptr<Y>( nullptr, std::move( del ), std::allocator<Y>() );
 | 
			
		||||
 | 
			
		||||
        BOOST_TEST( del.moved_ );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    return boost::report_errors();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
		Reference in New Issue
	
	Block a user