From: dan marsden (danmarsden_at_[hidden])
Date: 2006-05-09 15:10:20


Larry Evans wrote:
>On 05/06/2006 05:11 PM, dan marsden wrote:
>>
>> Thanks for the feedback
>
>Sure. And thanks for the fusion_v2 and the quick response to feedback.

No problem

>However, I've got another question. I removed the value_of_impl from my
>code since it looks like deref_impl defines what's needed and
>my code ran OK. Is value_of_impl really needed to define a
>fusion iterator for a new struct?

value_of_impl is only used by the value_of metafunction, and
is a requirement of the Fusion forward iterator concept. It is not needed in order
for deref to work correctly.

There is a distinction between deref and value_of:

fusion::result_of::deref<It>::type - Returns the result of dereferencing It
fusion::result_of::value_of<It>::type - Returns the element stored at It

Now if an element of type T is stored at It then:
fusion::result_of::deref<It>::type is T&
fusion::result_of::value_of<It>::type is T

If on the other hand an element of type T& is stored at It then:
fusion::result_of::deref<It>::type is T& (as before)
fusion::result_of::value_of<It>::type is T&

So value_of allows us to distinguish members that are references.

Hope that was what you were after.
Cheers
Dan