_GLIBCXX_BEGIN_NAMESPACE(std)
- template<bool>
+ template<bool _TrivialValueTypes>
struct __uninitialized_copy
{
template<typename _InputIterator, typename _ForwardIterator>
static _ForwardIterator
- uninitialized_copy(_InputIterator __first, _InputIterator __last,
- _ForwardIterator __result)
+ __uninit_copy(_InputIterator __first, _InputIterator __last,
+ _ForwardIterator __result)
{
_ForwardIterator __cur = __result;
__try
{
template<typename _InputIterator, typename _ForwardIterator>
static _ForwardIterator
- uninitialized_copy(_InputIterator __first, _InputIterator __last,
- _ForwardIterator __result)
+ __uninit_copy(_InputIterator __first, _InputIterator __last,
+ _ForwardIterator __result)
{ return std::copy(__first, __last, __result); }
};
typedef typename iterator_traits<_ForwardIterator>::value_type
_ValueType2;
- return std::__uninitialized_copy<(__is_pod(_ValueType1)
- && __is_pod(_ValueType2))>::
- uninitialized_copy(__first, __last, __result);
+ return std::__uninitialized_copy<(__is_trivial(_ValueType1)
+ && __is_trivial(_ValueType2))>::
+ __uninit_copy(__first, __last, __result);
}
- template<bool>
+ template<bool _TrivialValueType>
struct __uninitialized_fill
{
template<typename _ForwardIterator, typename _Tp>
static void
- uninitialized_fill(_ForwardIterator __first,
- _ForwardIterator __last, const _Tp& __x)
+ __uninit_fill(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __x)
{
_ForwardIterator __cur = __first;
__try
{
template<typename _ForwardIterator, typename _Tp>
static void
- uninitialized_fill(_ForwardIterator __first,
- _ForwardIterator __last, const _Tp& __x)
+ __uninit_fill(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __x)
{ std::fill(__first, __last, __x); }
};
typedef typename iterator_traits<_ForwardIterator>::value_type
_ValueType;
- std::__uninitialized_fill<__is_pod(_ValueType)>::
- uninitialized_fill(__first, __last, __x);
+ std::__uninitialized_fill<__is_trivial(_ValueType)>::
+ __uninit_fill(__first, __last, __x);
}
- template<bool>
+ template<bool _TrivialValueType>
struct __uninitialized_fill_n
{
template<typename _ForwardIterator, typename _Size, typename _Tp>
static void
- uninitialized_fill_n(_ForwardIterator __first, _Size __n,
- const _Tp& __x)
+ __uninit_fill_n(_ForwardIterator __first, _Size __n,
+ const _Tp& __x)
{
_ForwardIterator __cur = __first;
__try
{
template<typename _ForwardIterator, typename _Size, typename _Tp>
static void
- uninitialized_fill_n(_ForwardIterator __first, _Size __n,
- const _Tp& __x)
+ __uninit_fill_n(_ForwardIterator __first, _Size __n,
+ const _Tp& __x)
{ std::fill_n(__first, __n, __x); }
};
typedef typename iterator_traits<_ForwardIterator>::value_type
_ValueType;
- std::__uninitialized_fill_n<__is_pod(_ValueType)>::
- uninitialized_fill_n(__first, __n, __x);
+ std::__uninitialized_fill_n<__is_trivial(_ValueType)>::
+ __uninit_fill_n(__first, __n, __x);
}
// Extensions: versions of uninitialized_copy, uninitialized_fill,
}
#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // Extensions: __uninitialized_default, __uninitialized_default_n,
+ // __uninitialized_default_a, __uninitialized_default_n_a.
+
+ template<bool _TrivialValueType>
+ struct __uninitialized_default_1
+ {
+ template<typename _ForwardIterator>
+ static void
+ __uninit_default(_ForwardIterator __first, _ForwardIterator __last)
+ {
+ _ForwardIterator __cur = __first;
+ __try
+ {
+ for (; __cur != __last; ++__cur)
+ std::_Construct(std::__addressof(*__cur));
+ }
+ __catch(...)
+ {
+ std::_Destroy(__first, __cur);
+ __throw_exception_again;
+ }
+ }
+ };
+
+ template<>
+ struct __uninitialized_default_1<true>
+ {
+ template<typename _ForwardIterator>
+ static void
+ __uninit_default(_ForwardIterator __first, _ForwardIterator __last)
+ {
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _ValueType;
+
+ std::fill(__first, __last, _ValueType());
+ }
+ };
+
+ template<bool _TrivialValueType>
+ struct __uninitialized_default_n_1
+ {
+ template<typename _ForwardIterator, typename _Size>
+ static void
+ __uninit_default_n(_ForwardIterator __first, _Size __n)
+ {
+ _ForwardIterator __cur = __first;
+ __try
+ {
+ for (; __n > 0; --__n, ++__cur)
+ std::_Construct(std::__addressof(*__cur));
+ }
+ __catch(...)
+ {
+ std::_Destroy(__first, __cur);
+ __throw_exception_again;
+ }
+ }
+ };
+
+ template<>
+ struct __uninitialized_default_n_1<true>
+ {
+ template<typename _ForwardIterator, typename _Size>
+ static void
+ __uninit_default_n(_ForwardIterator __first, _Size __n)
+ {
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _ValueType;
+
+ std::fill_n(__first, __n, _ValueType());
+ }
+ };
+
+ // __uninitialized_default
+ // Fills [first, last) with std::distance(first, last) default
+ // constructed value_types(s).
+ template<typename _ForwardIterator>
+ inline void
+ __uninitialized_default(_ForwardIterator __first,
+ _ForwardIterator __last)
+ {
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _ValueType;
+
+ std::__uninitialized_default_1<__is_trivial(_ValueType)>::
+ __uninit_default(__first, __last);
+ }
+
+ // __uninitialized_default_n
+ // Fills [first, first + n) with n default constructed value_type(s).
+ template<typename _ForwardIterator, typename _Size>
+ inline void
+ __uninitialized_default_n(_ForwardIterator __first, _Size __n)
+ {
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _ValueType;
+
+ std::__uninitialized_default_n_1<__is_trivial(_ValueType)>::
+ __uninit_default_n(__first, __n);
+ }
+
+
+ // __uninitialized_default_a
+ // Fills [first, last) with std::distance(first, last) default
+ // constructed value_types(s), constructed with the allocator alloc.
+ template<typename _ForwardIterator, typename _Allocator>
+ void
+ __uninitialized_default_a(_ForwardIterator __first,
+ _ForwardIterator __last,
+ _Allocator& __alloc)
+ {
+ _ForwardIterator __cur = __first;
+ __try
+ {
+ for (; __cur != __last; ++__cur)
+ __alloc.construct(std::__addressof(*__cur));
+ }
+ __catch(...)
+ {
+ std::_Destroy(__first, __cur, __alloc);
+ __throw_exception_again;
+ }
+ }
+
+ template<typename _ForwardIterator, typename _Tp>
+ inline void
+ __uninitialized_default_a(_ForwardIterator __first,
+ _ForwardIterator __last,
+ allocator<_Tp>&)
+ { std::__uninitialized_default(__first, __last); }
+
+
+ // __uninitialized_default_n_a
+ // Fills [first, first + n) with n default constructed value_types(s),
+ // constructed with the allocator alloc.
+ template<typename _ForwardIterator, typename _Size, typename _Allocator>
+ void
+ __uninitialized_default_n_a(_ForwardIterator __first, _Size __n,
+ _Allocator& __alloc)
+ {
+ _ForwardIterator __cur = __first;
+ __try
+ {
+ for (; __n > 0; --__n, ++__cur)
+ __alloc.construct(std::__addressof(*__cur));
+ }
+ __catch(...)
+ {
+ std::_Destroy(__first, __cur, __alloc);
+ __throw_exception_again;
+ }
+ }
+
+ template<typename _ForwardIterator, typename _Size, typename _Tp>
+ inline void
+ __uninitialized_default_n_a(_ForwardIterator __first, _Size __n,
+ allocator<_Tp>&)
+ { std::__uninitialized_default_n(__first, __n); }
+
+
template<typename _InputIterator, typename _Size,
typename _ForwardIterator>
_ForwardIterator
// The template and inlines for the -*- C++ -*- internal _Array helper class.
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007, 2008, 2009
+// 2006, 2007, 2008, 2009, 2010
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
inline void
__valarray_fill_construct(_Tp* __b, _Tp* __e, const _Tp __t)
{
- _Array_init_ctor<_Tp, __is_pod(_Tp)>::_S_do_it(__b, __e, __t);
+ _Array_init_ctor<_Tp, __is_trivial(_Tp)>::_S_do_it(__b, __e, __t);
}
//
__valarray_copy_construct(const _Tp* __b, const _Tp* __e,
_Tp* __restrict__ __o)
{
- _Array_copy_ctor<_Tp, __is_pod(_Tp)>::_S_do_it(__b, __e, __o);
+ _Array_copy_ctor<_Tp, __is_trivial(_Tp)>::_S_do_it(__b, __e, __o);
}
// copy-construct raw array [__o, *) from strided array __a[<__n : __s>]
__valarray_copy_construct (const _Tp* __restrict__ __a, size_t __n,
size_t __s, _Tp* __restrict__ __o)
{
- if (__is_pod(_Tp))
+ if (__is_trivial(_Tp))
while (__n--)
{
*__o++ = *__a;
const size_t* __restrict__ __i,
_Tp* __restrict__ __o, size_t __n)
{
- if (__is_pod(_Tp))
+ if (__is_trivial(_Tp))
while (__n--)
*__o++ = __a[*__i++];
else
inline void
__valarray_destroy_elements(_Tp* __b, _Tp* __e)
{
- if (!__is_pod(_Tp))
+ if (!__is_trivial(_Tp))
while (__b != __e)
{
__b->~_Tp();
__valarray_copy(const _Tp* __restrict__ __a, size_t __n,
_Tp* __restrict__ __b)
{
- _Array_copier<_Tp, __is_pod(_Tp)>::_S_do_it(__a, __n, __b);
+ _Array_copier<_Tp, __is_trivial(_Tp)>::_S_do_it(__a, __n, __b);
}
// Copy strided array __a[<__n : __s>] in plain __b[<__n>]