Compare commits

...

14 Commits

Author SHA1 Message Date
8c5caaf594 glob headers 2022-07-05 10:48:33 +02:00
6eaae5f10b Rework as esp-idf component 2022-07-04 20:18:27 +02:00
59b5b17e81 Add support for different sync instructions for CodeWarrior PPC (#95)
* Use msync or se_isync as appropriate for CodeWarrior PPC

* Un-obsolete sp_counted_base_cw_ppc

* Remove untested VLE_ON branch

* Use the supported compiler intrinsic __sync(); instead of msync asm

* Revert "Use the supported compiler intrinsic __sync(); instead of msync asm"

This reverts commit 9b92ea28f0.
2022-06-22 18:41:00 +03:00
f2ab3b21f0 Merge pull request #90 from fanquake/use_core_checked_delete
refactor: use boost/core/checked_delete.hpp over boost/checked_delete.hpp
2022-05-20 03:45:08 +03:00
e04196b6a1 Update ci.yml 2022-05-20 01:35:15 +03:00
95eaa2d7c3 Update shared_ptr move constructors to improve codegen 2022-05-19 22:20:50 +03:00
2e31d0d633 Add ubuntu-22.04 to posix-cmake-test in ci.yml 2022-05-19 21:09:26 +03:00
b8cb132ab4 Update ci.yml 2022-05-19 20:15:52 +03:00
f4d7116241 refactor: use core/checked_delete.hpp over checked_delete.hpp
boost/checked_delete.hpp has been deprecated.
2022-04-03 16:49:10 +01:00
f2cc84a23c Correct example in documentation 2021-12-17 01:36:17 -05:00
f12a33813d Remove msvc-14.2 (in GHA); use clang-win from 2019 2021-12-17 02:49:45 +02:00
cfde4f7407 Correct spelling in changelog 2021-12-16 11:47:55 -05:00
b8d340b495 Update changelog 2021-12-16 11:29:54 -05:00
6716193d9c Add get_allocator_pointer 2021-12-16 11:26:11 -05:00
15 changed files with 524 additions and 39 deletions

View File

@ -20,33 +20,48 @@ jobs:
- toolset: gcc-4.8
cxxstd: "03,11"
os: ubuntu-18.04
install: g++-4.8
install: g++-4.8-multilib
address-model: 32,64
- toolset: gcc-5
cxxstd: "03,11,14,1z"
os: ubuntu-18.04
install: g++-5
install: g++-5-multilib
address-model: 32,64
- toolset: gcc-6
cxxstd: "03,11,14,1z"
os: ubuntu-18.04
install: g++-6
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-20.04
install: g++-9-multilib
address-model: 32,64
- toolset: gcc-10
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
install: g++-10
install: g++-10-multilib
address-model: 32,64
- toolset: gcc-11
cxxstd: "03,11,14,17,2a"
cxxstd: "03,11,14,17,20"
os: ubuntu-20.04
install: g++-11
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"
@ -86,17 +101,24 @@ jobs:
compiler: clang++-10
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
install: clang-10
- toolset: clang
compiler: clang++-11
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
install: clang-11
- toolset: clang
compiler: clang++-12
cxxstd: "03,11,14,17,2a"
cxxstd: "03,11,14,17,20"
os: ubuntu-20.04
install: clang-12
- 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
@ -140,22 +162,26 @@ 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"
- toolset: msvc-14.0
cxxstd: 14,latest
addrmd: 32,64
os: windows-2016
os: windows-2019
- toolset: msvc-14.2
cxxstd: "14,17,latest"
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
@ -195,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

View File

@ -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()

View File

@ -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

View File

@ -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`

View File

@ -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`

View File

@ -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

View File

@ -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>

View File

@ -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:

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>
@ -667,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;
}
@ -683,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;
}

View File

@ -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 ;

View 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