Boost logo

Boost :

Subject: Re: [boost] [log] Comments
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-03-15 19:02:15


AMDG

Andrey Semashev wrote:
> On 03/15/2010 11:22 PM, Vladimir Prus wrote:
>> The corresponding code using lambda would be, presumably:
>>
>> flt::attr< ...>("System") == m_sys
>>
>> Would it be possible to make the following work in the first case:
>>
>> if (attrs["System"] != m_sys)
>> return false;
>
> It doesn't specify the type of the value.

You can deduce the type from the type of m_sys.

>> ? Or, if changing type/behaviour of operator[] is undesirable, what
>> about
>>
>> if (attrs->get_nothrow("System") != m_sys)
>> return false;
>
> That should be:
>
> if (attrs.get_nothrow< System >("System") != m_sys)
> return false;
>
> Yes, it could be done. But as stated elsewhere in the discussion, this
> would require System to be copyable (which might be fine in this
> case). And it doesn't really differ from:
>
> bool result = false;
> extract< System >("System", attrs, var(result) = _1 != m_sys);
> return result;

except that the former is more readable.

> but with extract it doesn't have the copyability restriction.

Why does this require System to be copyable? Can't you
return a reference?

In Christ,
Steven Watanabe


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