www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Associative arrays rehashing.

reply =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= <jeberger free.fr> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

	Hi,

	I was wondering, if I call .rehash on an existing AA, do I need to
assign the returned value to the original array (eg: "a=a.rehash;")
or is simply calling .rehash sufficient (eg: "a.rehash;")?

		Jerome
- --
+------------------------- Jerome M. BERGER ---------------------+
|    mailto:jeberger free.fr      | ICQ:    238062172            |
|    http://jeberger.free.fr/     | Jabber: jeberger jabber.fr   |
+---------------------------------+------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFHWuDEd0kWM4JG3k8RAjh7AJ9cIIaO/FiIPdQJdXffrljn/KnI7gCgkI89
F/A5MaclfJVFAiYF1/Rkaco=
=bG9u
-----END PGP SIGNATURE-----
Dec 08 2007
parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
""Jérôme M. Berger"" <jeberger free.fr> wrote in message 
news:fjenc4$2joo$1 digitalmars.com...
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1

 Hi,

 I was wondering, if I call .rehash on an existing AA, do I need to
 assign the returned value to the original array (eg: "a=a.rehash;")
 or is simply calling .rehash sufficient (eg: "a.rehash;")?

Just calling it is sufficient. AA variables are really pointers to a structure which holds a reference to the actual table. Once you've filled in an AA, no matter how much you modify it, that original structure never moves.
Dec 08 2007