29 #ifndef LIB_DIFF_INDEX_TABLE_H 30 #define LIB_DIFF_INDEX_TABLE_H 51 template<
typename VAL>
54 std::vector<VAL> data_;
55 std::map<VAL,size_t> idx_;
62 for (
auto const& elm : seq)
64 __rejectDuplicate(elm);
65 data_.push_back (elm);
72 using iterator =
typename std::vector<VAL>::iterator;
73 using const_iterator =
typename std::vector<VAL>::const_iterator;
75 iterator begin() {
return data_.begin(); }
76 iterator end() {
return data_.end(); }
77 const_iterator begin()
const {
return data_.begin(); }
78 const_iterator end()
const {
return data_.end(); }
80 size_t size()
const {
return data_.size(); }
86 getElement (
size_t i)
const 94 contains (VAL
const& elm)
const 96 return pos(elm) != size();
101 pos (VAL
const& elm)
const 103 auto entry = idx_.find (elm);
104 return entry==idx_.end()? size()
110 __rejectDuplicate (VAL
const& elm)
112 if (util::contains (idx_, elm))
113 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).