Re: [Implementation] Calling wrapped functions, converters, policies

David Abrahams <[email protected]>
Newsgroups gmane.comp.lib.boost.langbinding
Message-ID <[email protected]>
Daniel Wallin <[email protected]> writes:

>>>Yeah, that would work fine. But I'm not sure I like it. How does it
>>>apply to explicit conversions? (object_cast<> / extract<>). I had
>>>thought that we'd handle these cases by just supplying a vector1<T>
>>> signature sequence.. 
>>     vector2<T,object>  // from-XXX
>> or     vector2<object,T>  // to-XXX
>> Simple ;-)
>
> So we would generate a dummy converter? Hackish. :)

I guess.  You don't like it?

>>>But we could tell the policy to generate the converter explicitly
>>>instead of using generate_converter_tuple<>.. I'm not sure what I
>>>think about this.
>>
>> Not sure what you're driving at here.
>
> We could invoke the nested apply<> explicitly instead of applying it
> while iterating over a signature sequence.
>
>    template<class T, class ConverterGenerator>
>    T extract(..., ConverterGenerator)
>    {
>        typename mpl::apply2<
>            ConverterGenerator
>          , T
>          , mpl::int_<0>
>        >::type cv;
>
>        return cv.convert(...);
>    }

I'm a little bit lost.  Not enough context.  Do I need to follow this?
If so, can you make a new post about just this subject?

>>>Yeah I think we did. I guess most of "the others" will likely just
>>>ignore the index though, provided that the index is passed to the
>>>converter later.
>>>
>>>    struct my_cv;
>>>    my_cv cv;
>>>    cv.from(..., mpl::int<2>());
>>>
>>>vs
>>>
>>>    template<int N>
>>>    struct my_cv;
>>>    my_cv<2> cv;
>>>    cv.from(...);
>>
>> Do we want to pass the index into the converter later?  I don't
>> think we do.  Seems to me that you might want some converters to,
>> ultimately, work on several indices.  Maybe I'm wrong.
>
> No I think you are right. It's a bit annoying to bind the index in
> the converter type though. It does mean we could potentially be
> subject to more code bloat since we are using compile time
> indices.. But I don't know if there's a way around that, at least
> not a good one.

I don't seem to care much ;-) You can't plan for everything.  We can
always rearchitect later.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com



-------------------------------------------------------
This SF. Net email is sponsored by: GoToMyPC
GoToMyPC is the fast, easy and secure way to access your computer from
any Web browser or wireless device. Click here to Try it Free!
https://www.gotomypc.com/tr/OSDN/AW/Q4_2003/t/g22lp?Target=mm/g22lp.tmpl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.