00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 #ifndef _EXT_MEMORY
00058 #define _EXT_MEMORY 1
00059
00060 #pragma GCC system_header
00061
00062 #include <memory>
00063 #include <bits/stl_tempbuf.h>
00064
00065 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
00066
00067 using std::ptrdiff_t;
00068 using std::pair;
00069 using std::__iterator_category;
00070 using std::_Temporary_buffer;
00071
00072 template<typename _InputIter, typename _Size, typename _ForwardIter>
00073 pair<_InputIter, _ForwardIter>
00074 __uninitialized_copy_n(_InputIter __first, _Size __count,
00075 _ForwardIter __result, std::input_iterator_tag)
00076 {
00077 _ForwardIter __cur = __result;
00078 __try
00079 {
00080 for (; __count > 0 ; --__count, ++__first, ++__cur)
00081 std::_Construct(&*__cur, *__first);
00082 return pair<_InputIter, _ForwardIter>(__first, __cur);
00083 }
00084 __catch(...)
00085 {
00086 std::_Destroy(__result, __cur);
00087 __throw_exception_again;
00088 }
00089 }
00090
00091 template<typename _RandomAccessIter, typename _Size, typename _ForwardIter>
00092 inline pair<_RandomAccessIter, _ForwardIter>
00093 __uninitialized_copy_n(_RandomAccessIter __first, _Size __count,
00094 _ForwardIter __result,
00095 std::random_access_iterator_tag)
00096 {
00097 _RandomAccessIter __last = __first + __count;
00098 return (pair<_RandomAccessIter, _ForwardIter>
00099 (__last, std::uninitialized_copy(__first, __last, __result)));
00100 }
00101
00102 template<typename _InputIter, typename _Size, typename _ForwardIter>
00103 inline pair<_InputIter, _ForwardIter>
00104 __uninitialized_copy_n(_InputIter __first, _Size __count,
00105 _ForwardIter __result)
00106 { return __uninitialized_copy_n(__first, __count, __result,
00107 __iterator_category(__first)); }
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119 template<typename _InputIter, typename _Size, typename _ForwardIter>
00120 inline pair<_InputIter, _ForwardIter>
00121 uninitialized_copy_n(_InputIter __first, _Size __count,
00122 _ForwardIter __result)
00123 { return __uninitialized_copy_n(__first, __count, __result,
00124 __iterator_category(__first)); }
00125
00126
00127
00128
00129 template<typename _InputIter, typename _Size, typename _ForwardIter,
00130 typename _Allocator>
00131 pair<_InputIter, _ForwardIter>
00132 __uninitialized_copy_n_a(_InputIter __first, _Size __count,
00133 _ForwardIter __result,
00134 _Allocator __alloc)
00135 {
00136 _ForwardIter __cur = __result;
00137 __try
00138 {
00139 for (; __count > 0 ; --__count, ++__first, ++__cur)
00140 __alloc.construct(&*__cur, *__first);
00141 return pair<_InputIter, _ForwardIter>(__first, __cur);
00142 }
00143 __catch(...)
00144 {
00145 std::_Destroy(__result, __cur, __alloc);
00146 __throw_exception_again;
00147 }
00148 }
00149
00150 template<typename _InputIter, typename _Size, typename _ForwardIter,
00151 typename _Tp>
00152 inline pair<_InputIter, _ForwardIter>
00153 __uninitialized_copy_n_a(_InputIter __first, _Size __count,
00154 _ForwardIter __result,
00155 std::allocator<_Tp>)
00156 {
00157 return uninitialized_copy_n(__first, __count, __result);
00158 }
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180 template <class _ForwardIterator, class _Tp
00181 = typename std::iterator_traits<_ForwardIterator>::value_type >
00182 struct temporary_buffer : public _Temporary_buffer<_ForwardIterator, _Tp>
00183 {
00184
00185 temporary_buffer(_ForwardIterator __first, _ForwardIterator __last)
00186 : _Temporary_buffer<_ForwardIterator, _Tp>(__first, __last) { }
00187
00188
00189 ~temporary_buffer() { }
00190 };
00191
00192 _GLIBCXX_END_NAMESPACE
00193
00194 #endif
00195