mirror of
https://github.com/boostorg/core.git
synced 2025-05-10 07:13:54 +00:00
Update test and documentation
This commit is contained in:
parent
ca832d9384
commit
c96dfcec4a
@ -116,7 +116,9 @@ reverse order by calling `std::allocator_traits<A>::destroy(a, &p[j])`.]]]]]
|
||||
[[`template<class A, class T, class I> void alloc_construct_n(A& a, T* p,
|
||||
std::size_t n, I begin);`]
|
||||
[[variablelist
|
||||
[[Requires][`A` is an /Allocator/; `I` is an /InputIterator/]]
|
||||
[[Requires]
|
||||
[[itemized_list
|
||||
[`A` is an /Allocator/][`I` is an /InputIterator/]]]]
|
||||
[[Effects]
|
||||
[Constructs each `i`-th element in order by calling
|
||||
`std::allocator_traits<A>::construct(a, &p[i], *begin++])`.]]
|
||||
@ -140,7 +142,7 @@ without going through the supplied allocator.
|
||||
|
||||
Glen Fernandes originally implemented this functionality in Boost.Smart_Ptr and
|
||||
later moved these functions to Boost.Core for use in other Boost libraries,
|
||||
such as Boost.Multi_Array.
|
||||
such as Boost.Multi_Array and Boost.Histogram.
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -18,7 +18,8 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
The header <boost/core/exchange.hpp> provides the function template
|
||||
`boost::exchange` which is an implementation of the `std::exchange`
|
||||
function introduced in C++14.
|
||||
function introduced in C++14. `boost::exchange(o, v)` replaces the
|
||||
value of `o` with `v` and returns the old value of `o`.
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@ -16,10 +16,11 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
[section Overview]
|
||||
|
||||
The header <boost/core/first_scalar.hpp> provides the function template
|
||||
The header <boost/core/first_scalar.hpp> provides the function templates
|
||||
`boost::first_scalar` that can be used to obtain a pointer to the first scalar
|
||||
element of an array. Given a pointer of type `T*` it returns a pointer of type
|
||||
`remove_all_extents_t<T>*`.
|
||||
element of an array. Given a pointer of type `T*` they return a pointer of
|
||||
type `remove_all_extents_t<T>*`. The functions are `constexpr` and can be used
|
||||
in constant expressions.
|
||||
|
||||
[endsect]
|
||||
|
||||
@ -80,4 +81,11 @@ noexcept;`]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section History]
|
||||
|
||||
Glen Fernandes implemented `first_scalar`. Peter Dimov suggested a change for
|
||||
GCC to support an additional `constexpr` use.
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
@ -47,15 +47,14 @@ struct creator {
|
||||
::operator delete(ptr);
|
||||
}
|
||||
|
||||
template<class U, class V>
|
||||
void construct(U* ptr, const V& value) {
|
||||
::new(static_cast<void*>(ptr)) U(value + 1);
|
||||
template<class V>
|
||||
void construct(type* ptr, const V& value) {
|
||||
::new(static_cast<void*>(ptr)) type(value + 1);
|
||||
++type::count;
|
||||
}
|
||||
|
||||
template<class U>
|
||||
void destroy(U* ptr) {
|
||||
ptr->~U();
|
||||
void destroy(type* ptr) {
|
||||
ptr->~type();
|
||||
--type::count;
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user