mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 22:21:09 +03:00
Better std.algorithm.iteration.permutations error messages
This commit is contained in:
parent
43be08c3a7
commit
e1f7edae57
2 changed files with 18 additions and 2 deletions
|
@ -7939,15 +7939,23 @@ See_Also:
|
|||
$(REF nextPermutation, std,algorithm,sorting).
|
||||
*/
|
||||
Permutations!Range permutations(Range)(Range r)
|
||||
if (isRandomAccessRange!Range && hasLength!Range)
|
||||
{
|
||||
static assert(isRandomAccessRange!Range, Range.stringof,
|
||||
" must be a RandomAccessRange");
|
||||
static assert(hasLength!Range, Range.stringof
|
||||
, " must have a length");
|
||||
|
||||
return typeof(return)(r);
|
||||
}
|
||||
|
||||
/// ditto
|
||||
struct Permutations(Range)
|
||||
if (isRandomAccessRange!Range && hasLength!Range)
|
||||
{
|
||||
static assert(isRandomAccessRange!Range, Range.stringof,
|
||||
" must be a RandomAccessRange");
|
||||
static assert(hasLength!Range, Range.stringof
|
||||
, " must have a length");
|
||||
|
||||
private size_t[] _indices, _state;
|
||||
private Range _r;
|
||||
private bool _empty;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue