f223f7524bae42ee50a2a3fde21c919ed2f9ebf1
[senf.git] / Utils / SafeBool.cti
1 // $Id$
2 //
3 // Copyright (C) 2006 
4
5 // Definition of inline template functions
6
7 //#include "SafeBool.ih"
8
9 // Custom includes
10
11 #define prefix_ inline
12 ///////////////////////////////cti.p///////////////////////////////////////
13
14 template <typename T>
15 prefix_ senf::SafeBool<T>::operator bool_type()
16     const
17 {
18     return (static_cast<const T*>(this))->boolean_test()
19         ? &SafeBoolBase::this_type_does_not_support_comparisons : 0;
20 }
21
22 template <typename T>
23 prefix_ bool senf::SafeBool<T>::operator!()
24     const
25 {
26     return ! (static_cast<const T*>(this))->boolean_test();
27 }
28
29 template <typename T>
30 prefix_ senf::SafeBool<T>::~SafeBool()
31 {}
32
33 template <typename T, typename U>
34 prefix_ void senf::operator==(const SafeBool<T>& lhs, const SafeBool<U>& rhs)
35 {
36     lhs.this_type_does_not_support_comparisons();     
37 }
38
39 template <typename T, typename U>
40 prefix_ void senf::operator!=(const SafeBool<T>& lhs, const SafeBool<U>& rhs)
41 {
42     lhs.this_type_does_not_support_comparisons();
43 }
44
45 ///////////////////////////////cti.e///////////////////////////////////////
46 #undef prefix_
47
48 \f
49 // Local Variables:
50 // mode: c++
51 // End: