1/*
2Copyright 2019 Glen Joseph Fernandes
3(glenjofe@gmail.com)
4
5Distributed under the Boost Software License, Version 1.0.
6(http://www.boost.org/LICENSE_1_0.txt)
7*/
8#ifndef BOOST_CORE_ALLOC_CONSTRUCT_HPP
9#define BOOST_CORE_ALLOC_CONSTRUCT_HPP
10
11/*
12This functionality is now in <boost/core/allocator_access.hpp>.
13*/
14#include <boost/core/noinit_adaptor.hpp>
15
16namespace boost {
17
18template<class A, class T>
19inline void
20alloc_destroy(A& a, T* p)
21{
22 boost::allocator_destroy(a, p);
23}
24
25template<class A, class T>
26inline void
27alloc_destroy_n(A& a, T* p, std::size_t n)
28{
29 boost::allocator_destroy_n(a, p, n);
30}
31
32template<class A, class T>
33inline void
34alloc_construct(A& a, T* p)
35{
36 boost::allocator_construct(a, p);
37}
38
39#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
40#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
41template<class A, class T, class U, class... V>
42inline void
43alloc_construct(A& a, T* p, U&& u, V&&... v)
44{
45 boost::allocator_construct(a, p, std::forward<U>(u),
46 std::forward<V>(v)...);
47}
48#else
49template<class A, class T, class U>
50inline void
51alloc_construct(A& a, T* p, U&& u)
52{
53 boost::allocator_construct(a, p, std::forward<U>(u));
54}
55#endif
56#else
57template<class A, class T, class U>
58inline void
59alloc_construct(A& a, T* p, const U& u)
60{
61 boost::allocator_construct(a, p, u);
62}
63
64template<class A, class T, class U>
65inline void
66alloc_construct(A& a, T* p, U& u)
67{
68 boost::allocator_construct(a, p, u);
69}
70#endif
71
72template<class A, class T>
73inline void
74alloc_construct_n(A& a, T* p, std::size_t n)
75{
76 boost::allocator_construct_n(a, p, n);
77}
78
79template<class A, class T>
80inline void
81alloc_construct_n(A& a, T* p, std::size_t n, const T* l, std::size_t m)
82{
83 boost::allocator_construct_n(a, p, n, l, m);
84}
85
86template<class A, class T, class I>
87inline void
88alloc_construct_n(A& a, T* p, std::size_t n, I b)
89{
90 boost::allocator_construct_n(a, p, n, b);
91}
92
93} /* boost */
94
95#endif
96