Questions tagged [tribool]

6 questions
6
votes
4 answers

C++ library with support for 3-valued logic: 0,1,X

I am working on a simulator for a microprocessor, written in C++. I am looking for a way to model state elements in the hardware that have just been powered up and have not yet been reset in any way. A real state element would have an unknown value…
Nathan Fellman
  • 122,701
  • 101
  • 260
  • 319
6
votes
1 answer

Boost::tribool: odd behaviour, or bug?

I'm exploring boost::tribool and was surprised by the following behaviour. { using namespace boost; boost::tribool t(indeterminate); assert(t==indeterminate); // This assertion fails! } However, if I do this, the assert…
Roddy
  • 66,617
  • 42
  • 165
  • 277
3
votes
2 answers

Boost tribool usage

That is my sample of testing boost::tribool: #include #include "boost/logic/tribool.hpp" int main() { boost::logic::tribool init; //init = boost::logic::indeterminate; init = true; //init = false; if…
Space Rabbit
  • 141
  • 2
  • 11
2
votes
1 answer

Does C++11 or C++14 support three or multiple valued logic?

I am wondering if C++11 or C++14 supports three or multiple valued logic. If not, any existing library does it?
user1899020
  • 13,167
  • 21
  • 79
  • 154
2
votes
1 answer

c++ boost tribool ternary operator wrong value

Boost 1.55, MSVC express 2012. Wrong expression evaluation with tribool. It works correct only when I specify tribool(false) explicitly. Moral of the story: compiler chooses TYPES based on VALUES. auto a = 0? indeterminate : false; // type function…
toby_toby_toby
  • 103
  • 1
  • 10
0
votes
0 answers

Enum constant in boolean context

I am new to C++ and I am trying to install the pybeesgrid package (https://github.com/berleon/pybeesgrid). In this specifc part of the pybeesgrid.cpp file: void buildGridsFromNpArrWorkFn( PyArrayObject * bits_and_config_ptr, PyObject…