1 // Profiling deque implementation -*- C++ -*-
3 // Copyright (C) 2009-2017 Free Software Foundation, Inc.
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)
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.
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.
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 // <http://www.gnu.org/licenses/>.
25 /** @file profile/deque
26 * This file is a GNU profile extension to the Standard C++ Library.
29 #ifndef _GLIBCXX_PROFILE_DEQUE
30 #define _GLIBCXX_PROFILE_DEQUE 1
34 namespace std _GLIBCXX_VISIBILITY(default)
38 /// Class std::deque wrapper with performance instrumentation.
39 template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
41 : public _GLIBCXX_STD_C::deque<_Tp, _Allocator>
43 typedef _GLIBCXX_STD_C::deque<_Tp, _Allocator> _Base;
46 typedef typename _Base::size_type size_type;
47 typedef typename _Base::value_type value_type;
49 // 23.2.1.1 construct/copy/destroy:
51 #if __cplusplus < 201103L
54 deque(const deque& __x)
60 deque(const deque&) = default;
61 deque(deque&&) = default;
63 deque(const deque& __d, const _Allocator& __a)
66 deque(deque&& __d, const _Allocator& __a)
67 : _Base(std::move(__d), __a) { }
71 deque(initializer_list<value_type> __l,
72 const _Allocator& __a = _Allocator())
77 deque(const _Allocator& __a)
80 #if __cplusplus >= 201103L
82 deque(size_type __n, const _Allocator& __a = _Allocator())
85 deque(size_type __n, const _Tp& __value,
86 const _Allocator& __a = _Allocator())
87 : _Base(__n, __value, __a) { }
90 deque(size_type __n, const _Tp& __value = _Tp(),
91 const _Allocator& __a = _Allocator())
92 : _Base(__n, __value, __a) { }
95 #if __cplusplus >= 201103L
96 template<typename _InputIterator,
97 typename = std::_RequireInputIter<_InputIterator>>
99 template<typename _InputIterator>
101 deque(_InputIterator __first, _InputIterator __last,
102 const _Allocator& __a = _Allocator())
103 : _Base(__first, __last, __a)
106 deque(const _Base& __x)
109 #if __cplusplus < 201103L
111 operator=(const deque& __x)
118 operator=(const deque&) = default;
121 operator=(deque&&) = default;
124 operator=(initializer_list<value_type> __l)
133 _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
134 { _Base::swap(__x); }
137 _M_base() _GLIBCXX_NOEXCEPT { return *this; }
140 _M_base() const _GLIBCXX_NOEXCEPT { return *this; }
143 template<typename _Tp, typename _Alloc>
145 operator==(const deque<_Tp, _Alloc>& __lhs,
146 const deque<_Tp, _Alloc>& __rhs)
147 { return __lhs._M_base() == __rhs._M_base(); }
149 template<typename _Tp, typename _Alloc>
151 operator!=(const deque<_Tp, _Alloc>& __lhs,
152 const deque<_Tp, _Alloc>& __rhs)
153 { return __lhs._M_base() != __rhs._M_base(); }
155 template<typename _Tp, typename _Alloc>
157 operator<(const deque<_Tp, _Alloc>& __lhs,
158 const deque<_Tp, _Alloc>& __rhs)
159 { return __lhs._M_base() < __rhs._M_base(); }
161 template<typename _Tp, typename _Alloc>
163 operator<=(const deque<_Tp, _Alloc>& __lhs,
164 const deque<_Tp, _Alloc>& __rhs)
165 { return __lhs._M_base() <= __rhs._M_base(); }
167 template<typename _Tp, typename _Alloc>
169 operator>=(const deque<_Tp, _Alloc>& __lhs,
170 const deque<_Tp, _Alloc>& __rhs)
171 { return __lhs._M_base() >= __rhs._M_base(); }
173 template<typename _Tp, typename _Alloc>
175 operator>(const deque<_Tp, _Alloc>& __lhs,
176 const deque<_Tp, _Alloc>& __rhs)
177 { return __lhs._M_base() > __rhs._M_base(); }
179 template<typename _Tp, typename _Alloc>
181 swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs)
182 _GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
183 { __lhs.swap(__rhs); }
185 } // namespace __profile