Blaze 3.9
UninitializedTransfer.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_UTIL_ALGORITHMS_UNINITIALIZEDTRANSFER_H_
36#define _BLAZE_UTIL_ALGORITHMS_UNINITIALIZEDTRANSFER_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <algorithm>
44#include <iterator>
47
48
49namespace blaze {
50
51//=================================================================================================
52//
53// UNINITIALIZED_TRANSFER ALGORITHMS
54//
55//=================================================================================================
56
57//*************************************************************************************************
71template< typename InputIt
72 , typename ForwardIt >
73ForwardIt uninitialized_transfer( InputIt first, InputIt last, ForwardIt dest )
74{
75 using T = typename std::iterator_traits<InputIt>::value_type;
76
77 if( IsNothrowMoveAssignable_v<T> ) {
78 return blaze::uninitialized_move( first, last, dest );
79 }
80 else {
81 return std::uninitialized_copy( first, last, dest );
82 }
83}
84//*************************************************************************************************
85
86
87//*************************************************************************************************
101template< typename InputIt
102 , typename ForwardIt >
103ForwardIt uninitialized_transfer_n( InputIt first, size_t n, ForwardIt dest )
104{
105 using T = typename std::iterator_traits<InputIt>::value_type;
106
107 if( IsNothrowMoveAssignable_v<T> ) {
108 return blaze::uninitialized_move_n( first, n, dest );
109 }
110 else {
111 return std::uninitialized_copy_n( first, n, dest );
112 }
113}
114//*************************************************************************************************
115
116} // namespace blaze
117
118#endif
Header file for the IsAssignable type trait.
Header file for the generic uninitialized_move algorithm.
ForwardIt uninitialized_transfer_n(InputIt first, size_t n, ForwardIt dest)
Transfers the elements from the given source range to the uninitialized destination range.
Definition: UninitializedTransfer.h:103
ForwardIt uninitialized_move(InputIt first, InputIt last, ForwardIt dest)
Move the elements from the given source range to the uninitialized destination range.
Definition: UninitializedMove.h:72
ForwardIt uninitialized_move_n(InputIt first, size_t n, ForwardIt dest)
Move the elements from the given source range to the uninitialized destination range.
Definition: UninitializedMove.h:107
ForwardIt uninitialized_transfer(InputIt first, InputIt last, ForwardIt dest)
Transfers the elements from the given source range to the uninitialized destination range.
Definition: UninitializedTransfer.h:73