Am Mon, 15 Apr 2013 13:06:01 -0400
schrieb "Steven Schveighoffer" :
> On Sun, 14 Apr 2013 02:50:07 -0400, gedaiu wrote:
>
> > On Saturday, 13 April 2013 at 21:10:16 UTC, Nicolas Guillemot wrote:
> >>> I think we should introduce a removeAll function for hashes. Either
> >>> through Druntime or t
On Monday, 15 April 2013 at 11:36:55 UTC, Tobias Pankrath wrote:
You could set the length to 0.
Before version 4.0 in C# a Clear extension-method just calls
Collection.length = 0; Later this method was included to BCL.
In D length property for AA is readonly.
On Sun, 14 Apr 2013 02:50:07 -0400, gedaiu wrote:
On Saturday, 13 April 2013 at 21:10:16 UTC, Nicolas Guillemot wrote:
I think we should introduce a removeAll function for hashes. Either
through Druntime or through a UFCS function that we could put in
std.array or somewhere.
How about .clear
Not on associative arrays afaik.
On Monday, 15 April 2013 at 11:36:55 UTC, Tobias Pankrath wrote:
You could set the length to 0.
You could set the length to 0.
On Sunday, 14 April 2013 at 06:50:08 UTC, gedaiu wrote:
On Saturday, 13 April 2013 at 21:10:16 UTC, Nicolas Guillemot
wrote:
I think we should introduce a removeAll function for hashes.
Either
through Druntime or through a UFCS function that we could put
in
std.array or somewhere.
How about
On Saturday, 13 April 2013 at 21:10:16 UTC, Nicolas Guillemot
wrote:
I think we should introduce a removeAll function for hashes.
Either
through Druntime or through a UFCS function that we could put
in
std.array or somewhere.
How about .clear() for consistency with C++ containers?
It looks
I think we should introduce a removeAll function for hashes.
Either
through Druntime or through a UFCS function that we could put in
std.array or somewhere.
How about .clear() for consistency with C++ containers?
On 4/13/13, gedaiu wrote:
> I know, that's why I am asking how i should do this...
I think we should introduce a removeAll function for hashes. Either
through Druntime or through a UFCS function that we could put in
std.array or somewhere.
Putting it in Druntime is probably the most efficient wa
On Saturday, 13 April 2013 at 09:52:45 UTC, Andrej Mitrovic wrote:
On 4/13/13, gedaiu wrote:
looks great, but i cleared the array like this:
values = null;
That's not clearing the array, that's clearing the reference to
the
array. For example:
void main()
{
int[int] hash;
hash[1]
On 4/13/13, gedaiu wrote:
> looks great, but i cleared the array like this:
>
> values = null;
That's not clearing the array, that's clearing the reference to the
array. For example:
void main()
{
int[int] hash;
hash[1] = 1;
auto hash2 = hash; // new reference
hash = null; //
values = null;
and it seems it works great. But, i don't know how correct is
this... I was expecting to have a clear() method on array.
Makes sense to me! Looks like the technique you described is
explained here: http://ddili.org/ders/d.en/null_is.html
Good find, thanks for sharing!
On Saturday, 13 April 2013 at 09:09:36 UTC, Nicolas Guillemot
wrote:
Hey gedaiu,
I'm still a novice to D, but here are some solutions I found.
They can probably be improved.
1) Assigning to it an empty map
https://ideone.com/h7ffmD
2) Removing all entries
https://ideone.com/E7k2WL
My guess
Hey gedaiu,
I'm still a novice to D, but here are some solutions I found.
They can probably be improved.
1) Assigning to it an empty map
https://ideone.com/h7ffmD
2) Removing all entries
https://ideone.com/E7k2WL
My guess is that the first method is more efficient. I wish I
knew how to do i
Hi,
I have an associative array: string values[string], and i want to
remove all the values from this array. I looked at the
documentation here: http://dlang.org/hash-map.html and i can't
see any method for this action.
There is a nice way to remove the values, or I should use foreach?
Than
15 matches
Mail list logo