Chris@102
|
1 //////////////////////////////////////////////////////////////////////////////
|
Chris@102
|
2 //
|
Chris@102
|
3 // (C) Copyright Ion Gaztanaga 2014-2014.
|
Chris@102
|
4 //
|
Chris@102
|
5 // Distributed under the Boost Software License, Version 1.0.
|
Chris@102
|
6 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@102
|
7 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@102
|
8 //
|
Chris@102
|
9 // See http://www.boost.org/libs/container for documentation.
|
Chris@102
|
10 //
|
Chris@102
|
11 //////////////////////////////////////////////////////////////////////////////
|
Chris@102
|
12
|
Chris@102
|
13 #ifndef BOOST_CONTAINER_DETAIL_CONSTRUCT_IN_PLACE_HPP
|
Chris@102
|
14 #define BOOST_CONTAINER_DETAIL_CONSTRUCT_IN_PLACE_HPP
|
Chris@102
|
15
|
Chris@102
|
16 #ifndef BOOST_CONFIG_HPP
|
Chris@102
|
17 # include <boost/config.hpp>
|
Chris@102
|
18 #endif
|
Chris@102
|
19
|
Chris@102
|
20 #if defined(BOOST_HAS_PRAGMA_ONCE)
|
Chris@102
|
21 # pragma once
|
Chris@102
|
22 #endif
|
Chris@102
|
23
|
Chris@102
|
24 #include <boost/container/allocator_traits.hpp>
|
Chris@102
|
25 #include <boost/container/detail/iterators.hpp>
|
Chris@102
|
26
|
Chris@102
|
27 namespace boost {
|
Chris@102
|
28 namespace container {
|
Chris@102
|
29
|
Chris@102
|
30 template<class Allocator, class T, class InpIt>
|
Chris@102
|
31 inline void construct_in_place(Allocator &a, T* dest, InpIt source)
|
Chris@102
|
32 { boost::container::allocator_traits<Allocator>::construct(a, dest, *source); }
|
Chris@102
|
33
|
Chris@102
|
34 template<class Allocator, class T, class U, class D>
|
Chris@102
|
35 inline void construct_in_place(Allocator &a, T *dest, value_init_construct_iterator<U, D>)
|
Chris@102
|
36 {
|
Chris@102
|
37 boost::container::allocator_traits<Allocator>::construct(a, dest);
|
Chris@102
|
38 }
|
Chris@102
|
39
|
Chris@102
|
40 template <class T, class Difference>
|
Chris@102
|
41 class default_init_construct_iterator;
|
Chris@102
|
42
|
Chris@102
|
43 template<class Allocator, class T, class U, class D>
|
Chris@102
|
44 inline void construct_in_place(Allocator &a, T *dest, default_init_construct_iterator<U, D>)
|
Chris@102
|
45 {
|
Chris@102
|
46 boost::container::allocator_traits<Allocator>::construct(a, dest, default_init);
|
Chris@102
|
47 }
|
Chris@102
|
48
|
Chris@102
|
49 template <class T, class EmplaceFunctor, class Difference>
|
Chris@102
|
50 class emplace_iterator;
|
Chris@102
|
51
|
Chris@102
|
52 template<class Allocator, class T, class U, class EF, class D>
|
Chris@102
|
53 inline void construct_in_place(Allocator &a, T *dest, emplace_iterator<U, EF, D> ei)
|
Chris@102
|
54 {
|
Chris@102
|
55 ei.construct_in_place(a, dest);
|
Chris@102
|
56 }
|
Chris@102
|
57
|
Chris@102
|
58 } //namespace container {
|
Chris@102
|
59 } //namespace boost {
|
Chris@102
|
60
|
Chris@102
|
61 #endif //#ifndef BOOST_CONTAINER_DETAIL_CONSTRUCT_IN_PLACE_HPP
|
Chris@102
|
62
|