Date: Thu, 14 Mar 2024 11:23:49 -0400
On Thu, Mar 14, 2024 at 11:11 AM Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]>
wrote:
> On Thu, Mar 14, 2024 at 11:09 AM Jake Fevold (BLOOMBERG/ 919 3RD A) via
> SG14 <sg14_at_[hidden]> wrote:
>
>> Just wanted to point out that the trivial relocation presented in P2786
>> is strongly preferred by BDE (sometimes called BSL) over the form in P1144.
>>
>
> That's not true; BSL actually uses the form presented in P1144 table §2.1
> <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p1144r10.html#applications>.
> I have several blog posts on the topic; see particularly
> https://quuxplusone.github.io/blog/2024/01/02/bsl-vector-erase/ which
> presents an example directly taken from bsl::vector.
>
> I'm happy to talk about this further; you can find me on the cpplang
> Slack. :)
>
That said, you could also put your money where your mouth is, by asking BSL
to use the P2786 definition *instead* of P1144's.
That would involve changing these lines:
*diff --git a/groups/bsl/bslmf/bslmf_isbitwisemoveable.h
b/groups/bsl/bslmf/bslmf_isbitwisemoveable.h*
*index c9c7e8c72..8158e0cb3 100644*
*--- a/groups/bsl/bslmf/bslmf_isbitwisemoveable.h*
*+++ b/groups/bsl/bslmf/bslmf_isbitwisemoveable.h*
@@ -658,7 +658,8 @@ struct IsBitwiseMoveable_Imp<t_TYPE, false> {
"function types");
static const bool k_ValueWithoutOnebyteHeuristic =
- bsl::is_trivially_copyable<t_TYPE>::value ||
+ (bsl::is_trivially_move_constructible<t_TYPE>::value
&&
+ bsl::is_trivially_destructible<t_TYPE>::value) ||
std::is_empty<t_TYPE>::value // required for gcc
< 5.0
|| k_NestedBitwiseMoveableTrait;
#endif
This would have the immediately observable effect of reporting libc++'s
std::tuple<int&> as BitwiseMoveable, which would mean that you'd start
using your optimizations for that type (even though they're not appropriate
for that type).
–Arthur
>
wrote:
> On Thu, Mar 14, 2024 at 11:09 AM Jake Fevold (BLOOMBERG/ 919 3RD A) via
> SG14 <sg14_at_[hidden]> wrote:
>
>> Just wanted to point out that the trivial relocation presented in P2786
>> is strongly preferred by BDE (sometimes called BSL) over the form in P1144.
>>
>
> That's not true; BSL actually uses the form presented in P1144 table §2.1
> <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p1144r10.html#applications>.
> I have several blog posts on the topic; see particularly
> https://quuxplusone.github.io/blog/2024/01/02/bsl-vector-erase/ which
> presents an example directly taken from bsl::vector.
>
> I'm happy to talk about this further; you can find me on the cpplang
> Slack. :)
>
That said, you could also put your money where your mouth is, by asking BSL
to use the P2786 definition *instead* of P1144's.
That would involve changing these lines:
*diff --git a/groups/bsl/bslmf/bslmf_isbitwisemoveable.h
b/groups/bsl/bslmf/bslmf_isbitwisemoveable.h*
*index c9c7e8c72..8158e0cb3 100644*
*--- a/groups/bsl/bslmf/bslmf_isbitwisemoveable.h*
*+++ b/groups/bsl/bslmf/bslmf_isbitwisemoveable.h*
@@ -658,7 +658,8 @@ struct IsBitwiseMoveable_Imp<t_TYPE, false> {
"function types");
static const bool k_ValueWithoutOnebyteHeuristic =
- bsl::is_trivially_copyable<t_TYPE>::value ||
+ (bsl::is_trivially_move_constructible<t_TYPE>::value
&&
+ bsl::is_trivially_destructible<t_TYPE>::value) ||
std::is_empty<t_TYPE>::value // required for gcc
< 5.0
|| k_NestedBitwiseMoveableTrait;
#endif
This would have the immediately observable effect of reporting libc++'s
std::tuple<int&> as BitwiseMoveable, which would mean that you'd start
using your optimizations for that type (even though they're not appropriate
for that type).
–Arthur
>
Received on 2024-03-14 15:24:04