diff options
Diffstat (limited to 'Source/kwsys/hashtable.hxx.in')
-rw-r--r-- | Source/kwsys/hashtable.hxx.in | 114 |
1 files changed, 58 insertions, 56 deletions
diff --git a/Source/kwsys/hashtable.hxx.in b/Source/kwsys/hashtable.hxx.in index dd92cb9d4..8c4b0025f 100644 --- a/Source/kwsys/hashtable.hxx.in +++ b/Source/kwsys/hashtable.hxx.in @@ -26,43 +26,42 @@ * */ #ifdef __BORLANDC__ -#pragma warn - 8027 /* 'for' not inlined. */ -#pragma warn - 8026 /* 'exception' not inlined. */ +# pragma warn - 8027 /* 'for' not inlined. */ +# pragma warn - 8026 /* 'exception' not inlined. */ #endif #ifndef @KWSYS_NAMESPACE@_hashtable_hxx -#define @KWSYS_NAMESPACE@_hashtable_hxx - -#include <@KWSYS_NAMESPACE@/Configure.hxx> - -#include <algorithm> // lower_bound -#include <functional> // unary_function -#include <iterator> // iterator_traits -#include <memory> // allocator -#include <stddef.h> // size_t -#include <utility> // pair -#include <vector> // vector - -#if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable : 4284) -#pragma warning(disable : 4786) -#pragma warning(disable : 4512) /* no assignment operator for class */ -#endif -#if defined(__sgi) && !defined(__GNUC__) -#pragma set woff 3970 /* pointer to int conversion */ 3321 3968 -#endif +# define @KWSYS_NAMESPACE@_hashtable_hxx + +# include <@KWSYS_NAMESPACE@/Configure.hxx> + +# include <algorithm> // lower_bound +# include <iterator> // iterator_traits +# include <memory> // allocator +# include <stddef.h> // size_t +# include <utility> // pair +# include <vector> // vector + +# if defined(_MSC_VER) +# pragma warning(push) +# pragma warning(disable : 4284) +# pragma warning(disable : 4786) +# pragma warning(disable : 4512) /* no assignment operator for class */ +# endif +# if defined(__sgi) && !defined(__GNUC__) +# pragma set woff 3970 /* pointer to int conversion */ 3321 3968 +# endif // In C++11, clang will warn about using dynamic exception specifications // as they are deprecated. But as this class is trying to faithfully // mimic unordered_set and unordered_map, we want to keep the 'throw()' // decorations below. So we suppress the warning. -#if defined(__clang__) && defined(__has_warning) -#if __has_warning("-Wdeprecated") -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated" -#endif -#endif +# if defined(__clang__) && defined(__has_warning) +# if __has_warning("-Wdeprecated") +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeprecated" +# endif +# endif namespace @KWSYS_NAMESPACE@ { @@ -74,7 +73,7 @@ struct _Hashtable_node void public_method_to_quiet_warning_about_all_methods_private(); private: - void operator=(_Hashtable_node<_Val> const&); // poison node assignment + void operator=(_Hashtable_node<_Val> const&) = delete; }; template <class _Val, class _Key, class _HashFcn, class _ExtractKey, @@ -251,6 +250,7 @@ private: public: typedef typename _Alloc::template rebind<_Val>::other allocator_type; allocator_type get_allocator() const { return _M_node_allocator; } + private: typedef typename _Alloc::template rebind<_Node>::other _M_node_allocator_type; @@ -354,7 +354,7 @@ public: return end(); } - iterator end() { return iterator(0, this); } + iterator end() { return iterator(nullptr, this); } const_iterator begin() const { @@ -364,7 +364,7 @@ public: return end(); } - const_iterator end() const { return const_iterator(0, this); } + const_iterator end() const { return const_iterator(nullptr, this); } friend bool operator==<>(const hashtable&, const hashtable&); @@ -510,7 +510,7 @@ private: { const size_type __n_buckets = _M_next_size(__n); _M_buckets.reserve(__n_buckets); - _M_buckets.insert(_M_buckets.end(), __n_buckets, (_Node*)0); + _M_buckets.insert(_M_buckets.end(), __n_buckets, (_Node*)nullptr); _M_num_elements = 0; } @@ -544,7 +544,7 @@ private: _Node* _M_new_node(const value_type& __obj) { _Node* __n = _M_get_node(); - __n->_M_next = 0; + __n->_M_next = nullptr; try { construct(&__n->_M_val, __obj); return __n; @@ -569,7 +569,7 @@ private: template <class _Val, class _Key, class _HF, class _ExK, class _EqK, class _All> _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>& - _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::operator++() +_Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::operator++() { const _Node* __old = _M_cur; _M_cur = _M_cur->_M_next; @@ -584,7 +584,7 @@ _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>& template <class _Val, class _Key, class _HF, class _ExK, class _EqK, class _All> inline _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All> - _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::operator++(int) +_Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::operator++(int) { iterator __tmp = *this; ++*this; @@ -594,7 +594,7 @@ inline _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All> template <class _Val, class _Key, class _HF, class _ExK, class _EqK, class _All> _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>& - _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::operator++() +_Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::operator++() { const _Node* __old = _M_cur; _M_cur = _M_cur->_M_next; @@ -609,7 +609,7 @@ _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>& template <class _Val, class _Key, class _HF, class _ExK, class _EqK, class _All> inline _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All> - _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::operator++(int) +_Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::operator++(int) { const_iterator __tmp = *this; ++*this; @@ -694,8 +694,9 @@ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::insert_equal_noresize( } template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::reference hashtable< - _Val, _Key, _HF, _Ex, _Eq, _All>::find_or_insert(const value_type& __obj) +typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::reference +hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::find_or_insert( + const value_type& __obj) { resize(_M_num_elements + 1); @@ -838,9 +839,9 @@ void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::erase(iterator __first, else if (__f_bucket == __l_bucket) _M_erase_bucket(__f_bucket, __first._M_cur, __last._M_cur); else { - _M_erase_bucket(__f_bucket, __first._M_cur, 0); + _M_erase_bucket(__f_bucket, __first._M_cur, nullptr); for (size_type __n = __f_bucket + 1; __n < __l_bucket; ++__n) - _M_erase_bucket(__n, 0); + _M_erase_bucket(__n, nullptr); if (__l_bucket != _M_buckets.size()) _M_erase_bucket(__l_bucket, __last._M_cur); } @@ -872,7 +873,8 @@ void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::resize( if (__num_elements_hint > __old_n) { const size_type __n = _M_next_size(__num_elements_hint); if (__n > __old_n) { - _M_buckets_type __tmp(__n, (_Node*)(0), _M_buckets.get_allocator()); + _M_buckets_type __tmp(__n, (_Node*)(nullptr), + _M_buckets.get_allocator()); try { for (size_type __bucket = 0; __bucket < __old_n; ++__bucket) { _Node* __first = _M_buckets[__bucket]; @@ -939,12 +941,12 @@ void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::clear() { for (size_type __i = 0; __i < _M_buckets.size(); ++__i) { _Node* __cur = _M_buckets[__i]; - while (__cur != 0) { + while (__cur != nullptr) { _Node* __next = __cur->_M_next; _M_delete_node(__cur); __cur = __next; } - _M_buckets[__i] = 0; + _M_buckets[__i] = nullptr; } _M_num_elements = 0; } @@ -955,7 +957,7 @@ void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::_M_copy_from( { _M_buckets.clear(); _M_buckets.reserve(__ht._M_buckets.size()); - _M_buckets.insert(_M_buckets.end(), __ht._M_buckets.size(), (_Node*)0); + _M_buckets.insert(_M_buckets.end(), __ht._M_buckets.size(), (_Node*)nullptr); try { for (size_type __i = 0; __i < __ht._M_buckets.size(); ++__i) { const _Node* __cur = __ht._M_buckets[__i]; @@ -963,7 +965,7 @@ void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::_M_copy_from( _Node* __copy = _M_new_node(__cur->_M_val); _M_buckets[__i] = __copy; - for (_Node *__next = __cur->_M_next; __next; + for (_Node* __next = __cur->_M_next; __next; __cur = __next, __next = __cur->_M_next) { __copy->_M_next = _M_new_node(__next->_M_val); __copy = __copy->_M_next; @@ -980,14 +982,14 @@ void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::_M_copy_from( } // namespace @KWSYS_NAMESPACE@ // Undo warning suppression. -#if defined(__clang__) && defined(__has_warning) -#if __has_warning("-Wdeprecated") -#pragma clang diagnostic pop -#endif -#endif - -#if defined(_MSC_VER) -#pragma warning(pop) -#endif +# if defined(__clang__) && defined(__has_warning) +# if __has_warning("-Wdeprecated") +# pragma clang diagnostic pop +# endif +# endif + +# if defined(_MSC_VER) +# pragma warning(pop) +# endif #endif |