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 » Community » Coffee corner » Little Quiz
Little Quiz [message #57757] Thu, 09 December 2021 09:57 Go to next message
mirek is currently offline  mirek
Messages: 13986
Registered: November 2005
Ultimate Member
What does this mean:

DropList dl;
...
if(*~~dl == '$') ...
Re: Little Quiz [message #57758 is a reply to message #57757] Thu, 09 December 2021 10:19 Go to previous messageGo to next message
Tom1
Messages: 1217
Registered: March 2007
Senior Contributor
Hi,

Is it the short version for e.g.:
if(((const char*)dl.Get())[0] == '$') 

?

Best regards,

Tom
Re: Little Quiz [message #57760 is a reply to message #57758] Thu, 09 December 2021 10:51 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13986
Registered: November 2005
Ultimate Member
Tom1 wrote on Thu, 09 December 2021 10:19
Hi,

Is it the short version for e.g.:
if(((const char*)dl.Get())[0] == '$') 

?

Best regards,

Tom


Almost correct.
Re: Little Quiz [message #57769 is a reply to message #57757] Fri, 10 December 2021 22:22 Go to previous messageGo to next message
Lance is currently offline  Lance
Messages: 536
Registered: March 2007
Contributor
the inner ~ is
DropList::operator ~

which inherits
Value Ctrl::operator ~()(maybe const modifier?)


the outer ~ is
String Value::operator~()(const modifier?)


the * cause a auto type cast be called
String::operatr const char * ()(modifier?);

and then dereference of the returned constant char * returns the first char in the String.

something like
Value t1=~dl;
String t2=~t1;
const char* t3=(const char*)t2;
char t4=*t3;
if(t3=='$')

Re: Little Quiz [message #57779 is a reply to message #57769] Mon, 13 December 2021 15:53 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13986
Registered: November 2005
Ultimate Member
* is String::operator*

Otherwise solved Smile
Re: Little Quiz [message #57800 is a reply to message #57779] Sat, 18 December 2021 05:47 Go to previous messageGo to next message
Lance is currently offline  Lance
Messages: 536
Registered: March 2007
Contributor
Very Happy

Didnot realise there is an operator * defined.

BTW, if there is no operator *, will the route suggested by my previous post be taken? IE, will * cause a implicit type case operator by called? I guess so.
Re: Little Quiz [message #57801 is a reply to message #57800] Sat, 18 December 2021 09:07 Go to previous message
mirek is currently offline  mirek
Messages: 13986
Registered: November 2005
Ultimate Member
It indeed is. I guess that operator* is there from times when compilers were not up to the task.
Previous Topic: Now this is pretty cool
Next Topic: Quiz #4
Goto Forum:
  


Current Time: Sun Jun 23 11:15:01 CEST 2024

Total time taken to generate the page: 0.01797 seconds