Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74626 - trunk/boost/chrono/stopwatches/memories
From: vicente.botet_at_[hidden]
Date: 2011-10-01 16:47:20


Author: viboes
Date: 2011-10-01 16:47:20 EDT (Sat, 01 Oct 2011)
New Revision: 74626
URL: http://svn.boost.org/trac/boost/changeset/74626

Log:
Chrono: Added laps_sequence_container.hpp
Added:
   trunk/boost/chrono/stopwatches/memories/laps_sequence_container.hpp (contents, props changed)

Added: trunk/boost/chrono/stopwatches/memories/laps_sequence_container.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/chrono/stopwatches/memories/laps_sequence_container.hpp 2011-10-01 16:47:20 EDT (Sat, 01 Oct 2011)
@@ -0,0 +1,57 @@
+// boost/chrono/stopwatches/stopwatch_reporter.hpp
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_MEMORIES_LAPS_CONTAINER_HPP
+#define BOOST_CHRONO_STOPWATCHES_MEMORIES_LAPS_CONTAINER_HPP
+
+#include <list>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ template<
+ typename Duration,
+ typename SequenceContainer = std::list<Duration>
+ >
+ struct laps_sequence_container
+ {
+ typedef Duration duration;
+ typedef typename duration::rep rep;
+ typedef SequenceContainer storage_type;
+ storage_type cont_;
+
+ void store(duration const& d)
+ {
+ cont_.push_front(d);
+ }
+
+ void reset()
+ {
+ cont_.clear();
+ }
+
+ storage_type const& container() const { return cont_; }
+
+ duration last() const {
+ if (cont_.empty())
+ return duration::zero();
+ else
+ return *cont_.begin();
+ }
+
+ };
+
+
+ } // namespace chrono
+} // namespace boost
+
+
+#endif
+
+


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk