Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #68272

Re: Template argument deduction mystery

From Juha Nieminen <nospam@thanks.invalid>
Newsgroups comp.lang.c++
Subject Re: Template argument deduction mystery
Date 2019-09-07 18:55 +0000
Organization Netfront http://www.netfront.net/
Message-ID <ql0ufs$1pup$1@adenine.netfront.net> (permalink)
References (2 earlier) <qkrvui$22o2$1@adenine.netfront.net> <rohcF.533208$on8.458387@fx46.iad> <20190906145510.4c03182d29e071b060cb8ad9@cvine--nospam--.freeserve.co.uk> <OTFcF.511763$tG2.425205@fx48.iad> <20190907152518.13d08d857bf2360dcd972522@cvine--nospam--.freeserve.co.uk>

Show all headers | View raw


Chris Vine <chris@cvine--nospam--.freeserve.co.uk> wrote:
> As I read it, he asked about the specialization of std::greater<void>
> which allows type deduction in its call operator.  That was made
> available in C++14.

I was, in fact, asking about both things.

It was completely mysterious to me how exactly std::greater would
know that it was supposed to be comparing doubles, when nowhere in
its instantiation it's told that. I didn't know that it has a
specialization for void that works for exactly this kind of situation.

It's also a bit unclear to me how it works without the empty <>
brackets. I know it's related to C++ automatic template type
deduction, but it's unclear to me how it works in this case.
Curiously, it appears that it works without any explicit deduction
guides. It works for the mere reason that the default template
parameter for std::greater is void.

The rules of automatic template parameter type deduction are still
a bit unclear to me.

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Template argument deduction mystery Juha Nieminen <nospam@thanks.invalid> - 2019-09-04 13:55 +0000
  Re: Template argument deduction mystery Ian Collins <ian-news@hotmail.com> - 2019-09-05 07:16 +1200
  Re: Template argument deduction mystery Bonita Montero <Bonita.Montero@gmail.com> - 2019-09-05 03:03 +0200
    Re: Template argument deduction mystery Juha Nieminen <nospam@thanks.invalid> - 2019-09-05 21:50 +0000
      Re: Template argument deduction mystery Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2019-09-05 20:04 -0400
        Re: Template argument deduction mystery Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2019-09-06 14:55 +0100
          Re: Template argument deduction mystery Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2019-09-06 23:56 -0400
            Re: Template argument deduction mystery Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2019-09-07 15:25 +0100
              Re: Template argument deduction mystery Juha Nieminen <nospam@thanks.invalid> - 2019-09-07 18:55 +0000
                Re: Template argument deduction mystery Bo Persson <bo@bo-persson.se> - 2019-09-07 21:28 +0200
                Re: Template argument deduction mystery Ian Collins <ian-news@hotmail.com> - 2019-09-08 12:29 +1200
                Re: Template argument deduction mystery Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2019-09-07 23:06 +0100
              Re: Template argument deduction mystery Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2019-09-07 18:35 -0400

csiph-web