diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WTF/wtf/HashIterators.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WTF/wtf/HashIterators.h')
-rw-r--r-- | Source/WTF/wtf/HashIterators.h | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/Source/WTF/wtf/HashIterators.h b/Source/WTF/wtf/HashIterators.h index b498b92c6..318a8496c 100644 --- a/Source/WTF/wtf/HashIterators.h +++ b/Source/WTF/wtf/HashIterators.h @@ -10,10 +10,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -23,8 +23,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WTF_HashIterators_h -#define WTF_HashIterators_h +#pragma once + +#include <iterator> namespace WTF { @@ -33,7 +34,7 @@ namespace WTF { template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableKeysIterator; template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableValuesIterator; - template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType>> { + template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType>> : public std::iterator<std::forward_iterator_tag, KeyValuePair<KeyType, MappedType>, std::ptrdiff_t, const KeyValuePair<KeyType, MappedType>*, const KeyValuePair<KeyType, MappedType>&> { private: typedef KeyValuePair<KeyType, MappedType> ValueType; public: @@ -56,7 +57,7 @@ namespace WTF { typename HashTableType::const_iterator m_impl; }; - template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType>> { + template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType>> : public std::iterator<std::forward_iterator_tag, KeyValuePair<KeyType, MappedType>, std::ptrdiff_t, KeyValuePair<KeyType, MappedType>*, KeyValuePair<KeyType, MappedType>&> { private: typedef KeyValuePair<KeyType, MappedType> ValueType; public: @@ -84,7 +85,7 @@ namespace WTF { typename HashTableType::iterator m_impl; }; - template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstKeysIterator { + template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstKeysIterator : public std::iterator<std::forward_iterator_tag, KeyType, std::ptrdiff_t, const KeyType*, const KeyType&> { private: typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType>> ConstIterator; @@ -101,7 +102,7 @@ namespace WTF { ConstIterator m_impl; }; - template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstValuesIterator { + template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableConstValuesIterator : public std::iterator<std::forward_iterator_tag, MappedType, std::ptrdiff_t, const MappedType*, const MappedType&> { private: typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType>> ConstIterator; @@ -118,7 +119,7 @@ namespace WTF { ConstIterator m_impl; }; - template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableKeysIterator { + template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableKeysIterator : public std::iterator<std::forward_iterator_tag, KeyType, std::ptrdiff_t, KeyType*, KeyType&> { private: typedef HashTableIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType>> Iterator; typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType>> ConstIterator; @@ -141,7 +142,7 @@ namespace WTF { Iterator m_impl; }; - template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableValuesIterator { + template<typename HashTableType, typename KeyType, typename MappedType> struct HashTableValuesIterator : public std::iterator<std::forward_iterator_tag, MappedType, std::ptrdiff_t, MappedType*, MappedType&> { private: typedef HashTableIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType>> Iterator; typedef HashTableConstIteratorAdapter<HashTableType, KeyValuePair<KeyType, MappedType>> ConstIterator; @@ -149,7 +150,7 @@ namespace WTF { public: HashTableValuesIterator(const Iterator& impl) : m_impl(impl) {} - MappedType* get() const { return &(m_impl.get()->value); } + MappedType* get() const { return std::addressof(m_impl.get()->value); } MappedType& operator*() const { return *get(); } MappedType* operator->() const { return get(); } @@ -212,7 +213,4 @@ namespace WTF { return a.m_impl != b.m_impl; } - } // namespace WTF - -#endif // WTF_HashIterators_h |