/// <summary>
 /// Dequeues a value from our thread-safe blocking queue.  The caller becomes responsible
 /// for the lifetime of the returned value.  This method blocks until an element from the
 /// queue becomes available (as in, we wait while it is empty).
 /// </summary>
 T pop()
 {
    lock_type lock(m_mutex);
    m_condition.wait(lock, [this]{ return !m_queue.empty(); });
    T returnedValue = std::move(m_queue.front()); //via http://stackoverflow.com/questions/2142965/c0x-move-from-container#comment2084416_2143009
    m_queue.pop_front();
    return returnedValue;
 }
//[ some_helpers
point_type center_of_mass( const container_type &x , const mass_type &m )
{
    double overall_mass = 0.0;
    point_type mean( 0.0 );
    for( size_t i=0 ; i<x.size() ; ++i )
    {
        overall_mass += m[i];
        mean += m[i] * x[i];
    }
    if( !x.empty() ) mean /= overall_mass;
    return mean;
}
Exemple #3
0
		static bool                                  empty(const container_type& p) { return p.empty(); }
Exemple #4
0
//Observe
	bool           empty()  const { return values.empty();  }
 bool empty() const                      { return list.empty(); }