On Thu, Mar 14, 2024 at 11:11 AM Arthur O'Dwyer <arthur.j.odwyer@gmail.com> wrote:
On Thu, Mar 14, 2024 at 11:09 AM Jake Fevold (BLOOMBERG/ 919 3RD A) via SG14 <sg14@lists.isocpp.org> 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. 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