On Thursday, 27 April 2017 at 16:39:38 UTC, Stanislav Blinov
wrote:
On Thursday, 27 April 2017 at 15:47:38 UTC, Alex wrote:
struct S
{
@disable this();
@disable this(this);
this(size_t dummy){}
}
Given a struct with an explicit constructor and a postblit.
How to make an array of it?
You mean with a disabled default ctor and postblit? You can't
with built-in arrays. They expect that elements can be
default-constructed and copied. Even std.container.Array in its
current implementation won't help you there.
The only way to get around that is to devise your own array
type that carefully deals with uninitialized storage and uses
emplace/move/moveEmplace to store elements.
Hm... ok. This is a acceptable answer. So, if such structs exist,
it is forced to use pointers on their instances as an
indirection... apart from using some reference type things
surrounding them...
Thanks for helping with perception :)