#pragma once #include #include #include namespace mbgl { template struct TypeIndex; template struct TypeIndex : std::integral_constant {}; template struct TypeIndex : std::integral_constant::value> {}; template class IndexedTuple; // A tuple of Ts, where individual members can be accessed via `t.get()` for I ∈ Is. // // See https://github.com/mapbox/cpp/blob/master/C%2B%2B%20Structural%20Metaprogramming.md // for motivation. // template class IndexedTuple, TypeList> : public std::tuple { public: static_assert(sizeof...(Is) == sizeof...(Ts), "IndexedTuple size mismatch"); using std::tuple::tuple; template auto& get() { return std::get::value>(*this); } template const auto& get() const { return std::get::value>(*this); } template IndexedTuple, TypeList> concat(const IndexedTuple, TypeList>& other) const { return IndexedTuple, TypeList> { get()..., other.template get()... }; } }; } // namespace mbgl