Boost logo

Boost :

Subject: Re: [boost] [type_erasure] Review started (July 18-27, 2012)
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2012-07-23 12:07:07

On Tuesday 24 July 2012 00:56:07 Julien Nitard wrote:
> > 2. In the same section, I didn't really understand the second code
> > snippet.
> >
> > Why is the tuple needed? Why not this:
> > any<requirements, _a> a = &array[0];
> > a = a + 2;
> >
> > Also, from the implementation perspective, will it simply add 2 to the
> > pointer or construct an "any" from 2 and then perform the addition?
> My 2cts: I think this is because the return type depends on the 2nd
> operand in the most general case.

Well, If my understanding is correct, according to the "requirements" typedef,
the result should be an "any" containing an object of the same type as the
left argument (which is the pointer in this case).

If there is a way to describe the operator when the result type differs from
the both argument types, the mentioned example doesn't show that. Actually, is
this possible with the library?

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