Infinity Engine v0.6.20
C++ API Documentation
Loading...
Searching...
No Matches
Pair.hpp
1// INFINITY_API_PUBLIC
2
3#pragma once
4
5#include <Infinity/Types/Core/Data.hpp>
6#include <Infinity/Types/Math/Vector2.hpp>
7#include <Infinity/Types/Math/Vector3.hpp>
8
9namespace Infinity::IO::Data
10{
12 template<typename L, typename R>
13 class PairSerializer;
15}
16
18{
74 template<typename L, typename R>
75 class INFINITY_API_TEMPLATE Pair : public Data
76 {
77 public:
85 { }
86
100 Pair(L first, R second)
101 {
102 data.first = first;
103 data.second = second;
104 }
105
119 L first() { return data.first; }
120
134 R second() { return data.second; }
135
151 virtual const Infinity::Types::TypeID& typeId() const override
152 {
153 return Infinity::Types::getTypeID<Pair<L, R>>();
154 }
155
156 private:
163 std::pair<L, R> data;
164
165 friend class Infinity::IO::Data::PairSerializer<L, R>;
166 };
167
188
211}
212
213// Register commonly-used Pair specializations in the type system
215INFINITY_TYPE(Infinity::Types::Core::Edge)
Base class for complex data types with memory wrapping and property support.
Definition Data.hpp:49
Generic container for holding two related values of potentially different types.
Definition Pair.hpp:76
virtual const Infinity::Types::TypeID & typeId() const override
Gets the runtime type identifier for this Pair instance.
Definition Pair.hpp:151
R second()
Gets the second element of the pair.
Definition Pair.hpp:134
Pair(L first, R second)
Constructs a Pair with specified values.
Definition Pair.hpp:100
Pair()
Default constructor.
Definition Pair.hpp:84
L first()
Gets the first element of the pair.
Definition Pair.hpp:119
Definition Array.hpp:17
Definition Base.hpp:12
Runtime type identifier for the Infinity type system.
Definition TypeID.hpp:71