This is the mail archive of the mailing list for the libstdc++ project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [v3 PATCH] PR libstdc++/79141

On 02/04/17 02:45 +0300, Ville Voutilainen wrote:
   PR libstdc++/79141
   * include/bits/stl_pair.h (__wrap_nonesuch): New.
   (operator=(typename conditional<
   const pair&, const __wrap_nonesuch&>::type)): Change __nonesuch
   to __wrap_nonesuch.
   (operator=(typename conditional<
   const pair&, const __nonesuch&>::type)): Likewise.
   (operator=(typename conditional<
   pair&&, __wrap_nonesuch&&>::type)): Likewise.
   * testsuite/20_util/pair/ New.

diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h
index 7c7cee2..b746fb4 100644
--- a/libstdc++-v3/include/bits/stl_pair.h
+++ b/libstdc++-v3/include/bits/stl_pair.h

+  struct __wrap_nonesuch : std::__nonesuch {
+    explicit __wrap_nonesuch(const __nonesuch&) = delete;
+  };

Could you please add a comment explaining that this is needed to
ensure that functions with parameters of this type are not viable when
an argument of {} is used. Because even with such a comment I'll
probably not understand this by next week.

And I think __explicit_nonesuch or __no_list_init would be a clearer
name. We're not really "wrapping" this, unless I misunderstand.

OK for trunk, I suppose.

This kind of thing is why I want to burn std::pair and std::tuple to
the ground.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]