Page MenuHomePhorge

helper.hpp
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

helper.hpp

/*
* This file is part of kazv.
* SPDX-FileCopyrightText: 2020 Tusooa Zhu <tusooa@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#pragma once
#include <libkazv-config.hpp>
#include <immer/config.hpp> // https://github.com/arximboldi/immer/issues/168
#include <QString>
#include <zug/transducer/map.hpp>
namespace Kazv
{
namespace detail
{
struct StrToQtT
{
template<class T>
auto operator()(T &&x) {
return QString::fromStdString(std::forward<T>(x));
}
};
struct ContainerSizeT
{
template<class T>
auto operator()(T &&x) -> int {
return std::forward<T>(x).size();
}
};
}
}
constexpr auto strToQt = zug::map(::Kazv::detail::StrToQtT{});
constexpr auto strListToQt = zug::map([](auto container) {
return zug::into(QStringList{}, strToQt, std::move(container));
});
constexpr auto containerSize = zug::map(::Kazv::detail::ContainerSizeT{});

File Metadata

Mime Type
text/x-c++
Expires
Wed, May 14, 7:44 AM (1 d, 5 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
100490
Default Alt Text
helper.hpp (1 KB)

Event Timeline