Boost logo

Boost :

Subject: Re: [boost] [type traits] add a set of templates to propagate constetc from one type to another?
From: Jeffrey Hellrung (jhellrung_at_[hidden])
Date: 2010-03-03 13:30:47


Stewart, Robert wrote:
> Note that John wrote about making To have the same cv-qualification as From, above.

Yes, I realized that shortly after replying :/

> However, if From already is const, copying "const" from To to From won't make From any more const, so "copy" does capture the augmentation idea pretty well.

I'm tending to interpret "copy" as overwrite or replace whatever cv
qualifiers are on To with whatever is on From, rather than "augment".
This might be a stretch, but that seems consistent with the use of the
word copy elsewhere, e.g., std::copy.

> All that to say that I understand your point. The question is whether we need both forms. If so, then we need a way to distinguish the two.

I think both could be useful. That said, I've only ever used the
"propagation"/"augmentation" form.

> "Propagate" is probably not a good choice because it doesn't quite imply the addition to existing state you mean, at least to me.

A common meaning of "propagate" is "to pass along to offspring", which
seems appropriate enough here.

I'll point out that the original poster also chose the word "propagate"
independently of myself.

Speaking of the OP, I've cc'ed Vasilis back onto this thread (although
that's easy to forget to do; I'd encourage Vasilis to either set to
receive emails or check the thread yourself.)

> Furthermore, "propagate" is frequently misspelled as "propogate."

I understand your concern here., but I consider this a minor issue at best.

> "Augment" seems a bit stilted, but it does capture the idea well. "Add" actually captures the idea pretty well, but we can't use that.

Both fail to convey the directionality and "from-to" or "source-dest"
nature of the operator.

> If we look at it from the other side, what John wrote above is about replacing From's cv-qualification with that of To, so "replace" works for that, which leaves "copy" for the augmenting form.
>
> Therefore, copy_cv, copy_const, copy_volatile make From have at least To's cv-qualification, constness, or volatileness, respectively, while replace_cv, replace_const, and replace_volatile make From have To's cv-qualification, constness, or volatileness, respectively.

I would prefer the replace_* and propagate_* combination, but I'm not
gonna go ax someone over it. I'll go along with whatever the maintainer
(John?) prefers.

- Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk