Boost logo

Boost Users :

From: Joaquin M López Muñoz (joaquinlopezmunoz_at_[hidden])
Date: 2021-09-14 13:46:56


El 14/09/2021 a las 8:54, John Emmas via Boost-users escribió:
> Sorry Joaquin, I'm not trying to drag this out but I wondered if you
> can clarify something for me...
>
> On 09/09/2021 12:16, Joaquin M López Muñoz via Boost-users wrote:
>>
>> if you mean for the elements to be allowed in both lists at the same
>> time, use tags:
>>
>
> I emailed our main developer overnight - but he seems to think that
> tags are only needed
> when building with MSVC. For other compilers (in his case, gcc) he's
> under the impression that
> elements can exist in both lists simultaneously by using
> list_member_hook<> rather than tags.

You can also have multiinsertion by using multiple member hooks instead
of multiple
(tagged) base hooks:

https://godbolt.org/z/GanT6dh1c

> I'd assumed it'd be the same for any compiler... would you mind
> clarifying it for me please?
> Thanks again,

Well, the example above works. That said, the last paragraph in

https://www.boost.org/doc/html/intrusive/usage.html#intrusive.usage.usage_member_hook

reads:

 Â Â Â  "However, member hooks have some implementation limitations: If
there is a virtual
 Â Â Â  inheritance relationship between the parent and the member hook,
then the distance
 Â Â Â  between the parent and the hook is not a compile-time fixed value
so obtaining the
 Â Â Â  address of the parent from the member hook is not possible without
reverse engineering
 Â Â Â  compiler produced RTTI. Apart from this, the non-standard pointer
to member
 Â Â Â  implementation for classes with complex inheritance relationships
in MSVC ABI
 Â Â Â  compatible-compilers is not supported by member hooks since it also
depends on
 Â Â Â  compiler-produced RTTI information."

So, member hooks won't work (anywhere) if virtual inheritance is used
or, in MSVC, in
some unspecified "complex inheritance" scenarios. What those scenarios
are you should
ask Ion, I guess.

So far, most of our interchange have referred back to the documentation,
which, IMHO,
is pretty good. Do your developers have any problem with Boost.Intrusive
docs that may
point at their improvement? Why don't they try things (like whether MSVC
works or not
with meber hooks) on their own?

Best

Joaquín M López Muñoz


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