Boost logo

Boost :

Subject: Re: [boost] Re : BOOST_FOREACH like macro for map
From: mobi phil (mobi_at_[hidden])
Date: 2009-10-21 05:10:24


at the end that is also not bad... It is still not clear for me how
well for eg. gcc can
optimize code generation if I would have such macros for like 100 types arround.
In the worst case I would have extra 100 functions + extra overhead of
function call.

On Wed, Oct 21, 2009 at 1:04 AM, Steven Watanabe <watanabesj_at_[hidden]> wrote:
> AMDG
>
> mobi phil wrote:
>>
>> I forgot to put in my question that I am looking for a macro and not
>> template if possible, and for a solution as elegant as BOOST_FOREACH,
>> where you have to code as less as possible. It not (only :) ) that I
>> am lazy to write, but I think the resulting code would be easier to
>> read.
>>
>> furthermore:
>> 1. exception... throwing the exception removes the complexity of
>> writing but introduces the complexity of exception (writing code +
>> runtime).
>>
>> 2. pointer... use cases I would like to avoid pointers, as I have
>> other constraints to work with const references.
>>
>
> Why?  What's wrong with
>
> if(const data_type* data = get_value(map, key)) {
>   processResult(*data);
> }
>
> In Christ,
> Steven Watanabe
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>

-- 
rgrds,
mobi phil
being mobile, but including technology
http://mobiphil.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk