Visual Computing Library  devel
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
26namespace vcl {
27
28template<typename T1, typename T2>
30{
31public:
32 RefPair(T1& f, T2& s) : first(f), second(s) {}
33
34 T1& first;
35 T2& second;
36};
37
38template<typename T1, typename T2>
40{
41public:
42 FirstRefPair(T1& f, const T2& s) : first(f), second(s) {}
43
44 T1& first;
45 T2 second;
46};
47
48template<typename T1, typename T2>
50{
51public:
52 SecondRefPair(const T1& f, T2& s) : first(f), second(s) {}
53
54 T1 first;
55 T2& second;
56};
57
58template<typename T1, typename T2>
59class KeyRefValueRefPair : public RefPair<T1, T2>
60{
61public:
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
68template<typename T1, typename T2>
69class KeyValueRefPair : public SecondRefPair<T1, T2>
70{
71public:
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
A class representing a box in N-dimensional space.
Definition box.h:46
Definition pair.h:40
Definition pair.h:60
Definition pair.h:70
Definition pair.h:30
Definition pair.h:50