|
Boost : |
From: Joel de Guzman (joel_at_[hidden])
Date: 2006-09-01 20:03:33
Jeremy Day wrote:
> On 9/1/06, David Abrahams <dave_at_[hidden]> wrote:
>> It's not really the same as making point actually *be* a conforming
>> fusion sequence, in some sense, is it? You've sorta "cheated" by
>> giving it a kind of implicitly-recognized conversion into a view.
>
>
> Don't you need the functionality that Joel describes if you deal with code
> from a library that you didn't write, such as anything provided by
> Microsoft? Or if you are dealing with legacy code?
Well, first, to answer Dave, yes, it's not really the same thing. We
are talking about conversion versus adaptation. I would say though
that both will be useful. Conversion has the disadvantage that a
copy step from the source structure to the target sequence will
be required. This might not be expensive, especially if you will
be using ties (sequence of references) and your structure is small
(e.g. point, rect, std::pair). Still, it's not zero overhead. On
the other hand, adaptation is copy-free. You essentially make an
arbitrary type a truly conforming sequence that can be used as-is.
The cost is the added complexity, and hence work, in adaptation.
We are still trying to make the procedure as painless as possible,
but it can't be as simple as the one-overload conversion; you'll
have to write a slew of functions and metafunctions. In either case,
we already made sure that conversion and adaptation are both
non-intrusive. That was a requirement from the very start. Hence,
you *can* adapt a type without having to modify it. The adaptation
of std::pair for fusion is an example.
Regards,
-- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk