summary refs log tree commit diff
path: root/src/Utils.h
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2019-12-14 17:08:36 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2019-12-14 18:59:38 +0100
commit659e36b113158ba9870e201dab7098888bf9d275 (patch)
tree1c8bf23cc0554c63a6bb7f4214348325330f781f /src/Utils.h
parentClear appveyor cache (diff)
downloadnheko-659e36b113158ba9870e201dab7098888bf9d275.tar.xz
Update to c++17
Diffstat (limited to 'src/Utils.h')
-rw-r--r--src/Utils.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/Utils.h b/src/Utils.h

index bdb51844..6c0cf0dd 100644 --- a/src/Utils.h +++ b/src/Utils.h
@@ -1,6 +1,6 @@ #pragma once -#include <boost/variant.hpp> +#include <variant> #include "Cache.h" #include "RoomInfoListItem.h" @@ -165,7 +165,7 @@ template<class T, class Event> DescInfo createDescriptionInfo(const Event &event, const QString &localUser, const QString &room_id) { - const auto msg = boost::get<T>(event); + const auto msg = std::get<T>(event); const auto sender = QString::fromStdString(msg.sender); const auto username = Cache::displayName(room_id, sender); @@ -200,25 +200,25 @@ erase_if(ContainerT &items, const PredicateT &predicate) inline uint64_t event_timestamp(const mtx::events::collections::TimelineEvents &event) { - return boost::apply_visitor([](auto msg) { return msg.origin_server_ts; }, event); + return std::visit([](auto msg) { return msg.origin_server_ts; }, event); } inline nlohmann::json serialize_event(const mtx::events::collections::TimelineEvents &event) { - return boost::apply_visitor([](auto msg) { return json(msg); }, event); + return std::visit([](auto msg) { return json(msg); }, event); } inline mtx::events::EventType event_type(const mtx::events::collections::TimelineEvents &event) { - return boost::apply_visitor([](auto msg) { return msg.type; }, event); + return std::visit([](auto msg) { return msg.type; }, event); } inline std::string event_id(const mtx::events::collections::TimelineEvents &event) { - return boost::apply_visitor([](auto msg) { return msg.event_id; }, event); + return std::visit([](auto msg) { return msg.event_id; }, event); } inline QString @@ -230,15 +230,14 @@ eventId(const mtx::events::collections::TimelineEvents &event) inline QString event_sender(const mtx::events::collections::TimelineEvents &event) { - return boost::apply_visitor([](auto msg) { return QString::fromStdString(msg.sender); }, - event); + return std::visit([](auto msg) { return QString::fromStdString(msg.sender); }, event); } template<class T> QString message_body(const mtx::events::collections::TimelineEvents &event) { - return QString::fromStdString(boost::get<T>(event).content.body); + return QString::fromStdString(std::get<T>(event).content.body); } //! Calculate the Levenshtein distance between two strings with character skipping.