Kyopro Library
 
読み取り中…
検索中…
一致する文字列を見つけられません
operator.hpp
[詳解]
1#pragma once
2#include"../../kyopro_library/template.hpp"
3
4/// @brief 作用素
5namespace Operator {
6 /// @brief 更新
7 template<typename T, T not_exist>
8 struct Update {
9 using Type=T;
10 static Type id() { return not_exist; }
11 static Type op(const Type& a, const Type& b) { return b==id()?a:b; }
12 };
13
14 /// @brief 加算
15 template<typename T>
16 struct Add {
17 using Type=T;
18 static Type id() { return 0; }
19 static Type op(const Type& a, const Type& b) { return a+b; }
20 };
21
22 /// @brief 可換な更新(タイムスタンプ)
23 template<typename T>
25 using Type=pair<T,int>;
26 static Type id() { return {0,-1}; }
27 static Type op(const Type& a, const Type& b) { return b.second>a.second ? b : a; }
28 };
29}
作用素
Definition operator.hpp:5
static Type op(const Type &a, const Type &b)
Definition operator.hpp:19
static Type id()
Definition operator.hpp:18
static Type id()
Definition operator.hpp:10
static Type op(const Type &a, const Type &b)
Definition operator.hpp:11
可換な更新(タイムスタンプ)
Definition operator.hpp:24
static Type op(const Type &a, const Type &b)
Definition operator.hpp:27