Wildvine Engine
Referencia Doxygen del codigo propio de Wildvine Engine.
Cargando...
Buscando...
Nada coincide
TPair.h
Ir a la documentación de este archivo.
1
6/*
7 * MIT License
8 *
9 * Copyright (c) 2024 Roberto Charreton
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included in all
19 * copies or substantial portions of the Software.
20 *
21 * In addition, any project or software that uses this library or class must include
22 * the following acknowledgment in the credits:
23 *
24 * "This project uses software developed by Roberto Charreton and Attribute Overload."
25 *
26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32 * SOFTWARE.
33*/
34#pragma once
35
36namespace EU {
37#pragma once
38#include <iostream>
39
50 template <typename KeyType, typename ValueType>
51 class TPair {
52 public:
56 TPair() : Key(KeyType()), Value(ValueType()) {}
57
64 TPair(const KeyType& InKey, const ValueType& InValue) : Key(InKey), Value(InValue) {}
65
69 KeyType Key;
70
74 ValueType Value;
75
83 bool operator==(const TPair<KeyType, ValueType>& Other) const {
84 return Key == Other.Key && Value == Other.Value;
85 }
86
94 bool operator!=(const TPair<KeyType, ValueType>& Other) const {
95 return !(*this == Other);
96 }
97
105 bool operator<(const TPair<KeyType, ValueType>& Other) const {
106 return Key < Other.Key || (Key == Other.Key && Value < Other.Value);
107 }
108
116 bool operator>(const TPair<KeyType, ValueType>& Other) const {
117 return Other < *this;
118 }
119
127 bool operator<=(const TPair<KeyType, ValueType>& Other) const {
128 return !(Other < *this);
129 }
130
138 bool operator>=(const TPair<KeyType, ValueType>& Other) const {
139 return !(*this < Other);
140 }
141
147 void Print() const {
148 std::cout << "Key: " << Key << ", Value: " << Value << std::endl;
149 }
150 };
151
152}
153
154
Clase TPair para representar un par de valores.
Definition TPair.h:51
KeyType Key
Clave del par.
Definition TPair.h:69
ValueType Value
Valor del par.
Definition TPair.h:74
bool operator==(const TPair< KeyType, ValueType > &Other) const
Compara dos pares para verificar si son iguales.
Definition TPair.h:83
bool operator>(const TPair< KeyType, ValueType > &Other) const
Compara dos pares para verificar si el par actual es mayor que el otro.
Definition TPair.h:116
bool operator<=(const TPair< KeyType, ValueType > &Other) const
Compara dos pares para verificar si el par actual es menor o igual al otro.
Definition TPair.h:127
TPair()
Constructor por defecto que inicializa el par con valores predeterminados.
Definition TPair.h:56
void Print() const
Imprime el par en la consola.
Definition TPair.h:147
bool operator>=(const TPair< KeyType, ValueType > &Other) const
Compara dos pares para verificar si el par actual es mayor o igual al otro.
Definition TPair.h:138
bool operator!=(const TPair< KeyType, ValueType > &Other) const
Compara dos pares para verificar si son diferentes.
Definition TPair.h:94
TPair(const KeyType &InKey, const ValueType &InValue)
Constructor que inicializa el par con los valores especificados.
Definition TPair.h:64
bool operator<(const TPair< KeyType, ValueType > &Other) const
Compara dos pares para verificar si el par actual es menor que el otro.
Definition TPair.h:105
Definition Matrix2x2.h:35