Platform.Data.Doublets C++
Toggle main menu visibility
Loading...
Searching...
No Matches
Doublet.h
Go to the documentation of this file.
1
namespace
Platform::Data::Doublets
2
{
3
// todo! use link concept
4
template
<
typename
T>
5
struct
Doublet
6
{
7
public
:
8
T
Source
= 0;
9
10
public
:
11
T
Target
= 0;
12
13
public
:
14
Doublet
(T source = 0, T target = 0) :
Source
(source),
Target
(target) {}
15
16
public
:
17
explicit
operator
std::string()
const
18
{
19
return
std::string(
""
)
20
.append(Platform::Converters::To<std::string>(
Source
))
21
.append(
"->"
)
22
.append(Platform::Converters::To<std::string>(
Target
));
23
}
24
25
public
:
26
friend
std::ostream&
operator<<
(std::ostream& stream,
const
Doublet<T>
& self)
27
{
28
return
stream << static_cast<std::string>(self);
29
}
30
31
public
:
32
bool
operator==
(
const
Doublet<T>
& other)
const
=
default
;
33
};
34
35
template
<
typename
... Args>
36
Doublet
(Args...) ->
Doublet
<std::common_type_t<Args...>>;
37
}
// namespace Platform::Data::Doublets
38
39
template
<
typename
T>
40
struct
std::hash<
Platform
::Data::Doublets::Doublet<T>>
41
{
42
std::size_t
operator()
(
const
Platform::Data::Doublets::Doublet<T>
& self)
const
43
{
44
return
Platform::Hashing::Hash(self.
Source
, self.
Target
);
45
}
46
};
Platform::Data::Doublets
Definition
TargetMatcher.h:2
Platform
Definition
TargetMatcher.h:2
Platform::Data::Doublets::Doublet
Definition
Doublet.h:6
Platform::Data::Doublets::Doublet::operator==
bool operator==(const Doublet< T > &other) const =default
Platform::Data::Doublets::Doublet::Doublet
Doublet(T source=0, T target=0)
Definition
Doublet.h:14
Platform::Data::Doublets::Doublet::Source
T Source
Definition
Doublet.h:8
Platform::Data::Doublets::Doublet::operator<<
friend std::ostream & operator<<(std::ostream &stream, const Doublet< T > &self)
Definition
Doublet.h:26
Platform::Data::Doublets::Doublet::Target
T Target
Definition
Doublet.h:11
std::hash< Platform::Data::Doublets::Doublet< T > >::operator()
std::size_t operator()(const Platform::Data::Doublets::Doublet< T > &self) const
Definition
Doublet.h:42
cpp
Platform.Data.Doublets
Doublet.h
Generated by
1.18.0