38 #ifndef LIB_DIFF_INDEX_TABLE_H 39 #define LIB_DIFF_INDEX_TABLE_H 60 template<
typename VAL>
63 std::vector<VAL> data_;
64 std::map<VAL,size_t> idx_;
71 for (
auto const& elm : seq)
73 __rejectDuplicate(elm);
74 data_.push_back (elm);
81 using iterator =
typename std::vector<VAL>::iterator;
82 using const_iterator =
typename std::vector<VAL>::const_iterator;
84 iterator begin() {
return data_.begin(); }
85 iterator end() {
return data_.end(); }
86 const_iterator begin()
const {
return data_.begin(); }
87 const_iterator end()
const {
return data_.end(); }
89 size_t size()
const {
return data_.size(); }
95 getElement (
size_t i)
const 103 contains (VAL
const& elm)
const 105 return pos(elm) != size();
110 pos (VAL
const& elm)
const 112 auto entry = idx_.find (elm);
113 return entry==idx_.end()? size()
119 __rejectDuplicate (VAL
const& elm)
121 if (util::contains (idx_, elm))
122 throw error::Logic(
_Fmt(
"Attempt to add duplicate %s to index table") % elm);
AnyPair entry(Query< TY > const &query, typename WrapReturn< TY >::Wrapper &obj)
helper to simplify creating mock table entries, wrapped correctly
A front-end for using printf-style formatting.
Implementation namespace for support and library code.
Derived specific exceptions within Lumiera's exception hierarchy.
data snapshot and lookup table
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Lumiera error handling (C++ interface).