1 // boost/chrono/stopwatches/collectors/laps_sequence_container.hpp
2 // Copyright 2011 Vicente J. Botet Escriba
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or
5 // copy at http://www.boost.org/LICENSE_1_0.txt)
6 // See http://www.boost.org/libs/chrono/stopwatches for documentation.
8 #ifndef BOOST_CHRONO_STOPWATCHES_MEMORIES_LAPS_CONTAINER_HPP
9 #define BOOST_CHRONO_STOPWATCHES_MEMORIES_LAPS_CONTAINER_HPP
20 typename SequenceContainer = std::list<Duration>
22 struct laps_sequence_container
24 typedef Duration duration;
25 typedef typename duration::rep rep;
26 typedef SequenceContainer storage_type;
27 typedef typename SequenceContainer::iterator iterator;
28 typedef typename SequenceContainer::const_iterator const_iterator;
31 void store(duration const& d)
41 storage_type const& container() const { return cont_; }
43 duration last() const {
45 return duration::zero();
47 return *cont_.begin();
50 duration elapsed() const {
51 duration elapsed_ = duration::zero();
52 for (const_iterator it = cont_.begin(); it !=cont_.end(); ++it) elapsed_ += *it;