2012-03-27 23:13:14 +00:00
|
|
|
// Profiling deque implementation -*- C++ -*-
|
|
|
|
|
2015-08-28 15:33:40 +00:00
|
|
|
// Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
2012-03-27 23:13:14 +00:00
|
|
|
//
|
|
|
|
// This file is part of the GNU ISO C++ Library. This library is free
|
|
|
|
// software; you can redistribute it and/or modify it under the
|
|
|
|
// terms of the GNU General Public License as published by the
|
|
|
|
// Free Software Foundation; either version 3, or (at your option)
|
|
|
|
// any later version.
|
|
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
// Under Section 7 of GPL version 3, you are granted additional
|
|
|
|
// permissions described in the GCC Runtime Library Exception, version
|
|
|
|
// 3.1, as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License and
|
|
|
|
// a copy of the GCC Runtime Library Exception along with this program;
|
|
|
|
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
// <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
/** @file profile/deque
|
|
|
|
* This file is a GNU profile extension to the Standard C++ Library.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _GLIBCXX_PROFILE_DEQUE
|
|
|
|
#define _GLIBCXX_PROFILE_DEQUE 1
|
|
|
|
|
|
|
|
#include <deque>
|
|
|
|
|
|
|
|
namespace std _GLIBCXX_VISIBILITY(default)
|
|
|
|
{
|
|
|
|
namespace __profile
|
|
|
|
{
|
|
|
|
/// Class std::deque wrapper with performance instrumentation.
|
|
|
|
template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
|
|
|
|
class deque
|
|
|
|
: public _GLIBCXX_STD_C::deque<_Tp, _Allocator>
|
|
|
|
{
|
|
|
|
typedef _GLIBCXX_STD_C::deque<_Tp, _Allocator> _Base;
|
|
|
|
|
|
|
|
public:
|
2015-08-28 15:33:40 +00:00
|
|
|
typedef typename _Base::size_type size_type;
|
|
|
|
typedef typename _Base::value_type value_type;
|
2012-03-27 23:13:14 +00:00
|
|
|
|
|
|
|
// 23.2.1.1 construct/copy/destroy:
|
2014-09-21 17:33:12 +00:00
|
|
|
|
2015-08-28 15:33:40 +00:00
|
|
|
#if __cplusplus < 201103L
|
2014-09-21 17:33:12 +00:00
|
|
|
deque()
|
|
|
|
: _Base() { }
|
2015-08-28 15:33:40 +00:00
|
|
|
deque(const deque& __x)
|
|
|
|
: _Base(__x) { }
|
|
|
|
|
|
|
|
~deque() { }
|
|
|
|
#else
|
|
|
|
deque() = default;
|
|
|
|
deque(const deque&) = default;
|
|
|
|
deque(deque&&) = default;
|
|
|
|
|
|
|
|
deque(const deque& __d, const _Allocator& __a)
|
|
|
|
: _Base(__d, __a) { }
|
|
|
|
|
|
|
|
deque(deque&& __d, const _Allocator& __a)
|
|
|
|
: _Base(std::move(__d), __a) { }
|
|
|
|
|
|
|
|
~deque() = default;
|
|
|
|
|
|
|
|
deque(initializer_list<value_type> __l,
|
|
|
|
const _Allocator& __a = _Allocator())
|
|
|
|
: _Base(__l, __a) { }
|
|
|
|
#endif
|
2014-09-21 17:33:12 +00:00
|
|
|
|
2012-03-27 23:13:14 +00:00
|
|
|
explicit
|
2014-09-21 17:33:12 +00:00
|
|
|
deque(const _Allocator& __a)
|
2012-03-27 23:13:14 +00:00
|
|
|
: _Base(__a) { }
|
|
|
|
|
2014-09-21 17:33:12 +00:00
|
|
|
#if __cplusplus >= 201103L
|
2012-03-27 23:13:14 +00:00
|
|
|
explicit
|
2015-08-28 15:33:40 +00:00
|
|
|
deque(size_type __n, const _Allocator& __a = _Allocator())
|
|
|
|
: _Base(__n, __a) { }
|
2012-03-27 23:13:14 +00:00
|
|
|
|
|
|
|
deque(size_type __n, const _Tp& __value,
|
|
|
|
const _Allocator& __a = _Allocator())
|
|
|
|
: _Base(__n, __value, __a) { }
|
|
|
|
#else
|
|
|
|
explicit
|
|
|
|
deque(size_type __n, const _Tp& __value = _Tp(),
|
|
|
|
const _Allocator& __a = _Allocator())
|
|
|
|
: _Base(__n, __value, __a) { }
|
|
|
|
#endif
|
|
|
|
|
2014-09-21 17:33:12 +00:00
|
|
|
#if __cplusplus >= 201103L
|
|
|
|
template<typename _InputIterator,
|
|
|
|
typename = std::_RequireInputIter<_InputIterator>>
|
|
|
|
#else
|
|
|
|
template<typename _InputIterator>
|
|
|
|
#endif
|
2015-08-28 15:33:40 +00:00
|
|
|
deque(_InputIterator __first, _InputIterator __last,
|
2012-03-27 23:13:14 +00:00
|
|
|
const _Allocator& __a = _Allocator())
|
|
|
|
: _Base(__first, __last, __a)
|
2015-08-28 15:33:40 +00:00
|
|
|
{ }
|
2012-03-27 23:13:14 +00:00
|
|
|
|
|
|
|
deque(const _Base& __x)
|
|
|
|
: _Base(__x) { }
|
|
|
|
|
2015-08-28 15:33:40 +00:00
|
|
|
#if __cplusplus < 201103L
|
2012-03-27 23:13:14 +00:00
|
|
|
deque&
|
|
|
|
operator=(const deque& __x)
|
|
|
|
{
|
2015-08-28 15:33:40 +00:00
|
|
|
_M_base() = __x;
|
2012-03-27 23:13:14 +00:00
|
|
|
return *this;
|
|
|
|
}
|
2015-08-28 15:33:40 +00:00
|
|
|
#else
|
|
|
|
deque&
|
|
|
|
operator=(const deque&) = default;
|
2012-03-27 23:13:14 +00:00
|
|
|
|
|
|
|
deque&
|
2015-08-28 15:33:40 +00:00
|
|
|
operator=(deque&&) = default;
|
2012-03-27 23:13:14 +00:00
|
|
|
|
|
|
|
deque&
|
|
|
|
operator=(initializer_list<value_type> __l)
|
|
|
|
{
|
2015-08-28 15:33:40 +00:00
|
|
|
_M_base() = __l;
|
2012-03-27 23:13:14 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void
|
2015-08-28 15:33:40 +00:00
|
|
|
swap(deque& __x)
|
2014-09-21 17:33:12 +00:00
|
|
|
#if __cplusplus >= 201103L
|
2015-08-28 15:33:40 +00:00
|
|
|
noexcept( noexcept(declval<_Base>().swap(__x)) )
|
2014-09-21 17:33:12 +00:00
|
|
|
#endif
|
2015-08-28 15:33:40 +00:00
|
|
|
{ _Base::swap(__x); }
|
2012-03-27 23:13:14 +00:00
|
|
|
|
|
|
|
_Base&
|
2015-08-28 15:33:40 +00:00
|
|
|
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
|
2012-03-27 23:13:14 +00:00
|
|
|
|
|
|
|
const _Base&
|
2015-08-28 15:33:40 +00:00
|
|
|
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
|
2012-03-27 23:13:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template<typename _Tp, typename _Alloc>
|
|
|
|
inline bool
|
|
|
|
operator==(const deque<_Tp, _Alloc>& __lhs,
|
|
|
|
const deque<_Tp, _Alloc>& __rhs)
|
|
|
|
{ return __lhs._M_base() == __rhs._M_base(); }
|
|
|
|
|
|
|
|
template<typename _Tp, typename _Alloc>
|
|
|
|
inline bool
|
|
|
|
operator!=(const deque<_Tp, _Alloc>& __lhs,
|
|
|
|
const deque<_Tp, _Alloc>& __rhs)
|
|
|
|
{ return __lhs._M_base() != __rhs._M_base(); }
|
|
|
|
|
|
|
|
template<typename _Tp, typename _Alloc>
|
|
|
|
inline bool
|
|
|
|
operator<(const deque<_Tp, _Alloc>& __lhs,
|
|
|
|
const deque<_Tp, _Alloc>& __rhs)
|
|
|
|
{ return __lhs._M_base() < __rhs._M_base(); }
|
|
|
|
|
|
|
|
template<typename _Tp, typename _Alloc>
|
|
|
|
inline bool
|
|
|
|
operator<=(const deque<_Tp, _Alloc>& __lhs,
|
|
|
|
const deque<_Tp, _Alloc>& __rhs)
|
|
|
|
{ return __lhs._M_base() <= __rhs._M_base(); }
|
|
|
|
|
|
|
|
template<typename _Tp, typename _Alloc>
|
|
|
|
inline bool
|
|
|
|
operator>=(const deque<_Tp, _Alloc>& __lhs,
|
|
|
|
const deque<_Tp, _Alloc>& __rhs)
|
|
|
|
{ return __lhs._M_base() >= __rhs._M_base(); }
|
|
|
|
|
|
|
|
template<typename _Tp, typename _Alloc>
|
|
|
|
inline bool
|
|
|
|
operator>(const deque<_Tp, _Alloc>& __lhs,
|
|
|
|
const deque<_Tp, _Alloc>& __rhs)
|
|
|
|
{ return __lhs._M_base() > __rhs._M_base(); }
|
|
|
|
|
|
|
|
template<typename _Tp, typename _Alloc>
|
|
|
|
inline void
|
|
|
|
swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs)
|
|
|
|
{ __lhs.swap(__rhs); }
|
|
|
|
|
|
|
|
} // namespace __profile
|
|
|
|
} // namespace std
|
|
|
|
|
|
|
|
#endif
|