|
Boost : |
From: Larry Evans (cppljevans_at_[hidden])
Date: 2005-01-17 23:32:33
On 01/17/2005 07:35 PM, David Abrahams wrote:
> Larry Evans <cppljevans_at_[hidden]> writes:
>
>
>>But the aforementioned
>>
>> t.get_inherit_side<...>:::type::left_type::value;
>>
>>does compile? OK, now I see. Instead of >::head_type, there
>>should have been >::type::head_type. Does it make sense now?
>
>
> Nope. I'm still looking for a member whose name is get_tail<...> and
> not seeing any such thing.
>
The lastest upload, get_ith_head_test.cpp has a member function,
get_ith_head, which does this.
The code:
t.get_inherit_side<...>:::type::left_type::value;
is simply a qualified access to the member variable of a supertype of t.
There's no need for a member method, and all get_ith_head does is
simply use what amounts to the above code to access the proper
superclass member variable. As mentioned previously, this is no
different than:
t.sk::sk+1::sn::value;
where t is of type T, and:
s0 is supertype of T
s1 is supertype of s0
...
sk is supertype of sk-1
...
sn is supertype of sn-1
and all get_tail<T,Index> (and it's successor, get_ith_tail) does is
create a typedef for the Index-th supertype of T. There's obviously
a 1-to-1 mapping between the values and qualifiers:
sk::sk+1::...::sn
where:
for k in 0..n
hence, there's no problem with having the same member variable
name since it's prefixed by it's unique qualifier. Isn't this
what tuple_base.hpp's element template does, except it just
keeps following the tail_type typedefs for k times?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk