Skip to content

modern logic classes #30

@gpeterhoff

Description

@gpeterhoff

Hello,
I have implemented (single header library) the logic classes bool4, bool3 and bool2:

These provide additional support:

Differences to bool/tribool

  • operator>>(stream) always returns false in the event of an error

Implementation

  • If standard functions/classes are available these are used, otherwise (fallback) boost.
  • I used my small (single header) library streamutil. This simplifies a few things, but is not absolutely necessary.
  • For tribool I added the functions/type traits/limits/operators.

Unfortunately I can't provide bool4/3/2 in the namespace boost::logic because it conflicts with indeterminate.

todo

  • Remove tribool, then the classes can be implemented in boost::logic. For compatibility reasons, "using tribool = bool3;" can be provided (temporarily).
  • For bool4/bool3 there are more logical operators 1.). Perhaps it would be possible to provide these as well. However, I am not a mathematician and cannot judge whether this would make sense, as the functions/operators would have to be provided uniformly for bool4/3/2.

In principle, you should take another look at the code/tables to detect errors :-)

many thanks
Gero

Code
logic2.hpp.txt
streamutil.hpp.txt
is_integer.hpp.txt

1.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions