count_if - TumpCpp リファレンス
namespace tump {
namespace fn {
// 大元のメタ関数定義
template <TypeList Src, TypeList Dest>
requires (!is_empty_v<Src>)
using copy = ...;
}
// 第一級関数化
using copy = cbk<fn::copy, 2>;
// 定数メンバ type 呼び出し省略のエイリアステンプレート
template <TypeList Src, TypeList Dest>
using copy_t = typename fn::copy<Src, Dest>::type;
}
パラメータ
- Src -
tump::TypeListで真と判定される型。空のリストを指定できない。 - Dest -
tump::TypeListで真と判定される型。
概要
tump::copyは、リストDestの中身を、リストSrcが持つパラメータパックに置き換えます。
例
#include <tuple>
#include <vector>
#include <tump.hpp>
class A {};
using list1 = tump::list<std::vector<int>, char>;
using list2 = std::tuple<int, float, A>;
using list3 = tump::make_empty_t<list2>;
static_assert(std::is_same_v<
tump::copy_t<list2, list1>,
tump::list<int, float, A>
> == true);
static_assert(tump::eval<
tump::copy, list1, list3,
tump::_eq,
std::tuple<std::vector<int>, char>
>::value == true);
int main() {}
関連リンク
tump::evaltump::TypeListtump::listtump::is_emptytump::make_emptytump::_eq