mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-08-01 05:34:36 +02:00
Derive empty base optimization from rebound allocator
This commit is contained in:
@@ -28,6 +28,12 @@ namespace boost {
|
|||||||
size(size_ * array_total<T>::size) {
|
size(size_ * array_total<T>::size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class U>
|
||||||
|
as_size_base(const as_size_base<T[], U>& other)
|
||||||
|
: A(other),
|
||||||
|
size(other.size) {
|
||||||
|
}
|
||||||
|
|
||||||
std::size_t size;
|
std::size_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -38,6 +44,11 @@ namespace boost {
|
|||||||
: A(allocator) {
|
: A(allocator) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class U>
|
||||||
|
as_size_base(const as_size_base<T[N], U>& other)
|
||||||
|
: A(other) {
|
||||||
|
}
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
size = array_total<T[N]>::size
|
size = array_total<T[N]>::size
|
||||||
};
|
};
|
||||||
@@ -58,9 +69,13 @@ namespace boost {
|
|||||||
|
|
||||||
template<class T, class R, class A, class Y = char>
|
template<class T, class R, class A, class Y = char>
|
||||||
class as_allocator
|
class as_allocator
|
||||||
: as_size_base<T, A> {
|
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
|
||||||
using as_size_base<T, A>::size;
|
: as_size_base<T, typename std::allocator_traits<A>::
|
||||||
|
template rebind_alloc<Y> > {
|
||||||
|
#else
|
||||||
|
: as_size_base<T, typename A::
|
||||||
|
template rebind<Y>::other> {
|
||||||
|
#endif
|
||||||
template<class T_, class R_, class A_, class Y_>
|
template<class T_, class R_, class A_, class Y_>
|
||||||
friend class as_allocator;
|
friend class as_allocator;
|
||||||
|
|
||||||
@@ -78,6 +93,8 @@ namespace boost {
|
|||||||
typedef typename A::template rebind<char>::other CA;
|
typedef typename A::template rebind<char>::other CA;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
using as_size_base<T, YA>::size;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef typename array_base<T>::type type;
|
typedef typename array_base<T>::type type;
|
||||||
|
|
||||||
@@ -105,36 +122,30 @@ namespace boost {
|
|||||||
};
|
};
|
||||||
|
|
||||||
as_allocator(const A& allocator, type** result)
|
as_allocator(const A& allocator, type** result)
|
||||||
: as_size_base<T, A>(allocator),
|
: as_size_base<T, YA>(allocator),
|
||||||
data(result) {
|
data(result) {
|
||||||
}
|
}
|
||||||
|
|
||||||
as_allocator(const A& allocator, std::size_t size_,
|
as_allocator(const A& allocator, std::size_t size_,
|
||||||
type** result)
|
type** result)
|
||||||
: as_size_base<T, A>(allocator, size_),
|
: as_size_base<T, YA>(allocator, size_),
|
||||||
data(result) {
|
data(result) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class U>
|
template<class U>
|
||||||
as_allocator(const as_allocator<T, R, A, U>& other)
|
as_allocator(const as_allocator<T, R, A, U>& other)
|
||||||
: as_size_base<T, A>(other),
|
: as_size_base<T, YA>(other),
|
||||||
data(other.data) {
|
data(other.data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pointer address(reference value) const {
|
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
|
||||||
YA ya(*this);
|
|
||||||
return ya.address(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
const_pointer address(const_reference value) const {
|
|
||||||
YA ya(*this);
|
|
||||||
return ya.address(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_type max_size() const {
|
size_type max_size() const {
|
||||||
YA ya(*this);
|
return YT::max_size(*this);
|
||||||
return ya.max_size();
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
using YA::address;
|
||||||
|
using YA::max_size;
|
||||||
|
#endif
|
||||||
|
|
||||||
pointer allocate(size_type count, const void* value = 0) {
|
pointer allocate(size_type count, const void* value = 0) {
|
||||||
enum {
|
enum {
|
||||||
@@ -171,21 +182,19 @@ namespace boost {
|
|||||||
|
|
||||||
template<class U>
|
template<class U>
|
||||||
void construct(U* memory, const_reference value) {
|
void construct(U* memory, const_reference value) {
|
||||||
YA ya(*this);
|
|
||||||
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
|
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
|
||||||
YT::construct(ya, memory, value);
|
YT::construct(*this, memory, value);
|
||||||
#else
|
#else
|
||||||
ya.construct(memory, value);
|
YA::construct(memory, value);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class U>
|
template<class U>
|
||||||
void destroy(U* memory) {
|
void destroy(U* memory) {
|
||||||
YA ya(*this);
|
|
||||||
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
|
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
|
||||||
YT::destroy(ya, memory);
|
YT::destroy(*this, memory);
|
||||||
#else
|
#else
|
||||||
ya.destroy(memory);
|
YA::destroy(memory);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,8 +203,7 @@ namespace boost {
|
|||||||
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||||
template<class U, class... Args>
|
template<class U, class... Args>
|
||||||
void construct(U* memory, Args&&... args) {
|
void construct(U* memory, Args&&... args) {
|
||||||
YA ya(*this);
|
YT::construct(*this, memory, std::forward<Args>(args)...);
|
||||||
YT::construct(ya, memory, std::forward<Args>(args)...);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -223,8 +231,7 @@ namespace boost {
|
|||||||
private:
|
private:
|
||||||
void free(ms_init_tag) {
|
void free(ms_init_tag) {
|
||||||
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
|
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
|
||||||
const A& a1(*this);
|
as_destroy(*this, data.object, size);
|
||||||
as_destroy(a1, data.object, size);
|
|
||||||
#else
|
#else
|
||||||
ms_destroy(data.object, size);
|
ms_destroy(data.object, size);
|
||||||
#endif
|
#endif
|
||||||
@@ -295,6 +302,7 @@ namespace boost {
|
|||||||
data(other.data) {
|
data(other.data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(BOOST_NO_CXX11_ALLOCATOR)
|
||||||
pointer address(reference value) const {
|
pointer address(reference value) const {
|
||||||
return &value;
|
return &value;
|
||||||
}
|
}
|
||||||
@@ -302,6 +310,7 @@ namespace boost {
|
|||||||
const_pointer address(const_reference value) const {
|
const_pointer address(const_reference value) const {
|
||||||
return &value;
|
return &value;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
size_type max_size() const {
|
size_type max_size() const {
|
||||||
enum {
|
enum {
|
||||||
|
@@ -20,7 +20,7 @@ namespace boost {
|
|||||||
typedef ms_in_allocator_tag D;
|
typedef ms_in_allocator_tag D;
|
||||||
typedef sp_counted_impl_pda<P, D, A> Y;
|
typedef sp_counted_impl_pda<P, D, A> Y;
|
||||||
public:
|
public:
|
||||||
sp_counted_impl_pda(P, const D&, const A& allocator_)
|
sp_counted_impl_pda(P, D, const A& allocator_)
|
||||||
: allocator(allocator_) {
|
: allocator(allocator_) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -30,50 +30,50 @@
|
|||||||
user-supplied allocator, allowing finer control.</p>
|
user-supplied allocator, allowing finer control.</p>
|
||||||
<h2><a name="synopsis">Synopsis</a></h2>
|
<h2><a name="synopsis">Synopsis</a></h2>
|
||||||
<pre>namespace boost {
|
<pre>namespace boost {
|
||||||
template<typename U> // U is T[]
|
template<class U> // U is T[]
|
||||||
shared_ptr<U> <a href="#functions">make_shared</a>(size_t size);
|
shared_ptr<U> <a href="#functions">make_shared</a>(size_t size);
|
||||||
|
|
||||||
template<typename U, typename A> // U is T[]
|
template<class U, class A> // U is T[]
|
||||||
shared_ptr<U> <a href="#functions">allocate_shared</a>(const A& allocator, size_t size);
|
shared_ptr<U> <a href="#functions">allocate_shared</a>(const A& allocator, size_t size);
|
||||||
|
|
||||||
template<typename U> // U is T[N]
|
template<class U> // U is T[N]
|
||||||
shared_ptr<U> <a href="#functions">make_shared</a>();
|
shared_ptr<U> <a href="#functions">make_shared</a>();
|
||||||
|
|
||||||
template<typename U, typename A> // U is T[N]
|
template<class U, class A> // U is T[N]
|
||||||
shared_ptr<U> <a href="#functions">allocate_shared</a>(const A& allocator);
|
shared_ptr<U> <a href="#functions">allocate_shared</a>(const A& allocator);
|
||||||
|
|
||||||
template<typename U> // U is T[]
|
template<class U> // U is T[]
|
||||||
shared_ptr<U> <a href="#functions">make_shared</a>(size_t size, const T& value);
|
shared_ptr<U> <a href="#functions">make_shared</a>(size_t size, const T& value);
|
||||||
|
|
||||||
template<typename U, typename A> // U is T[]
|
template<class U, class A> // U is T[]
|
||||||
shared_ptr<U> <a href="#functions">allocate_shared</a>(const A& allocator, size_t size, const T& value);
|
shared_ptr<U> <a href="#functions">allocate_shared</a>(const A& allocator, size_t size, const T& value);
|
||||||
|
|
||||||
template<typename U> // U is T[N]
|
template<class U> // U is T[N]
|
||||||
shared_ptr<U> <a href="#functions">make_shared</a>(const T& value);
|
shared_ptr<U> <a href="#functions">make_shared</a>(const T& value);
|
||||||
|
|
||||||
template<typename U, typename A> // U is T[N]
|
template<class U, class A> // U is T[N]
|
||||||
shared_ptr<U> <a href="#functions">allocate_shared</a>(const A& allocator, const T& value);
|
shared_ptr<U> <a href="#functions">allocate_shared</a>(const A& allocator, const T& value);
|
||||||
|
|
||||||
template<typename U> // U is T[]
|
template<class U> // U is T[]
|
||||||
shared_ptr<U> <a href="#functions">make_shared_noinit</a>(size_t size);
|
shared_ptr<U> <a href="#functions">make_shared_noinit</a>(size_t size);
|
||||||
|
|
||||||
template<typename U, typename A> // U is T[]
|
template<class U, class A> // U is T[]
|
||||||
shared_ptr<U> <a href="#functions">allocate_shared_noinit</a>(const A& allocator, size_t size);
|
shared_ptr<U> <a href="#functions">allocate_shared_noinit</a>(const A& allocator, size_t size);
|
||||||
|
|
||||||
template<typename U> // U is T[N]
|
template<class U> // U is T[N]
|
||||||
shared_ptr<U> <a href="#functions">make_shared_noinit</a>();
|
shared_ptr<U> <a href="#functions">make_shared_noinit</a>();
|
||||||
|
|
||||||
template<typename U, typename A> // U is T[N]
|
template<class U, class A> // U is T[N]
|
||||||
shared_ptr<U> <a href="#functions">allocate_shared_noinit</a>(const A& allocator);
|
shared_ptr<U> <a href="#functions">allocate_shared_noinit</a>(const A& allocator);
|
||||||
}</pre>
|
}</pre>
|
||||||
<h2><a name="common">Common Requirements</a></h2>
|
<h2><a name="common">Common Requirements</a></h2>
|
||||||
<pre>template<typename U>
|
<pre>template<class U>
|
||||||
shared_ptr<U> make_shared(<em>args</em>);
|
shared_ptr<U> make_shared(<em>args</em>);
|
||||||
template<typename U, typename A>
|
template<class U, class A>
|
||||||
shared_ptr<U> allocate_shared(const A& allocator, <em>args</em>);
|
shared_ptr<U> allocate_shared(const A& allocator, <em>args</em>);
|
||||||
template<typename U>
|
template<class U>
|
||||||
shared_ptr<U> make_shared_noinit(<em>args</em>);
|
shared_ptr<U> make_shared_noinit(<em>args</em>);
|
||||||
template<typename U, typename A>
|
template<class U, class A>
|
||||||
shared_ptr<U> allocate_shared_noinit(const A& allocator, <em>args</em>);</pre>
|
shared_ptr<U> allocate_shared_noinit(const A& allocator, <em>args</em>);</pre>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p><b>Requires:</b> <code>U</code> is of the form <code>T[]</code> or
|
<p><b>Requires:</b> <code>U</code> is of the form <code>T[]</code> or
|
||||||
@@ -157,9 +157,9 @@ template<typename U, typename A>
|
|||||||
structures such as the reference counts.</p>
|
structures such as the reference counts.</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<h2><a name="functions">Free Functions</a></h2>
|
<h2><a name="functions">Free Functions</a></h2>
|
||||||
<pre>template<typename U>
|
<pre>template<class U>
|
||||||
shared_ptr<U> make_shared(size_t size);
|
shared_ptr<U> make_shared(size_t size);
|
||||||
template<typename U, typename A>
|
template<class U, class A>
|
||||||
shared_ptr<U> allocate_shared(const A& allocator, size_t size);</pre>
|
shared_ptr<U> allocate_shared(const A& allocator, size_t size);</pre>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p><b>Returns:</b> A <code>shared_ptr</code> to a value-initialized
|
<p><b>Returns:</b> A <code>shared_ptr</code> to a value-initialized
|
||||||
@@ -172,9 +172,9 @@ template<typename U, typename A>
|
|||||||
boost::shared_ptr<int[][2]> a2 = boost::make_shared<int[][2]>(size);</pre>
|
boost::shared_ptr<int[][2]> a2 = boost::make_shared<int[][2]>(size);</pre>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<pre>template<typename U>
|
<pre>template<class U>
|
||||||
shared_ptr<U> make_shared();
|
shared_ptr<U> make_shared();
|
||||||
template<typename U, typename A>
|
template<class U, class A>
|
||||||
shared_ptr<U> allocate_shared(const A& allocator);</pre>
|
shared_ptr<U> allocate_shared(const A& allocator);</pre>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p><b>Returns:</b> A <code>shared_ptr</code> to a value-initialized
|
<p><b>Returns:</b> A <code>shared_ptr</code> to a value-initialized
|
||||||
@@ -187,9 +187,9 @@ template<typename U, typename A>
|
|||||||
boost::shared_ptr<int[4][2]> a2 = boost::make_shared<int[4][2]>();</pre>
|
boost::shared_ptr<int[4][2]> a2 = boost::make_shared<int[4][2]>();</pre>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<pre>template<typename U>
|
<pre>template<class U>
|
||||||
shared_ptr<U> make_shared(size_t size, const T& value);
|
shared_ptr<U> make_shared(size_t size, const T& value);
|
||||||
template<typename U, typename A>
|
template<class U, class A>
|
||||||
shared_ptr<U> allocate_shared(const A& allocator, size_t size, const T& value);</pre>
|
shared_ptr<U> allocate_shared(const A& allocator, size_t size, const T& value);</pre>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p><b>Returns:</b> A <code>shared_ptr</code> to an object of type
|
<p><b>Returns:</b> A <code>shared_ptr</code> to an object of type
|
||||||
@@ -203,9 +203,9 @@ template<typename U, typename A>
|
|||||||
boost::shared_ptr<int[][2]> a2 = boost::make_shared<int[][2]>(size, {1, 2});</pre>
|
boost::shared_ptr<int[][2]> a2 = boost::make_shared<int[][2]>(size, {1, 2});</pre>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<pre>template<typename U>
|
<pre>template<class U>
|
||||||
shared_ptr<U> make_shared(const T& value);
|
shared_ptr<U> make_shared(const T& value);
|
||||||
template<typename U, typename A>
|
template<class U, class A>
|
||||||
shared_ptr<U> allocate_shared(const A& allocator, const T& value);</pre>
|
shared_ptr<U> allocate_shared(const A& allocator, const T& value);</pre>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p><b>Returns:</b> A <code>shared_ptr</code> to an object of type
|
<p><b>Returns:</b> A <code>shared_ptr</code> to an object of type
|
||||||
@@ -219,9 +219,9 @@ template<typename U, typename A>
|
|||||||
boost::shared_ptr<int[4][2]> a2 = boost::make_shared<int[4][2]>({1, 2});</pre>
|
boost::shared_ptr<int[4][2]> a2 = boost::make_shared<int[4][2]>({1, 2});</pre>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<pre>template<typename U>
|
<pre>template<class U>
|
||||||
shared_ptr<U> make_shared_noinit(size_t size);
|
shared_ptr<U> make_shared_noinit(size_t size);
|
||||||
template<typename U, typename A>
|
template<class U, class A>
|
||||||
shared_ptr<U> allocate_shared_noinit(const A& allocator, size_t size);</pre>
|
shared_ptr<U> allocate_shared_noinit(const A& allocator, size_t size);</pre>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p><b>Returns:</b> A <code>shared_ptr</code> to a default-initialized
|
<p><b>Returns:</b> A <code>shared_ptr</code> to a default-initialized
|
||||||
@@ -234,9 +234,9 @@ template<typename U, typename A>
|
|||||||
boost::shared_ptr<int[][2]> a2 = boost::make_shared_noinit<int[][2]>(size);</pre>
|
boost::shared_ptr<int[][2]> a2 = boost::make_shared_noinit<int[][2]>(size);</pre>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<pre>template<typename U>
|
<pre>template<class U>
|
||||||
shared_ptr<U> make_shared_noinit();
|
shared_ptr<U> make_shared_noinit();
|
||||||
template<typename U, typename A>
|
template<class U, class A>
|
||||||
shared_ptr<U> allocate_shared_noinit(const A& allocator);</pre>
|
shared_ptr<U> allocate_shared_noinit(const A& allocator);</pre>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p><b>Returns:</b> A <code>shared_ptr</code> to a default-initialized
|
<p><b>Returns:</b> A <code>shared_ptr</code> to a default-initialized
|
||||||
|
@@ -18,30 +18,30 @@
|
|||||||
<code>unique_ptr</code> objects.</p>
|
<code>unique_ptr</code> objects.</p>
|
||||||
<h2><a name="synopsis">Synopsis</a></h2>
|
<h2><a name="synopsis">Synopsis</a></h2>
|
||||||
<pre>namespace boost {
|
<pre>namespace boost {
|
||||||
template<typename U> // U is not array
|
template<class U> // U is not array
|
||||||
unique_ptr<U> <a href="#functions">make_unique</a>();
|
unique_ptr<U> <a href="#functions">make_unique</a>();
|
||||||
|
|
||||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||||
template<typename U, typename... Args> // U is not array
|
template<class U, class... Args> // U is not array
|
||||||
unique_ptr<U> <a href="#functions">make_unique</a>(Args&&... args);
|
unique_ptr<U> <a href="#functions">make_unique</a>(Args&&... args);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template<typename U> // U is not array
|
template<class U> // U is not array
|
||||||
unique_ptr<U> <a href="#functions">make_unique</a>(U&& value);
|
unique_ptr<U> <a href="#functions">make_unique</a>(U&& value);
|
||||||
|
|
||||||
template<typename U> // U is T[]
|
template<class U> // U is T[]
|
||||||
unique_ptr<U> <a href="#functions">make_unique</a>(size_t size);
|
unique_ptr<U> <a href="#functions">make_unique</a>(size_t size);
|
||||||
|
|
||||||
template<typename U> // U is not array
|
template<class U> // U is not array
|
||||||
unique_ptr<U> <a href="#functions">make_unique_noinit</a>();
|
unique_ptr<U> <a href="#functions">make_unique_noinit</a>();
|
||||||
|
|
||||||
template<typename U> // U is T[]
|
template<class U> // U is T[]
|
||||||
unique_ptr<U> <a href="#functions">make_unique_noinit</a>(size_t size);
|
unique_ptr<U> <a href="#functions">make_unique_noinit</a>(size_t size);
|
||||||
}</pre>
|
}</pre>
|
||||||
<h2><a name="common">Common Requirements</a></h2>
|
<h2><a name="common">Common Requirements</a></h2>
|
||||||
<pre>template<typename U>
|
<pre>template<class U>
|
||||||
unique_ptr<U> make_unique(<em>args</em>);
|
unique_ptr<U> make_unique(<em>args</em>);
|
||||||
template<typename U>
|
template<class U>
|
||||||
unique_ptr<U> make_unique_noinit(<em>args</em>);</pre>
|
unique_ptr<U> make_unique_noinit(<em>args</em>);</pre>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p><b>Effects:</b> Allocates memory for an object of type <code>U</code>
|
<p><b>Effects:</b> Allocates memory for an object of type <code>U</code>
|
||||||
@@ -73,7 +73,7 @@ template<typename U>
|
|||||||
</blockquote>
|
</blockquote>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<h2><a name="functions">Free Functions</a></h2>
|
<h2><a name="functions">Free Functions</a></h2>
|
||||||
<pre>template<typename U, typename... Args>
|
<pre>template<class U, class... Args>
|
||||||
unique_ptr<U> make_unique(Args&&... args);</pre>
|
unique_ptr<U> make_unique(Args&&... args);</pre>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p><b>Returns:</b> A unique_ptr to an object of type <code>U</code>,
|
<p><b>Returns:</b> A unique_ptr to an object of type <code>U</code>,
|
||||||
@@ -86,7 +86,7 @@ unique_ptr<U> make_unique(Args&&... args);</pre>
|
|||||||
unique_ptr<point> p2 = boost::make_unique<point>(x, y);</pre>
|
unique_ptr<point> p2 = boost::make_unique<point>(x, y);</pre>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<pre>template<typename U>
|
<pre>template<class U>
|
||||||
unique_ptr<U> make_unique(U&& value);</pre>
|
unique_ptr<U> make_unique(U&& value);</pre>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p><b>Returns:</b> A unique_ptr to an object of type <code>U</code>,
|
<p><b>Returns:</b> A unique_ptr to an object of type <code>U</code>,
|
||||||
@@ -99,7 +99,7 @@ unique_ptr<U> make_unique(U&& value);</pre>
|
|||||||
unique_ptr<point> p2 = boost::make_unique<point>({-10, 25});</pre>
|
unique_ptr<point> p2 = boost::make_unique<point>({-10, 25});</pre>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<pre>template<typename U>
|
<pre>template<class U>
|
||||||
unique_ptr<U> make_unique(size_t size);</pre>
|
unique_ptr<U> make_unique(size_t size);</pre>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p><b>Returns:</b> A unique_ptr to a value-initialized object of type
|
<p><b>Returns:</b> A unique_ptr to a value-initialized object of type
|
||||||
@@ -112,7 +112,7 @@ unique_ptr<U> make_unique(size_t size);</pre>
|
|||||||
unique_ptr<int[][2]> p2 = boost::make_unique<int[][2]>(2);</pre>
|
unique_ptr<int[][2]> p2 = boost::make_unique<int[][2]>(2);</pre>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<pre>template<typename U>
|
<pre>template<class U>
|
||||||
unique_ptr<U> make_unique_noinit();</pre>
|
unique_ptr<U> make_unique_noinit();</pre>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p><b>Returns:</b> A unique_ptr to a default-initialized object of
|
<p><b>Returns:</b> A unique_ptr to a default-initialized object of
|
||||||
@@ -125,7 +125,7 @@ unique_ptr<U> make_unique_noinit();</pre>
|
|||||||
unique_ptr<point> p2 = boost::make_unique_noinit<point>();</pre>
|
unique_ptr<point> p2 = boost::make_unique_noinit<point>();</pre>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<pre>template<typename U>
|
<pre>template<class U>
|
||||||
unique_ptr<U> make_unique_noinit(size_t size);</pre>
|
unique_ptr<U> make_unique_noinit(size_t size);</pre>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<p><b>Returns:</b> A unique_ptr to a default-initialized object of
|
<p><b>Returns:</b> A unique_ptr to a default-initialized object of
|
||||||
|
Reference in New Issue
Block a user