f3de79d43a
2014-05-24 François Dumont <fdumont@gcc.gnu.org> * include/profile/array: Clean useless white chars. * include/profile/base.h: Likewise. * include/profile/iterator_tracker.h: Likewise. * include/profile/bitset: Code cleanup and remove not instrumented code. * include/profile/deque: Likewise. * include/profile/forward_list: Likewise. * include/profile/list (std::__profile::_List_profile<>): New. (std::__profile::list<>): Inherit from latter and adapt. * include/profile/impl/profiler_map_to_unordered_map.h: Generalize advise to match any ordered to unordered container conversion. * include/profile/ordered_base.h (std::__profile::_Ordered_profile<>): New. * include/Makefile.am: Add latter. * include/Makefile.in: Regenerate. * include/profile/map.h (std::__profile::map<>): Inherit from latter, remove not instrumented code. * include/profile/multimap.h (std::__profile::multimap<>): Likewise. * include/profile/set.h (std::__profile::set<>): Likewise. * include/profile/multiset.h (std::__profile::multiset<>): Likewise. * include/profile/unordered_base.h: Add some line feed. * include/profile/unordered_map: Clean useless white chars and replace spaces with tabs. * include/profile/unordered_set: Likewise. * include/profile/vector (std::__profile::_Vector_profile_pre<>): New. (std::__profile::_Vector_profile_post<>): New. (std::__profile::vector<>): Inherit from latter and adapt. From-SVN: r210900
184 lines
4.9 KiB
C++
184 lines
4.9 KiB
C++
// Profiling deque implementation -*- C++ -*-
|
|
|
|
// Copyright (C) 2009-2014 Free Software Foundation, Inc.
|
|
//
|
|
// 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:
|
|
typedef typename _Base::size_type size_type;
|
|
typedef typename _Base::value_type value_type;
|
|
|
|
// 23.2.1.1 construct/copy/destroy:
|
|
|
|
#if __cplusplus < 201103L
|
|
deque()
|
|
: _Base() { }
|
|
deque(const deque& __x)
|
|
: _Base(__x) { }
|
|
|
|
~deque() { }
|
|
#else
|
|
deque() = default;
|
|
deque(const deque&) = default;
|
|
deque(deque&&) = default;
|
|
|
|
~deque() = default;
|
|
|
|
deque(initializer_list<value_type> __l,
|
|
const _Allocator& __a = _Allocator())
|
|
: _Base(__l, __a) { }
|
|
#endif
|
|
|
|
explicit
|
|
deque(const _Allocator& __a)
|
|
: _Base(__a) { }
|
|
|
|
#if __cplusplus >= 201103L
|
|
explicit
|
|
deque(size_type __n)
|
|
: _Base(__n) { }
|
|
|
|
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
|
|
|
|
#if __cplusplus >= 201103L
|
|
template<typename _InputIterator,
|
|
typename = std::_RequireInputIter<_InputIterator>>
|
|
#else
|
|
template<typename _InputIterator>
|
|
#endif
|
|
deque(_InputIterator __first, _InputIterator __last,
|
|
const _Allocator& __a = _Allocator())
|
|
: _Base(__first, __last, __a)
|
|
{ }
|
|
|
|
deque(const _Base& __x)
|
|
: _Base(__x) { }
|
|
|
|
#if __cplusplus < 201103L
|
|
deque&
|
|
operator=(const deque& __x)
|
|
{
|
|
_M_base() = __x;
|
|
return *this;
|
|
}
|
|
#else
|
|
deque&
|
|
operator=(const deque&) = default;
|
|
|
|
deque&
|
|
operator=(deque&&) = default;
|
|
|
|
deque&
|
|
operator=(initializer_list<value_type> __l)
|
|
{
|
|
_M_base() = __l;
|
|
return *this;
|
|
}
|
|
#endif
|
|
|
|
void
|
|
swap(deque& __x)
|
|
#if __cplusplus >= 201103L
|
|
noexcept( noexcept(declval<_Base>().swap(__x)) )
|
|
#endif
|
|
{ _Base::swap(__x); }
|
|
|
|
_Base&
|
|
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
|
|
|
|
const _Base&
|
|
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
|
|
};
|
|
|
|
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
|