acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
safe_bool.h
1
2
//#pragma once
3
//
4
//
5
//class safe_bool_base {
6
//protected:
7
// typedef void (safe_bool_base::* bool_type)() const;
8
// void this_type_does_not_support_comparisons() const {}
9
//
10
// safe_bool_base() {}
11
// safe_bool_base(const safe_bool_base&) {}
12
// safe_bool_base& operator=(const safe_bool_base&) { return *this; }
13
// ~safe_bool_base() {}
14
//};
15
//
16
//template <typename T = void> class safe_bool : public safe_bool_base {
17
//public:
18
// operator bool_type() const {
19
// return (static_cast<const T*>(this))->boolean_test()
20
// ? &safe_bool_base::this_type_does_not_support_comparisons : 0;
21
// }
22
//protected:
23
// ~safe_bool() {}
24
//};
25
//
26
//template<> class safe_bool<void> : public safe_bool_base {
27
//public:
28
// operator bool_type() const {
29
// return boolean_test() == true ?
30
// &safe_bool_base::this_type_does_not_support_comparisons : 0;
31
// }
32
//protected:
33
// virtual bool boolean_test() const = 0;
34
// virtual ~safe_bool() {}
35
//};
36
//
37
//template <typename T, typename U>
38
//void operator==(const safe_bool<T>& lhs, const safe_bool<U>& rhs) {
39
// lhs.this_type_does_not_support_comparisons();
40
// return false;
41
//}
42
//
43
//template <typename T, typename U>
44
//void operator!=(const safe_bool<T>& lhs, const safe_bool<U>& rhs) {
45
// lhs.this_type_does_not_support_comparisons();
46
// return false;
47
//}
template
safe_bool.h
Generated by
1.17.0