Boost logo

Boost :

Subject: Re: [boost] Efficient tuple implementation
From: Louis Dionne (ldionne.2_at_[hidden])
Date: 2014-06-20 14:27:14

Larry Evans <cppljevans <at>> writes:

> [...]
> Is there some way to encapsulate op_and, or_or, false_ and true_ in
> some sort of typeclass for a boolean lattice:
> ?
> It seems if I had used such a typeclass, it would be more likely
> that I would have avoided the above copy&paste error by
> forcing me to be more careful.

It ought to be possible, at least in principle. I'm not sure how much it
would be useful (at least for Boost.Hana), but I'll think about it.

The real problem I see is how to implement short-circuiting for the boolean
operations. Since C++ has strict semantics, we have to resort to a library-
based approach, and that raises some issues.

If you are interested, you can take a look at my Logical type class
implementation in Boost.Hana [1]. While it does not describe a boolean
algebra, it handles conjunction, disjunction and branching. I am unsatisfied
with it though, and I'm currently trying to improve it.



Boost list run by bdawes at, gregod at, cpdaniel at, john at