CPP07 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
whatever.hpp
[詳解]
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* whatever.hpp :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2025/08/07 20:57:03 by kamitsui #+# #+# */
9/* Updated: 2025/08/07 21:04:04 by kamitsui ### ########.fr */
10/* */
11/* ************************************************************************** */
12
18#ifndef WHATEVER_HPP
19#define WHATEVER_HPP
20
21#include <iostream>
22
29template <typename T> void swap(T &a, T &b) {
30 T temp = a;
31 a = b;
32 b = temp;
33}
34
43template <typename T> T const &min(T const &a, T const &b) { return (a < b ? a : b); }
44
53template <typename T> T const &max(T const &a, T const &b) { return (a > b ? a : b); }
54
55#endif
void printElement(const T &element)
Prints an element to the standard output.
Definition iter.hpp:65
T const & min(T const &a, T const &b)
Returns the smaller of two values. If the values are equal, it returns the second value.
Definition whatever.hpp:43
void swap(T &a, T &b)
Swaps the values of two variables.
Definition whatever.hpp:29
T const & max(T const &a, T const &b)
Returns the greater of two values. If the values are equal, it returns the second value.
Definition whatever.hpp:53