OGLplus  (0.59.0) a C++ wrapper for rendering APIs

eagine/tribool.cpp

Copyright Matus Chochlik. Distributed under the Boost Software License, Version 1.0. See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt

#include <iostream>
void print(const char* expr, eagine::weakbool v) {
std::cout << "'" << expr << "': ";
if(!v) {
std::cout << "no" << std::endl;
} else if(v) {
std::cout << "yes" << std::endl;
} else {
std::cout << "maybe" << std::endl;
}
}
void print(const char* expr, eagine::tribool v) {
std::cout << "'" << expr << "': ";
if(v) {
std::cout << "yes" << std::endl;
} else if(!v) {
std::cout << "no" << std::endl;
} else {
std::cout << "maybe" << std::endl;
}
}
#define EAG_PRINT(EXPR) print(EAGINE_STRINGIFY(EXPR), EXPR)
auto main() -> int {
using namespace eagine;
tribool yes{true};
tribool no{false};
EAG_PRINT(yes);
EAG_PRINT(no);
EAG_PRINT(maybe);
EAG_PRINT(~yes);
EAG_PRINT(~no);
EAG_PRINT(~maybe);
EAG_PRINT(yes && yes);
EAG_PRINT(yes && no);
EAG_PRINT(yes && maybe);
EAG_PRINT(no && yes);
EAG_PRINT(no && no);
EAG_PRINT(no && maybe);
EAG_PRINT(maybe && maybe);
EAG_PRINT(yes || yes);
EAG_PRINT(yes || no);
EAG_PRINT(yes || maybe);
EAG_PRINT(no || yes);
EAG_PRINT(no || no);
EAG_PRINT(no || maybe);
EAG_PRINT(maybe || maybe);
return 0;
}
Common code is placed in this namespace.
Definition: eagine.hpp:21
constexpr static const indeterminate_t indeterminate
Constant representing unspecified tribool value.
Definition: tribool.hpp:24
Tri-state boolean value.
Definition: tribool.hpp:61
Weak tri-state boolean value.
Definition: tribool.hpp:31
@ maybe
Result is conditionally valid.

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).