Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-PLACET committed Sep 3, 2024
1 parent 4b6cf82 commit 60c0eb0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions include/sparrow/arrow_array_schema_proxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,21 +413,25 @@ namespace sparrow
return array().private_data;
}

template <typename... Callable>
struct visitor : Callable...
template <class... Ts>
struct overloaded : Ts...
{
using Callable::operator()...;
using Ts::operator()...;
};
// Although not required in C++20, clang needs it to build the code below
template <class... Ts>
overloaded(Ts...) -> overloaded<Ts...>;

template <typename T>
[[nodiscard]] T& get_variant(auto& var)
{
return std::visit(
visitor{
overloaded{
[](T* ptr) -> T&
{
if (ptr == nullptr)
{
// TODO: Replace with a more specific exception
throw std::runtime_error("Null pointer");
}
return *ptr;
Expand Down

0 comments on commit 60c0eb0

Please sign in to comment.