]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/container/detail/construct_in_place.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / container / detail / construct_in_place.hpp
CommitLineData
7c673cae
FG
1//////////////////////////////////////////////////////////////////////////////
2//
3// (C) Copyright Ion Gaztanaga 2014-2014.
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
9// See http://www.boost.org/libs/container for documentation.
10//
11//////////////////////////////////////////////////////////////////////////////
12
13#ifndef BOOST_CONTAINER_DETAIL_CONSTRUCT_IN_PLACE_HPP
14#define BOOST_CONTAINER_DETAIL_CONSTRUCT_IN_PLACE_HPP
15
16#ifndef BOOST_CONFIG_HPP
17# include <boost/config.hpp>
18#endif
19
20#if defined(BOOST_HAS_PRAGMA_ONCE)
21# pragma once
22#endif
23
24#include <boost/container/allocator_traits.hpp>
25#include <boost/container/detail/iterators.hpp>
26#include <boost/container/detail/value_init.hpp>
27
28namespace boost {
29namespace container {
30
31//In place construction
32
1e59de90
TL
33struct iterator_arg_t{};
34
7c673cae
FG
35template<class Allocator, class T, class InpIt>
36BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T* dest, InpIt source)
37{ boost::container::allocator_traits<Allocator>::construct(a, dest, *source); }
38
1e59de90
TL
39template<class Allocator, class T, class U>
40BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T *dest, value_init_construct_iterator<U>)
7c673cae
FG
41{
42 boost::container::allocator_traits<Allocator>::construct(a, dest);
43}
44
1e59de90 45template <class T>
7c673cae
FG
46class default_init_construct_iterator;
47
1e59de90
TL
48template<class Allocator, class T, class U>
49BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T *dest, default_init_construct_iterator<U>)
7c673cae
FG
50{
51 boost::container::allocator_traits<Allocator>::construct(a, dest, default_init);
52}
53
1e59de90 54template <class T, class EmplaceFunctor>
7c673cae
FG
55class emplace_iterator;
56
1e59de90
TL
57template<class Allocator, class T, class U, class EF>
58BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T *dest, emplace_iterator<U, EF> ei)
7c673cae
FG
59{
60 ei.construct_in_place(a, dest);
61}
62
63//Assignment
64
65template<class DstIt, class InpIt>
66BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, InpIt source)
67{ *dest = *source; }
68
1e59de90
TL
69template<class DstIt, class U>
70BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, value_init_construct_iterator<U>)
7c673cae 71{
11fdf7f2 72 dtl::value_init<U> val;
7c673cae
FG
73 *dest = boost::move(val.get());
74}
75
1e59de90 76template <class DstIt>
7c673cae
FG
77class default_init_construct_iterator;
78
79template<class DstIt, class U, class D>
1e59de90 80BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, default_init_construct_iterator<U>)
7c673cae
FG
81{
82 U u;
83 *dest = boost::move(u);
84}
85
1e59de90 86template <class T, class EmplaceFunctor>
7c673cae
FG
87class emplace_iterator;
88
1e59de90
TL
89template<class DstIt, class U, class EF>
90BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, emplace_iterator<U, EF> ei)
7c673cae
FG
91{
92 ei.assign_in_place(dest);
93}
94
95} //namespace container {
96} //namespace boost {
97
98#endif //#ifndef BOOST_CONTAINER_DETAIL_CONSTRUCT_IN_PLACE_HPP