_aaApply2
H. S. Teoh
hsteoh at qfbox.info
Mon Jul 22 15:28:45 UTC 2024
On Mon, Jul 22, 2024 at 11:11:53AM +0000, Quirin Schroll via Digitalmars-d wrote:
> On Sunday, 21 July 2024 at 16:44:56 UTC, IchorDev wrote:
> > Shouldn't AAs be using a range interface instead of opApply these
> > days? Is really there any reason for a `foreach` over an AA not to
> > be `nothrow`?
>
> The range interface doesn’t really support key–value pair iteration.
[...]
Sure it does. Check the implementation in object.d, internally it uses a
range over a struct that encapsulates the key and value pair. You can
actually use this interface in user code too: aa.byKeyValue(). The
non-range interface is really for compatibility with legacy code.
T
--
How many guacas are in 1 guacamole? 6.022*10^23, also known as Avocado's Number.
More information about the Digitalmars-d
mailing list