Class documentation of Concepts

Loading...
Searching...
No Matches
hashMap.hh
Go to the documentation of this file.
1
7#ifndef hashMap_hh
8#define hashMap_hh
9
10#include <functional>
11#include <unordered_map>
12
15
16namespace concepts {
17
18 template<class F>
19 class HashMap : public std::unordered_map<uint, F>, public virtual OutputOperator {
20 public:
21
23 bool exists(uint i) const {
24 return this->find(i) != this->end();
25 }
26 protected:
27 virtual std::ostream& info(std::ostream& os) const;
28 };
29
30 template<class F>
31 std::ostream& HashMap<F>::info(std::ostream& os) const {
32 os << concepts::typeOf(*this)<<"(" << this->size() << ": " << std::endl;
33 for (typename concepts::HashMap<F>::
34 const_iterator i = this->begin(); i != this->end(); ++i)
35 os << " " << i->first << " - "
36 << OutputMatlab<F>(i->second) << std::endl;
37 return os << ')';
38 }
39
40} // namespace concepts
41
42#endif
bool exists(uint i) const
Returns true if the entrance exists.
Definition hashMap.hh:23
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Definition hashMap.hh:31
std::string typeOf(const T &t)
Definition output.hh:43
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320