public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: "François Dumont" <frs.dumont@gmail.com>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: "libstdc++@gcc.gnu.org" <libstdc++@gcc.gnu.org>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Hashtable PR96088
Date: Mon, 24 May 2021 11:31:54 +0200	[thread overview]
Message-ID: <74d39bb0-6c12-1c6b-7444-08f263252865@gmail.com> (raw)
In-Reply-To: <YKaR6rhQPQ6MECsn@redhat.com>

On 20/05/21 6:44 pm, Jonathan Wakely wrote:
> On 06/05/21 22:03 +0200, François Dumont via Libstdc++ wrote:
>> Hi
>>
>>     Considering your feedback on backtrace in debug mode is going to 
>> take me some time so here is another one.
>>
>>     Compared to latest submission I've added a _Hash_arg_t partial 
>> specialization for std::hash<>. It is not strictly necessary for the 
>> moment but when we will eventually remove its nested argument_type it 
>> will be. I also wonder if it is not easier to handle for the 
>> compiler, not sure about that thought.
>
> The std::hash specializations in libstdc++ define argument_type, but
> I'm already working on one that doesn't (forstd::stacktrace).
>
> And std::hash<acme::ProgramDefinedType> can be specialized by users,
> and is not required to provide argument_type.
>
> So it's already not valid to assume that std::hash<T>::argument_type
> exists.
>
>> @@ -850,9 +852,56 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>>     iterator
>>     _M_emplace(const_iterator, false_type __uks, _Args&&... __args);
>>
>> +      template<typename _Kt, typename _Arg, typename _NodeGenerator>
>> +    std::pair<iterator, bool>
>> +    _M_insert_unique(_Kt&&, _Arg&&, const _NodeGenerator&);
>> +
>> +      // Detect nested argument_type.
>> +      template<typename _Kt, typename _Ht, typename = __void_t<>>
>> +    struct _Hash_arg_t
>> +    { typedef _Kt argument_type; };
>> +
>> +      // std::hash
>> +      template<typename _Kt, typename _Arg>
>> +    struct _Hash_arg_t<_Kt, std::hash<_Arg>>
>> +    { typedef _Arg argument_type; };
>> +
>> +      // Nested argument_type.
>> +      template<typename _Kt, typename _Ht>
>> +    struct _Hash_arg_t<_Kt, _Ht,
>> +              __void_t<typename _Ht::argument_type>>
>> +    { typedef typename _Ht::argument_type argument_type; };
>> +
>> +      // Function pointer.
>> +      template<typename _Kt, typename _Arg>
>> +    struct _Hash_arg_t<_Kt, std::size_t(*)(const _Arg&)>
>> +    { typedef _Arg argument_type; };
>> +
>> +      template<typename _Kt,
>> +           typename _ArgType
>> +         = typename _Hash_arg_t<_Kt, _Hash>::argument_type>
>> +    static typename conditional<
>> +      __is_nothrow_convertible<_Kt, _ArgType>::value, _Kt&&, 
>> key_type>::type
>
> Please use __conditional_t<...> here instead of
> typename conditional<...>::type.

I forgot to say in my new proposal that I didn't find the 
__conditional_t. I can see a std::condition_t but only in C++14.

Do you want to add a __conditional_t for C++11 ?



  parent reply	other threads:[~2021-05-24  9:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-01 12:36 Hashtable PR96088 Work in Progress François Dumont
2020-10-17 16:21 ` [PATCH] Hashtable PR96088 François Dumont
2020-10-24 14:25   ` François Dumont
2020-12-04  9:10     ` François Dumont
2021-05-06 20:03       ` François Dumont
2021-05-17 19:24         ` François Dumont
2021-05-20 16:44         ` Jonathan Wakely
2021-05-21  5:55           ` François Dumont
2021-05-21  6:48             ` Jonathan Wakely
2021-05-21  6:55               ` Jonathan Wakely
2021-05-22 16:35                 ` François Dumont
2021-05-24 11:19                   ` Jonathan Wakely
2021-06-01 17:45                   ` Jonathan Wakely
2021-06-01 17:47                     ` Jonathan Wakely
2021-06-01 18:10                       ` Jonathan Wakely
2021-06-01 20:00                         ` François Dumont
2021-06-02 12:35                         ` Jonathan Wakely
2021-05-24  9:31           ` François Dumont [this message]
2021-05-24 11:18             ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74d39bb0-6c12-1c6b-7444-08f263252865@gmail.com \
    --to=frs.dumont@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely@redhat.com \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).