Re: [C++-sig] [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: >> > struct ContextConcept >> > { >> > ... >> > something postcall(something_else); >> > }; >> > >> > struct ConverterConcept >> > { >> > ... >> > T convert(PolicyConcept::context_type& context); >> > }; >> >>This is passing the per-call state into the convert function? The >>problem I have with this is that the dynamically-registered converter >>implementation doesn't have access to the policy's static type, nor >>presumably to its nested context_type. > > Yes it does; the dynamically-registered converters are implemented as > a default policy You're not making sense here. The dynamic from-XXX converter implementation does not model the CallPolicy concept, nor, I think, the ConversionPolicy concept. It basically comes down to one or two function pointers with a fixed static type for any given C++ target type. These function pointers get plugged into the static converter at runtime. > which selects the appropriate converter type. There > is no reason the system cannot be aware of the state type: > > struct default_state > { > postcall_chain* chain; > }; > > template<class T> > struct rvalue_converter > { > T& convert(default_state& state, ...) > }; If it's always a postcall chain, what's the point of nesting its type in the CallPolicy? > Note that this is quite possible even if the policy object is copied and > used as state: > > struct default_policy > { > postcall_chain* chain; > void postcall(...) { for (postcall_chain* c = chain; c != 0; c = c > ->next) (*c)(..); > }; > Ya lost me here. -- Dave Abrahams Boost Consulting www.boost-consulting.com ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf