Visual Computing Library
devel
Version:
Loading versions...
Loading...
Searching...
No Matches
pair.h
1
/*****************************************************************************
2
* VCLib *
3
* Visual Computing Library *
4
* *
5
* Copyright(C) 2021-2025 *
6
* Visual Computing Lab *
7
* ISTI - Italian National Research Council *
8
* *
9
* All rights reserved. *
10
* *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the Mozilla Public License Version 2.0 as published *
13
* by the Mozilla Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* *
16
* This program is distributed in the hope that it will be useful, *
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19
* Mozilla Public License Version 2.0 *
20
* (https://www.mozilla.org/en-US/MPL/2.0/) for more details. *
21
****************************************************************************/
22
23
#ifndef VCL_BASE_PAIR_H
24
#define VCL_BASE_PAIR_H
25
26
namespace
vcl {
27
28
template
<
typename
T1,
typename
T2>
29
class
RefPair
30
{
31
public
:
32
RefPair
(
T1
& f,
T2
& s) : first(f), second(s) {}
33
34
T1
& first;
35
T2
& second;
36
};
37
38
template
<
typename
T1,
typename
T2>
39
class
FirstRefPair
40
{
41
public
:
42
FirstRefPair
(
T1
& f,
const
T2
& s) : first(f), second(s) {}
43
44
T1
& first;
45
T2
second;
46
};
47
48
template
<
typename
T1,
typename
T2>
49
class
SecondRefPair
50
{
51
public
:
52
SecondRefPair
(
const
T1
& f,
T2
& s) : first(f), second(s) {}
53
54
T1
first;
55
T2
& second;
56
};
57
58
template
<
typename
T1,
typename
T2>
59
class
KeyRefValueRefPair
:
public
RefPair
<T1, T2>
60
{
61
public
:
62
KeyRefValueRefPair
(
T1
& f,
T2
& s) :
RefPair<T1, T2>
(f, s) {}
63
64
T1
& key =
RefPair<T1, T2>::first
;
// alias
65
T2
& value =
RefPair<T1, T2>::second
;
// alias
66
};
67
68
template
<
typename
T1,
typename
T2>
69
class
KeyValueRefPair
:
public
SecondRefPair
<T1, T2>
70
{
71
public
:
72
KeyValueRefPair
(
const
T1
& f,
T2
& s) :
SecondRefPair<T1, T2>
(f, s) {}
73
74
T1
& key =
SecondRefPair<T1, T2>::first
;
// alias
75
T2
& value =
SecondRefPair<T1, T2>::second
;
// alias
76
};
77
78
}
// namespace vcl
79
80
#endif
// VCL_BASE_PAIR_H
vcl::Box
A class representing a box in N-dimensional space.
Definition
box.h:46
vcl::FirstRefPair
Definition
pair.h:40
vcl::KeyRefValueRefPair
Definition
pair.h:60
vcl::KeyValueRefPair
Definition
pair.h:70
vcl::RefPair
Definition
pair.h:30
vcl::SecondRefPair
Definition
pair.h:50
vclib
core
include
vclib
base
pair.h
Generated by
1.9.8