The Pedigree Project 0.1
template.h
1/*
2 * Copyright (c) 2008-2014, Pedigree Developers
3 *
4 * Please see the CONTRIB file in the root of the source tree for a full
5 * list of contributors.
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#ifndef KERNEL_UTILITIES_TEMPLATE_H
21#define KERNEL_UTILITIES_TEMPLATE_H
22
32#if __cplusplus < 202002L
33template <class T1, class T2>
34bool operator!=(const T1& x1, const T2& x2) {
35 return !(x1 == x2);
36}
37#endif
42template <class T>
43T operator++(T& x, int) {
44 T tmp(x);
45 ++x;
46 return tmp;
47}
52template <class T>
53T operator--(T& x, int) {
54 T tmp(x);
55 --x;
56 return tmp;
57}
58
61template <typename T>
64 typedef T type;
65};
68template <typename T>
69struct nonconst_type<const T> {
71 typedef T type;
72};
73
76#endif
T operator--(T &x, int)
Global postdecrement operator for types with overloaded predecrement operator.
Definition template.h:53
T operator++(T &x, int)
Global postincrement operator for types with overloaded preincrement operator.
Definition template.h:43
bool operator!=(const T1 &x1, const T2 &x2)
Global != operator for types with overloaded == operator.
Definition template.h:34
Remove the const qualifier of a type.
Definition template.h:62