On Fri, 28 Jun 2024 at 07:53, Maciej Cencora wrote:
>
> But constexpr-ness of bit_cast has additional limitations and e.g. providing
> an union as _Tp would be a hard-error. So we have two options:
> - before bitcasting check if type can be bitcast-ed at compile-time,
> - change the 'if constex
But constexpr-ness of bit_cast has additional limitations and e.g.
providing an union as _Tp would be a hard-error. So we have two options:
- before bitcasting check if type can be bitcast-ed at compile-time,
- change the 'if constexpr' to regular 'if'.
If we go with the second solution then we
On Thu, 27 Jun 2024 at 14:27, Maciej Cencora wrote:
>
> I think going the bit_cast way would be the best because it enables the
> optimization for many more classes including common wrappers like optional,
> variant, pair, tuple and std::array.
This isn't tested but seems to work on simple case
I think going the bit_cast way would be the best because it enables the
optimization for many more classes including common wrappers like optional,
variant, pair, tuple and std::array.
Regards,
Maciej Cencora
czw., 27 cze 2024 o 14:57 Maciej Cencora napisał(a):
> You could include some of the b
You could include some of the bigger classes by checking whether the class
type is bit_cast-able to std::array of bytes, and that bitcasted output is
equal to value-initialized array.
Regards,
Maciej
czw., 27 cze 2024 o 14:50 Jonathan Wakely napisał(a):
> On Thu, 27 Jun 2024 at 13:49, Jonathan
On Thu, 27 Jun 2024 at 13:49, Jonathan Wakely wrote:
>
> On Thu, 27 Jun 2024 at 13:40, Maciej Cencora wrote:
> >
> > Hi,
> >
> > not sure whether I've missed some conditional that would exclude this case,
> > but your change seems to incorrectly handle trivial types that have a
> > non-zero bit
On Thu, 27 Jun 2024 at 13:40, Maciej Cencora wrote:
>
> Hi,
>
> not sure whether I've missed some conditional that would exclude this case,
> but your change seems to incorrectly handle trivial types that have a
> non-zero bit pattern of value-initialized object, e.g. pointer to member.
Good poi
On Thu, 27 Jun 2024 at 11:53, Jonathan Wakely wrote:
>
> For trivial types std::__uninitialized_default (which is used by
> std::uninitialized_value_construct) value-initializes the first element
> then copies that to the rest of the range using std::fill.
>
> Tamar is working on improved vectoriz