2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
15 \brief safe_bool inline template implementation */
17 //#include "safe_bool.ih"
21 #define prefix_ inline
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
24 #ifdef SENF_CXX11_ENABLED
27 prefix_ senf::comparable_safe_bool<T>::operator bool()
30 return static_cast<const T*>(this)->boolean_test();
36 prefix_ senf::comparable_safe_bool<T>::operator bool_type()
39 return (static_cast<const T*>(this))->boolean_test()
40 // ? &safe_bool_base::this_type_does_not_support_comparisons : 0;
41 ? &comparable_safe_bool<T>::this_type_does_not_support_comparisons : 0;
45 prefix_ bool senf::comparable_safe_bool<T>::operator!()
48 return ! (static_cast<const T*>(this))->boolean_test();
52 prefix_ senf::comparable_safe_bool<T>::~comparable_safe_bool()
55 template <typename T, typename U>
56 prefix_ void senf::operator==(const safe_bool<T>& lhs, const safe_bool<U>& rhs)
58 lhs.this_type_does_not_support_comparisons();
61 template <typename T, typename U>
62 prefix_ void senf::operator!=(const safe_bool<T>& lhs, const safe_bool<U>& rhs)
64 lhs.this_type_does_not_support_comparisons();
69 //-/////////////////////////////////////////////////////////////////////////////////////////////////
76 // c-file-style: "senf"
77 // indent-tabs-mode: nil
78 // ispell-local-dictionary: "american"
79 // compile-command: "scons -u test"