Home » U++ Library support » U++ Core » [DISCUSSION] Add 'complex' datatype, to Value too
Re: [DISCUSSION] Add 'complex' datatype, to Value too [message #32970 is a reply to message #32961] |
Sun, 26 June 2011 16:05   |
 |
kohait00
Messages: 939 Registered: July 2009 Location: Germany
|
Experienced Contributor |
|
|
ok this all doesnt help..we got a semantic problem here.
complex can be constructed both from double and anther complex.
same applies for operator=, it can assign a double or a complex.
now, for Value support (and Nuller) we have both operator double() and operator cdouble() implicit conversion, that applies here.
so the compiler could construct a cdouble from a Value (or Nuller) in 2 paths, converting it to double or cdouble. and it does not know which one to prefer.
cdouble x = val.operator double();
cdouble x = val.operator cdouble();
both work, same for Null.
thats due to the implicit handling of double as a sole real part in complex context in std::complex. so there is no way around that. not even deriving from std::complex, unless we spare out the complex(double) ctor and operator=(double).
and it only touches Value conversion stuff. one could leave out the Value support, but it's bad too. so at least to have the Value support like that (dealing with explicit conversion access in this special context) is an advantage, at least the user could know what to call if the compiler doesnt.
RESULT: though it's 'ugly' to explicitly call Null.operator cdouble() and v.operator cdouble(), it's a reasonable price to pay for a common std::complex usage which we dont need to code oursselves anymore. Nuller.operator cdouble() even could be left out, so it only would apply to Value.operator cdouble() to call. but i'd keep it the same semantic, Null.operator cdouble() as well.
is it worth it, that's the final question? everything else works..
[Updated on: Sun, 26 June 2011 16:21] Report message to a moderator
|
|
|
 |
|
[DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
By: Tom1 on Sun, 12 June 2011 18:04
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
By: koldo on Mon, 13 June 2011 08:47
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
By: Tom1 on Mon, 13 June 2011 11:20
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
By: Tom1 on Mon, 13 June 2011 19:24
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
By: mirek on Mon, 13 June 2011 20:12
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
By: mirek on Tue, 14 June 2011 08:15
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
By: mirek on Sat, 25 June 2011 19:48
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
By: mirek on Sun, 26 June 2011 09:30
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
By: mirek on Mon, 27 June 2011 18:04
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
By: mirek on Tue, 28 June 2011 09:16
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
By: mirek on Wed, 06 July 2011 13:17
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
By: mirek on Wed, 06 July 2011 17:25
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
By: mirek on Wed, 06 July 2011 19:02
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
By: mirek on Wed, 06 July 2011 19:03
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
By: mirek on Wed, 06 July 2011 19:31
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
By: unknown user on Wed, 06 July 2011 23:23
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
By: Zbych on Wed, 06 July 2011 22:19
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
By: mirek on Thu, 07 July 2011 08:19
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
By: mirek on Thu, 07 July 2011 17:40
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
By: mirek on Sat, 30 July 2011 10:11
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
|
 |
|
Re: [DISCUSSION] Add 'complex' datatype, to Value too
By: koldo on Mon, 01 August 2011 09:50
|
Goto Forum:
Current Time: Sun Aug 24 23:21:56 CEST 2025
Total time taken to generate the page: 0.05475 seconds
|