D-Programming-Language/phobos — pull request #2370 by JakobOvrum (2014-07-25 06:15:18+00:00)
Title: Make TakeExactly!R implicitly convertible to Take!R

Many container methods accept `Take!Range` but not the result of `takeExactly`. This patch makes the latter implicitly convertible to the former, seamlessly allowing for code like this:
```d
void main()
{
import std.algorithm : equal, findSplitBefore;
import std.container.slist;
import std.range : only, takeExactly;

auto list = make!SList(1, 2, 3, 4);
auto split = list[].findSplitBefore(only(3));
list.linearRemove(split[0]); // Currently an error, OK with this patch
assert(list[].equal([3, 4]));
}
```
std.algorithm.commonPrefix and the `findSplit*` functions all document that they return the same type as `takeExactly` does on the same input.

However, while the `Take!Range` idiom is commonly supported among containers, it's not a formal part of those primitives, so I didn't add any documentation in this patch explaining this capability. It's just a nice extra until we formalize the `Take!Range` idiom or figure out something better to replace it.