From 1e38f3b1d110160abc1343fea58c75bf2ef4d6b2 Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Tue, 12 May 2020 15:50:36 -0300 Subject: [PATCH] Remove pre-C++17 workarounds/ifdefs --- lokimq/bt_serialize.h | 19 +++++-------------- lokimq/lokimq.h | 8 -------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/lokimq/bt_serialize.h b/lokimq/bt_serialize.h index a65a4de..b43b19b 100644 --- a/lokimq/bt_serialize.h +++ b/lokimq/bt_serialize.h @@ -40,6 +40,7 @@ #include #include #include "mapbox/variant.hpp" +#include namespace lokimq { @@ -110,14 +111,6 @@ class bt_dict : public std::unordered_map { using std::unordered_map::unordered_map; }; -#ifdef __cpp_lib_void_t -using std::void_t; -#else -/// C++17 void_t backport -template struct void_t_impl { using type = void; }; -template using void_t = typename void_t_impl::type; -#endif - namespace detail { /// Reads digits into an unsigned 64-bit int. @@ -230,7 +223,7 @@ template struct is_bt_input_dict_container : std:: template struct is_bt_input_dict_container>::value, - void_t>> : std::true_type {}; @@ -238,7 +231,7 @@ struct is_bt_input_dict_container struct is_bt_insertable : std::false_type {}; template struct is_bt_insertable().insert(std::declval().end(), std::declval()))>> + std::void_t().insert(std::declval().end(), std::declval()))>> : std::true_type {}; /// Determines whether the given type looks like a compatible map (i.e. has std::string keys) that @@ -248,7 +241,7 @@ template struct is_bt_output_dict_container>::value && is_bt_insertable::value, - void_t>> + std::void_t>> : std::true_type {}; @@ -307,7 +300,7 @@ template struct is_bt_input_list_container::value && !is_bt_input_dict_container::value, - void_t>> + std::void_t>> : std::true_type {}; template struct is_bt_output_list_container : std::false_type {}; @@ -426,7 +419,6 @@ struct bt_deserialize> { }; -#ifdef __cpp_lib_variant /// C++17 std::variant support template struct bt_serialize> { @@ -441,7 +433,6 @@ struct bt_deserialize> { bt_deserialize_try_variant(s, val); } }; -#endif template struct bt_stream_serializer { diff --git a/lokimq/lokimq.h b/lokimq/lokimq.h index 4f2451d..78f1605 100644 --- a/lokimq/lokimq.h +++ b/lokimq/lokimq.h @@ -1318,11 +1318,7 @@ template bt_dict build_send(ConnectionID to, std::string_view cmd, T&&... opts) { bt_dict control_data; bt_list parts{{cmd}}; -#ifdef __cpp_fold_expressions (detail::apply_send_option(parts, control_data, std::forward(opts)),...); -#else - (void) std::initializer_list{(detail::apply_send_option(parts, control_data, std::forward(opts)), 0)...}; -#endif if (to.sn()) control_data["conn_pubkey"] = std::move(to.pk); @@ -1388,11 +1384,7 @@ void LokiMQ::log_(LogLevel lvl, const char* file, int line, const T&... stuff) { return; std::ostringstream os; -#ifdef __cpp_fold_expressions (os << ... << stuff); -#else - (void) std::initializer_list{(os << stuff, 0)...}; -#endif logger(lvl, trim_log_filename(file).data(), line, os.str()); }