Re: Using in with associative arrays and then indexing them (efficiency)

2012-01-03 Thread Jonathan M Davis
On Tuesday, January 03, 2012 11:52:13 Matej Nanut wrote: Hello everyone, I would like to know whether if (symbol in symbols) return symbols[symbol]; is any less efficient than auto tmp = symbol in symbols; if (tmp !is null)

Re: Using in with associative arrays and then indexing them (efficiency)

2012-01-03 Thread Timon Gehr
On 01/03/2012 12:07 PM, Jonathan M Davis wrote: On Tuesday, January 03, 2012 11:52:13 Matej Nanut wrote: Hello everyone, I would like to know whether if (symbol in symbols) return symbols[symbol]; is any less efficient than auto tmp = symbol in symbols;

Re: Using in with associative arrays and then indexing them (efficiency)

2012-01-03 Thread Jonathan M Davis
On Tuesday, January 03, 2012 12:13:45 Timon Gehr wrote: On 01/03/2012 12:07 PM, Jonathan M Davis wrote: On Tuesday, January 03, 2012 11:52:13 Matej Nanut wrote: Hello everyone, I would like to know whether if (symbol in symbols) return

Re: Using in with associative arrays and then indexing them (efficiency)

2012-01-03 Thread Timon Gehr
On 01/03/2012 12:22 PM, Jonathan M Davis wrote: On Tuesday, January 03, 2012 12:13:45 Timon Gehr wrote: On 01/03/2012 12:07 PM, Jonathan M Davis wrote: On Tuesday, January 03, 2012 11:52:13 Matej Nanut wrote: Hello everyone, I would like to know whether if (symbol in symbols)

Re: Using in with associative arrays and then indexing them (efficiency)

2012-01-03 Thread Jonathan M Davis
On Tuesday, January 03, 2012 12:27:08 Timon Gehr wrote: No, I love declaring variables in if statements and would like it to be extended to while statements as well. What I meant is the fact that something called 'in' returns a pointer. And the two code snippets I was referring to were the two

Re: Using in with associative arrays and then indexing them (efficiency)

2012-01-03 Thread Kai Meyer
On 01/03/2012 04:07 AM, Jonathan M Davis wrote: On Tuesday, January 03, 2012 11:52:13 Matej Nanut wrote: Hello everyone, I would like to know whether if (symbol in symbols) return symbols[symbol]; is any less efficient than auto tmp = symbol in symbols;

Re: Using in with associative arrays and then indexing them (efficiency)

2012-01-03 Thread Matej Nanut
On 3 January 2012 17:58, Kai Meyer k...@unixlords.com wrote: On 01/03/2012 04:07 AM, Jonathan M Davis wrote: if(auto tmp = symbol in symbols)     return *tmp; - Jonathan M Davis +1 Very slick :) Yup, I'm going with this one. Thanks!

Re: Using in with associative arrays and then indexing them (efficiency)

2012-01-03 Thread Ali Çehreli
On 01/03/2012 02:52 AM, Matej Nanut wrote: I would like to know whether if (symbol in symbols) return symbols[symbol]; is any less efficient than auto tmp = symbol in symbols; if (tmp !is null) return *tmp; Without