@@ -1282,7 +1282,7 @@ if (isInputRange!R &&
12821282
12831283@safe pure unittest
12841284{
1285- // example from issue 19727
1285+ // example from https://issues.dlang.org/show_bug.cgi?id= 19727
12861286 import std.path : asRelativePath;
12871287 string [] ext = [" abc" , " def" , " ghi" ];
12881288 string path = " /foo/file.def" ;
@@ -1315,19 +1315,12 @@ in
13151315}
13161316do
13171317{
1318- import std.typecons : Rebindable ;
1318+ import std.typecons : Rebindable2 ;
13191319
13201320 alias Element = ElementType! Range ;
1321- Rebindable ! Element seed = r.front;
1321+ auto seed = Rebindable2 ! Element( r.front) ;
13221322 r.popFront();
1323- static if (is (typeof (seed) == Unqual! Element))
1324- {
1325- return extremum! (map, selector)(r, seed);
1326- }
1327- else
1328- {
1329- return extremum! (map, selector)(r, seed.get );
1330- }
1323+ return extremum! (map, selector)(r, seed.get );
13311324}
13321325
13331326private auto extremum (alias map, alias selector = " a < b" , Range ,
@@ -1337,35 +1330,24 @@ if (isInputRange!Range && !isInfinite!Range &&
13371330 ! is (CommonType! (ElementType! Range , RangeElementType) == void ) &&
13381331 is (typeof (unaryFun! map(ElementType! (Range ).init))))
13391332{
1340- import std.typecons : Rebindable ;
1333+ import std.typecons : Rebindable2 ;
13411334
13421335 alias mapFun = unaryFun! map;
13431336 alias selectorFun = binaryFun! selector;
13441337
13451338 alias Element = ElementType! Range ;
13461339 alias CommonElement = CommonType! (Element, RangeElementType);
1347- Rebindable ! CommonElement extremeElement = seedElement;
1340+ auto extremeElement = Rebindable2 ! CommonElement( seedElement) ;
13481341
13491342 // if we only have one statement in the loop, it can be optimized a lot better
13501343 static if (__traits(isSame, map, a => a))
13511344 {
1352- CommonElement getExtremeElement ()
1353- {
1354- static if (is (typeof (extremeElement) == Unqual! CommonElement))
1355- {
1356- return extremeElement;
1357- }
1358- else
1359- {
1360- return extremeElement.get ;
1361- }
1362- }
13631345 // direct access via a random access range is faster
13641346 static if (isRandomAccessRange! Range )
13651347 {
13661348 foreach (const i; 0 .. r.length)
13671349 {
1368- if (selectorFun(r[i], getExtremeElement ))
1350+ if (selectorFun(r[i], extremeElement. get ))
13691351 {
13701352 extremeElement = r[i];
13711353 }
@@ -1375,7 +1357,7 @@ if (isInputRange!Range && !isInfinite!Range &&
13751357 {
13761358 while (! r.empty)
13771359 {
1378- if (selectorFun(r.front, getExtremeElement ))
1360+ if (selectorFun(r.front, extremeElement. get ))
13791361 {
13801362 extremeElement = r.front;
13811363 }
@@ -1386,7 +1368,7 @@ if (isInputRange!Range && !isInfinite!Range &&
13861368 else
13871369 {
13881370 alias MapType = Unqual! (typeof (mapFun(CommonElement.init)));
1389- MapType extremeElementMapped = mapFun(extremeElement);
1371+ MapType extremeElementMapped = mapFun(extremeElement. get );
13901372
13911373 // direct access via a random access range is faster
13921374 static if (isRandomAccessRange! Range )
@@ -1415,15 +1397,7 @@ if (isInputRange!Range && !isInfinite!Range &&
14151397 }
14161398 }
14171399 }
1418- // For several cases, such as classes or arrays, Rebindable!T aliases itself to T or Unqual!T.
1419- static if (is (typeof (extremeElement) == Unqual! CommonElement))
1420- {
1421- return extremeElement;
1422- }
1423- else
1424- {
1425- return extremeElement.get ;
1426- }
1400+ return extremeElement.get ;
14271401}
14281402
14291403private auto extremum (alias selector = " a < b" , Range )(Range r)
@@ -1555,7 +1529,7 @@ if (isInputRange!Range && !isInfinite!Range &&
15551529}
15561530
15571531// https://issues.dlang.org/show_bug.cgi?id=24027
1558- @safe nothrow pure unittest
1532+ @safe nothrow unittest
15591533{
15601534 class A
15611535 {
@@ -2336,7 +2310,7 @@ private R1 simpleMindedFind(alias pred, R1, R2)(R1 haystack, scope R2 needle)
23362310 @safe :
23372311 string _impl;
23382312
2339- // This is what triggers issue 7992.
2313+ // This is what triggers https://issues.dlang.org/show_bug.cgi?id= 7992.
23402314 @property size_t length() const { return _impl.length; }
23412315 @property void length(size_t len) { _impl.length = len; }
23422316
@@ -2349,7 +2323,7 @@ private R1 simpleMindedFind(alias pred, R1, R2)(R1 haystack, scope R2 needle)
23492323 @property CustomString save() { return this ; }
23502324 }
23512325
2352- // If issue 7992 occurs, this will throw an exception from calling
2326+ // If https://issues.dlang.org/show_bug.cgi?id= 7992 occurs, this will throw an exception from calling
23532327 // popFront() on an empty range.
23542328 auto r = find(CustomString(" a" ), CustomString(" b" ));
23552329 assert (r.empty);
0 commit comments