|
Boost : |
From: Joel de Guzman (joel_at_[hidden])
Date: 2005-12-03 19:39:32
Andreas Pokorny wrote:
> On Sat, Dec 03, 2005 at 03:56:09PM +0100, Andreas Pokorny <andreas.pokorny_at_[hidden]> wrote:
>
>>On Sat, Dec 03, 2005 at 08:21:04AM +0800, Joel de Guzman <joel_at_[hidden]> wrote:
>>
>>>>There are entries in the map that do not require runtime data at all,
>>>>for these entries all information is coverd by the second template
>>>>parameter of pair. And others like the dimension_tag which require
>>>>an instance of the second type stored in the container.
>>>>
>>>>How can I acchieve that with fusion?
>>>
>>>If both the key and the data need to be just types, then what
>>>immediately comes to my mind is an mpl::map. What am I missing?
>>>Pure types == MPL. Half type/data == Fusion.
>>
>>But I need both in the same associative container. What changes are
>>required to make fusion deal with:
>>template<typename F,typename S> struct ct_pair {
>> typedef F first_type;
>> typedef S second_type;
>>};
>>
>>It would be acceptable if fusion::at<key>(seq), or deref on a ct_pair causes
>>compile errors, provided that the pair entries in the same container
>>still work.
>
>
> Oh, simpler than I thought. Kudos to you two, Dan and Joel.
> Fusion-2 is great, looking forward to write a review. I now use some
> ct_pairs next to fusion::pairs in fusion::map. The meta stuff seems to work,
> only the runtime access functions deref and at fail to compile if they get
> applied on a ct_pair.
Ah yes :) That's because fusion::map is not tied to a specific pair
implementation. In fact it is ignorant of the fusion::pair.
"boost/fusion/core/pair.hpp" is included in map only as a convenience
to users.
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