Boost logo

Boost :

Subject: Re: [boost] [contract] concepts: pseudo-signatures vs. usage patterns
From: Andrew Sutton (asutton.list_at_[hidden])
Date: 2012-10-11 10:09:26

> Next, for OutputIterator, I want operation (*it = v) to be valid. But I
> never intend to use the assignment alone or the indirection alone. With
> usage-patterns, I can write:
> *it = v; // cannot use the result of the assignment
> With pseudo signatures, I need to specify at least two declarations, and I
> need to specify what the operator* returns, even though it should be an
> implementation detail:
> typename DerefResult;
> DerefResult operator*(Iter&);
> void operator=(DerefResult, ValueType<Iter>);
> But again, maybe this operation should be output(it, v), and it is STL's
> limitation that it uses a combination of operators for a sort-of 'atomic'
> operation.

Neither pro nor con, and I'm not sure if this will add anything to the
debate, but Marcin and I had a long discussion, as we were writing the
TR about requirements involving compound expressions. I think we ended
up with the idea that you can always split a compound expression into
sub-expressions using auto and &&.

auto&& r = *i;
r = x;

I believe that this would essentially equivalent to what would be
declared using pseudo-signatures. That is, an unspecified, deduced
type name whose only requirement was to support assignment.

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