1 // Profiling deque implementation -*- C++ -*-
3 // Copyright (C) 2009-2015 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 #if __cplusplus >= 201103L
134 noexcept( noexcept(declval<_Base>().swap(__x)) )
136 { _Base::swap(__x); }
139 _M_base() _GLIBCXX_NOEXCEPT { return *this; }
142 _M_base() const _GLIBCXX_NOEXCEPT { return *this; }
145 template<typename _Tp, typename _Alloc>
147 operator==(const deque<_Tp, _Alloc>& __lhs,
148 const deque<_Tp, _Alloc>& __rhs)
149 { return __lhs._M_base() == __rhs._M_base(); }
151 template<typename _Tp, typename _Alloc>
153 operator!=(const deque<_Tp, _Alloc>& __lhs,
154 const deque<_Tp, _Alloc>& __rhs)
155 { return __lhs._M_base() != __rhs._M_base(); }
157 template<typename _Tp, typename _Alloc>
159 operator<(const deque<_Tp, _Alloc>& __lhs,
160 const deque<_Tp, _Alloc>& __rhs)
161 { return __lhs._M_base() < __rhs._M_base(); }
163 template<typename _Tp, typename _Alloc>
165 operator<=(const deque<_Tp, _Alloc>& __lhs,
166 const deque<_Tp, _Alloc>& __rhs)
167 { return __lhs._M_base() <= __rhs._M_base(); }
169 template<typename _Tp, typename _Alloc>
171 operator>=(const deque<_Tp, _Alloc>& __lhs,
172 const deque<_Tp, _Alloc>& __rhs)
173 { return __lhs._M_base() >= __rhs._M_base(); }
175 template<typename _Tp, typename _Alloc>
177 operator>(const deque<_Tp, _Alloc>& __lhs,
178 const deque<_Tp, _Alloc>& __rhs)
179 { return __lhs._M_base() > __rhs._M_base(); }
181 template<typename _Tp, typename _Alloc>
183 swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs)
184 { __lhs.swap(__rhs); }
186 } // namespace __profile