stl_raw_storage_iter.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 
00004 // Free Software Foundation, Inc.
00005 //
00006 // This file is part of the GNU ISO C++ Library.  This library is free
00007 // software; you can redistribute it and/or modify it under the
00008 // terms of the GNU General Public License as published by the
00009 // Free Software Foundation; either version 2, or (at your option)
00010 // any later version.
00011 
00012 // This library is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 
00017 // You should have received a copy of the GNU General Public License along
00018 // with this library; see the file COPYING.  If not, write to the Free
00019 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
00020 // USA.
00021 
00022 // As a special exception, you may use this file as part of a free software
00023 // library without restriction.  Specifically, if other files instantiate
00024 // templates or use macros or inline functions from this file, or you compile
00025 // this file and link it with other files to produce an executable, this
00026 // file does not by itself cause the resulting executable to be covered by
00027 // the GNU General Public License.  This exception does not however
00028 // invalidate any other reasons why the executable file might be covered by
00029 // the GNU General Public License.
00030 
00031 /*
00032  *
00033  * Copyright (c) 1994
00034  * Hewlett-Packard Company
00035  *
00036  * Permission to use, copy, modify, distribute and sell this software
00037  * and its documentation for any purpose is hereby granted without fee,
00038  * provided that the above copyright notice appear in all copies and
00039  * that both that copyright notice and this permission notice appear
00040  * in supporting documentation.  Hewlett-Packard Company makes no
00041  * representations about the suitability of this software for any
00042  * purpose.  It is provided "as is" without express or implied warranty.
00043  *
00044  *
00045  * Copyright (c) 1996
00046  * Silicon Graphics Computer Systems, Inc.
00047  *
00048  * Permission to use, copy, modify, distribute and sell this software
00049  * and its documentation for any purpose is hereby granted without fee,
00050  * provided that the above copyright notice appear in all copies and
00051  * that both that copyright notice and this permission notice appear
00052  * in supporting documentation.  Silicon Graphics makes no
00053  * representations about the suitability of this software for any
00054  * purpose.  It is provided "as is" without express or implied warranty.
00055  */
00056 
00057 /** @file stl_raw_storage_iter.h
00058  *  This is an internal header file, included by other library headers.
00059  *  You should not attempt to use it directly.
00060  */
00061 
00062 #ifndef _STL_RAW_STORAGE_ITERATOR_H
00063 #define _STL_RAW_STORAGE_ITERATOR_H 1
00064 
00065 _GLIBCXX_BEGIN_NAMESPACE(std)
00066 
00067   /**
00068    *  This iterator class lets algorithms store their results into
00069    *  uninitialized memory.
00070   */
00071   template <class _OutputIterator, class _Tp>
00072     class raw_storage_iterator
00073     : public iterator<output_iterator_tag, void, void, void, void>
00074     {
00075     protected:
00076       _OutputIterator _M_iter;
00077 
00078     public:
00079       explicit
00080       raw_storage_iterator(_OutputIterator __x)
00081       : _M_iter(__x) {}
00082 
00083       raw_storage_iterator&
00084       operator*() { return *this; }
00085 
00086       raw_storage_iterator&
00087       operator=(const _Tp& __element)
00088       {
00089     std::_Construct(&*_M_iter, __element);
00090     return *this;
00091       }
00092 
00093       raw_storage_iterator<_OutputIterator, _Tp>&
00094       operator++()
00095       {
00096     ++_M_iter;
00097     return *this;
00098       }
00099 
00100       raw_storage_iterator<_OutputIterator, _Tp>
00101       operator++(int)
00102       {
00103     raw_storage_iterator<_OutputIterator, _Tp> __tmp = *this;
00104     ++_M_iter;
00105     return __tmp;
00106       }
00107     };
00108 
00109 _GLIBCXX_END_NAMESPACE
00110 
00111 #endif

Generated on Sat Oct 25 05:09:14 2008 for libstdc++ by  doxygen 1.5.6