libstdc++
stl_uninitialized.h
Go to the documentation of this file.
00001 // Raw memory manipulators -*- C++ -*-
00002 
00003 // Copyright (C) 2001-2014 Free Software Foundation, Inc.
00004 //
00005 // This file is part of the GNU ISO C++ Library.  This library is free
00006 // software; you can redistribute it and/or modify it under the
00007 // terms of the GNU General Public License as published by the
00008 // Free Software Foundation; either version 3, or (at your option)
00009 // any later version.
00010 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU General Public License for more details.
00015 
00016 // Under Section 7 of GPL version 3, you are granted additional
00017 // permissions described in the GCC Runtime Library Exception, version
00018 // 3.1, as published by the Free Software Foundation.
00019 
00020 // You should have received a copy of the GNU General Public License and
00021 // a copy of the GCC Runtime Library Exception along with this program;
00022 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
00023 // <http://www.gnu.org/licenses/>.
00024 
00025 /*
00026  *
00027  * Copyright (c) 1994
00028  * Hewlett-Packard Company
00029  *
00030  * Permission to use, copy, modify, distribute and sell this software
00031  * and its documentation for any purpose is hereby granted without fee,
00032  * provided that the above copyright notice appear in all copies and
00033  * that both that copyright notice and this permission notice appear
00034  * in supporting documentation.  Hewlett-Packard Company makes no
00035  * representations about the suitability of this software for any
00036  * purpose.  It is provided "as is" without express or implied warranty.
00037  *
00038  *
00039  * Copyright (c) 1996,1997
00040  * Silicon Graphics Computer Systems, Inc.
00041  *
00042  * Permission to use, copy, modify, distribute and sell this software
00043  * and its documentation for any purpose is hereby granted without fee,
00044  * provided that the above copyright notice appear in all copies and
00045  * that both that copyright notice and this permission notice appear
00046  * in supporting documentation.  Silicon Graphics makes no
00047  * representations about the suitability of this software for any
00048  * purpose.  It is provided "as is" without express or implied warranty.
00049  */
00050 
00051 /** @file bits/stl_uninitialized.h
00052  *  This is an internal header file, included by other library headers.
00053  *  Do not attempt to use it directly. @headername{memory}
00054  */
00055 
00056 #ifndef _STL_UNINITIALIZED_H
00057 #define _STL_UNINITIALIZED_H 1
00058 
00059 namespace std _GLIBCXX_VISIBILITY(default)
00060 {
00061 _GLIBCXX_BEGIN_NAMESPACE_VERSION
00062 
00063   template<bool _TrivialValueTypes>
00064     struct __uninitialized_copy
00065     {
00066       template<typename _InputIterator, typename _ForwardIterator>
00067         static _ForwardIterator
00068         __uninit_copy(_InputIterator __first, _InputIterator __last,
00069               _ForwardIterator __result)
00070         {
00071       _ForwardIterator __cur = __result;
00072       __try
00073         {
00074           for (; __first != __last; ++__first, ++__cur)
00075         std::_Construct(std::__addressof(*__cur), *__first);
00076           return __cur;
00077         }
00078       __catch(...)
00079         {
00080           std::_Destroy(__result, __cur);
00081           __throw_exception_again;
00082         }
00083     }
00084     };
00085 
00086   template<>
00087     struct __uninitialized_copy<true>
00088     {
00089       template<typename _InputIterator, typename _ForwardIterator>
00090         static _ForwardIterator
00091         __uninit_copy(_InputIterator __first, _InputIterator __last,
00092               _ForwardIterator __result)
00093         { return std::copy(__first, __last, __result); }
00094     };
00095 
00096   /**
00097    *  @brief Copies the range [first,last) into result.
00098    *  @param  __first  An input iterator.
00099    *  @param  __last   An input iterator.
00100    *  @param  __result An output iterator.
00101    *  @return   __result + (__first - __last)
00102    *
00103    *  Like copy(), but does not require an initialized output range.
00104   */
00105   template<typename _InputIterator, typename _ForwardIterator>
00106     inline _ForwardIterator
00107     uninitialized_copy(_InputIterator __first, _InputIterator __last,
00108                _ForwardIterator __result)
00109     {
00110       typedef typename iterator_traits<_InputIterator>::value_type
00111     _ValueType1;
00112       typedef typename iterator_traits<_ForwardIterator>::value_type
00113     _ValueType2;
00114 #if __cplusplus < 201103L
00115       const bool __assignable = true;
00116 #else
00117       // trivial types can have deleted assignment
00118       typedef typename iterator_traits<_InputIterator>::reference _RefType1;
00119       typedef typename iterator_traits<_ForwardIterator>::reference _RefType2;
00120       const bool __assignable = is_assignable<_RefType2, _RefType1>::value;
00121 #endif
00122 
00123       return std::__uninitialized_copy<__is_trivial(_ValueType1)
00124                        && __is_trivial(_ValueType2)
00125                        && __assignable>::
00126     __uninit_copy(__first, __last, __result);
00127     }
00128 
00129 
00130   template<bool _TrivialValueType>
00131     struct __uninitialized_fill
00132     {
00133       template<typename _ForwardIterator, typename _Tp>
00134         static void
00135         __uninit_fill(_ForwardIterator __first, _ForwardIterator __last,
00136               const _Tp& __x)
00137         {
00138       _ForwardIterator __cur = __first;
00139       __try
00140         {
00141           for (; __cur != __last; ++__cur)
00142         std::_Construct(std::__addressof(*__cur), __x);
00143         }
00144       __catch(...)
00145         {
00146           std::_Destroy(__first, __cur);
00147           __throw_exception_again;
00148         }
00149     }
00150     };
00151 
00152   template<>
00153     struct __uninitialized_fill<true>
00154     {
00155       template<typename _ForwardIterator, typename _Tp>
00156         static void
00157         __uninit_fill(_ForwardIterator __first, _ForwardIterator __last,
00158               const _Tp& __x)
00159         { std::fill(__first, __last, __x); }
00160     };
00161 
00162   /**
00163    *  @brief Copies the value x into the range [first,last).
00164    *  @param  __first  An input iterator.
00165    *  @param  __last   An input iterator.
00166    *  @param  __x      The source value.
00167    *  @return   Nothing.
00168    *
00169    *  Like fill(), but does not require an initialized output range.
00170   */
00171   template<typename _ForwardIterator, typename _Tp>
00172     inline void
00173     uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last,
00174                const _Tp& __x)
00175     {
00176       typedef typename iterator_traits<_ForwardIterator>::value_type
00177     _ValueType;
00178 #if __cplusplus < 201103L
00179       const bool __assignable = true;
00180 #else
00181       // trivial types can have deleted assignment
00182       const bool __assignable = is_copy_assignable<_ValueType>::value;
00183 #endif
00184 
00185       std::__uninitialized_fill<__is_trivial(_ValueType) && __assignable>::
00186     __uninit_fill(__first, __last, __x);
00187     }
00188 
00189 
00190   template<bool _TrivialValueType>
00191     struct __uninitialized_fill_n
00192     {
00193       template<typename _ForwardIterator, typename _Size, typename _Tp>
00194         static void
00195         __uninit_fill_n(_ForwardIterator __first, _Size __n,
00196             const _Tp& __x)
00197         {
00198       _ForwardIterator __cur = __first;
00199       __try
00200         {
00201           for (; __n > 0; --__n, ++__cur)
00202         std::_Construct(std::__addressof(*__cur), __x);
00203         }
00204       __catch(...)
00205         {
00206           std::_Destroy(__first, __cur);
00207           __throw_exception_again;
00208         }
00209     }
00210     };
00211 
00212   template<>
00213     struct __uninitialized_fill_n<true>
00214     {
00215       template<typename _ForwardIterator, typename _Size, typename _Tp>
00216         static void
00217         __uninit_fill_n(_ForwardIterator __first, _Size __n,
00218             const _Tp& __x)
00219         { std::fill_n(__first, __n, __x); }
00220     };
00221 
00222   /**
00223    *  @brief Copies the value x into the range [first,first+n).
00224    *  @param  __first  An input iterator.
00225    *  @param  __n      The number of copies to make.
00226    *  @param  __x      The source value.
00227    *  @return   Nothing.
00228    *
00229    *  Like fill_n(), but does not require an initialized output range.
00230   */
00231   template<typename _ForwardIterator, typename _Size, typename _Tp>
00232     inline void
00233     uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x)
00234     {
00235       typedef typename iterator_traits<_ForwardIterator>::value_type
00236     _ValueType;
00237 #if __cplusplus < 201103L
00238       const bool __assignable = true;
00239 #else
00240       // trivial types can have deleted assignment
00241       const bool __assignable = is_copy_assignable<_ValueType>::value;
00242 #endif
00243 
00244       std::__uninitialized_fill_n<__is_trivial(_ValueType) && __assignable>::
00245     __uninit_fill_n(__first, __n, __x);
00246     }
00247 
00248   // Extensions: versions of uninitialized_copy, uninitialized_fill,
00249   //  and uninitialized_fill_n that take an allocator parameter.
00250   //  We dispatch back to the standard versions when we're given the
00251   //  default allocator.  For nondefault allocators we do not use 
00252   //  any of the POD optimizations.
00253 
00254   template<typename _InputIterator, typename _ForwardIterator,
00255        typename _Allocator>
00256     _ForwardIterator
00257     __uninitialized_copy_a(_InputIterator __first, _InputIterator __last,
00258                _ForwardIterator __result, _Allocator& __alloc)
00259     {
00260       _ForwardIterator __cur = __result;
00261       __try
00262     {
00263       typedef __gnu_cxx::__alloc_traits<_Allocator> __traits;
00264       for (; __first != __last; ++__first, ++__cur)
00265         __traits::construct(__alloc, std::__addressof(*__cur), *__first);
00266       return __cur;
00267     }
00268       __catch(...)
00269     {
00270       std::_Destroy(__result, __cur, __alloc);
00271       __throw_exception_again;
00272     }
00273     }
00274 
00275   template<typename _InputIterator, typename _ForwardIterator, typename _Tp>
00276     inline _ForwardIterator
00277     __uninitialized_copy_a(_InputIterator __first, _InputIterator __last,
00278                _ForwardIterator __result, allocator<_Tp>&)
00279     { return std::uninitialized_copy(__first, __last, __result); }
00280 
00281   template<typename _InputIterator, typename _ForwardIterator,
00282        typename _Allocator>
00283     inline _ForwardIterator
00284     __uninitialized_move_a(_InputIterator __first, _InputIterator __last,
00285                _ForwardIterator __result, _Allocator& __alloc)
00286     {
00287       return std::__uninitialized_copy_a(_GLIBCXX_MAKE_MOVE_ITERATOR(__first),
00288                      _GLIBCXX_MAKE_MOVE_ITERATOR(__last),
00289                      __result, __alloc);
00290     }
00291 
00292   template<typename _InputIterator, typename _ForwardIterator,
00293        typename _Allocator>
00294     inline _ForwardIterator
00295     __uninitialized_move_if_noexcept_a(_InputIterator __first,
00296                        _InputIterator __last,
00297                        _ForwardIterator __result,
00298                        _Allocator& __alloc)
00299     {
00300       return std::__uninitialized_copy_a
00301     (_GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__first),
00302      _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__last), __result, __alloc);
00303     }
00304 
00305   template<typename _ForwardIterator, typename _Tp, typename _Allocator>
00306     void
00307     __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last,
00308                const _Tp& __x, _Allocator& __alloc)
00309     {
00310       _ForwardIterator __cur = __first;
00311       __try
00312     {
00313       typedef __gnu_cxx::__alloc_traits<_Allocator> __traits;
00314       for (; __cur != __last; ++__cur)
00315         __traits::construct(__alloc, std::__addressof(*__cur), __x);
00316     }
00317       __catch(...)
00318     {
00319       std::_Destroy(__first, __cur, __alloc);
00320       __throw_exception_again;
00321     }
00322     }
00323 
00324   template<typename _ForwardIterator, typename _Tp, typename _Tp2>
00325     inline void
00326     __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last,
00327                const _Tp& __x, allocator<_Tp2>&)
00328     { std::uninitialized_fill(__first, __last, __x); }
00329 
00330   template<typename _ForwardIterator, typename _Size, typename _Tp,
00331        typename _Allocator>
00332     void
00333     __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, 
00334                  const _Tp& __x, _Allocator& __alloc)
00335     {
00336       _ForwardIterator __cur = __first;
00337       __try
00338     {
00339       typedef __gnu_cxx::__alloc_traits<_Allocator> __traits;
00340       for (; __n > 0; --__n, ++__cur)
00341         __traits::construct(__alloc, std::__addressof(*__cur), __x);
00342     }
00343       __catch(...)
00344     {
00345       std::_Destroy(__first, __cur, __alloc);
00346       __throw_exception_again;
00347     }
00348     }
00349 
00350   template<typename _ForwardIterator, typename _Size, typename _Tp,
00351        typename _Tp2>
00352     inline void
00353     __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, 
00354                  const _Tp& __x, allocator<_Tp2>&)
00355     { std::uninitialized_fill_n(__first, __n, __x); }
00356 
00357 
00358   // Extensions: __uninitialized_copy_move, __uninitialized_move_copy,
00359   // __uninitialized_fill_move, __uninitialized_move_fill.
00360   // All of these algorithms take a user-supplied allocator, which is used
00361   // for construction and destruction.
00362 
00363   // __uninitialized_copy_move
00364   // Copies [first1, last1) into [result, result + (last1 - first1)), and
00365   //  move [first2, last2) into
00366   //  [result, result + (last1 - first1) + (last2 - first2)).
00367   template<typename _InputIterator1, typename _InputIterator2,
00368        typename _ForwardIterator, typename _Allocator>
00369     inline _ForwardIterator
00370     __uninitialized_copy_move(_InputIterator1 __first1,
00371                   _InputIterator1 __last1,
00372                   _InputIterator2 __first2,
00373                   _InputIterator2 __last2,
00374                   _ForwardIterator __result,
00375                   _Allocator& __alloc)
00376     {
00377       _ForwardIterator __mid = std::__uninitialized_copy_a(__first1, __last1,
00378                                __result,
00379                                __alloc);
00380       __try
00381     {
00382       return std::__uninitialized_move_a(__first2, __last2, __mid, __alloc);
00383     }
00384       __catch(...)
00385     {
00386       std::_Destroy(__result, __mid, __alloc);
00387       __throw_exception_again;
00388     }
00389     }
00390 
00391   // __uninitialized_move_copy
00392   // Moves [first1, last1) into [result, result + (last1 - first1)), and
00393   //  copies [first2, last2) into
00394   //  [result, result + (last1 - first1) + (last2 - first2)).
00395   template<typename _InputIterator1, typename _InputIterator2,
00396        typename _ForwardIterator, typename _Allocator>
00397     inline _ForwardIterator
00398     __uninitialized_move_copy(_InputIterator1 __first1,
00399                   _InputIterator1 __last1,
00400                   _InputIterator2 __first2,
00401                   _InputIterator2 __last2,
00402                   _ForwardIterator __result,
00403                   _Allocator& __alloc)
00404     {
00405       _ForwardIterator __mid = std::__uninitialized_move_a(__first1, __last1,
00406                                __result,
00407                                __alloc);
00408       __try
00409     {
00410       return std::__uninitialized_copy_a(__first2, __last2, __mid, __alloc);
00411     }
00412       __catch(...)
00413     {
00414       std::_Destroy(__result, __mid, __alloc);
00415       __throw_exception_again;
00416     }
00417     }
00418   
00419   // __uninitialized_fill_move
00420   // Fills [result, mid) with x, and moves [first, last) into
00421   //  [mid, mid + (last - first)).
00422   template<typename _ForwardIterator, typename _Tp, typename _InputIterator,
00423        typename _Allocator>
00424     inline _ForwardIterator
00425     __uninitialized_fill_move(_ForwardIterator __result, _ForwardIterator __mid,
00426                   const _Tp& __x, _InputIterator __first,
00427                   _InputIterator __last, _Allocator& __alloc)
00428     {
00429       std::__uninitialized_fill_a(__result, __mid, __x, __alloc);
00430       __try
00431     {
00432       return std::__uninitialized_move_a(__first, __last, __mid, __alloc);
00433     }
00434       __catch(...)
00435     {
00436       std::_Destroy(__result, __mid, __alloc);
00437       __throw_exception_again;
00438     }
00439     }
00440 
00441   // __uninitialized_move_fill
00442   // Moves [first1, last1) into [first2, first2 + (last1 - first1)), and
00443   //  fills [first2 + (last1 - first1), last2) with x.
00444   template<typename _InputIterator, typename _ForwardIterator, typename _Tp,
00445        typename _Allocator>
00446     inline void
00447     __uninitialized_move_fill(_InputIterator __first1, _InputIterator __last1,
00448                   _ForwardIterator __first2,
00449                   _ForwardIterator __last2, const _Tp& __x,
00450                   _Allocator& __alloc)
00451     {
00452       _ForwardIterator __mid2 = std::__uninitialized_move_a(__first1, __last1,
00453                                 __first2,
00454                                 __alloc);
00455       __try
00456     {
00457       std::__uninitialized_fill_a(__mid2, __last2, __x, __alloc);
00458     }
00459       __catch(...)
00460     {
00461       std::_Destroy(__first2, __mid2, __alloc);
00462       __throw_exception_again;
00463     }
00464     }
00465 
00466 #if __cplusplus >= 201103L
00467   // Extensions: __uninitialized_default, __uninitialized_default_n,
00468   // __uninitialized_default_a, __uninitialized_default_n_a.
00469 
00470   template<bool _TrivialValueType>
00471     struct __uninitialized_default_1
00472     {
00473       template<typename _ForwardIterator>
00474         static void
00475         __uninit_default(_ForwardIterator __first, _ForwardIterator __last)
00476         {
00477       _ForwardIterator __cur = __first;
00478       __try
00479         {
00480           for (; __cur != __last; ++__cur)
00481         std::_Construct(std::__addressof(*__cur));
00482         }
00483       __catch(...)
00484         {
00485           std::_Destroy(__first, __cur);
00486           __throw_exception_again;
00487         }
00488     }
00489     };
00490 
00491   template<>
00492     struct __uninitialized_default_1<true>
00493     {
00494       template<typename _ForwardIterator>
00495         static void
00496         __uninit_default(_ForwardIterator __first, _ForwardIterator __last)
00497         {
00498       typedef typename iterator_traits<_ForwardIterator>::value_type
00499         _ValueType;
00500 
00501       std::fill(__first, __last, _ValueType());
00502     }
00503     };
00504 
00505   template<bool _TrivialValueType>
00506     struct __uninitialized_default_n_1
00507     {
00508       template<typename _ForwardIterator, typename _Size>
00509         static void
00510         __uninit_default_n(_ForwardIterator __first, _Size __n)
00511         {
00512       _ForwardIterator __cur = __first;
00513       __try
00514         {
00515           for (; __n > 0; --__n, ++__cur)
00516         std::_Construct(std::__addressof(*__cur));
00517         }
00518       __catch(...)
00519         {
00520           std::_Destroy(__first, __cur);
00521           __throw_exception_again;
00522         }
00523     }
00524     };
00525 
00526   template<>
00527     struct __uninitialized_default_n_1<true>
00528     {
00529       template<typename _ForwardIterator, typename _Size>
00530         static void
00531         __uninit_default_n(_ForwardIterator __first, _Size __n)
00532         {
00533       typedef typename iterator_traits<_ForwardIterator>::value_type
00534         _ValueType;
00535 
00536       std::fill_n(__first, __n, _ValueType());
00537     }
00538     };
00539 
00540   // __uninitialized_default
00541   // Fills [first, last) with std::distance(first, last) default
00542   // constructed value_types(s).
00543   template<typename _ForwardIterator>
00544     inline void
00545     __uninitialized_default(_ForwardIterator __first,
00546                 _ForwardIterator __last)
00547     {
00548       typedef typename iterator_traits<_ForwardIterator>::value_type
00549     _ValueType;
00550       // trivial types can have deleted assignment
00551       const bool __assignable = is_copy_assignable<_ValueType>::value;
00552 
00553       std::__uninitialized_default_1<__is_trivial(_ValueType)
00554                      && __assignable>::
00555     __uninit_default(__first, __last);
00556     }
00557 
00558   // __uninitialized_default_n
00559   // Fills [first, first + n) with n default constructed value_type(s).
00560   template<typename _ForwardIterator, typename _Size>
00561     inline void
00562     __uninitialized_default_n(_ForwardIterator __first, _Size __n)
00563     {
00564       typedef typename iterator_traits<_ForwardIterator>::value_type
00565     _ValueType;
00566       // trivial types can have deleted assignment
00567       const bool __assignable = is_copy_assignable<_ValueType>::value;
00568 
00569       std::__uninitialized_default_n_1<__is_trivial(_ValueType)
00570                        && __assignable>::
00571     __uninit_default_n(__first, __n);
00572     }
00573 
00574 
00575   // __uninitialized_default_a
00576   // Fills [first, last) with std::distance(first, last) default
00577   // constructed value_types(s), constructed with the allocator alloc.
00578   template<typename _ForwardIterator, typename _Allocator>
00579     void
00580     __uninitialized_default_a(_ForwardIterator __first,
00581                   _ForwardIterator __last,
00582                   _Allocator& __alloc)
00583     {
00584       _ForwardIterator __cur = __first;
00585       __try
00586     {
00587       typedef __gnu_cxx::__alloc_traits<_Allocator> __traits;
00588       for (; __cur != __last; ++__cur)
00589         __traits::construct(__alloc, std::__addressof(*__cur));
00590     }
00591       __catch(...)
00592     {
00593       std::_Destroy(__first, __cur, __alloc);
00594       __throw_exception_again;
00595     }
00596     }
00597 
00598   template<typename _ForwardIterator, typename _Tp>
00599     inline void
00600     __uninitialized_default_a(_ForwardIterator __first,
00601                   _ForwardIterator __last,
00602                   allocator<_Tp>&)
00603     { std::__uninitialized_default(__first, __last); }
00604 
00605 
00606   // __uninitialized_default_n_a
00607   // Fills [first, first + n) with n default constructed value_types(s),
00608   // constructed with the allocator alloc.
00609   template<typename _ForwardIterator, typename _Size, typename _Allocator>
00610     void
00611     __uninitialized_default_n_a(_ForwardIterator __first, _Size __n, 
00612                 _Allocator& __alloc)
00613     {
00614       _ForwardIterator __cur = __first;
00615       __try
00616     {
00617       typedef __gnu_cxx::__alloc_traits<_Allocator> __traits;
00618       for (; __n > 0; --__n, ++__cur)
00619         __traits::construct(__alloc, std::__addressof(*__cur));
00620     }
00621       __catch(...)
00622     {
00623       std::_Destroy(__first, __cur, __alloc);
00624       __throw_exception_again;
00625     }
00626     }
00627 
00628   template<typename _ForwardIterator, typename _Size, typename _Tp>
00629     inline void
00630     __uninitialized_default_n_a(_ForwardIterator __first, _Size __n, 
00631                 allocator<_Tp>&)
00632     { std::__uninitialized_default_n(__first, __n); }
00633 
00634 
00635   template<typename _InputIterator, typename _Size,
00636        typename _ForwardIterator>
00637     _ForwardIterator
00638     __uninitialized_copy_n(_InputIterator __first, _Size __n,
00639                _ForwardIterator __result, input_iterator_tag)
00640     {
00641       _ForwardIterator __cur = __result;
00642       __try
00643     {
00644       for (; __n > 0; --__n, ++__first, ++__cur)
00645         std::_Construct(std::__addressof(*__cur), *__first);
00646       return __cur;
00647     }
00648       __catch(...)
00649     {
00650       std::_Destroy(__result, __cur);
00651       __throw_exception_again;
00652     }
00653     }
00654 
00655   template<typename _RandomAccessIterator, typename _Size,
00656        typename _ForwardIterator>
00657     inline _ForwardIterator
00658     __uninitialized_copy_n(_RandomAccessIterator __first, _Size __n,
00659                _ForwardIterator __result,
00660                random_access_iterator_tag)
00661     { return std::uninitialized_copy(__first, __first + __n, __result); }
00662 
00663   /**
00664    *  @brief Copies the range [first,first+n) into result.
00665    *  @param  __first  An input iterator.
00666    *  @param  __n      The number of elements to copy.
00667    *  @param  __result An output iterator.
00668    *  @return  __result + __n
00669    *
00670    *  Like copy_n(), but does not require an initialized output range.
00671   */
00672   template<typename _InputIterator, typename _Size, typename _ForwardIterator>
00673     inline _ForwardIterator
00674     uninitialized_copy_n(_InputIterator __first, _Size __n,
00675              _ForwardIterator __result)
00676     { return std::__uninitialized_copy_n(__first, __n, __result,
00677                      std::__iterator_category(__first)); }
00678 #endif
00679 
00680 _GLIBCXX_END_NAMESPACE_VERSION
00681 } // namespace
00682 
00683 #endif /* _STL_UNINITIALIZED_H */