From 60c0eb04d5e9fd761f5987d33af49cadf9506d62 Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Tue, 3 Sep 2024 11:20:06 +0200 Subject: [PATCH] Fix --- include/sparrow/arrow_array_schema_proxy.hpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/sparrow/arrow_array_schema_proxy.hpp b/include/sparrow/arrow_array_schema_proxy.hpp index 3cd9777f..0c9ba8c0 100644 --- a/include/sparrow/arrow_array_schema_proxy.hpp +++ b/include/sparrow/arrow_array_schema_proxy.hpp @@ -413,21 +413,25 @@ namespace sparrow return array().private_data; } - template - struct visitor : Callable... + template + struct overloaded : Ts... { - using Callable::operator()...; + using Ts::operator()...; }; + // Although not required in C++20, clang needs it to build the code below + template + overloaded(Ts...) -> overloaded; template [[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;