Initial commit
This commit is contained in:
commit
91d54c58d5
42 changed files with 2212 additions and 0 deletions
33
src/foundation/tuple.cppm
Normal file
33
src/foundation/tuple.cppm
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue