58 #ifndef _STL_UNINITIALIZED_H 
   59 #define _STL_UNINITIALIZED_H 1 
   61 namespace std _GLIBCXX_VISIBILITY(default)
 
   63 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   65   template<
bool _TrivialValueTypes>
 
   66     struct __uninitialized_copy
 
   68       template<
typename _InputIterator, 
typename _ForwardIterator>
 
   69         static _ForwardIterator
 
   70         __uninit_copy(_InputIterator __first, _InputIterator __last,
 
   71               _ForwardIterator __result)
 
   73       _ForwardIterator __cur = __result;
 
   76           for (; __first != __last; ++__first, ++__cur)
 
   83           __throw_exception_again;
 
   89     struct __uninitialized_copy<true>
 
   91       template<
typename _InputIterator, 
typename _ForwardIterator>
 
   92         static _ForwardIterator
 
   93         __uninit_copy(_InputIterator __first, _InputIterator __last,
 
   94               _ForwardIterator __result)
 
   95         { 
return std::copy(__first, __last, __result); }
 
  107   template<
typename _InputIterator, 
typename _ForwardIterator>
 
  108     inline _ForwardIterator
 
  110                _ForwardIterator __result)
 
  112       typedef typename iterator_traits<_InputIterator>::value_type
 
  114       typedef typename iterator_traits<_ForwardIterator>::value_type
 
  117       return std::__uninitialized_copy<(__is_trivial(_ValueType1)
 
  118                     && __is_trivial(_ValueType2))>::
 
  119     __uninit_copy(__first, __last, __result);
 
  123   template<
bool _TrivialValueType>
 
  124     struct __uninitialized_fill
 
  126       template<
typename _ForwardIterator, 
typename _Tp>
 
  128         __uninit_fill(_ForwardIterator __first, _ForwardIterator __last,
 
  131       _ForwardIterator __cur = __first;
 
  134           for (; __cur != __last; ++__cur)
 
  140           __throw_exception_again;
 
  146     struct __uninitialized_fill<true>
 
  148       template<
typename _ForwardIterator, 
typename _Tp>
 
  150         __uninit_fill(_ForwardIterator __first, _ForwardIterator __last,
 
  152         { std::fill(__first, __last, __x); }
 
  164   template<
typename _ForwardIterator, 
typename _Tp>
 
  169       typedef typename iterator_traits<_ForwardIterator>::value_type
 
  172       std::__uninitialized_fill<__is_trivial(_ValueType)>::
 
  173     __uninit_fill(__first, __last, __x);
 
  177   template<
bool _TrivialValueType>
 
  178     struct __uninitialized_fill_n
 
  180       template<
typename _ForwardIterator, 
typename _Size, 
typename _Tp>
 
  182         __uninit_fill_n(_ForwardIterator __first, _Size __n,
 
  185       _ForwardIterator __cur = __first;
 
  188           for (; __n > 0; --__n, ++__cur)
 
  194           __throw_exception_again;
 
  200     struct __uninitialized_fill_n<true>
 
  202       template<
typename _ForwardIterator, 
typename _Size, 
typename _Tp>
 
  204         __uninit_fill_n(_ForwardIterator __first, _Size __n,
 
  218   template<
typename _ForwardIterator, 
typename _Size, 
typename _Tp>
 
  222       typedef typename iterator_traits<_ForwardIterator>::value_type
 
  225       std::__uninitialized_fill_n<__is_trivial(_ValueType)>::
 
  226     __uninit_fill_n(__first, __n, __x);
 
  235   template<
typename _InputIterator, 
typename _ForwardIterator,
 
  238     __uninitialized_copy_a(_InputIterator __first, _InputIterator __last,
 
  239                _ForwardIterator __result, _Allocator& __alloc)
 
  241       _ForwardIterator __cur = __result;
 
  245       for (; __first != __last; ++__first, ++__cur)
 
  252       __throw_exception_again;
 
  256   template<
typename _InputIterator, 
typename _ForwardIterator, 
typename _Tp>
 
  257     inline _ForwardIterator
 
  258     __uninitialized_copy_a(_InputIterator __first, _InputIterator __last,
 
  259                _ForwardIterator __result, allocator<_Tp>&)
 
  262   template<
typename _InputIterator, 
typename _ForwardIterator,
 
  264     inline _ForwardIterator
 
  265     __uninitialized_move_a(_InputIterator __first, _InputIterator __last,
 
  266                _ForwardIterator __result, _Allocator& __alloc)
 
  268       return std::__uninitialized_copy_a(_GLIBCXX_MAKE_MOVE_ITERATOR(__first),
 
  269                      _GLIBCXX_MAKE_MOVE_ITERATOR(__last),
 
  273   template<
typename _InputIterator, 
typename _ForwardIterator,
 
  275     inline _ForwardIterator
 
  276     __uninitialized_move_if_noexcept_a(_InputIterator __first,
 
  277                        _InputIterator __last,
 
  278                        _ForwardIterator __result,
 
  281       return std::__uninitialized_copy_a
 
  282     (_GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__first),
 
  283      _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__last), __result, __alloc);
 
  286   template<
typename _ForwardIterator, 
typename _Tp, 
typename _Allocator>
 
  288     __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last,
 
  289                const _Tp& __x, _Allocator& __alloc)
 
  291       _ForwardIterator __cur = __first;
 
  295       for (; __cur != __last; ++__cur)
 
  301       __throw_exception_again;
 
  305   template<
typename _ForwardIterator, 
typename _Tp, 
typename _Tp2>
 
  307     __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last,
 
  308                const _Tp& __x, allocator<_Tp2>&)
 
  311   template<
typename _ForwardIterator, 
typename _Size, 
typename _Tp,
 
  314     __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, 
 
  315                  const _Tp& __x, _Allocator& __alloc)
 
  317       _ForwardIterator __cur = __first;
 
  321       for (; __n > 0; --__n, ++__cur)
 
  327       __throw_exception_again;
 
  331   template<
typename _ForwardIterator, 
typename _Size, 
typename _Tp,
 
  334     __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, 
 
  335                  const _Tp& __x, allocator<_Tp2>&)
 
  348   template<
