xref: /netbsd-src/external/gpl3/gcc.old/dist/libstdc++-v3/include/profile/deque (revision c0a68be459da21030695f60d10265c2fc49758f8)
136ac495dSmrg// Profiling deque implementation -*- C++ -*-
236ac495dSmrg
3*c0a68be4Smrg// Copyright (C) 2009-2019 Free Software Foundation, Inc.
436ac495dSmrg//
536ac495dSmrg// This file is part of the GNU ISO C++ Library.  This library is free
636ac495dSmrg// software; you can redistribute it and/or modify it under the
736ac495dSmrg// terms of the GNU General Public License as published by the
836ac495dSmrg// Free Software Foundation; either version 3, or (at your option)
936ac495dSmrg// any later version.
1036ac495dSmrg
1136ac495dSmrg// This library is distributed in the hope that it will be useful,
1236ac495dSmrg// but WITHOUT ANY WARRANTY; without even the implied warranty of
1336ac495dSmrg// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1436ac495dSmrg// GNU General Public License for more details.
1536ac495dSmrg
1636ac495dSmrg// Under Section 7 of GPL version 3, you are granted additional
1736ac495dSmrg// permissions described in the GCC Runtime Library Exception, version
1836ac495dSmrg// 3.1, as published by the Free Software Foundation.
1936ac495dSmrg
2036ac495dSmrg// You should have received a copy of the GNU General Public License and
2136ac495dSmrg// a copy of the GCC Runtime Library Exception along with this program;
2236ac495dSmrg// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
2336ac495dSmrg// <http://www.gnu.org/licenses/>.
2436ac495dSmrg
2536ac495dSmrg/** @file profile/deque
2636ac495dSmrg *  This file is a GNU profile extension to the Standard C++ Library.
2736ac495dSmrg */
2836ac495dSmrg
2936ac495dSmrg#ifndef _GLIBCXX_PROFILE_DEQUE
3036ac495dSmrg#define _GLIBCXX_PROFILE_DEQUE 1
3136ac495dSmrg
3236ac495dSmrg#include <deque>
3336ac495dSmrg
3436ac495dSmrgnamespace std _GLIBCXX_VISIBILITY(default)
3536ac495dSmrg{
3636ac495dSmrgnamespace __profile
3736ac495dSmrg{
3836ac495dSmrg  /// Class std::deque wrapper with performance instrumentation.
3936ac495dSmrg  template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
4036ac495dSmrg    class deque
4136ac495dSmrg    : public _GLIBCXX_STD_C::deque<_Tp, _Allocator>
4236ac495dSmrg    {
4336ac495dSmrg      typedef  _GLIBCXX_STD_C::deque<_Tp, _Allocator> _Base;
4436ac495dSmrg
4536ac495dSmrg    public:
4636ac495dSmrg      typedef typename _Base::size_type			size_type;
4736ac495dSmrg      typedef typename _Base::value_type		value_type;
4836ac495dSmrg
4936ac495dSmrg      // 23.2.1.1 construct/copy/destroy:
5036ac495dSmrg
5136ac495dSmrg#if __cplusplus < 201103L
5236ac495dSmrg      deque()
5336ac495dSmrg      : _Base() { }
5436ac495dSmrg      deque(const deque& __x)
5536ac495dSmrg      : _Base(__x) { }
5636ac495dSmrg
5736ac495dSmrg      ~deque() { }
5836ac495dSmrg#else
5936ac495dSmrg      deque() = default;
6036ac495dSmrg      deque(const deque&) = default;
6136ac495dSmrg      deque(deque&&) = default;
6236ac495dSmrg
6336ac495dSmrg      deque(const deque& __d, const _Allocator& __a)
6436ac495dSmrg      : _Base(__d, __a) { }
6536ac495dSmrg
6636ac495dSmrg      deque(deque&& __d, const _Allocator& __a)
6736ac495dSmrg      : _Base(std::move(__d), __a) { }
6836ac495dSmrg
6936ac495dSmrg      ~deque() = default;
7036ac495dSmrg
7136ac495dSmrg      deque(initializer_list<value_type> __l,
7236ac495dSmrg	    const _Allocator& __a = _Allocator())
7336ac495dSmrg      : _Base(__l, __a) { }
7436ac495dSmrg#endif
7536ac495dSmrg
7636ac495dSmrg      explicit
7736ac495dSmrg      deque(const _Allocator& __a)
7836ac495dSmrg      : _Base(__a) { }
7936ac495dSmrg
8036ac495dSmrg#if __cplusplus >= 201103L
8136ac495dSmrg      explicit
8236ac495dSmrg      deque(size_type __n, const _Allocator& __a = _Allocator())
8336ac495dSmrg      : _Base(__n, __a) { }
8436ac495dSmrg
8536ac495dSmrg      deque(size_type __n, const _Tp& __value,
8636ac495dSmrg	    const _Allocator& __a = _Allocator())
8736ac495dSmrg      : _Base(__n, __value, __a) { }
8836ac495dSmrg#else
8936ac495dSmrg      explicit
9036ac495dSmrg      deque(size_type __n, const _Tp& __value = _Tp(),
9136ac495dSmrg	    const _Allocator& __a = _Allocator())
9236ac495dSmrg      : _Base(__n, __value, __a) { }
9336ac495dSmrg#endif
9436ac495dSmrg
9536ac495dSmrg#if __cplusplus >= 201103L
9636ac495dSmrg      template<typename _InputIterator,
9736ac495dSmrg	       typename = std::_RequireInputIter<_InputIterator>>
9836ac495dSmrg#else
9936ac495dSmrg      template<typename _InputIterator>
10036ac495dSmrg#endif
10136ac495dSmrg	deque(_InputIterator __first, _InputIterator __last,
10236ac495dSmrg	      const _Allocator& __a = _Allocator())
10336ac495dSmrg	: _Base(__first, __last, __a)
10436ac495dSmrg	{ }
10536ac495dSmrg
10636ac495dSmrg      deque(const _Base& __x)
10736ac495dSmrg      : _Base(__x) { }
10836ac495dSmrg
10936ac495dSmrg#if __cplusplus < 201103L
11036ac495dSmrg      deque&
11136ac495dSmrg      operator=(const deque& __x)
11236ac495dSmrg      {
11336ac495dSmrg	_M_base() = __x;
11436ac495dSmrg	return *this;
11536ac495dSmrg      }
11636ac495dSmrg#else
11736ac495dSmrg      deque&
11836ac495dSmrg      operator=(const deque&) = default;
11936ac495dSmrg
12036ac495dSmrg      deque&
12136ac495dSmrg      operator=(deque&&) = default;
12236ac495dSmrg
12336ac495dSmrg      deque&
12436ac495dSmrg      operator=(initializer_list<value_type> __l)
12536ac495dSmrg      {
12636ac495dSmrg	_M_base() = __l;
12736ac495dSmrg	return *this;
12836ac495dSmrg      }
12936ac495dSmrg#endif
13036ac495dSmrg
13136ac495dSmrg      void
13236ac495dSmrg      swap(deque& __x)
13336ac495dSmrg      _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
13436ac495dSmrg      { _Base::swap(__x); }
13536ac495dSmrg
13636ac495dSmrg      _Base&
13736ac495dSmrg      _M_base() _GLIBCXX_NOEXCEPT	{ return *this; }
13836ac495dSmrg
13936ac495dSmrg      const _Base&
14036ac495dSmrg      _M_base() const _GLIBCXX_NOEXCEPT	{ return *this; }
14136ac495dSmrg    };
14236ac495dSmrg
14336ac495dSmrg  template<typename _Tp, typename _Alloc>
14436ac495dSmrg    inline bool
14536ac495dSmrg    operator==(const deque<_Tp, _Alloc>& __lhs,
14636ac495dSmrg	       const deque<_Tp, _Alloc>& __rhs)
14736ac495dSmrg    { return __lhs._M_base() == __rhs._M_base(); }
14836ac495dSmrg
14936ac495dSmrg  template<typename _Tp, typename _Alloc>
15036ac495dSmrg    inline bool
15136ac495dSmrg    operator!=(const deque<_Tp, _Alloc>& __lhs,
15236ac495dSmrg	       const deque<_Tp, _Alloc>& __rhs)
15336ac495dSmrg    { return __lhs._M_base() != __rhs._M_base(); }
15436ac495dSmrg
15536ac495dSmrg  template<typename _Tp, typename _Alloc>
15636ac495dSmrg    inline bool
15736ac495dSmrg    operator<(const deque<_Tp, _Alloc>& __lhs,
15836ac495dSmrg	      const deque<_Tp, _Alloc>& __rhs)
15936ac495dSmrg    { return __lhs._M_base() < __rhs._M_base(); }
16036ac495dSmrg
16136ac495dSmrg  template<typename _Tp, typename _Alloc>
16236ac495dSmrg    inline bool
16336ac495dSmrg    operator<=(const deque<_Tp, _Alloc>& __lhs,
16436ac495dSmrg	       const deque<_Tp, _Alloc>& __rhs)
16536ac495dSmrg    { return __lhs._M_base() <= __rhs._M_base(); }
16636ac495dSmrg
16736ac495dSmrg  template<typename _Tp, typename _Alloc>
16836ac495dSmrg    inline bool
16936ac495dSmrg    operator>=(const deque<_Tp, _Alloc>& __lhs,
17036ac495dSmrg	       const deque<_Tp, _Alloc>& __rhs)
17136ac495dSmrg    { return __lhs._M_base() >= __rhs._M_base(); }
17236ac495dSmrg
17336ac495dSmrg  template<typename _Tp, typename _Alloc>
17436ac495dSmrg    inline bool
17536ac495dSmrg    operator>(const deque<_Tp, _Alloc>& __lhs,
17636ac495dSmrg	      const deque<_Tp, _Alloc>& __rhs)
17736ac495dSmrg    { return __lhs._M_base() > __rhs._M_base(); }
17836ac495dSmrg
17936ac495dSmrg  template<typename _Tp, typename _Alloc>
18036ac495dSmrg    inline void
18136ac495dSmrg    swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs)
18236ac495dSmrg    _GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
18336ac495dSmrg    { __lhs.swap(__rhs); }
18436ac495dSmrg
18536ac495dSmrg} // namespace __profile
18636ac495dSmrg} // namespace std
18736ac495dSmrg
18836ac495dSmrg#endif
189