// Debugging unordered_set/unordered_multiset implementation -*- C++ -*-
-// Copyright (C) 2003-2014 Free Software Foundation, Inc.
+// Copyright (C) 2003-2016 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
#ifndef _GLIBCXX_DEBUG_UNORDERED_SET
#define _GLIBCXX_DEBUG_UNORDERED_SET 1
+#pragma GCC system_header
+
#if __cplusplus < 201103L
# include <bits/c++0x_warning.h>
#else
typedef __gnu_debug::_Safe_local_iterator<
_Base_const_local_iterator, unordered_set> const_local_iterator;
+ unordered_set() = default;
+
explicit
- unordered_set(size_type __n = 10,
+ unordered_set(size_type __n,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
const allocator_type& __a = allocator_type())
: _Base(__l, __n, __hf, __eql, __a) { }
+ unordered_set(size_type __n, const allocator_type& __a)
+ : unordered_set(__n, hasher(), key_equal(), __a)
+ { }
+
+ unordered_set(size_type __n, const hasher& __hf,
+ const allocator_type& __a)
+ : unordered_set(__n, __hf, key_equal(), __a)
+ { }
+
+ template<typename _InputIterator>
+ unordered_set(_InputIterator __first, _InputIterator __last,
+ size_type __n,
+ const allocator_type& __a)
+ : unordered_set(__first, __last, __n, hasher(), key_equal(), __a)
+ { }
+
+ template<typename _InputIterator>
+ unordered_set(_InputIterator __first, _InputIterator __last,
+ size_type __n, const hasher& __hf,
+ const allocator_type& __a)
+ : unordered_set(__first, __last, __n, __hf, key_equal(), __a)
+ { }
+
+ unordered_set(initializer_list<value_type> __l,
+ size_type __n,
+ const allocator_type& __a)
+ : unordered_set(__l, __n, hasher(), key_equal(), __a)
+ { }
+
+ unordered_set(initializer_list<value_type> __l,
+ size_type __n, const hasher& __hf,
+ const allocator_type& __a)
+ : unordered_set(__l, __n, __hf, key_equal(), __a)
+ { }
+
~unordered_set() = default;
unordered_set&
void
swap(unordered_set& __x)
- noexcept( noexcept(declval<_Base>().swap(__x)) )
+ noexcept( noexcept(declval<_Base&>().swap(__x)) )
{
_Safe::_M_swap(__x);
_Base::swap(__x);
void
insert(_InputIterator __first, _InputIterator __last)
{
- __glibcxx_check_valid_range(__first, __last);
+ typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
+ __glibcxx_check_valid_range2(__first, __last, __dist);
size_type __bucket_count = this->bucket_count();
- _Base::insert(__gnu_debug::__base(__first),
- __gnu_debug::__base(__last));
+
+ if (__dist.second >= __gnu_debug::__dp_sign)
+ _Base::insert(__gnu_debug::__unsafe(__first),
+ __gnu_debug::__unsafe(__last));
+ else
+ _Base::insert(__first, __last);
+
_M_check_rehashed(__bucket_count);
}
inline void
swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
+ noexcept(noexcept(__x.swap(__y)))
{ __x.swap(__y); }
template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
typedef __gnu_debug::_Safe_local_iterator<
_Base_const_local_iterator, unordered_multiset> const_local_iterator;
+ unordered_multiset() = default;
+
explicit
- unordered_multiset(size_type __n = 10,
+ unordered_multiset(size_type __n,
const hasher& __hf = hasher(),
const key_equal& __eql = key_equal(),
const allocator_type& __a = allocator_type())
const allocator_type& __a = allocator_type())
: _Base(__l, __n, __hf, __eql, __a) { }
+ unordered_multiset(size_type __n, const allocator_type& __a)
+ : unordered_multiset(__n, hasher(), key_equal(), __a)
+ { }
+
+ unordered_multiset(size_type __n, const hasher& __hf,
+ const allocator_type& __a)
+ : unordered_multiset(__n, __hf, key_equal(), __a)
+ { }
+
+ template<typename _InputIterator>
+ unordered_multiset(_InputIterator __first, _InputIterator __last,
+ size_type __n,
+ const allocator_type& __a)
+ : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a)
+ { }
+
+ template<typename _InputIterator>
+ unordered_multiset(_InputIterator __first, _InputIterator __last,
+ size_type __n, const hasher& __hf,
+ const allocator_type& __a)
+ : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a)
+ { }
+
+ unordered_multiset(initializer_list<value_type> __l,
+ size_type __n,
+ const allocator_type& __a)
+ : unordered_multiset(__l, __n, hasher(), key_equal(), __a)
+ { }
+
+ unordered_multiset(initializer_list<value_type> __l,
+ size_type __n, const hasher& __hf,
+ const allocator_type& __a)
+ : unordered_multiset(__l, __n, __hf, key_equal(), __a)
+ { }
+
~unordered_multiset() = default;
unordered_multiset&
void
swap(unordered_multiset& __x)
- noexcept( noexcept(declval<_Base>().swap(__x)) )
+ noexcept( noexcept(declval<_Base&>().swap(__x)) )
{
_Safe::_M_swap(__x);
_Base::swap(__x);
void
insert(_InputIterator __first, _InputIterator __last)
{
- __glibcxx_check_valid_range(__first, __last);
+ typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
+ __glibcxx_check_valid_range2(__first, __last, __dist);
size_type __bucket_count = this->bucket_count();
- _Base::insert(__gnu_debug::__base(__first),
- __gnu_debug::__base(__last));
+
+ if (__dist.second >= __gnu_debug::__dp_sign)
+ _Base::insert(__gnu_debug::__unsafe(__first),
+ __gnu_debug::__unsafe(__last));
+ else
+ _Base::insert(__first, __last);
+
_M_check_rehashed(__bucket_count);
}
inline void
swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+ noexcept(noexcept(__x.swap(__y)))
{ __x.swap(__y); }
template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>