draconisplusplus/include/rfl/internal/to_ptr_tuple.hpp

26 lines
484 B
C++
Raw Normal View History

2024-05-31 22:59:00 -04:00
#ifndef RFL_INTERNAL_TO_PTR_TUPLE_HPP_
#define RFL_INTERNAL_TO_PTR_TUPLE_HPP_
#include <iostream>
#include <tuple>
#include <type_traits>
#include "bind_to_tuple.hpp"
namespace rfl {
namespace internal {
template <class T>
constexpr auto to_ptr_tuple(T& _t) {
if constexpr (std::is_pointer_v<std::remove_cvref_t<T>>) {
return to_ptr_tuple(*_t);
} else {
return bind_to_tuple(_t, [](auto& x) { return &x; });
}
}
} // namespace internal
} // namespace rfl
#endif