]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/libstdc++-v3/contrib/libstdc++-v3-4.3.3/include/bits/stl_raw_storage_iter.h
update
[l4.git] / l4 / pkg / libstdc++-v3 / contrib / libstdc++-v3-4.3.3 / include / bits / stl_raw_storage_iter.h
1 // -*- C++ -*-
2
3 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 
4 // Free Software Foundation, Inc.
5 //
6 // This file is part of the GNU ISO C++ Library.  This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 2, or (at your option)
10 // any later version.
11
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 // GNU General Public License for more details.
16
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING.  If not, write to the Free
19 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20 // USA.
21
22 // As a special exception, you may use this file as part of a free software
23 // library without restriction.  Specifically, if other files instantiate
24 // templates or use macros or inline functions from this file, or you compile
25 // this file and link it with other files to produce an executable, this
26 // file does not by itself cause the resulting executable to be covered by
27 // the GNU General Public License.  This exception does not however
28 // invalidate any other reasons why the executable file might be covered by
29 // the GNU General Public License.
30
31 /*
32  *
33  * Copyright (c) 1994
34  * Hewlett-Packard Company
35  *
36  * Permission to use, copy, modify, distribute and sell this software
37  * and its documentation for any purpose is hereby granted without fee,
38  * provided that the above copyright notice appear in all copies and
39  * that both that copyright notice and this permission notice appear
40  * in supporting documentation.  Hewlett-Packard Company makes no
41  * representations about the suitability of this software for any
42  * purpose.  It is provided "as is" without express or implied warranty.
43  *
44  *
45  * Copyright (c) 1996
46  * Silicon Graphics Computer Systems, Inc.
47  *
48  * Permission to use, copy, modify, distribute and sell this software
49  * and its documentation for any purpose is hereby granted without fee,
50  * provided that the above copyright notice appear in all copies and
51  * that both that copyright notice and this permission notice appear
52  * in supporting documentation.  Silicon Graphics makes no
53  * representations about the suitability of this software for any
54  * purpose.  It is provided "as is" without express or implied warranty.
55  */
56
57 /** @file stl_raw_storage_iter.h
58  *  This is an internal header file, included by other library headers.
59  *  You should not attempt to use it directly.
60  */
61
62 #ifndef _STL_RAW_STORAGE_ITERATOR_H
63 #define _STL_RAW_STORAGE_ITERATOR_H 1
64
65 _GLIBCXX_BEGIN_NAMESPACE(std)
66
67   /**
68    *  This iterator class lets algorithms store their results into
69    *  uninitialized memory.
70   */
71   template <class _OutputIterator, class _Tp>
72     class raw_storage_iterator
73     : public iterator<output_iterator_tag, void, void, void, void>
74     {
75     protected:
76       _OutputIterator _M_iter;
77
78     public:
79       explicit
80       raw_storage_iterator(_OutputIterator __x)
81       : _M_iter(__x) {}
82
83       raw_storage_iterator&
84       operator*() { return *this; }
85
86       raw_storage_iterator&
87       operator=(const _Tp& __element)
88       {
89         std::_Construct(&*_M_iter, __element);
90         return *this;
91       }
92
93       raw_storage_iterator<_OutputIterator, _Tp>&
94       operator++()
95       {
96         ++_M_iter;
97         return *this;
98       }
99
100       raw_storage_iterator<_OutputIterator, _Tp>
101       operator++(int)
102       {
103         raw_storage_iterator<_OutputIterator, _Tp> __tmp = *this;
104         ++_M_iter;
105         return __tmp;
106       }
107     };
108
109 _GLIBCXX_END_NAMESPACE
110
111 #endif