|
Boost Users : |
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-03-26 14:36:13
AMDG
Robert Dailey wrote:
> The term 'inherit' here does not refer to class inheritance obviously.
> It's an unusual usage of the term to me. When you do
> inherit<empty_base, WalkPacket> what exactly is that doing?
template<class T1, class T2>
struct inherit : T1, T2 {};
> Is it joining them in a list container or something? What is the
> resulting type of mpl::inherit_linearly::type? Is the result of
> mpl::inherit_linearly::type implicitly constructible from an
> mpl::transform::type?
The result of the inherit_linearly call inherits using multiple
inheritence from
all the types in the sequence.
> I'm going to read over the docs a few more times in the meantime to
> see if I can grasp this concept. Also, I'm not seeing how you're
> filling in the 2 placeholders in the signal_holder typedef.
mpl::inherit_linearly treats the second argument as a binary lambda
expression.
It is very similar to the runtime std::accumulate. Think of inherit<_,
_> as
the MPL equivalent of a function object that returns inherit<T1, T2> for
arguments T1 and T2.
> Also, mpl::vector has a max size limit I'm sure. Right now we have a
> very minimal set of packet types, but in the future we have to
> consider the possibility that 100+ packet types will exist (the final
> number is ultimately unknown). If this is true, I doubt mpl::vector
> would be usable anymore since 100 seems too large for it. This makes
> me feel like I'm going to have to resort to a completely template-less
> approach. I might have to send a generic Packet object to all
> subscribers, which has a ::Get() method that performs a
> static_cast<>() to the concrete type based on an ID.
MPL allows configuration to make vector able to hold larger numbers of
types.
If you need such a large number of Packets, compilation may be very slow
with metaprogramming.
In Christ,
Steven Watanabe
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net