Created on 2009-03-22.00:00:00 last changed 171 months ago
Proposed resolution:
Change in [algorithms.syn] and [alg.random.shuffle]:
concept UniformRandomNumberGenerator<typename Rand> { }template<RandomAccessIterator Iter, UniformRandomNumberGenerator Rand> requires ShuffleIterator<Iter> && Convertible<Rand::result_type, Iter::difference_type> void random_shuffle(Iter first, Iter last, Rand&& g);
Rationale:
Solved by N3056.
[
2010 Pittsburgh: Moved to NAD EditorialResolved, addressed by
N3056.
]
[ 2009-10 post-Santa Cruz: ]
Leave Open, Walter to work on it.
[ 2009-07-28 Alisdair adds: ]
Revert to Open, with a note there is consensus on direction but the wording needs updating to reflect removal of concepts.
[ 2009-06-05 Daniel updated proposed wording as recommended in Batavia. ]
[ Batavia (2009-05): ]
Alisdair notes that point (ii) has already been addressed.
We agree with the proposed resolution to point (i) with Daniel's added requirement.
Move to Review.
[ 2009-05-02 Daniel adds: ]
this issue completes adding necessary requirement to the third new random_shuffle overload. The current suggestion is:
template<RandomAccessIterator Iter, UniformRandomNumberGenerator Rand> requires ShuffleIterator<Iter> void random_shuffle(Iter first, Iter last, Rand&& g);IMO this is still insufficient and I suggest to add the requirement
Convertible<Rand::result_type, Iter::difference_type>to the list (as the two other overloads already have).
Rationale:
Its true that this third overload is somewhat different from the remaining two. Nevertheless we know from UniformRandomNumberGenerator, that it's result_type is an integral type and that it satisfies UnsignedIntegralLike<result_type>.
To realize it's designated task, the algorithm has to invoke the Callable aspect of g and needs to perform some algebra involving it's min()/max() limits to compute another index value that at this point is converted into Iter::difference_type. This is so, because [random.access.iterators] uses this type as argument of it's algebraic operators. Alternatively consider the equivalent iterator algorithms in [iterator.operations] with the same result.
This argument leads us to the conclusion that we also need Convertible<Rand::result_type, Iter::difference_type> here.
There are a couple of issues with the declaration of the random_shuffle algorithm accepting a random number engine.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-12-05 14:14:49 | admin | set | status: nad editorial -> resolved |
2010-10-21 18:28:33 | admin | set | messages: + msg690 |
2010-10-21 18:28:33 | admin | set | messages: + msg689 |
2010-10-21 18:28:33 | admin | set | messages: + msg688 |
2010-10-21 18:28:33 | admin | set | messages: + msg687 |
2010-10-21 18:28:33 | admin | set | messages: + msg686 |
2010-10-21 18:28:33 | admin | set | messages: + msg685 |
2010-10-21 18:28:33 | admin | set | messages: + msg684 |
2010-10-21 18:28:33 | admin | set | messages: + msg683 |
2009-03-22 00:00:00 | admin | create |