型依存の定数 (utility/limits.cpp)
- category: utility
-
View this file on GitHub
- Last commit date: 2020-07-11 14:49:45+09:00
Required by
- Li-Chao tree (DataStructure/li_chao_tree.cpp)
- 最大流 (Dinitz 法) (Graph/dinitz.cpp)
- グラフ上の最短距離 (Graph/pre17/shortest_path.cpp)
- グラフ上の最短距離 (Graph/shortest_path.cpp)
- 線形計画法ソルバ (simplex 法) (Math/lp_solver.cpp)
- オンライン・オフライン変換 (algorithm/online_to_offline_optimization.cpp)
- 区間最大値・区間加算用のヘルパークラス (utility/action/add_max.cpp)
- 区間最小値・区間加算用のヘルパークラス (utility/action/add_min.cpp)
- 区間最小値・区間最小値更新用のヘルパークラス (utility/action/min_min.cpp)
- max を得る演算のモノイド (utility/monoid/max.cpp)
- min を得る演算のモノイド (utility/monoid/min.cpp)
Verified with
- test/aoj_0575.test.cpp
- test/aoj_0613.test.cpp
- test/aoj_1595.test.cpp
- test/aoj_2313.test.cpp
- test/aoj_2911.test.cpp
- test/aoj_2976.test.cpp
- test/aoj_DSL_2_A.test.cpp
- test/aoj_DSL_2_H.test.cpp
- test/aoj_DSL_3_D.test.cpp
- test/yc_703_onoff.test.cpp
- test/yc_704_onoff.test.cpp
- test/yc_705_onoff.test.cpp
- test/yc_878.test.cpp
- test/yc_878_reversed.test.cpp
- test/yj_bipartitematching.test.cpp
- test/yj_line_add_get_min_li_chao_tree.test.cpp
- test/yj_segment_add_get_min.test.cpp
- test/yj_staticrmq.test.cpp
Code
#ifndef H_limits
#define H_limits
/**
* @brief 型依存の定数
* @author えびちゃん
*/
#include <limits>
#include <utility>
template <typename Tp>
class limits: public std::numeric_limits<Tp> {};
template <typename T1, typename T2>
class limits<std::pair<T1, T2>> {
public:
static constexpr auto min() {
return std::make_pair(limits<T1>::min(), limits<T2>::min());
}
static constexpr auto max() {
return std::make_pair(limits<T1>::max(), limits<T2>::max());
}
};
#endif /* !defined(H_limits) */
#line 1 "utility/limits.cpp"
/**
* @brief 型依存の定数
* @author えびちゃん
*/
#include <limits>
#include <utility>
template <typename Tp>
class limits: public std::numeric_limits<Tp> {};
template <typename T1, typename T2>
class limits<std::pair<T1, T2>> {
public:
static constexpr auto min() {
return std::make_pair(limits<T1>::min(), limits<T2>::min());
}
static constexpr auto max() {
return std::make_pair(limits<T1>::max(), limits<T2>::max());
}
};