[Assorted-commits] SF.net SVN: assorted:[1270] cpp-commons/trunk/src/commons
Brought to you by:
yangzhang
From: <yan...@us...> - 2009-03-08 09:40:11
|
Revision: 1270 http://assorted.svn.sourceforge.net/assorted/?rev=1270&view=rev Author: yangzhang Date: 2009-03-08 09:40:09 +0000 (Sun, 08 Mar 2009) Log Message: ----------- tweaks to get unique_ptr to work; still need to fully understand things Modified Paths: -------------- cpp-commons/trunk/src/commons/fast_map.h cpp-commons/trunk/src/commons/st/st.h Modified: cpp-commons/trunk/src/commons/fast_map.h =================================================================== --- cpp-commons/trunk/src/commons/fast_map.h 2009-03-08 09:39:11 UTC (rev 1269) +++ cpp-commons/trunk/src/commons/fast_map.h 2009-03-08 09:40:09 UTC (rev 1270) @@ -125,8 +125,7 @@ * the application, but more importantly, the interface required the ability * to serialize the map, and partially. The internals have to be exposed in * order for fast serialization (i.e. memcpy) to be possible; also, the - * ability to serialize just a certain range of the fast_map is also - * important. + * ability to serialize just a certain range of the fast_map was required. */ template <typename Key, typename Data> class fast_map Modified: cpp-commons/trunk/src/commons/st/st.h =================================================================== --- cpp-commons/trunk/src/commons/st/st.h 2009-03-08 09:39:11 UTC (rev 1269) +++ cpp-commons/trunk/src/commons/st/st.h 2009-03-08 09:40:09 UTC (rev 1270) @@ -196,6 +196,10 @@ class st_channel { public: + void push(T &&x) { + q_.push(boost::move(x)); + empty_.signal(); + } void push(const T &x) { q_.push(x); empty_.signal(); @@ -204,11 +208,12 @@ while (q_.empty()) { empty_.wait(); } - T x = front(); + T x = boost::move(front()); q_.pop(); - return x; + return boost::move(x); } const T& front() const { return q_.front(); } + T& front() { return q_.front(); } bool empty() const { return q_.empty(); } void pop() { q_.pop(); } void clear() { while (!q_.empty()) q_.pop(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |