|
Boost : |
Subject: Re: [boost] [fusion] undocumented sequence requirement: convert
From: Joel de Guzman (joel_at_[hidden])
Date: 2012-08-23 10:35:52
On 8/23/2012 7:57 PM, Mathias Gaunard wrote:
> On 23/08/2012 05:39, Joel de Guzman wrote:
>
>> which result_of::convert calls. Here's an example for vector:
>>
>> struct vector_tag;
>>
>> namespace extension
>> {
>> template <typename T>
>> struct convert_impl;
>>
>> template <>
>> struct convert_impl<vector_tag>
>> {
>> template <typename Sequence>
>> struct apply
>> {
>> typedef typename
>> detail::as_vector<result_of::size<Sequence>::value> gen;
>> typedef typename gen::
>> template apply<typename
>> result_of::begin<Sequence>::type>::type
>> type;
>>
>> static type call(Sequence& seq)
>> {
>> return gen::call(fusion::begin(seq));
>> }
>> };
>> };
>> }
>>
>> Pretty much straightforward. I think it is safe to use this extension
>> mechanism. It has been stable for a long time now. Surely, that is
>> not an excuse for it being undocumented though. At any rate, I
>> added this in my TODO list.
>
> Any reason not to make the vector version the default?
No, the result should be the target sequence type identified by
its tag.
Regards,
-- Joel de Guzman http://www.boostpro.com http://boost-spirit.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk