September 08, 2016 Data structures of mixed type | ||||
---|---|---|---|---|
| ||||
Attachments:
| What is the idiomatic way of having an array with a mix of int and float data?
Is relying on automated conversion of int to float acceptable?
--
Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder@ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
|
September 08, 2016 Re: Data structures of mixed type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russel Winder | On Thursday, 8 September 2016 at 08:56:13 UTC, Russel Winder wrote: > What is the idiomatic way of having an array with a mix of int and float data? Maybe https://dlang.org/phobos/std_variant.html#.Algebraic ? > Is relying on automated conversion of int to float acceptable? I don't think so: import std.stdio; void main() { int i = 12345678; float f = i; writeln(f); } Andrea |
Copyright © 1999-2021 by the D Language Foundation