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


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

Re: Use of decltype

From Juha Nieminen <nospam@thanks.invalid>
Newsgroups comp.lang.c++
Subject Re: Use of decltype
Date 2016-03-11 19:31 +0000
Organization Netfront http://www.netfront.net/
Message-ID <nbv6ec$m05$1@adenine.netfront.net> (permalink)
References <de414d5c-7cdd-4b99-8632-7336ef15a077@googlegroups.com>

Show all headers | View raw


Paul <pepstein5@gmail.com> wrote:
>   std::vector<int> v{1};
>   std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>());

I haven't tried, but this probably works:

std::greater<std::remove_reference_t<decltype(v[0])>>

Of course this is becoming needlessly verbose. Just use the vector's
value_type.

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

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


Thread

Use of decltype Paul <pepstein5@gmail.com> - 2016-03-11 03:56 -0800
  Re: Use of decltype Victor Bazarov <v.bazarov@comcast.invalid> - 2016-03-11 07:37 -0500
    Re: Use of decltype Paul <pepstein5@gmail.com> - 2016-03-11 05:18 -0800
  Re: Use of decltype Juha Nieminen <nospam@thanks.invalid> - 2016-03-11 19:31 +0000
  Re: Use of decltype "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2016-03-11 23:00 +0100
    Re: Use of decltype woodbrian77@gmail.com - 2016-03-11 15:09 -0800
    Re: Use of decltype Paul <pepstein5@gmail.com> - 2016-03-12 01:09 -0800
      Re: Use of decltype Öö Tiib <ootiib@hot.ee> - 2016-03-12 04:02 -0800
      Re: Use of decltype Juha Nieminen <nospam@thanks.invalid> - 2016-03-14 09:16 +0000
        Re: Use of decltype woodbrian77@gmail.com - 2016-03-14 11:20 -0700
          Re: Use of decltype Juha Nieminen <nospam@thanks.invalid> - 2016-03-15 09:03 +0000
  Re: Use of decltype SG <s.gesemann@gmail.com> - 2016-03-16 06:33 -0700

csiph-web