⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 203304 in webkit


Ignore:
Timestamp:
Jul 15, 2016, 3:25:43 PM (10 years ago)
Author:
Chris Dumez
Message:

Add move constructor / assignment operator to ListHashSet
https://bugs.webkit.org/show_bug.cgi?id=159837

Reviewed by Alex Christensen.

Add move constructor / assignment operator to ListHashSet.

  • wtf/ListHashSet.h:
Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r203303 r203304  
     12016-07-15  Chris Dumez  <cdumez@apple.com>
     2
     3        Add move constructor / assignment operator to ListHashSet
     4        https://bugs.webkit.org/show_bug.cgi?id=159837
     5
     6        Reviewed by Alex Christensen.
     7
     8        Add move constructor / assignment operator to ListHashSet.
     9
     10        * wtf/ListHashSet.h:
     11
    1122016-07-15  Geoffrey Garen  <ggaren@apple.com>
    213
  • trunk/Source/WTF/wtf/ListHashSet.h

    r194496 r203304  
    2020 */
    2121
    22 #ifndef WTF_ListHashSet_h
    23 #define WTF_ListHashSet_h
     22#pragma once
    2423
    2524#include <wtf/HashSet.h>
     
    7069    typedef HashTableAddResult<iterator> AddResult;
    7170
    72     ListHashSet();
     71    ListHashSet() = default;
    7372    ListHashSet(const ListHashSet&);
     73    ListHashSet(ListHashSet&&) = default;
    7474    ListHashSet& operator=(const ListHashSet&);
     75    ListHashSet& operator=(ListHashSet&&) = default;
    7576    ~ListHashSet();
    7677
     
    150151
    151152    HashTable<Node*, Node*, IdentityExtractor, NodeHash, NodeTraits, NodeTraits> m_impl;
    152     Node* m_head;
    153     Node* m_tail;
     153    Node* m_head { nullptr };
     154    Node* m_tail { nullptr };
    154155};
    155156
     
    160161    ListHashSetNode(T&& value)
    161162        : m_value(std::forward<T>(value))
    162         , m_prev(0)
    163         , m_next(0)
    164163    {
    165164    }
    166165
    167166    ValueArg m_value;
    168     ListHashSetNode* m_prev;
    169     ListHashSetNode* m_next;
     167    ListHashSetNode* m_prev { nullptr };
     168    ListHashSetNode* m_next { nullptr };
    170169};
    171170
     
    261260    const_iterator& operator++()
    262261    {
    263         ASSERT(m_position != 0);
     262        ASSERT(m_position);
    264263        m_position = m_position->m_next;
    265264        return *this;
     
    308307
    309308template<typename T, typename U>
    310 inline ListHashSet<T, U>::ListHashSet()
    311     : m_head(0)
    312     , m_tail(0)
    313 {
    314 }
    315 
    316 template<typename T, typename U>
    317309inline ListHashSet<T, U>::ListHashSet(const ListHashSet& other)
    318     : m_head(0)
    319     , m_tail(0)
    320310{
    321311    for (auto it = other.begin(), end = other.end(); it != end; ++it)
     
    603593    deleteAllNodes();
    604594    m_impl.clear();
    605     m_head = 0;
    606     m_tail = 0;
     595    m_head = nullptr;
     596    m_tail = nullptr;
    607597}
    608598
     
    638628{
    639629    node->m_prev = m_tail;
    640     node->m_next = 0;
     630    node->m_next = nullptr;
    641631
    642632    if (m_tail) {
     
    654644void ListHashSet<T, U>::prependNode(Node* node)
    655645{
    656     node->m_prev = 0;
     646    node->m_prev = nullptr;
    657647    node->m_next = m_head;
    658648
     
    687677        return;
    688678
    689     for (Node* node = m_head, *next = m_head->m_next; node; node = next, next = node ? node->m_next : 0)
     679    for (Node* node = m_head, *next = m_head->m_next; node; node = next, next = node ? node->m_next : nullptr)
    690680        delete node;
    691681}
     
    706696
    707697using WTF::ListHashSet;
    708 
    709 #endif /* WTF_ListHashSet_h */
Note: See TracChangeset for help on using the changeset viewer.