Re: Re: [C++-sig] [Implementation] Calling wrapped functions, converters, policies

Daniel Wallin <[email protected]>
Newsgroups gmane.comp.lib.boost.langbinding
Message-ID <[email protected]>
At 14:46 2003-09-22, David Abrahams wrote:
>Daniel Wallin <[email protected]> writes:
>
> > At 18:53 2003-09-21, David Abrahams wrote:
> >>Daniel Wallin <[email protected]> writes:
> >>
> >> >>Actually I was thinking that the index should be encoded in the type
> >> >>of the converter.
> >> >
> >> > Ok, both approaches work.
> >>
> >>I think we may have single converter tuple at this point.  If so we'll
> >>want something like:
> >>
> >>        converters.convert(argument_package,mpl::int_<1>());
> >
> > I have expressed some concern on this before due to the issue with an
> > additional layer when returning temporaries from convert().
> > (with const& argument types..)
> >
> > I would rather see something like:
> >
> >     get<0>(converters).convert(argument_package);
> >
> > or
> >
> >     get<0>(converters).convert(argument_package, mpl::int_<0>());
>
>I'm sorry, I don't see why one should be more problematic than the
>other, but I'm willing to go with your first alternative if you like.
>I think the 2nd one is unneccessary.

It's problematic because of how the 'converters tuple' type would be
implemented. I guess it could be implemented with inheritance,
and require that converters take an mpl::int_<N> where N is their
index. But as I saw this it would probably be implemented with
a forwarding function, which would obviously cause problems if
the converter would return a temporary which should bind to a
const&.

Now that I think about it it wouldn't be that problematic to implement
with inheritance instead, although it does complicate the convert()
signature a bit.

---
Daniel Wallin




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
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.