get_max - TumpCpp リファレンス
namespace tump {
namespace fn
{
// 大元のメタ関数定義
template <BynaryTree T>
struct get_max {};
}
// 第一級関数化
using get_max = cbk<fn::get_max, 1>;
// 定数メンバ type 呼び出し省略のエイリアステンプレート
template <BynaryTree T>
using get_max_t = typename fn::get_max<T>::type;
}
パラメータ
- T -
tump::BynaryTreeで真と判定されるバイナリツリー
概要
tump::get_maxは、バイナリツリーTが保持する要素のうち、最大と判定される型を返却します。
例
#include <tump.hpp>
using size_bintree = tump::push_t<tump::empty_bintree<>, std::int32_t, std::uint8_t, std::int64_t>;
static_assert(std::is_same_v<tump::get_max_t<size_bintree>, std::int64_t> == true);
template <class L, class R>
struct compare_list_size : public tump::vwrap<
int(tump::len_v<L>) - int(tump::len_v<R>)
> {};
using comparing_list_size = tump::comparing_type<
tump::cbk<compare_list_size, 2>,
tump::is_type_list
>;
using sorted_list = tump::eval<
tump::flip, tump::to_bintree,
comparing_list_size,
tump::list<
tump::list<int, float>,
tump::list<>,
std::tuple<int, float, char>,
std::tuple<int>
>
>;
static_assert(tump::eval<tump::get_max, sorted_list, tump::_eq, std::tuple<int, float, char>>::value == true);
int main() {}