D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7145 - Implement initializedArray in std.array
Summary: Implement initializedArray in std.array
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other Windows
: P2 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-20 10:40 UTC by Andrej Mitrovic
Modified: 2016-08-27 22:24 UTC (History)
1 user (show)

See Also:


Attachments
initArray (1.32 KB, text/x-dsrc)
2011-12-20 10:40 UTC, Andrej Mitrovic
Details
initArray2 (1.47 KB, text/x-dsrc)
2011-12-20 11:16 UTC, Andrej Mitrovic
Details
3rd version (2.41 KB, text/x-dsrc)
2011-12-20 12:28 UTC, Andrej Mitrovic
Details

Note You need to log in before you can comment on or make changes to this issue.
Description Andrej Mitrovic 2011-12-20 10:40:45 UTC
Created attachment 1056 [details]
initArray

It would be nice to have an initializedArray function, which
creates and initializes an arbitrarily-sized array with a *specific*
initializer. An implementation is provided in the attachment.
Comment 1 Andrej Mitrovic 2011-12-20 11:16:09 UTC
Created attachment 1057 [details]
initArray2

Rebased initArry to dsimcha's initialize() function from his std.allocator package.
Comment 2 Andrej Mitrovic 2011-12-20 12:28:53 UTC
Created attachment 1058 [details]
3rd version

This one adds initialization by another array's elements. Basically it's a deep-copy.
Comment 3 Andrej Mitrovic 2016-08-27 22:24:51 UTC
Hmm.. I'm not sure about the use-case of this. It combines some stuff with an optional allocator but that should ideally be part of the new allocator stuff in the works by Andrei.

The provided example implementation isn't very noteworthy though. Closing this.