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


Groups > de.comp.lang.iso-c++ > #2047

Re: bedingte Ueberladung

From Stefan Reuther <stefan.news@arcor.de>
Newsgroups de.comp.lang.iso-c++
Subject Re: bedingte Ueberladung
Date 2017-05-17 18:50 +0200
Organization A noiseless patient Spider
Message-ID <ofi61e.28c.1@stefan.msgid.phost.de> (permalink)
References <ofcu9s.18s.1@stefan.msgid.phost.de> <87r2zomzfn.fsf@mid.deneb.enyo.de>

Show all headers | View raw


Am 16.05.2017 um 20:25 schrieb Florian Weimer:
> * Stefan Reuther:
>> Als Workaround hab ich jetzt erstmal ein
>>    void foo(if_then_else<is_same_type<uint32_t,size_t>::value,
>>                          uint64_t, size_t>::type);
>> sprich, "wenn uint32_t gleich size_t, überlade das auch noch für
>> uint64_t"; das geht in dem Fall zufällig und stört nicht.
> 
> Funktioniert das auf s390? Siehe zum Beispiel:

Keine Ahnung, hast du mal ein System zum Testen? :-) Auf x64 vs. x86
funktioniert's jedenfalls.

>   <https://bugzilla.redhat.com/show_bug.cgi?id=1163188>

Es gibt noch einen zweiten Overload mit uint32_t.

Die Idee ist: wenn size_t == uint32_t, dann nehmen sowohl die Aufrufe
'foo(size_t(1))' als auch 'foo(uint32_t(1))' diesen ersten Overload. Der
zweite muss dann nur einen anderen Datentyp haben, der in der
Overload-Auflösung schlechter dasteht. Das wäre hier 'uint64_t', könnte
aber sicher auch jeder andere Integer-Typ sein.


  Stefan

Back to de.comp.lang.iso-c++ | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

bedingte Ueberladung Stefan Reuther <stefan.news@arcor.de> - 2017-05-15 19:07 +0200
  Re: bedingte Ueberladung ram@zedat.fu-berlin.de (Stefan Ram) - 2017-05-16 10:47 +0000
    Re: bedingte Ueberladung Stefan Reuther <stefan.news@arcor.de> - 2017-05-16 19:02 +0200
  Re: bedingte Ueberladung Markus Schaaf <mschaaf@elaboris.de> - 2017-05-16 13:44 +0200
    Re: bedingte Ueberladung Stefan Reuther <stefan.news@arcor.de> - 2017-05-16 18:59 +0200
  Re: bedingte Ueberladung Florian Weimer <fw@deneb.enyo.de> - 2017-05-16 20:25 +0200
    Re: bedingte Ueberladung Stefan Reuther <stefan.news@arcor.de> - 2017-05-17 18:50 +0200
      Re: bedingte Ueberladung Florian Weimer <fw@deneb.enyo.de> - 2017-05-17 19:56 +0200

csiph-web