33 lines
558 B
C++
33 lines
558 B
C++
export module bedrock.foundation:tuple;
|
|
|
|
import bedrock.numbers;
|
|
|
|
namespace br {
|
|
|
|
export template <typename... Types>
|
|
class Tuple;
|
|
|
|
export template <typename T1, typename T2>
|
|
class Tuple<T1, T2> {
|
|
public:
|
|
Tuple(T1 t1, T2 t2)
|
|
: m_t1(t1), m_t2(t2) {}
|
|
|
|
template <usize I>
|
|
auto get() const -> auto {
|
|
if constexpr (I == 0) {
|
|
return m_t1;
|
|
}
|
|
if constexpr (I == 1) {
|
|
return m_t2;
|
|
}
|
|
}
|
|
|
|
#pragma clang diagnostic push
|
|
#pragma clang diagnostic ignored "-Wpadded"
|
|
const T1 m_t1;
|
|
const T2 m_t2;
|
|
#pragma clang diagnostic pop
|
|
};
|
|
|
|
} // namespace br
|