WARPXM v1.10.0
Loading...
Searching...
No Matches
wmtypewrapper.h
Go to the documentation of this file.
1/*
2 * wmtypewrapper.h
3 * warpm Xcode project
4 *
5 * provides utility to use std::type_info as key in associative containers
6 *
7 * Created by Noah Reddell on 4/6/12.
8 * Copyright 2012 University of Washington. All rights reserved.
9 *
10 */
11#ifndef wmtypewrapper_h
12#define wmtypewrapper_h
13
14#include <typeinfo>
15
21{
22public:
23 WmTypeWrapper(const std::type_info& info) : mInfo(info)
24 {
25 }
26
30 template<typename VALUETYPE> static WmTypeWrapper create()
31 {
32 return WmTypeWrapper(typeid(VALUETYPE));
33 }
34
35 // Requried to use as a key into a std::map.
36
37 bool operator==(const WmTypeWrapper& other) const
38 {
39 return mInfo.operator==(other.mInfo);
40 }
41
42 bool operator<(const WmTypeWrapper& other) const
43 {
44 return mInfo.before(other.mInfo);
45 }
46
47 bool operator==(const std::type_info& other) const
48 {
49 return mInfo.operator==(other);
50 }
51
52private:
53 const std::type_info& mInfo;
54};
55
56#endif // wmtypewrapper_h
Definition: wmtypewrapper.h:21
bool operator==(const std::type_info &other) const
Definition: wmtypewrapper.h:47
bool operator==(const WmTypeWrapper &other) const
Definition: wmtypewrapper.h:37
WmTypeWrapper(const std::type_info &info)
Definition: wmtypewrapper.h:23
bool operator<(const WmTypeWrapper &other) const
Definition: wmtypewrapper.h:42
static WmTypeWrapper create()
retreive a WmTypeWrapper object wrapping VALUETYPE
Definition: wmtypewrapper.h:30