Boost logo

Boost :

From: dan marsden (danmarsden_at_[hidden])
Date: 2006-05-05 16:27:46

David Abrahams wrote:
>dan marsden <danmarsden_at_[hidden]> writes:
>> The ref/cref generation is currently in detail, so library private
>> implementation, and the is_const switch is repeated as with my
>> example. So yes this is a recurring theme, we could provide a
>> utility to do the necessary, but that does not seem to be a feature
>> specific to fusion (as opposed to any other lib that needs to make
>> similar decisions, I believe there is similar code in phoenix for
>> example).
>> Possibly we could make this decision at a higher level, in deref
>> proper for example, but I'm not sure the logic is appropriate in all
>> cases, such as transform views, were it may be appropriate to return
>> non-const refs from a deref of a const container.
>IMO you can do better.

We're considering a utility metafunction that can be used to generate the
return type for the various places where element access is required:

element_ref<Seq, Element>::type

It will then do the add_reference and add_const if needed based on the Seq
the element is from. It can then be used to avoid the fiddling above in what I
suspect is the common case.

Is this sufficient improvement, or did you have something grander in mind?


Boost list run by bdawes at, gregod at, cpdaniel at, john at