File indexing completed on 2025-01-18 09:30:09
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef BOOST_CONTAINER_DETAIL_CONSTRUCT_IN_PLACE_HPP
0014 #define BOOST_CONTAINER_DETAIL_CONSTRUCT_IN_PLACE_HPP
0015
0016 #ifndef BOOST_CONFIG_HPP
0017 # include <boost/config.hpp>
0018 #endif
0019
0020 #if defined(BOOST_HAS_PRAGMA_ONCE)
0021 # pragma once
0022 #endif
0023
0024 #include <boost/container/allocator_traits.hpp>
0025 #include <boost/container/detail/iterators.hpp>
0026 #include <boost/container/detail/value_init.hpp>
0027
0028 namespace boost {
0029 namespace container {
0030
0031
0032
0033 struct iterator_arg_t{};
0034
0035 template<class Allocator, class T, class InpIt>
0036 BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T* dest, InpIt source)
0037 { boost::container::allocator_traits<Allocator>::construct(a, dest, *source); }
0038
0039 template<class Allocator, class T, class U>
0040 BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T *dest, value_init_construct_iterator<U>)
0041 {
0042 boost::container::allocator_traits<Allocator>::construct(a, dest);
0043 }
0044
0045 template <class T>
0046 class default_init_construct_iterator;
0047
0048 template<class Allocator, class T, class U>
0049 BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T *dest, default_init_construct_iterator<U>)
0050 {
0051 boost::container::allocator_traits<Allocator>::construct(a, dest, default_init);
0052 }
0053
0054 template <class T, class EmplaceFunctor>
0055 class emplace_iterator;
0056
0057 template<class Allocator, class T, class U, class EF>
0058 BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T *dest, emplace_iterator<U, EF> ei)
0059 {
0060 ei.construct_in_place(a, dest);
0061 }
0062
0063
0064
0065 template<class DstIt, class InpIt>
0066 BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, InpIt source)
0067 { *dest = *source; }
0068
0069 template<class DstIt, class U>
0070 BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, value_init_construct_iterator<U>)
0071 {
0072 dtl::value_init<U> val;
0073 *dest = boost::move(val.get());
0074 }
0075
0076 template <class DstIt>
0077 class default_init_construct_iterator;
0078
0079 template<class DstIt, class U, class D>
0080 BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, default_init_construct_iterator<U>)
0081 {
0082 U u;
0083 *dest = boost::move(u);
0084 }
0085
0086 template <class T, class EmplaceFunctor>
0087 class emplace_iterator;
0088
0089 template<class DstIt, class U, class EF>
0090 BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, emplace_iterator<U, EF> ei)
0091 {
0092 ei.assign_in_place(dest);
0093 }
0094
0095 }
0096 }
0097
0098 #endif