SImple C++ code to D

Meta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 17 06:37:15 PDT 2014


On Tuesday, 15 July 2014 at 16:04:26 UTC, bearophile wrote:
> Alexandre:
>
>> map<string, Address> syms;
>
> If you don't need the key ordering then use a built-in 
> associative array:
>
> Address[string] syms;
>
> Otherwise use a RedBlackTree from std.container.
>
>
>> vector<pair<DWORD, Address>> values;
>> vector<pair<DWORD, shared_ptr<DWORD>>> addrs;
>
> Tuple!(DWORD, Address)[] values;
> Tuple!(DWORD, DWORD*)[] addrs;
>
> Tuple and tuple are in std.typecons.
>
> Bye,
> bearophile

For `Tuple!(DWORD, DWORD*)[] addrs;`, DWORD* is not same as 
shared_ptr<DWORD>. It's important to keep that in mind.


More information about the Digitalmars-d-learn mailing list