From 977bced84e997e120dcb92cf741e7203047d1933 Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Tue, 7 Sep 2021 01:16:38 -0300 Subject: [PATCH] Apple workaround --- oxenmq/bt_serialize.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/oxenmq/bt_serialize.cpp b/oxenmq/bt_serialize.cpp index 10fcba2..0c34f0e 100644 --- a/oxenmq/bt_serialize.cpp +++ b/oxenmq/bt_serialize.cpp @@ -28,6 +28,7 @@ #include "bt_serialize.h" #include "bt_producer.h" +#include "variant.h" #include #include @@ -248,7 +249,7 @@ bt_list_producer::bt_list_producer(bt_dict_producer* parent, std::string_view pr bt_list_producer::bt_list_producer(bt_list_producer&& other) : data{std::move(other.data)}, buffer{other.buffer}, from{other.from}, to{other.to} { if (other.has_child) throw std::logic_error{"Cannot move bt_list/dict_producer with active sublists/subdicts"}; - std::visit([](auto& x) { + var::visit([](auto& x) { if constexpr (!std::is_same_v) x = nullptr; }, other.data); @@ -262,7 +263,7 @@ bt_list_producer::bt_list_producer(char* begin, char* end) } bt_list_producer::~bt_list_producer() { - std::visit([this](auto& x) { + var::visit([this](auto& x) { if constexpr (!std::is_same_v) { if (!x) return; @@ -296,7 +297,7 @@ bt_dict_producer bt_list_producer::append_dict() { void bt_list_producer::buffer_append(std::string_view d, bool advance) { - std::visit([d, advance, this](auto& x) { + var::visit([d, advance, this](auto& x) { if constexpr (std::is_same_v) { size_t avail = std::distance(x.first, x.second); if (d.size() > avail) @@ -314,7 +315,7 @@ void bt_list_producer::buffer_append(std::string_view d, bool advance) { static constexpr std::string_view eee = "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"sv; void bt_list_producer::append_intermediate_ends(size_t count) { - return std::visit([this, count](auto& x) mutable { + return var::visit([this, count](auto& x) mutable { if constexpr (std::is_same_v) { for (; count > eee.size(); count -= eee.size()) buffer_append(eee, false);