RhythmGame 1.4.3
Loading...
Searching...
No Matches
get.h
Go to the documentation of this file.
1//
2// Created by bobini on 14.06.23.
3//
4
5#ifndef RHYTHMGAME_GET_H
6#define RHYTHMGAME_GET_H
7
8#include <boost/pfr/tuple_size.hpp>
9#include <boost/pfr/core.hpp>
10
11namespace support {
19template<std::size_t N, typename T>
20constexpr auto
21get(T&& t) -> auto&
22 requires requires { std::get<N>(std::declval<T>()); }
23{
24 return std::get<N>(t);
25}
26
34template<std::size_t N, typename T>
35constexpr auto
36get(T&& aggregate) -> auto&
37 requires std::is_aggregate_v<std::remove_cvref_t<T>>
38{
39 return boost::pfr::get<N>(std::forward<T>(aggregate));
40}
41
42} // namespace support
43
44#endif // RHYTHMGAME_GET_H
Contains various helper classes and functions.
Definition Capitalize.h:9
constexpr auto get(T &&t) -> auto &
Returns the nth element of a type that supports std::get.
Definition get.h:21