1.1 --- a/epoc32/include/stdapis/stlport/stl/_uninitialized.h Tue Mar 16 16:12:26 2010 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,291 +0,0 @@
1.4 -/*
1.5 - *
1.6 - * Copyright (c) 1994
1.7 - * Hewlett-Packard Company
1.8 - *
1.9 - * Copyright (c) 1996,1997
1.10 - * Silicon Graphics Computer Systems, Inc.
1.11 - *
1.12 - * Copyright (c) 1997
1.13 - * Moscow Center for SPARC Technology
1.14 - *
1.15 - * Copyright (c) 1999
1.16 - * Boris Fomitchev
1.17 - *
1.18 - * This material is provided "as is", with absolutely no warranty expressed
1.19 - * or implied. Any use is at your own risk.
1.20 - *
1.21 - * Permission to use or copy this software for any purpose is hereby granted
1.22 - * without fee, provided the above notices are retained on all copies.
1.23 - * Permission to modify the code and to distribute modified code is granted,
1.24 - * provided the above notices are retained, and a notice that the code was
1.25 - * modified is included with the above copyright notice.
1.26 - *
1.27 - */
1.28 -
1.29 -/* NOTE: This is an internal header file, included by other STL headers.
1.30 - * You should not attempt to use it directly.
1.31 - */
1.32 -
1.33 -#ifndef _STLP_INTERNAL_UNINITIALIZED_H
1.34 -#define _STLP_INTERNAL_UNINITIALIZED_H
1.35 -
1.36 -# ifndef _STLP_CSTRING
1.37 -# include <cstring>
1.38 -# endif
1.39 -
1.40 -# ifndef _STLP_INTERNAL_ALGOBASE_H
1.41 -# include <stl/_algobase.h>
1.42 -# endif
1.43 -
1.44 -# ifndef _STLP_INTERNAL_CONSTRUCT_H
1.45 -# include <stl/_construct.h>
1.46 -# endif
1.47 -
1.48 -_STLP_BEGIN_NAMESPACE
1.49 -
1.50 -// uninitialized_copy
1.51 -
1.52 -// Valid if copy construction is equivalent to assignment, and if the
1.53 -// destructor is trivial.
1.54 -template <class _InputIter, class _ForwardIter>
1.55 -inline _ForwardIter
1.56 -__uninitialized_copy(_InputIter __first, _InputIter __last, _ForwardIter __result,
1.57 - const __true_type&) {
1.58 - return __copy_aux(__first, __last, __result, _BothPtrType< _InputIter, _ForwardIter> :: _Ret());
1.59 -}
1.60 -
1.61 -template <class _InputIter, class _ForwardIter>
1.62 -// _STLP_INLINE_LOOP
1.63 -_ForwardIter
1.64 -__uninitialized_copy(_InputIter __first, _InputIter __last, _ForwardIter __result,
1.65 - const __false_type&)
1.66 -{
1.67 - _STLP_LEAVE_VOLATILE _ForwardIter __cur = __result;
1.68 - _STLP_TRY {
1.69 - for ( ; __first != __last; ++__first, ++__cur)
1.70 - _Construct(&*__cur, *__first);
1.71 - // return __cur;
1.72 - }
1.73 - _STLP_UNWIND (_STLP_STD::_Destroy(__result, __cur));
1.74 - return __cur;
1.75 -}
1.76 -
1.77 -template <class _InputIter, class _ForwardIter>
1.78 -inline _ForwardIter
1.79 -uninitialized_copy(_InputIter __first, _InputIter __last, _ForwardIter __result) {
1.80 - return __uninitialized_copy(__first, __last, __result, _IS_POD_ITER(__result, _ForwardIter));
1.81 -}
1.82 -
1.83 -inline char*
1.84 -uninitialized_copy(const char* __first, const char* __last, char* __result) {
1.85 - return (char*)__copy_trivial (__first, __last, __result);
1.86 -}
1.87 -
1.88 -# ifdef _STLP_HAS_WCHAR_T // dwa 8/15/97
1.89 -inline wchar_t*
1.90 -uninitialized_copy(const wchar_t* __first, const wchar_t* __last, wchar_t* __result) {
1.91 - return (wchar_t*)__copy_trivial (__first, __last, __result);
1.92 -}
1.93 -# endif /* _STLP_HAS_WCHAR_T */
1.94 -
1.95 -# ifndef _STLP_NO_EXTENSIONS
1.96 -// uninitialized_copy_n (not part of the C++ standard)
1.97 -
1.98 -template <class _InputIter, class _Size, class _ForwardIter>
1.99 -// _STLP_INLINE_LOOP
1.100 -pair<_InputIter, _ForwardIter>
1.101 -__uninitialized_copy_n(_InputIter __first, _Size __count,
1.102 - _ForwardIter __result,
1.103 - const input_iterator_tag &)
1.104 -{
1.105 - _STLP_LEAVE_VOLATILE _ForwardIter __cur = __result;
1.106 - _STLP_TRY {
1.107 - for ( ; __count > 0 ; --__count, ++__first, ++__cur)
1.108 - _Construct(&*__cur, *__first);
1.109 - // return pair<_InputIter, _ForwardIter>(__first, __cur);
1.110 - }
1.111 - _STLP_UNWIND(_STLP_STD::_Destroy(__result, __cur));
1.112 -
1.113 - return pair<_InputIter, _ForwardIter>(__first, __cur);
1.114 -
1.115 -}
1.116 -
1.117 -# if defined(_STLP_NONTEMPL_BASE_MATCH_BUG)
1.118 -template <class _InputIterator, class _Size, class _ForwardIterator>
1.119 -inline pair<_InputIterator, _ForwardIterator>
1.120 -__uninitialized_copy_n(_InputIterator __first, _Size __count,
1.121 - _ForwardIterator __result,
1.122 - const forward_iterator_tag &) {
1.123 - return __uninitialized_copy_n(__first, __count, __result, input_iterator_tag());
1.124 -}
1.125 -
1.126 -template <class _InputIterator, class _Size, class _ForwardIterator>
1.127 -inline pair<_InputIterator, _ForwardIterator>
1.128 -__uninitialized_copy_n(_InputIterator __first, _Size __count,
1.129 - _ForwardIterator __result,
1.130 - const bidirectional_iterator_tag &) {
1.131 - return __uninitialized_copy_n(__first, __count, __result, input_iterator_tag());
1.132 -}
1.133 -# endif
1.134 -
1.135 -
1.136 -template <class _RandomAccessIter, class _Size, class _ForwardIter>
1.137 -inline pair<_RandomAccessIter, _ForwardIter>
1.138 -__uninitialized_copy_n(_RandomAccessIter __first, _Size __count, _ForwardIter __result, const random_access_iterator_tag &) {
1.139 - _RandomAccessIter __last = __first + __count;
1.140 - return pair<_RandomAccessIter, _ForwardIter>( __last, __uninitialized_copy(__first, __last, __result,
1.141 - _IS_POD_ITER(__result, _ForwardIter)));
1.142 -}
1.143 -
1.144 -// this is used internally in <rope> , which is extension itself.
1.145 -template <class _InputIter, class _Size, class _ForwardIter>
1.146 -inline pair<_InputIter, _ForwardIter>
1.147 -uninitialized_copy_n(_InputIter __first, _Size __count,
1.148 - _ForwardIter __result) {
1.149 - return __uninitialized_copy_n(__first, __count, __result, _STLP_ITERATOR_CATEGORY(__first, _InputIter));
1.150 -}
1.151 -# endif /* _STLP_NO_EXTENSIONS */
1.152 -
1.153 -// Valid if copy construction is equivalent to assignment, and if the
1.154 -// destructor is trivial.
1.155 -template <class _ForwardIter, class _Tp>
1.156 -inline void
1.157 -__uninitialized_fill(_ForwardIter __first, _ForwardIter __last,
1.158 - const _Tp& __x, const __true_type&) {
1.159 - _STLP_STD::fill(__first, __last, __x);
1.160 -}
1.161 -
1.162 -template <class _ForwardIter, class _Tp>
1.163 -// _STLP_INLINE_LOOP
1.164 -void
1.165 -__uninitialized_fill(_ForwardIter __first, _ForwardIter __last,
1.166 - const _Tp& __x, const __false_type&)
1.167 -{
1.168 - _STLP_LEAVE_VOLATILE _ForwardIter __cur = __first;
1.169 - _STLP_TRY {
1.170 - for ( ; __cur != __last; ++__cur)
1.171 - _Construct(&*__cur, __x);
1.172 - }
1.173 - _STLP_UNWIND(_STLP_STD::_Destroy(__first, __cur));
1.174 -}
1.175 -
1.176 -template <class _ForwardIter, class _Tp>
1.177 -inline void uninitialized_fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __x) {
1.178 - __uninitialized_fill(__first, __last, __x, _IS_POD_ITER(__first, _ForwardIter));
1.179 -}
1.180 -
1.181 -// Valid if copy construction is equivalent to assignment, and if the
1.182 -// destructor is trivial.
1.183 -template <class _ForwardIter, class _Size, class _Tp>
1.184 -inline _ForwardIter
1.185 -__uninitialized_fill_n(_ForwardIter __first, _Size __n,
1.186 - const _Tp& __x, const __true_type&) {
1.187 - return _STLP_STD::fill_n(__first, __n, __x);
1.188 -}
1.189 -
1.190 -template <class _ForwardIter, class _Size, class _Tp>
1.191 -//_STLP_INLINE_LOOP
1.192 -_ForwardIter
1.193 -__uninitialized_fill_n(_ForwardIter __first, _Size __n,
1.194 - const _Tp& __x, const __false_type&)
1.195 -{
1.196 - _STLP_LEAVE_VOLATILE _ForwardIter __cur = __first;
1.197 - _STLP_TRY {
1.198 - for ( ; __n > 0; --__n, ++__cur)
1.199 - _Construct(&*__cur, __x);
1.200 - // return __cur;
1.201 - }
1.202 - _STLP_UNWIND(_STLP_STD::_Destroy(__first, __cur));
1.203 - // # ifdef _STLP_THROW_RETURN_BUG
1.204 - return __cur;
1.205 - //# endif
1.206 -}
1.207 -
1.208 -template <class _ForwardIter, class _Size, class _Tp>
1.209 -inline _ForwardIter
1.210 -uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp& __x) {
1.211 - return __uninitialized_fill_n(__first, __n, __x, _IS_POD_ITER(__first, _ForwardIter));
1.212 -}
1.213 -
1.214 -// Extensions: __uninitialized_copy_copy, __uninitialized_copy_fill,
1.215 -// __uninitialized_fill_copy.
1.216 -
1.217 -// __uninitialized_copy_copy
1.218 -// Copies [first1, last1) into [result, result + (last1 - first1)), and
1.219 -// copies [first2, last2) into
1.220 -// [result, result + (last1 - first1) + (last2 - first2)).
1.221 -
1.222 -template <class _InputIter1, class _InputIter2, class _ForwardIter>
1.223 -inline _ForwardIter
1.224 -__uninitialized_copy_copy(_InputIter1 __first1, _InputIter1 __last1,
1.225 - _InputIter2 __first2, _InputIter2 __last2,
1.226 - _ForwardIter __result, __true_type)
1.227 -{
1.228 - return __uninitialized_copy(__first2, __last2,
1.229 - __uninitialized_copy(__first1, __last1, __result, __true_type()), __true_type());
1.230 -}
1.231 -
1.232 -template <class _InputIter1, class _InputIter2, class _ForwardIter>
1.233 -// inline
1.234 -_ForwardIter
1.235 -__uninitialized_copy_copy(_InputIter1 __first1, _InputIter1 __last1,
1.236 - _InputIter2 __first2, _InputIter2 __last2,
1.237 - _ForwardIter __result, __false_type)
1.238 -{
1.239 - _STLP_LEAVE_VOLATILE _ForwardIter __mid = __uninitialized_copy(__first1, __last1, __result, _IS_POD_ITER(__result, _ForwardIter));
1.240 -
1.241 - _STLP_TRY {
1.242 - return __uninitialized_copy(__first2, __last2, __mid , _IS_POD_ITER(__result, _ForwardIter));
1.243 - }
1.244 - _STLP_UNWIND (_STLP_STD::_Destroy(__result, __mid));
1.245 -# ifdef _STLP_THROW_RETURN_BUG
1.246 - return __mid;
1.247 -# endif
1.248 -}
1.249 -
1.250 -// __uninitialized_fill_copy
1.251 -// Fills [result, mid) with x, and copies [first, last) into
1.252 -// [mid, mid + (last - first)).
1.253 -template <class _ForwardIter, class _Tp, class _InputIter>
1.254 -// inline
1.255 -_ForwardIter
1.256 -__uninitialized_fill_copy(_ForwardIter __result, _ForwardIter __mid, const _Tp& __x,
1.257 - _InputIter __first, _InputIter __last)
1.258 -{
1.259 - typedef typename __type_traits<_Tp>::is_POD_type _I_POD;
1.260 - __uninitialized_fill(__result, __mid, __x, _I_POD());
1.261 - _STLP_TRY {
1.262 - return __uninitialized_copy(__first, __last, __mid, _I_POD());
1.263 - }
1.264 - _STLP_UNWIND (_STLP_STD::_Destroy(__result, __mid));
1.265 -# ifdef _STLP_THROW_RETURN_BUG
1.266 - return __result;
1.267 -# endif
1.268 -}
1.269 -
1.270 -// __uninitialized_copy_fill
1.271 -// Copies [first1, last1) into [first2, first2 + (last1 - first1)), and
1.272 -// fills [first2 + (last1 - first1), last2) with x.
1.273 -template <class _InputIter, class _ForwardIter, class _Tp>
1.274 -// inline
1.275 -void
1.276 -__uninitialized_copy_fill(_InputIter __first1, _InputIter __last1,
1.277 - _ForwardIter __first2, _ForwardIter __last2,
1.278 - const _Tp& __x)
1.279 -{
1.280 - typedef typename __type_traits<_Tp>::is_POD_type _I_POD;
1.281 - _ForwardIter __mid2 = __uninitialized_copy(__first1, __last1, __first2, _I_POD());
1.282 - _STLP_TRY {
1.283 - __uninitialized_fill(__mid2, __last2, __x, _I_POD());
1.284 - }
1.285 - _STLP_UNWIND(_STLP_STD::_Destroy(__first2, __mid2));
1.286 -}
1.287 -
1.288 -_STLP_END_NAMESPACE
1.289 -
1.290 -#endif /* _STLP_INTERNAL_UNINITIALIZED_H */
1.291 -
1.292 -// Local Variables:
1.293 -// mode:C++
1.294 -// End: