1 |
424 |
jeremybenn |
// -*- C++ -*-
|
2 |
|
|
|
3 |
|
|
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
|
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 3, 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 |
|
|
// Under Section 7 of GPL version 3, you are granted additional
|
18 |
|
|
// permissions described in the GCC Runtime Library Exception, version
|
19 |
|
|
// 3.1, as published by the Free Software Foundation.
|
20 |
|
|
|
21 |
|
|
// You should have received a copy of the GNU General Public License and
|
22 |
|
|
// a copy of the GCC Runtime Library Exception along with this program;
|
23 |
|
|
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
24 |
|
|
// <http://www.gnu.org/licenses/>.
|
25 |
|
|
|
26 |
|
|
/*
|
27 |
|
|
*
|
28 |
|
|
* Copyright (c) 1994
|
29 |
|
|
* Hewlett-Packard Company
|
30 |
|
|
*
|
31 |
|
|
* Permission to use, copy, modify, distribute and sell this software
|
32 |
|
|
* and its documentation for any purpose is hereby granted without fee,
|
33 |
|
|
* provided that the above copyright notice appear in all copies and
|
34 |
|
|
* that both that copyright notice and this permission notice appear
|
35 |
|
|
* in supporting documentation. Hewlett-Packard Company makes no
|
36 |
|
|
* representations about the suitability of this software for any
|
37 |
|
|
* purpose. It is provided "as is" without express or implied warranty.
|
38 |
|
|
*
|
39 |
|
|
*
|
40 |
|
|
* Copyright (c) 1996
|
41 |
|
|
* Silicon Graphics Computer Systems, Inc.
|
42 |
|
|
*
|
43 |
|
|
* Permission to use, copy, modify, distribute and sell this software
|
44 |
|
|
* and its documentation for any purpose is hereby granted without fee,
|
45 |
|
|
* provided that the above copyright notice appear in all copies and
|
46 |
|
|
* that both that copyright notice and this permission notice appear
|
47 |
|
|
* in supporting documentation. Silicon Graphics makes no
|
48 |
|
|
* representations about the suitability of this software for any
|
49 |
|
|
* purpose. It is provided "as is" without express or implied warranty.
|
50 |
|
|
*/
|
51 |
|
|
|
52 |
|
|
/** @file stl_raw_storage_iter.h
|
53 |
|
|
* This is an internal header file, included by other library headers.
|
54 |
|
|
* You should not attempt to use it directly.
|
55 |
|
|
*/
|
56 |
|
|
|
57 |
|
|
#ifndef _STL_RAW_STORAGE_ITERATOR_H
|
58 |
|
|
#define _STL_RAW_STORAGE_ITERATOR_H 1
|
59 |
|
|
|
60 |
|
|
_GLIBCXX_BEGIN_NAMESPACE(std)
|
61 |
|
|
|
62 |
|
|
/**
|
63 |
|
|
* This iterator class lets algorithms store their results into
|
64 |
|
|
* uninitialized memory.
|
65 |
|
|
*/
|
66 |
|
|
template <class _OutputIterator, class _Tp>
|
67 |
|
|
class raw_storage_iterator
|
68 |
|
|
: public iterator<output_iterator_tag, void, void, void, void>
|
69 |
|
|
{
|
70 |
|
|
protected:
|
71 |
|
|
_OutputIterator _M_iter;
|
72 |
|
|
|
73 |
|
|
public:
|
74 |
|
|
explicit
|
75 |
|
|
raw_storage_iterator(_OutputIterator __x)
|
76 |
|
|
: _M_iter(__x) {}
|
77 |
|
|
|
78 |
|
|
raw_storage_iterator&
|
79 |
|
|
operator*() { return *this; }
|
80 |
|
|
|
81 |
|
|
raw_storage_iterator&
|
82 |
|
|
operator=(const _Tp& __element)
|
83 |
|
|
{
|
84 |
|
|
std::_Construct(&*_M_iter, __element);
|
85 |
|
|
return *this;
|
86 |
|
|
}
|
87 |
|
|
|
88 |
|
|
raw_storage_iterator<_OutputIterator, _Tp>&
|
89 |
|
|
operator++()
|
90 |
|
|
{
|
91 |
|
|
++_M_iter;
|
92 |
|
|
return *this;
|
93 |
|
|
}
|
94 |
|
|
|
95 |
|
|
raw_storage_iterator<_OutputIterator, _Tp>
|
96 |
|
|
operator++(int)
|
97 |
|
|
{
|
98 |
|
|
raw_storage_iterator<_OutputIterator, _Tp> __tmp = *this;
|
99 |
|
|
++_M_iter;
|
100 |
|
|
return __tmp;
|
101 |
|
|
}
|
102 |
|
|
};
|
103 |
|
|
|
104 |
|
|
_GLIBCXX_END_NAMESPACE
|
105 |
|
|
|
106 |
|
|
#endif
|