Changeset 16562 for trunk/FACT++


Ignore:
Timestamp:
06/01/13 19:56:09 (11 years ago)
Author:
tbretz
Message:
Added a possibility to move an entry from another list into this list.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/queue.h

    r16528 r16562  
    158158
    159159        return true;
    160 
    161160    }
    162161
    163162    bool post(T &&val) { return emplace(std::move(val)); }
     163#endif
     164
     165#ifdef __GXX_EXPERIMENTAL_CXX0X__
     166    bool move(std::list<T>&& x, typename std::list<T>::iterator i)
     167#else
     168    bool move(std::list<T>& x, typename std::list<T>::iterator i)
     169#endif
     170    {
     171        const std::lock_guard<std::mutex> lock(fMutex);
     172        if (fState==kIdle)
     173            return false;
     174
     175        fList.splice(fList.end(), x, i);
     176        fSize++;
     177
     178        fCond.notify_one();
     179
     180        return true;
     181    }
     182
     183#ifdef __GXX_EXPERIMENTAL_CXX0X__
     184    bool move(std::list<T>& x, typename std::list<T>::iterator i) { return move(std::move(x), i); }
    164185#endif
    165186
Note: See TracChangeset for help on using the changeset viewer.