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 
31 template <class T1, class T2>
32 bool operator!=(const T1 &x1, const T2 &x2)
33 {
34  return !(x1 == x2);
35 }
40 template <class T>
41 T operator++(T &x, int)
42 {
43  T tmp(x);
44  ++x;
45  return tmp;
46 }
51 template <class T>
52 T operator--(T &x, int)
53 {
54  T tmp(x);
55  --x;
56  return tmp;
57 }
58 
61 template <typename T>
63 {
65  typedef T type;
66 };
69 template <typename T>
70 struct nonconst_type<const T>
71 {
73  typedef T type;
74 };
75 
78 #endif
T operator++(T &x, int)
Global postincrement operator for types with overloaded preincrement operator.
Definition: template.h:41
Remove the const qualifier of a type.
Definition: template.h:62
T operator--(T &x, int)
Global postdecrement operator for types with overloaded predecrement operator.
Definition: template.h:52
bool operator!=(const T1 &x1, const T2 &x2)
Global != operator for types with overloaded == operator.
Definition: template.h:32