Date: Fri, 23 Jan 2026 17:03:02 -0800
On Friday, 23 January 2026 15:48:21 Pacific Standard Time Frederick Virchanza
Gotham via Std-Proposals wrote:
> When we have a vector full of elements, each element is always the
> most-derived type. Therefore, a polymorphic vector element can be
> memcpy'd so long as you're not on Apple Silicon. On every machine
> other than arm64e, you can memcpy a polymorphic object so long as the
> class is 'final', or you're guaranteed to be working with the
> most-derived object.
While that is true, I don't think the use-case suffices to add yet another trait
in addition to is_relocatable or is_trivially_move_assignable. Specifically,
because keeping polymorphic types in a vector is uncommon in the first place.
It can be a platform-specific optimisation (QoI) applied by some
implementations, if they feel the need.
Gotham via Std-Proposals wrote:
> When we have a vector full of elements, each element is always the
> most-derived type. Therefore, a polymorphic vector element can be
> memcpy'd so long as you're not on Apple Silicon. On every machine
> other than arm64e, you can memcpy a polymorphic object so long as the
> class is 'final', or you're guaranteed to be working with the
> most-derived object.
While that is true, I don't think the use-case suffices to add yet another trait
in addition to is_relocatable or is_trivially_move_assignable. Specifically,
because keeping polymorphic types in a vector is uncommon in the first place.
It can be a platform-specific optimisation (QoI) applied by some
implementations, if they feel the need.
-- Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org Principal Engineer - Intel Data Center - Platform & Sys. Eng.
Received on 2026-01-24 01:03:13