typename _InputIterator1, 
typename _InputIterator2,
 
  349        typename _ForwardIterator, 
typename _Allocator>
 
  350     inline _ForwardIterator
 
  351     __uninitialized_copy_move(_InputIterator1 __first1,
 
  352                   _InputIterator1 __last1,
 
  353                   _InputIterator2 __first2,
 
  354                   _InputIterator2 __last2,
 
  355                   _ForwardIterator __result,
 
  358       _ForwardIterator __mid = std::__uninitialized_copy_a(__first1, __last1,
 
  363       return std::__uninitialized_move_a(__first2, __last2, __mid, __alloc);
 
  368       __throw_exception_again;
 
  376   template<
typename _InputIterator1, 
typename _InputIterator2,
 
  377        typename _ForwardIterator, 
typename _Allocator>
 
  378     inline _ForwardIterator
 
  379     __uninitialized_move_copy(_InputIterator1 __first1,
 
  380                   _InputIterator1 __last1,
 
  381                   _InputIterator2 __first2,
 
  382                   _InputIterator2 __last2,
 
  383                   _ForwardIterator __result,
 
  386       _ForwardIterator __mid = std::__uninitialized_move_a(__first1, __last1,
 
  391       return std::__uninitialized_copy_a(__first2, __last2, __mid, __alloc);
 
  396       __throw_exception_again;
 
  403   template<
typename _ForwardIterator, 
typename _Tp, 
typename _InputIterator,
 
  405     inline _ForwardIterator
 
  406     __uninitialized_fill_move(_ForwardIterator __result, _ForwardIterator __mid,
 
  407                   const _Tp& __x, _InputIterator __first,
 
  408                   _InputIterator __last, _Allocator& __alloc)
 
  410       std::__uninitialized_fill_a(__result, __mid, __x, __alloc);
 
  413       return std::__uninitialized_move_a(__first, __last, __mid, __alloc);
 
  418       __throw_exception_again;
 
  425   template<
typename _InputIterator, 
typename _ForwardIterator, 
typename _Tp,
 
  428     __uninitialized_move_fill(_InputIterator __first1, _InputIterator __last1,
 
  429                   _ForwardIterator __first2,
 
  430                   _ForwardIterator __last2, 
const _Tp& __x,
 
  433       _ForwardIterator __mid2 = std::__uninitialized_move_a(__first1, __last1,
 
  438       std::__uninitialized_fill_a(__mid2, __last2, __x, __alloc);
 
  443       __throw_exception_again;
 
  447 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 
  451   template<
bool _TrivialValueType>
 
  452     struct __uninitialized_default_1
 
  454       template<
typename _ForwardIterator>
 
  456         __uninit_default(_ForwardIterator __first, _ForwardIterator __last)
 
  458       _ForwardIterator __cur = __first;
 
  461           for (; __cur != __last; ++__cur)
 
  467           __throw_exception_again;
 
  473     struct __uninitialized_default_1<true>
 
  475       template<
typename _ForwardIterator>
 
  477         __uninit_default(_ForwardIterator __first, _ForwardIterator __last)
 
  479       typedef typename iterator_traits<_ForwardIterator>::value_type
 
  482       std::fill(__first, __last, _ValueType());
 
  486   template<
bool _TrivialValueType>
 
  487     struct __uninitialized_default_n_1
 
  489       template<
typename _ForwardIterator, 
typename _Size>
 
  491         __uninit_default_n(_ForwardIterator __first, _Size __n)
 
  493       _ForwardIterator __cur = __first;
 
  496           for (; __n > 0; --__n, ++__cur)
 
  502           __throw_exception_again;
 
  508     struct __uninitialized_default_n_1<true>
 
  510       template<
typename _ForwardIterator, 
typename _Size>
 
  512         __uninit_default_n(_ForwardIterator __first, _Size __n)
 
  514       typedef typename iterator_traits<_ForwardIterator>::value_type
 
  524   template<
typename _ForwardIterator>
 
  526     __uninitialized_default(_ForwardIterator __first,
 
  527                 _ForwardIterator __last)
 
  529       typedef typename iterator_traits<_ForwardIterator>::value_type
 
  532       std::__uninitialized_default_1<__is_trivial(_ValueType)>::
 
  533     __uninit_default(__first, __last);
 
  538   template<
typename _ForwardIterator, 
typename _Size>
 
  540     __uninitialized_default_n(_ForwardIterator __first, _Size __n)
 
  542       typedef typename iterator_traits<_ForwardIterator>::value_type
 
  545       std::__uninitialized_default_n_1<__is_trivial(_ValueType)>::
 
  546     __uninit_default_n(__first, __n);
 
  553   template<
typename _ForwardIterator, 
typename _Allocator>
 
  555     __uninitialized_default_a(_ForwardIterator __first,
 
  556                   _ForwardIterator __last,
 
  559       _ForwardIterator __cur = __first;
 
  563       for (; __cur != __last; ++__cur)
 
  569       __throw_exception_again;
 
  573   template<
typename _ForwardIterator, 
typename _Tp>
 
  575     __uninitialized_default_a(_ForwardIterator __first,
 
  576                   _ForwardIterator __last,
 
  578     { std::__uninitialized_default(__first, __last); }
 
  584   template<
typename _ForwardIterator, 
typename _Size, 
typename _Allocator>
 
  586     __uninitialized_default_n_a(_ForwardIterator __first, _Size __n, 
 
  589       _ForwardIterator __cur = __first;
 
  593       for (; __n > 0; --__n, ++__cur)
 
  599       __throw_exception_again;
 
  603   template<
typename _ForwardIterator, 
typename _Size, 
typename _Tp>
 
  605     __uninitialized_default_n_a(_ForwardIterator __first, _Size __n, 
 
  607     { std::__uninitialized_default_n(__first, __n); }
 
  610   template<
typename _InputIterator, 
typename _Size,
 
  611        typename _ForwardIterator>
 
  613     __uninitialized_copy_n(_InputIterator __first, _Size __n,
 
  614                _ForwardIterator __result, input_iterator_tag)
 
  616       _ForwardIterator __cur = __result;
 
  619       for (; __n > 0; --__n, ++__first, ++__cur)
 
  626       __throw_exception_again;
 
  630   template<
typename _RandomAccessIterator, 
typename _Size,
 
  631        typename _ForwardIterator>
 
  632     inline _ForwardIterator
 
  633     __uninitialized_copy_n(_RandomAccessIterator __first, _Size __n,
 
  634                _ForwardIterator __result,
 
  635                random_access_iterator_tag)
 
  647   template<
typename _InputIterator, 
typename _Size, 
typename _ForwardIterator>
 
  648     inline _ForwardIterator
 
  650              _ForwardIterator __result)
 
  651     { 
return std::__uninitialized_copy_n(__first, __n, __result,
 
  655 _GLIBCXX_END_NAMESPACE_VERSION
 
Uniform interface to C++98 and C++0x allocators. 
 
void _Destroy(_Tp *__pointer)
 
_OI fill_n(_OI __first, _Size __n, const _Tp &__value)
Fills the range [first,first+n) with copies of value. 
 
void uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp &__x)
Copies the value x into the range [first,last). 
 
_ForwardIterator uninitialized_copy_n(_InputIterator __first, _Size __n, _ForwardIterator __result)
Copies the range [first,first+n) into result. 
 
void uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp &__x)
Copies the value x into the range [first,first+n). 
 
void _Construct(_T1 *__p, _Args &&...__args)
 
iterator_traits< _Iter >::iterator_category __iterator_category(const _Iter &)
 
_Tp * __addressof(_Tp &__r) _GLIBCXX_NOEXCEPT
Same as C++11 std::addressof. 
 
_ForwardIterator uninitialized_copy(_InputIterator __first, _InputIterator __last, _ForwardIterator __result)
Copies the range [first,last) into result.