Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » [DISCUSSION] Add 'complex' datatype, to Value too
Re: [DISCUSSION] Add 'complex' datatype, to Value too [message #32935 is a reply to message #32930] Wed, 22 June 2011 13:12 Go to previous messageGo to previous message
kohait00 is currently offline  kohait00
Messages: 939
Registered: July 2009
Location: Germany
Experienced Contributor
here comes a patch file for including complex as an additional basic datatype. thats why i have placed it in Defs.h, though it's 'math' related, but the other data types are math as well, right Smile
it contains the integration of it in Value as far as possible. but due to it beeing a class/struct and having ctor and operator=, it is not possible to use =Null / from-Value-conversion semantics. or at least i havent succeeded to do so. see my ComplexTest.

quick view, maybe anyone has an idea how to make this possible anyway..or leave it as issue.

NOTE: for successfull usage of std::complex (cdouble) in RichValue, the SetNull template usage change is needed. see my thread
http://www.ultimatepp.org/forum/index.php?t=msg&goto=325 14&#msg_32514

attached is a complete patch for that.. (patch8)

	//cdouble to value conversion test
	Value v = RichToValue(y);
	v = y;

	//Value to cdouble conversion test	
//	x = v; //ambiguity in std::complex::operator=
	x = v.operator cdouble(); //needs explicit call
#if flagMSC
	//works for MSC, GCC has constructor amiguity
	x = cdouble(v);
	x = (cdouble)v;
#endif

//	x = Null; //ambiguity in std::complex::operator=
	x = Null.operator cdouble(); //needs explicit call
#if flagMSC
	//works for MSC, GCC has constructor amiguity
	x = cdouble(Null);
	x = (cdouble)Null;
#endif


EDIT:


Topt.h:227
+NTL_MOVEABLE(cdouble);

[Updated on: Wed, 22 June 2011 13:36]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Bugs in Tuple, RemoveSorted and in Scribble Example
Next Topic: PLATFORM_X11 warnings
Goto Forum:
  


Current Time: Mon Jun 16 02:05:55 CEST 2025

Total time taken to generate the page: 0.04571 seconds