FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
solvespace/src/handle.h at master · solvespace/solvespace · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
solvespace
/
solvespace
Public
Notifications
You must be signed in to change notification settings
Fork
595
Star
4.1k
Code
Issues
244
Pull requests
34
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
solvespace
/
src
/
handle.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
47 lines (37 loc) · 1.29 KB
Breadcrumbs
solvespace
/
src
/
handle.h
Copy path
File metadata and controls
47 lines (37 loc) · 1.29 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#
ifndef
SOVLESPACE_HANDLE_H
#
define
SOVLESPACE_HANDLE_H
#
include
<
functional
>
#
include
<
type_traits
>
namespace
SolveSpace
{
//
/ Trait indicating which types are handle types and should get the associated operators.
//
/ Specialize for each handle type and inherit from std::true_type.
template
<
class
T
>
struct
IsHandleOracle
: std::false_type {};
//
Equality-compare any two instances of a handle type.
template
<
class
T
>
static
inline
typename
std::enable_if<IsHandleOracle<T>::value,
bool
>::type
operator
==(T
const
&lhs, T
const
&rhs) {
return
lhs.
v
== rhs.
v
;
}
//
Inequality-compare any two instances of a handle type.
template
<
class
T
>
static
inline
typename
std::enable_if<IsHandleOracle<T>::value,
bool
>::type
operator
!=(T
const
&lhs, T
const
&rhs) {
return
!(lhs == rhs);
}
//
Less-than-compare any two instances of a handle type.
template
<
class
T
>
static
inline
typename
std::enable_if<IsHandleOracle<T>::value,
bool
>::type
operator
<(T
const
&lhs, T
const
&rhs) {
return
lhs.
v
< rhs.
v
;
}
template
<
class
T
>
struct
HandleHasher
{
static_assert
(IsHandleOracle<T>::value,
"
Not a valid handle type
"
);
inline
size_t
operator
()(
const
T &h)
const
{
using
Hasher = std::hash<
decltype
(T::v)>;
return
Hasher{}(h.
v
);
}
};
}
//
namespace SolveSpace
#
endif
//
!SOVLESPACE_HANDLE_H
Back
|
FazBrowse Home
|
New Git URL