View Single Post
  #5  
Old 09-12-2011, 04:45 AM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

I'd use if(signal_q.empty()) instead of if(signal_q.size() < 1), but it looks good to me.

In case anyone cares about the longer explanation, the empty() function is guaranteed to be constant time where the size() function is not. In practice, for most containers including deque they are both constant time and empty() just returns size() == 0, but there are some implementations where that isn't true. It's talked about in Effective STL #4.
Reply With Quote