Boost logo

Boost Users :

Subject: Re: [Boost-users] Sequence of boost::logic::tribools - let indeterminate entries inherit from their neighbours
From: Jens Müller (blog_at_[hidden])
Date: 2014-05-17 03:30:50


On 08.05.2014 12:43, Jens Müller wrote:
>
> My current idea is actually a sort of proxy output iterator which keeps
> a counter of "pending" indeterminate tribools and flushes them to the
> proxied output iterator once their status becomes known. It should also
> automatically flush in it's destructor.

I did just that: A function object with a just three member variables: a
pending count, the "last real value" bool, and an output iterator.

And then I wrapped this in a boost::function_output_iterator.

> Then I could just use std::copy with a std::back_inserter in order to
> convert a sequence including indeterminate values into a sequence just
> containing bools.

Actually, I am using it in a std::transform now (instead of a std::copy,
a simple std::foreach with the function object would have sufficed), so
that I can directly compute the visibility (as tribool) of the elements.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net