-
Notifications
You must be signed in to change notification settings - Fork 0
/
_ticont.h
69 lines (52 loc) · 1.25 KB
/
_ticont.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef __TICONT_H__
#define __TICONT_H__
// Copyright David Lawrence Bien 1997 - 2021.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt).
// _ticont.h
// STL container compatible type_info wrapper.
__BIENUTIL_BEGIN_NAMESPACE
struct _type_info_wrap
{
private:
typedef _type_info_wrap _TyThis;
public:
type_info const & m_rti;
_type_info_wrap( type_info const & _rti )
: m_rti( _rti )
{
}
_type_info_wrap( _type_info_wrap const & _r )
: m_rti( _r.m_rti )
{
}
bool operator < ( _TyThis const & _r ) const
{
return m_rti.before( _r.m_rti );
}
bool operator == ( _TyThis const & _r ) const
{
return m_rti == _r.m_rti;
}
bool operator != ( _TyThis const & _r ) const
{
return m_rti != _r.m_rti;
}
size_t hash() const
{
return reinterpret_cast< size_t >( &m_rti );
}
};
__BIENUTIL_END_NAMESPACE
namespace std {
__BIENUTIL_USING_NAMESPACE
template<> struct hash<_type_info_wrap>
{
size_t operator()(_type_info_wrap const & _rtiw) const
{
return _rtiw.hash();
}
};
} // end namespace std
#endif //__TICONT_H__