2

I am wondering if C++11 or C++14 supports three or multiple valued logic. If not, any existing library does it?

PaperBirdMaster
  • 12,806
  • 9
  • 48
  • 94
user1899020
  • 13,167
  • 21
  • 79
  • 154
  • What do you mean by "multiple valued logic"? You can switch on any integral type (but there's no equivalent to Fortran's arithmetic if). – James Kanze Apr 02 '14 at 13:58
  • 6
    You mean something like boost::tribool? http://www.boost.org/doc/libs/1_55_0/doc/html/tribool.html – mkaes Apr 02 '14 at 13:58
  • A quick search does not show language support or any library that looks to support it; there are links related to VHDL (Hardware Description Language) but nothing concrete; me think you will have to implement it. – Max Apr 02 '14 at 13:59
  • @mkaes Yes. The boost::tribool seems to meet my requirements. – user1899020 Apr 02 '14 at 14:03
  • Boost tribool is new to me, although it looks a bit like a simplified form o Fuzzy Logic. http://en.wikipedia.org/wiki/Fuzzy_logic – glampert Apr 02 '14 at 19:24
  • `boost::tribool` has been there since [version 1.32](http://www.boost.org/doc/libs/1_32_0/doc/html/tribool.html#tribool.introduction). So really no need for C++11/14 :-) – rubenvb Apr 03 '14 at 08:14

1 Answers1

1

Boost tribool provides an interface for three-state logic. It doesn't require c++11 or c++1y.

http://www.boost.org/doc/libs/1_55_0/doc/html/tribool.html

vmrob
  • 2,966
  • 29
  • 40