2 * Copyright 2014, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Based on TypeOp in "C++-Templates, The Complete Guide", which is
6 * Copyright 2003 by Pearson Education, Inc.
8 #ifndef _TYPE_OPERATION_H
9 #define _TYPE_OPERATION_H
14 // Generic type conversion operations.
20 typedef T
const ConstT
;
24 typedef T
const& ConstRefT
;
28 // Specialization for constant types.
30 class TypeOperation
<T
const> {
34 typedef T
const ConstT
;
36 typedef T
const& RefT
;
38 typedef T
const& ConstRefT
;
42 // Specialization for reference types.
44 class TypeOperation
<T
&> {
47 typedef typename TypeOperation
<T
>::BareT BareT
;
48 typedef T
const ConstT
;
51 typedef typename TypeOperation
<T
>::BareRefT BareRefT
;
52 typedef T
const& ConstRefT
;
56 // Specialization for void.
58 class TypeOperation
<void> {
62 typedef void const ConstT
;
65 typedef void BareRefT
;
66 typedef void ConstRefT
;
70 } // namespace BPrivate
73 using BPrivate::TypeOperation
;
76 #endif // _TYPE_OPERATION_H