GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
MyMap.hh
Go to the documentation of this file.
1
2
3#ifndef MYMAP_HH
4#define MYMAP_HH
5
6
7#include <map>
8#include <optional>
9
10
11namespace std
12{
13 template<class A, class B>
14 class mymap : public std::map<A,B>
15 {
16 public:
17 std::optional<B&> index(A a) const
18 {
19 typename std::map<A,B>::const_iterator i = find(a);
20 if (i!=std::map<A,B>::end()) return std::optional<B&>((*i)->second);
21 return std::optional<B&>();
22 }
23 };
24};
25
26#endif
void * find(int i)
Definition ui.cc:347
Definition compiled_tests.cpp:1189
Definition MyMap.hh:15
std::optional< B & > index(A a) const
Definition MyMap.hh:17
STL namespace.