|
Boost : |
Subject: [boost] Fusion + New Iterator Concepts?
From: Brandon Kohn (blkohn_at_[hidden])
Date: 2009-02-14 12:15:15
Greetings Ladies and Gents,
I've been kicking around a problem in which I'm trying to create an access
policy interface which specializes compile-time and run-time access to
values mapped on an integral index.
I.e. something like:
value_type access<T>::get<Index>( T t )
value_type access<T>::get( T t, size_t index )
Where access<T> describes a specialized access policy for T.
In this context T is a sequence of anything (polymorphic even) that provides
a value_type instance. The elements of T may be simple values, a generator()
instance, A member function of some type etc.
I began implementing an access type to specialize compile-time indexed
access which assumes T is a model of the Boost.Fusion RandomAccessSequence
which works wonderfully. I then began to write an extension that allows me
to define fusion sequences of member functions (which provide the required
values.) This is where I seem to have hit a snag. Among the use-cases I
would like to support is a case where the value is returned from the
provider using pass-by-value semantics. Fusion seems to be built using
iterator concepts which essentially expect the underlying types to be able
to provide a reference type. Looking further I found a document in the
Boost.Iterator library defining "New Iterator Concepts" ( see:
http://www.boost.org/doc/libs/1_38_0/libs/iterator/doc/new-iter-concepts.html )
. This document seems to define exactly what I need which is the separation
of traversal behavior from access behavior.
My question (finally!) is whether or not anyone has thought about applying
these ideas to Boost.Fusion (or if they are perhaps already supported in
some undocumented form?)
Cheers,
Brandon
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk