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 _RefType;
00119       const bool __assignable = is_assignable<_ValueType1, _RefType>::value;
00120 #endif
00121 
00122       return std::__uninitialized_copy<__is_trivial(_ValueType1)
00123                        && __is_trivial(_ValueType2)
00124                        && __assignable>::
00125     __uninit_copy(__first, __last, __result);
00126     }
00127 
00128 
00129   template<bool _TrivialValueType>
00130     struct __uninitialized_fill
00131     {
00132       template<typename _ForwardIterator, typename _Tp>
00133         static void
00134         __uninit_fill(_ForwardIterator __first, _ForwardIterator __last,
00135               const _Tp& __x)
00136         {
00137       _ForwardIterator __cur = __first;
00138       __try
00139         {
00140           for (; __cur != __last; ++__cur)
00141         std::_Construct(std::__addressof(*__cur), __x);
00142         }
00143       __catch(...)
00144         {
00145           std::_Destroy(__first, __cur);
00146           __throw_exception_again;
00147         }
00148     }
00149     };
00150 
00151   template<>
00152     struct __uninitialized_fill<true>
00153     {
00154       template<typename _ForwardIterator, typename _Tp>
00155         static void
00156         __uninit_fill(_ForwardIterator __first, _ForwardIterator __last,
00157               const _Tp& __x)
00158         { std::fill(__first, __last, __x); }
00159     };
00160 
00161   /**
00162    *  @brief Copies the value x into the range [first,last).
00163    *  @param  __first  An input iterator.
00164    *  @param  __last   An input iterator.
00165    *  @param  __x      The source value.
00166    *  @return   Nothing.
00167    *
00168    *  Like fill(), but does not require an initialized output range.
00169   */
00170   template<typename _ForwardIterator, typename _Tp>
00171     inline void
00172     uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last,
00173                const _Tp& __x)
00174     {
00175       typedef typename iterator_traits<_ForwardIterator>::value_type
00176     _ValueType;
00177 #if __cplusplus < 201103L
00178       const bool __assignable = true;
00179 #else
00180       // trivial types can have deleted assignment
00181       const bool __assignable = is_copy_assignable<_ValueType>::value;
00182 #endif
00183 
00184       std::__uninitialized_fill<__is_trivial(_ValueType) && __assignable>::
00185     __uninit_fill(__first, __last, __x);
00186     }
00187 
00188 
00189   template<bool _TrivialValueType>
00190     struct __uninitialized_fill_n
00191     {
00192       template<typename _ForwardIterator, typename _Size, typename _Tp>
00193         static void
00194         __uninit_fill_n(_ForwardIterator __first, _Size __n,
00195             const _Tp& __x)
00196         {
00197       _ForwardIterator __cur = __first;
00198       __try
00199         {
00200           for (; __n > 0; --__n, ++__cur)
00201         std::_Construct(std::__addressof(*__cur), __x);
00202         }
00203       __catch(...)
00204         {
00205           std::_Destroy(__first, __cur);
00206           __throw_exception_again;
00207         }
00208     }
00209     };
00210 
00211   template<>
00212     struct __uninitialized_fill_n<true>
00213     {
00214       template<typename _ForwardIterator, typename _Size, typename _Tp>
00215         static void
00216         __uninit_fill_n(_ForwardIterator __first, _Size __n,
00217             const _Tp& __x)
00218         { std::fill_n(__first, __n, __x); }
00219     };
00220 
00221   /**
00222    *  @brief Copies the value x into the range [first,first+n).
00223    *  @param  __first  An input iterator.
00224    *  @param  __n      The number of copies to make.
00225    *  @param  __x      The source value.
00226    *  @return   Nothing.
00227    *
00228    *  Like fill_n(), but does not require an initialized output range.
00229   */
00230   template<typename _ForwardIterator, typename _Size, typename _Tp>
00231     inline void
00232     uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x)
00233     {
00234       typedef typename iterator_traits<_ForwardIterator>::value_type
00235     _ValueType;
00236 #if __cplusplus < 201103L
00237       const bool __assignable = true;
00238 #else
00239       // trivial types can have deleted assignment
00240       const bool __assignable = is_copy_assignable<_ValueType>::value;
00241 #endif
00242 
00243       std::__uninitialized_fill_n<__is_trivial(_ValueType) && __assignable>::
00244     __uninit_fill_n(__first, __n, __x);
00245     }
00246 
00247   // Extensions: versions of uninitialized_copy, uninitialized_fill,
00248   //  and uninitialized_fill_n that take an allocator parameter.
00249   //  We dispatch back to the standard versions when we're given the
00250   //  default allocator.  For nondefault allocators we do not use 
00251   //  any of the POD optimizations.
00252 
00253   template<typename _InputIterator, typename _ForwardIterator,
00254        typename _Allocator>
00255     _ForwardIterator
00256     __uninitialized_copy_a(_InputIterator __first, _InputIterator __last,
00257                _ForwardIterator __result, _Allocator& __alloc)
00258     {
00259       _ForwardIterator __cur = __result;
00260       __try
00261     {
00262       typedef __gnu_cxx::__alloc_traits<_Allocator> __traits;
00263       for (; __first != __last; ++__first, ++__cur)
00264         __traits::construct(__alloc, std::__addressof(*__cur), *__first);
00265       return __cur;
00266     }
00267       __catch(...)
00268     {
00269       std::_Destroy(__result, __cur, __alloc);
00270       __throw_exception_again;
00271     }
00272     }
00273 
00274   template<typename _InputIterator, typename _ForwardIterator, typename _Tp>
00275     inline _ForwardIterator
00276     __uninitialized_copy_a(_InputIterator __first, _InputIterator __last,
00277                _ForwardIterator __result, allocator<_Tp>&)
00278     { return std::uninitialized_copy(__first, __last, __result); }
00279 
00280   template<typename _InputIterator, typename _ForwardIterator,
00281        typename _Allocator>
00282     inline _ForwardIterator
00283     __uninitialized_move_a(_InputIterator __first, _InputIterator __last,
00284                _ForwardIterator __result, _Allocator& __alloc)
00285     {
00286       return std::__uninitialized_copy_a(_GLIBCXX_MAKE_MOVE_ITERATOR(__first),
00287                      _GLIBCXX_MAKE_MOVE_ITERATOR(__last),
00288                      __result, __alloc);
00289     }
00290 
00291   template<typename _InputIterator, typename _ForwardIterator,
00292        typename _Allocator>
00293     inline _ForwardIterator
00294     __uninitialized_move_if_noexcept_a(_InputIterator __first,
00295                        _InputIterator __last,
00296                        _ForwardIterator __result,
00297                        _Allocator& __alloc)
00298     {
00299       return std::__uninitialized_copy_a
00300     (_GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__first),
00301      _GLIBCXX_MAKE_MOVE_IF_NOEXCEPT_ITERATOR(__last), __result, __alloc);
00302     }
00303 
00304   template<typename _ForwardIterator, typename _Tp, typename _Allocator>
00305     void
00306     __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last,
00307                const _Tp& __x, _Allocator& __alloc)
00308     {
00309       _ForwardIterator __cur = __first;
00310       __try
00311     {
00312       typedef __gnu_cxx::__alloc_traits<_Allocator> __traits;
00313       for (; __cur != __last; ++__cur)
00314         __traits::construct(__alloc, std::__addressof(*__cur), __x);
00315     }
00316       __catch(...)
00317     {
00318       std::_Destroy(__first, __cur, __alloc);
00319       __throw_exception_again;
00320     }
00321     }
00322 
00323   template<typename _ForwardIterator, typename _Tp, typename _Tp2>
00324     inline void
00325     __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last,
00326                const _Tp& __x, allocator<_Tp2>&)
00327     { std::uninitialized_fill(__first, __last, __x); }
00328 
00329   template<typename _ForwardIterator, typename _Size, typename _Tp,
00330        typename _Allocator>
00331     void
00332     __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, 
00333                  const _Tp& __x, _Allocator& __alloc)
00334     {
00335       _ForwardIterator __cur = __first;
00336       __try
00337     {
00338       typedef __gnu_cxx::__alloc_traits<_Allocator> __traits;
00339       for (; __n > 0; --__n, ++__cur)
00340         __traits::construct(__alloc, std::__addressof(*__cur), __x);
00341     }
00342       __catch(...)
00343     {
00344       std::_Destroy(__first, __cur, __alloc);
00345       __throw_exception_again;
00346     }
00347     }
00348 
00349   template<typename _ForwardIterator, typename _Size, typename _Tp,
00350        typename _Tp2>
00351     inline void
00352     __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, 
00353                  const _Tp& __x, allocator<_Tp2>&)
00354     { std::uninitialized_fill_n(__first, __n, __x); }
00355 
00356 
00357   // Extensions: __uninitialized_copy_move, __uninitialized_move_copy,
00358   // __uninitialized_fill_move, __uninitialized_move_fill.
00359   // All of these algorithms take a user-supplied allocator, which is used
00360   // for construction and destruction.
00361 
00362   // __uninitialized_copy_move
00363   // Copies [first1, last1) into [result, result + (last1 - first1)), and
00364   //  move [first2, last2) into
00365   //  [result, result + (last1 - first1) + (last2 - first2)).
00366   template<typename _InputIterator1, typename _InputIterator2,
00367        typename _ForwardIterator, typename _Allocator>
00368     inline _ForwardIterator
00369     __uninitialized_copy_move(_InputIterator1 __first1,
00370                   _InputIterator1 __last1,
00371                   _InputIterator2 __first2,
00372                   _InputIterator2 __last2,
00373                   _ForwardIterator __result,
00374                   _Allocator& __alloc)
00375     {
00376       _ForwardIterator __mid = std::__uninitialized_copy_a(__first1, __last1,
00377                                __result,
00378                                __alloc);
00379       __try
00380     {
00381       return std::__uninitialized_move_a(__first2, __last2, __mid, __alloc);
00382     }
00383       __catch(...)
00384     {
00385       std::_Destroy(__result, __mid, __alloc);
00386       __throw_exception_again;
00387     }
00388     }
00389 
00390   // __uninitialized_move_copy
00391   // Moves [first1, last1) into [result, result + (last1 - first1)), and
00392   //  copies [first2, last2) into
00393   //  [result, result + (last1 - first1) + (last2 - first2)).
00394   template<typename _InputIterator1, typename _InputIterator2,
00395        typename _ForwardIterator, typename _Allocator>
00396     inline _ForwardIterator
00397     __uninitialized_move_copy(_InputIterator1 __first1,
00398                   _InputIterator1 __last1,
00399                   _InputIterator2 __first2,
00400                   _InputIterator2 __last2,
00401                   _ForwardIterator __result,
00402                   _Allocator& __alloc)
00403     {
00404       _ForwardIterator __mid = std::__uninitialized_move_a(__first1, __last1,
00405                                __result,
00406                                __alloc);
00407       __try
00408     {
00409       return std::__uninitialized_copy_a(__first2, __last2, __mid, __alloc);
00410     }
00411       __catch(...)
00412     {
00413       std::_Destroy(__result, __mid, __alloc);
00414       __throw_exception_again;
00415     }
00416     }
00417   
00418   // __uninitialized_fill_move
00419   // Fills [result, mid) with x, and moves [first, last) into
00420   //  [mid, mid + (last - first)).
00421   template<typename _ForwardIterator, typename _Tp, typename _InputIterator,
00422        typename _Allocator>
00423     inline _ForwardIterator
00424     __uninitialized_fill_move(_ForwardIterator __result, _ForwardIterator __mid,
00425                   const _Tp& __x, _InputIterator __first,
00426                   _InputIterator __last, _Allocator& __alloc)
00427     {
00428       std::__uninitialized_fill_a(__result, __mid, __x, __alloc);
00429       __try
00430     {
00431       return std::__uninitialized_move_a(__first, __last, __mid, __alloc);
00432     }
00433       __catch(...)
00434     {
00435       std::_Destroy(__result, __mid, __alloc);
00436       __throw_exception_again;
00437     }
00438     }
00439 
00440   // __uninitialized_move_fill
00441   // Moves [first1, last1) into [first2, first2 + (last1 - first1)), and
00442   //  fills [first2 + (last1 - first1), last2) with x.
00443   template<typename _InputIterator, typename _ForwardIterator, typename _Tp,
00444        typename _Allocator>
00445     inline void
00446     __uninitialized_move_fill(_InputIterator __first1, _InputIterator __last1,
00447                   _ForwardIterator __first2,
00448                   _ForwardIterator __last2, const _Tp& __x,
00449                   _Allocator& __alloc)
00450     {
00451       _ForwardIterator __mid2 = std::__uninitialized_move_a(__first1, __last1,
00452                                 __first2,
00453                                 __alloc);
00454       __try
00455     {
00456       std::__uninitialized_fill_a(__mid2, __last2, __x, __alloc);
00457     }
00458       __catch(...)
00459     {
00460       std::_Destroy(__first2, __mid2, __alloc);
00461       __throw_exception_again;
00462     }
00463     }
00464 
00465 #if __cplusplus >= 201103L
00466   // Extensions: __uninitialized_default, __uninitialized_default_n,
00467   // __uninitialized_default_a, __uninitialized_default_n_a.
00468 
00469   template<bool _TrivialValueType>
00470     struct __uninitialized_default_1
00471     {
00472       template<typename _ForwardIterator>
00473         static void
00474         __uninit_default(_ForwardIterator __first, _ForwardIterator __last)
00475         {
00476       _ForwardIterator __cur = __first;
00477       __try
00478         {
00479           for (; __cur != __last; ++__cur)
00480         std::_Construct(std::__addressof(*__cur));
00481         }
00482       __catch(...)
00483         {
00484           std::_Destroy(__first, __cur);
00485           __throw_exception_again;
00486         }
00487     }
00488     };
00489 
00490   template<>
00491     struct __uninitialized_default_1<true>
00492     {
00493       template<typename _ForwardIterator>
00494         static void
00495         __uninit_default(_ForwardIterator __first, _ForwardIterator __last)
00496         {
00497       typedef typename iterator_traits<_ForwardIterator>::value_type
00498         _ValueType;
00499 
00500       std::fill(__first, __last, _ValueType());
00501     }
00502     };
00503 
00504   template<bool _TrivialValueType>
00505     struct __uninitialized_default_n_1
00506     {
00507       template<typename _ForwardIterator, typename _Size>
00508         static void
00509         __uninit_default_n(_ForwardIterator __first, _Size __n)
00510         {
00511       _ForwardIterator __cur = __first;
00512       __try
00513         {
00514           for (; __n > 0; --__n, ++__cur)
00515         std::_Construct(std::__addressof(*__cur));
00516         }
00517       __catch(...)
00518         {
00519           std::_Destroy(__first, __cur);
00520           __throw_exception_again;
00521         }
00522     }
00523     };
00524 
00525   template<>
00526     struct __uninitialized_default_n_1<true>
00527     {
00528       template<typename _ForwardIterator, typename _Size>
00529         static void
00530         __uninit_default_n(_ForwardIterator __first, _Size __n)
00531         {
00532       typedef typename iterator_traits<_ForwardIterator>::value_type
00533         _ValueType;
00534 
00535       std::fill_n(__first, __n, _ValueType());
00536     }
00537     };
00538 
00539   // __uninitialized_default
00540   // Fills [first, last) with std::distance(first, last) default
00541   // constructed value_types(s).
00542   template<typename _ForwardIterator>
00543     inline void
00544     __uninitialized_default(_ForwardIterator __first,
00545                 _ForwardIterator __last)
00546     {
00547       typedef typename iterator_traits<_ForwardIterator>::value_type
00548     _ValueType;
00549       // trivial types can have deleted assignment
00550       const bool __assignable = is_copy_assignable<_ValueType>::value;
00551 
00552       std::__uninitialized_default_1<__is_trivial(_ValueType)
00553                      && __assignable>::
00554     __uninit_default(__first, __last);
00555     }
00556 
00557   // __uninitialized_default_n
00558   // Fills [first, first + n) with n default constructed value_type(s).
00559   template<typename _ForwardIterator, typename _Size>
00560     inline void
00561     __uninitialized_default_n(_ForwardIterator __first, _Size __n)
00562     {
00563       typedef typename iterator_traits<_ForwardIterator>::value_type
00564     _ValueType;
00565       // trivial types can have deleted assignment
00566       const bool __assignable = is_copy_assignable<_ValueType>::value;
00567 
00568       std::__uninitialized_default_n_1<__is_trivial(_ValueType)
00569                        && __assignable>::
00570     __uninit_default_n(__first, __n);
00571     }
00572 
00573 
00574   // __uninitialized_default_a
00575   // Fills [first, last) with std::distance(first, last) default
00576   // constructed value_types(s), constructed with the allocator alloc.
00577   template<typename _ForwardIterator, typename _Allocator>
00578     void
00579     __uninitialized_default_a(_ForwardIterator __first,
00580                   _ForwardIterator __last,
00581                   _Allocator& __alloc)
00582     {
00583       _ForwardIterator __cur = __first;
00584       __try
00585     {
00586       typedef __gnu_cxx::__alloc_traits<_Allocator> __traits;
00587       for (; __cur != __last; ++__cur)
00588         __traits::construct(__alloc, std::__addressof(*__cur));
00589     }
00590       __catch(...)
00591     {
00592       std::_Destroy(__first, __cur, __alloc);
00593       __throw_exception_again;
00594     }
00595     }
00596 
00597   template<typename _ForwardIterator, typename _Tp>
00598     inline void
00599     __uninitialized_default_a(_ForwardIterator __first,
00600                   _ForwardIterator __last,
00601                   allocator<_Tp>&)
00602     { std::__uninitialized_default(__first, __last); }
00603 
00604 
00605   // __uninitialized_default_n_a
00606   // Fills [first, first + n) with n default constructed value_types(s),
00607   // constructed with the allocator alloc.
00608   template<typename _ForwardIterator, typename _Size, typename _Allocator>
00609     void
00610     __uninitialized_default_n_a(_ForwardIterator __first, _Size __n, 
00611                 _Allocator& __alloc)
00612     {
00613       _ForwardIterator __cur = __first;
00614       __try
00615     {
00616       typedef __gnu_cxx::__alloc_traits<_Allocator> __traits;
00617       for (; __n > 0; --__n, ++__cur)
00618         __traits::construct(__alloc, std::__addressof(*__cur));
00619     }
00620       __catch(...)
00621     {
00622       std::_Destroy(__first, __cur, __alloc);
00623       __throw_exception_again;
00624     }
00625     }
00626 
00627   template<typename _ForwardIterator, typename _Size, typename _Tp>
00628     inline void
00629     __uninitialized_default_n_a(_ForwardIterator __first, _Size __n, 
00630                 allocator<_Tp>&)
00631     { std::__uninitialized_default_n(__first, __n); }
00632 
00633 
00634   template<typename _InputIterator, typename _Size,
00635        typename _ForwardIterator>
00636     _ForwardIterator
00637     __uninitialized_copy_n(_InputIterator __first, _Size __n,
00638                _ForwardIterator __result, input_iterator_tag)
00639     {
00640       _ForwardIterator __cur = __result;
00641       __try
00642     {
00643       for (; __n > 0; --__n, ++__first, ++__cur)
00644         std::_Construct(std::__addressof(*__cur), *__first);
00645       return __cur;
00646     }
00647       __catch(...)
00648     {
00649       std::_Destroy(__result, __cur);
00650       __throw_exception_again;
00651     }
00652     }
00653 
00654   template<typename _RandomAccessIterator, typename _Size,
00655        typename _ForwardIterator>
00656     inline _ForwardIterator
00657     __uninitialized_copy_n(_RandomAccessIterator __first, _Size __n,
00658                _ForwardIterator __result,
00659                random_access_iterator_tag)
00660     { return std::uninitialized_copy(__first, __first + __n, __result); }
00661 
00662   /**
00663    *  @brief Copies the range [first,first+n) into result.
00664    *  @param  __first  An input iterator.
00665    *  @param  __n      The number of elements to copy.
00666    *  @param  __result An output iterator.
00667    *  @return  __result + __n
00668    *
00669    *  Like copy_n(), but does not require an initialized output range.
00670   */
00671   template<typename _InputIterator, typename _Size, typename _ForwardIterator>
00672     inline _ForwardIterator
00673     uninitialized_copy_n(_InputIterator __first, _Size __n,
00674              _ForwardIterator __result)
00675     { return std::__uninitialized_copy_n(__first, __n, __result,
00676                      std::__iterator_category(__first)); }
00677 #endif
00678 
00679 _GLIBCXX_END_NAMESPACE_VERSION
00680 } // namespace
00681 
00682 #endif /* _STL_UNINITIALIZED_H */