Boost logo

Boost :

Subject: Re: [boost] [type_erasure]suggest tuple doc contain requires clause specifying T... are unique
From: Larry Evans (cppljevans_at_[hidden])
Date: 2012-07-30 16:58:49

On 07/30/12 13:06, Larry Evans wrote:
> Specifies that the T... are placeholders; however, it doesn't
> specify that they be unique; hence,
> tuple<concept,_a,_a> x(int(0),std::vector<int>(0));
> would satisfy the current description but wouldn't be
> right. Of course no one would intentionally do that; however,
> if the Tags are calculated in some meta-program, it might
> happened accidentally. Hence the requires class should also
> say, "If T... are not unique, no diagnostic occurs", or something
> similar.
> The reason I think "no diagnostic occurs" is that I've looked
> briefly in tuple.hpp, at the:
> ::boost::type_erasure::cons<Concept, T...> impl;
> in the class tuple definition and the cons definition, and I don't
> see any check for duplicates.

Running the attached test, which includes a tuple with duplicate
tags, produces no compile error; hence, I think putting:

  "no diagnostic occurs"

in this case in the tuple docs is justified.

I thought maybe mpl::map, which is used in tuple to create the
bindings, would check for duplicates; however, the second
attachment, with an mpl::map containing duplicate keys, compiles OK.


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