On 03/03/2015 12:18 AM, Kadir Erdem Demir wrote:

> I have an char[];
>
> char[] strArr = "http://www.hurriyet.com.tr/ekonomi".dup;
>
> I stripped the domain out of url like:
>
> auto domain = findSplitAfter(strArr, "http://";)[1].until('/');
>
> Than because I am new to the language I became curious if I change
> domain(which I believe a input iterator); the values of strArr will also
> change or not.

.front of a char range is a dchar that is created on the fly (i.e. it is an rvalue), effectively making such ranges "generators". If possible, setting the returned dchar would not change the original char.

> But if the array is a array of ints it compiles.

Elements of some ranges (e.g. slices) are lvalues. When needed, hasLvalueElements can detect the kind of range at compile time:

  http://dlang.org/phobos/std_range.html#hasLvalueElements

Ali

Reply via email to