Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6554 serge 1
// Profiling deque implementation -*- C++ -*-
2
 
3
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
4
//
5
// This file is part of the GNU ISO C++ Library.  This library is free
6
// software; you can redistribute it and/or modify it under the
7
// terms of the GNU General Public License as published by the
8
// Free Software Foundation; either version 3, or (at your option)
9
// any later version.
10
 
11
// This library is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
// GNU General Public License for more details.
15
 
16
// Under Section 7 of GPL version 3, you are granted additional
17
// permissions described in the GCC Runtime Library Exception, version
18
// 3.1, as published by the Free Software Foundation.
19
 
20
// You should have received a copy of the GNU General Public License and
21
// a copy of the GCC Runtime Library Exception along with this program;
22
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23
// .
24
 
25
/** @file profile/deque
26
 *  This file is a GNU profile extension to the Standard C++ Library.
27
 */
28
 
29
#ifndef _GLIBCXX_PROFILE_DEQUE
30
#define _GLIBCXX_PROFILE_DEQUE 1
31
 
32
#include 
33
 
34
namespace std _GLIBCXX_VISIBILITY(default)
35
{
36
namespace __profile
37
{
38
  /// Class std::deque wrapper with performance instrumentation.
39
  template >
40
    class deque
41
    : public _GLIBCXX_STD_C::deque<_Tp, _Allocator>
42
    {
43
      typedef  _GLIBCXX_STD_C::deque<_Tp, _Allocator> _Base;
44
 
45
    public:
46
      typedef typename _Base::size_type			size_type;
47
      typedef typename _Base::value_type		value_type;
48
 
49
      // 23.2.1.1 construct/copy/destroy:
50
 
51
#if __cplusplus < 201103L
52
      deque()
53
      : _Base() { }
54
      deque(const deque& __x)
55
      : _Base(__x) { }
56
 
57
      ~deque() { }
58
#else
59
      deque() = default;
60
      deque(const deque&) = default;
61
      deque(deque&&) = default;
62
 
63
      deque(const deque& __d, const _Allocator& __a)
64
      : _Base(__d, __a) { }
65
 
66
      deque(deque&& __d, const _Allocator& __a)
67
      : _Base(std::move(__d), __a) { }
68
 
69
      ~deque() = default;
70
 
71
      deque(initializer_list __l,
72
	    const _Allocator& __a = _Allocator())
73
      : _Base(__l, __a) { }
74
#endif
75
 
76
      explicit
77
      deque(const _Allocator& __a)
78
      : _Base(__a) { }
79
 
80
#if __cplusplus >= 201103L
81
      explicit
82
      deque(size_type __n, const _Allocator& __a = _Allocator())
83
      : _Base(__n, __a) { }
84
 
85
      deque(size_type __n, const _Tp& __value,
86
	    const _Allocator& __a = _Allocator())
87
      : _Base(__n, __value, __a) { }
88
#else
89
      explicit
90
      deque(size_type __n, const _Tp& __value = _Tp(),
91
	    const _Allocator& __a = _Allocator())
92
      : _Base(__n, __value, __a) { }
93
#endif
94
 
95
#if __cplusplus >= 201103L
96
      template
97
	       typename = std::_RequireInputIter<_InputIterator>>
98
#else
99
      template
100
#endif
101
	deque(_InputIterator __first, _InputIterator __last,
102
	      const _Allocator& __a = _Allocator())
103
	: _Base(__first, __last, __a)
104
	{ }
105
 
106
      deque(const _Base& __x)
107
      : _Base(__x) { }
108
 
109
#if __cplusplus < 201103L
110
      deque&
111
      operator=(const deque& __x)
112
      {
113
	_M_base() = __x;
114
	return *this;
115
      }
116
#else
117
      deque&
118
      operator=(const deque&) = default;
119
 
120
      deque&
121
      operator=(deque&&) = default;
122
 
123
      deque&
124
      operator=(initializer_list __l)
125
      {
126
	_M_base() = __l;
127
	return *this;
128
      }
129
#endif
130
 
131
      void
132
      swap(deque& __x)
133
#if __cplusplus >= 201103L
134
	noexcept( noexcept(declval<_Base>().swap(__x)) )
135
#endif
136
      { _Base::swap(__x); }
137
 
138
      _Base&
139
      _M_base() _GLIBCXX_NOEXCEPT	{ return *this; }
140
 
141
      const _Base&
142
      _M_base() const _GLIBCXX_NOEXCEPT	{ return *this; }
143
    };
144
 
145
  template
146
    inline bool
147
    operator==(const deque<_Tp, _Alloc>& __lhs,
148
	       const deque<_Tp, _Alloc>& __rhs)
149
    { return __lhs._M_base() == __rhs._M_base(); }
150
 
151
  template
152
    inline bool
153
    operator!=(const deque<_Tp, _Alloc>& __lhs,
154
	       const deque<_Tp, _Alloc>& __rhs)
155
    { return __lhs._M_base() != __rhs._M_base(); }
156
 
157
  template
158
    inline bool
159
    operator<(const deque<_Tp, _Alloc>& __lhs,
160
	      const deque<_Tp, _Alloc>& __rhs)
161
    { return __lhs._M_base() < __rhs._M_base(); }
162
 
163
  template
164
    inline bool
165
    operator<=(const deque<_Tp, _Alloc>& __lhs,
166
	       const deque<_Tp, _Alloc>& __rhs)
167
    { return __lhs._M_base() <= __rhs._M_base(); }
168
 
169
  template
170
    inline bool
171
    operator>=(const deque<_Tp, _Alloc>& __lhs,
172
	       const deque<_Tp, _Alloc>& __rhs)
173
    { return __lhs._M_base() >= __rhs._M_base(); }
174
 
175
  template
176
    inline bool
177
    operator>(const deque<_Tp, _Alloc>& __lhs,
178
	      const deque<_Tp, _Alloc>& __rhs)
179
    { return __lhs._M_base() > __rhs._M_base(); }
180
 
181
  template
182
    inline void
183
    swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs)
184
    { __lhs.swap(__rhs); }
185
 
186
} // namespace __profile
187
} // namespace std
188
 
189
#endif