mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-14 15:04:09 +00:00
fix tuple get adapt-interfaces
This commit is contained in:
parent
0c00166c5f
commit
2dcafaa98d
10 changed files with 265 additions and 266 deletions
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <cstddef>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/tuple/tuple.hpp>
|
||||
#include <sprout/tuple/tuple/get.hpp>
|
||||
#include <sprout/variant/variant.hpp>
|
||||
|
||||
namespace sprout {
|
||||
|
@ -18,20 +18,28 @@ namespace sprout {
|
|||
inline SPROUT_CONSTEXPR U& get(sprout::variant<Types...>& operand) {
|
||||
return operand.template get<U>();
|
||||
}
|
||||
template<std::size_t I, typename... Types>
|
||||
inline SPROUT_CONSTEXPR typename sprout::tuples::tuple_element<
|
||||
I,
|
||||
sprout::variant<Types...>
|
||||
>::type const& get(sprout::variant<Types...> const& operand) {
|
||||
return operand.template get_at<I>();
|
||||
}
|
||||
template<std::size_t I, typename... Types>
|
||||
inline SPROUT_CONSTEXPR typename sprout::tuples::tuple_element<
|
||||
I,
|
||||
sprout::variant<Types...>
|
||||
>::type& get(sprout::variant<Types...>& operand) {
|
||||
return operand.template get_at<I>();
|
||||
}
|
||||
} // namespace sprout
|
||||
|
||||
namespace sprout_adl {
|
||||
//
|
||||
// tuple_get
|
||||
//
|
||||
template<std::size_t I, typename... Types>
|
||||
inline SPROUT_CONSTEXPR typename sprout::tuples::tuple_element<
|
||||
I,
|
||||
sprout::variant<Types...>
|
||||
>::type const&
|
||||
tuple_get(sprout::variant<Types...> const& operand) {
|
||||
return operand.template get_at<I>();
|
||||
}
|
||||
template<std::size_t I, typename... Types>
|
||||
inline SPROUT_CONSTEXPR typename sprout::tuples::tuple_element<
|
||||
I,
|
||||
sprout::variant<Types...>
|
||||
>::type&
|
||||
tuple_get(sprout::variant<Types...>& operand) {
|
||||
return operand.template get_at<I>();
|
||||
}
|
||||
} // namespace sprout_adl
|
||||
|
||||
#endif // #ifndef SPROUT_VARIANT_GET_HPP
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue