23 #include <boost/range.hpp> 24 #include <boost/range/adaptors.hpp> 38 template <
typename T,
typename Key = std::
string>
61 assert((0 <= ibegin && iend <= iend && iend <= boost::size(
m_t)) &&
"Bad subscript.");
71 assert(0 <= ibegin && ibegin <= boost::size(
m_t) &&
"Bad subscript.");
82 throw std::range_error(
"Name is a duplicate: ");
87 std::map<Key, std::size_t>
m_map;
const std::vector< range_type > & Get()
Retrieve all the ranges,.
SliceIndexer< T > make_slice_indexer(T &t)
const range_type & Get(const Key &s) const
Retrieve const reference to a range by its Id.
T & m_t
Refernec to container that gets sliced into ranges.
range_type & Set(std::size_t ibegin, const Key &name)
Set a range, where the end is the end of the container.
boost::sliced_range< T > range_type
range_type & Get(const Key &s)
Retrieve reference to a range by its key.
Datastructure to index a container (supporting RandomAccessIterators) with slices.
range_type & Set(std::size_t ibegin, std::size_t iend, const Key &name)
Set a range. Warning: range is [ibegin, iend) i.e. half-open, iend not included!
void check(const Key &name)
Check key map for duplicate; throw iff duplicate.
SliceIndexer(T &t)
SliceIndexer holds a reference to the conatiner that it indexes.
std::map< Key, std::size_t > m_map
Maps key values to subscripts.
Namespace for the simulator and related classes.
std::vector< range_type > m_slices
Contains the slices.