-
Notifications
You must be signed in to change notification settings - Fork 4
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
disabled opAssign prevents some valid usage #2
Comments
I'll think about enabling it. I don't even remember exactly why I disabled it. I think it was just that I didn't see a use case at the time and didn't feel like making some decision on its semantics (i don't remember the details), so I just decided to disable it as the path of least resistance. You're right, though, that allowing manually created stacks makes allowing assignment look a lot more useful. |
Now that I look at the code a little more, there are a whole bunch of details about lifetime management/postblits/destructors that no longer make sense given the manual stack creation modification. I'll clean them up and document them better, but that's going to take a day or two. |
Fixed. I also cleaned up some resource management, documentation, error handling and performance issues. |
Thanks, I'll try new version then. |
A short example, this fails:
import std.regionallocator;
void main()
{
RegionAllocator alloc; //will initialize later?
auto stack = RegionAllocatorStack(1<<22, GCScan.no);
alloc = stack.newRegionAllocator(); //calls disabled opAssign and fails
}
While it may seem backwards in this case, it's perfectly normal in case I have a struct A, and, for instance, want it to hold aloocator for it's private stack.
e.g. something like this:
struct A
{
RegionAllocator alloc;
this(uint page)
{
auto stack = stack = RegionAllocatorStack(1<<22, GCScan.no);
alloc = stack.newRegionAllocator();
}
//...
}
Workaround for now is to just comment out this opAssign (there is postblit, why disable opAssign?)
The text was updated successfully, but these errors were encountered: