libstdc++/71073 add system_header pragma to Debug Mode headers
[gcc.git] / libstdc++-v3 / include / debug / unordered_set
index 63a687760849ceb29877d7fd112262b52006cc10..6a4dba6475d0c7f23bc57fbd711a2852280928d0 100644 (file)
@@ -1,6 +1,6 @@
 // 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
@@ -29,6 +29,8 @@
 #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
@@ -82,8 +84,10 @@ namespace __debug
       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())
@@ -127,6 +131,41 @@ namespace __debug
                    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&
@@ -145,7 +184,7 @@ namespace __debug
 
       void
       swap(unordered_set& __x)
-       noexcept( noexcept(declval<_Base>().swap(__x)) )
+       noexcept( noexcept(declval<_Base&>().swap(__x)) )
       {
        _Safe::_M_swap(__x);
        _Base::swap(__x);
@@ -318,10 +357,16 @@ namespace __debug
        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);
        }
 
@@ -437,6 +482,7 @@ namespace __debug
     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>
@@ -491,8 +537,10 @@ namespace __debug
       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())
@@ -536,6 +584,41 @@ namespace __debug
                         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&
@@ -554,7 +637,7 @@ namespace __debug
 
       void
       swap(unordered_multiset& __x)
-       noexcept( noexcept(declval<_Base>().swap(__x)) )
+       noexcept( noexcept(declval<_Base&>().swap(__x)) )
       {
        _Safe::_M_swap(__x);
        _Base::swap(__x);
@@ -725,10 +808,16 @@ namespace __debug
        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);
        }
 
@@ -834,6 +923,7 @@ namespace __debug
     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>