digitalmars.D - std.container update - now Array is in
- Andrei Alexandrescu (7/7) May 27 2010 http://erdani.com/d/phobos/std_container.html
- Michel Fortin (11/19) May 27 2010 I don't get that:
- Andrei Alexandrescu (3/18) May 27 2010 Sorry, fixed now.
- Pillsy (11/15) May 28 2010 I think it might be a good idea is to make it so that, for struct
- Steven Schveighoffer (5/11) May 28 2010 I just noticed, there is no doc for ElementType, only ValueType and
- Steven Schveighoffer (12/24) May 28 2010 Also, ElementType is also a template in std.range, can we change one of ...
- Andrei Alexandrescu (4/17) May 28 2010 I figured out that ElementType is actually unneeded - introspection can
- Steven Schveighoffer (9/29) May 28 2010 Well, the docs still use ElementType everywhere. I don't really know ho...
http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d I defined Array as a straightforward implementation of the homonym abstraction. There are a few imperfect corners, but by and large I'm starting to believe it's becoming possible to write certain cross-container codes. Andrei
May 27 2010
On 2010-05-27 21:08:29 -0400, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> said:http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d I defined Array as a straightforward implementation of the homonym abstraction. There are a few imperfect corners, but by and large I'm starting to believe it's becoming possible to write certain cross-container codes.I don't get that: property void reserve(size_t e) Why is reserve a property? You want it called like that? array.reserve = 10; I'm sure it's just an oversight. -- Michel Fortin michel.fortin michelf.com http://michelf.com/
May 27 2010
On 05/27/2010 09:27 PM, Michel Fortin wrote:On 2010-05-27 21:08:29 -0400, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> said:Sorry, fixed now. Andreihttp://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d I defined Array as a straightforward implementation of the homonym abstraction. There are a few imperfect corners, but by and large I'm starting to believe it's becoming possible to write certain cross-container codes.I don't get that: property void reserve(size_t e) Why is reserve a property? You want it called like that? array.reserve = 10; I'm sure it's just an oversight.
May 27 2010
== Quote from Andrei Alexandrescu (SeeWebsiteForEmail erdani.org)'s article:I defined Array as a straightforward implementation of the homonym abstraction. There are a few imperfect corners, but by and large I'm starting to believe it's becoming possible to write certain cross-container codes.I think it might be a good idea is to make it so that, for struct types, when they're removed from the containers, their destructors are run[1]. That way containers would be able to work with some kinds of "smart pointer" abstractions once the compiler is up to supporting them, which would make both the containers and the "smart pointers" a good deal more useful. Cheers, Pillsy [1] I asked some questions about the feasibility of this in d.learn.
May 28 2010
On Thu, 27 May 2010 21:08:29 -0400, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d I defined Array as a straightforward implementation of the homonym abstraction. There are a few imperfect corners, but by and large I'm starting to believe it's becoming possible to write certain cross-container codes.I just noticed, there is no doc for ElementType, only ValueType and KeyType. -Steve
May 28 2010
On Fri, 28 May 2010 15:51:53 -0400, Steven Schveighoffer <schveiguy yahoo.com> wrote:On Thu, 27 May 2010 21:08:29 -0400, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Also, ElementType is also a template in std.range, can we change one of these? I would use the following condition to accept a range: struct container(T) { void add(R)(R r) if (isInputRange!R && isImplicitlyConvertible(ElementType!R, T) } But I think if container(T) defines ElementType, the compiler will be confused... -Stevehttp://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d I defined Array as a straightforward implementation of the homonym abstraction. There are a few imperfect corners, but by and large I'm starting to believe it's becoming possible to write certain cross-container codes.I just noticed, there is no doc for ElementType, only ValueType and KeyType.
May 28 2010
On 05/28/2010 02:51 PM, Steven Schveighoffer wrote:On Thu, 27 May 2010 21:08:29 -0400, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:I figured out that ElementType is actually unneeded - introspection can extract it for you, see std.range.ElementType. Andreihttp://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d I defined Array as a straightforward implementation of the homonym abstraction. There are a few imperfect corners, but by and large I'm starting to believe it's becoming possible to write certain cross-container codes.I just noticed, there is no doc for ElementType, only ValueType and KeyType. -Steve
May 28 2010
On Fri, 28 May 2010 16:03:10 -0400, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:On 05/28/2010 02:51 PM, Steven Schveighoffer wrote:Well, the docs still use ElementType everywhere. I don't really know how it would be introspected, what common function are all containers expected to implement (analogous to front() in a range)? The only thing I would suggest is that having ElementType or something equivalent, would help with documentation, since ddoc would be immune to said introspection. -SteveOn Thu, 27 May 2010 21:08:29 -0400, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:I figured out that ElementType is actually unneeded - introspection can extract it for you, see std.range.ElementType.http://erdani.com/d/phobos/std_container.html http://erdani.com/d/phobos/container.d I defined Array as a straightforward implementation of the homonym abstraction. There are a few imperfect corners, but by and large I'm starting to believe it's becoming possible to write certain cross-container codes.I just noticed, there is no doc for ElementType, only ValueType and KeyType. -Steve
May 28 2010