Skip to content

tweaks in fill(val), fill(range) and copy() #802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

tweaks in fill(val), fill(range) and copy() #802

wants to merge 1 commit into from

Conversation

monarchdodra
Copy link
Collaborator

Originally meant as a couple of improvements in copy, fill(val) and fill(range):
*Removing case in fill(range) for infinite ranges with slicing. Also removing lots of un-needed stuff when forwarding to copy, as copy is only optimized in case of arrays.
*Re-writing fill(val) to use opSliceAssign, instead of relying on mem-copies. This makes it more simple and more efficient
*Added a case for optimized array copy even with overlap (copy by bands of non-overlap).

While I was on the subject, I've formalized the effect of these methods on reference semantics range: As a general rule:
"source" is always advanced
"target" is not advanced, if possible (target is RA with length). Other wise, it is advanced.
These are TENTATIVE changes, and I think should be discussed.

This does NOT change any document existing behavior.

This change rational is in this post:
http://forum.dlang.org/thread/oiczxzkzxketxitncghl@forum.dlang.org

@monarchdodra
Copy link
Collaborator Author

bit of compile errors, closing temporarilly

@monarchdodra
Copy link
Collaborator Author

Fixed, whew!

@monarchdodra monarchdodra reopened this Sep 18, 2012
{
alias ElementType!Range T;
static if (hasElaborateCopyConstructor!T || !isDynamicArray!Range)

static if (isArray!Range && is(T == Unqual!Value))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static if (is(typeof(range[] = filler)))

@monarchdodra
Copy link
Collaborator Author

Looking back on this 2 week old code with a cool head, I realize there is a lot of stupid in there. However, it does correct even more stupid I had put in there 2 months ago... Closing temporarilly while I remove the last of the stupid >:(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants