On Fri, 25 Feb 2011 23:48:19 +0100, spir wrote:
> we cannot even use something like memcopy because the source & target
> mem areas overlap
In those cases, use memmove.
But maybe there's a D-ish way that's just as efficient, not sure.
On 02/25/2011 11:31 PM, Andrej Mitrovic wrote:
On 2/25/11, spir wrote:
But where is this func
implemented?
DMD\dmd2\src\druntime\src\rt\aaA.d
_aaDel&& _aaDelX
And then in object.d:
extern (C)
{
// from druntime/src/compiler/dmd/aaA.d
...
void _aaDel(void* p, TypeInfo keyti,
On 02/25/2011 09:09 PM, Jonathan M Davis wrote:
On Friday, February 25, 2011 11:30:28 spir wrote:
Hello,
What's the idiomatic way to:
* delete an element in an associative array
If you have the key, then just use remove. The online documentation for
asseciative array discusses it. e.g.
b.re
On 2/25/11, spir wrote:
> But where is this func
> implemented?
DMD\dmd2\src\druntime\src\rt\aaA.d
_aaDel && _aaDelX
And then in object.d:
extern (C)
{
// from druntime/src/compiler/dmd/aaA.d
...
void _aaDel(void* p, TypeInfo keyti, ...);
...
}
I don't really know how it gets c
On 02/25/2011 08:55 PM, Andrej Mitrovic wrote:
On 2/25/11, spir wrote:
* delete an element in an associative array
Just use .remove?
void main()
{
auto var = ["a" : 1];
var.remove("b");// nothing happens
var.remove("a");// "a" key is gone
assert(!var.length); //
On Friday, February 25, 2011 12:51:53 Andrej Mitrovic wrote:
> I have asked for remove before, I got some responses here (in fact,
> Jonathan made an enhancement request for it):
>
> http://www.digitalmars.com/d/archives/digitalmars/D/learn/Removing_an_objec
> t_from_a_range_23212.html
>
> The to
I have asked for remove before, I got some responses here (in fact,
Jonathan made an enhancement request for it):
http://www.digitalmars.com/d/archives/digitalmars/D/learn/Removing_an_object_from_a_range_23212.html
The topic was derailed, but essentially you can provide a predicate as
a function
On Friday 25 February 2011 12:30:00 Andrej Mitrovic wrote:
> On 2/25/11, Jonathan M Davis wrote:
> >> * insert an element in a dyn array
> >
> > Same as remove. There's no function for doing it at the moment.
>
> std.array.insert:
>
> int[] a = [ 1, 2, 3, 4 ];
> a.insert(2, [ 1, 2 ]);
> assert(
On Friday 25 February 2011 12:09:44 Jonathan M Davis wrote:
> On Friday, February 25, 2011 11:30:28 spir wrote:
> > * delete an element in a dyn array
>
> I don't think that there is one right now. There should probably be a
> function in std.array which does what remove in std.container would do,
On Friday 25 February 2011 12:16:19 Steven Schveighoffer wrote:
> On Fri, 25 Feb 2011 15:09:44 -0500, Jonathan M Davis
>
> wrote:
> > On Friday, February 25, 2011 11:30:28 spir wrote:
> >> Hello,
> >>
> >> What's the idiomatic way to:
> >>
> >> * delete an element in an associative array
> >
>
On 2/25/11, Jonathan M Davis wrote:
>
>> * insert an element in a dyn array
>
> Same as remove. There's no function for doing it at the moment.
std.array.insert:
int[] a = [ 1, 2, 3, 4 ];
a.insert(2, [ 1, 2 ]);
assert(a == [ 1, 2, 1, 2, 3, 4 ]);
afaik insert was missing from the documentation i
On Fri, 25 Feb 2011 15:09:44 -0500, Jonathan M Davis
wrote:
On Friday, February 25, 2011 11:30:28 spir wrote:
Hello,
What's the idiomatic way to:
* delete an element in an associative array
If you have the key, then just use remove. The online documentation for
asseciative array discusse
On Friday, February 25, 2011 11:30:28 spir wrote:
> Hello,
>
> What's the idiomatic way to:
>
> * delete an element in an associative array
If you have the key, then just use remove. The online documentation for
asseciative array discusses it. e.g.
b.remove("hello");
If you're looking to remo
On 2/25/11, spir wrote:
> * delete an element in an associative array
Just use .remove?
void main()
{
auto var = ["a" : 1];
var.remove("b");// nothing happens
var.remove("a");// "a" key is gone
assert(!var.length); // empty
}
Hello,
What's the idiomatic way to:
* delete an element in an associative array
* delete an element in a dyn array
* insert an element in a dyn array
Thank you,
Denis
--
_
vita es estrany
spir.wikidot.com
15 matches
Mail list logo