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 » String [FEATURE REQUEST]
String [FEATURE REQUEST] [message #19418] Tue, 02 December 2008 20:22 Go to next message
amando1957 is currently offline  amando1957
Messages: 57
Registered: November 2007
Location: Wien/Vienna/Viden
Member
Hi to all!

The String is surely topping the std::thingy, but could have two goodies well known from char-pointers:

1
Query if empty with
if (! s) {Cout() << "is empty.\n";}

to wrap the
if (s.GetCount() < 1) {Cout() << "is empty.\n";}


2
With a char-pointer I can do:
char *toRemove = "xxx Some text";
Cout() << (toRemove + 4);

would write "Some text" at screen. Now the String has got
friend String operator+(const String& a, int b) { String c(a); c += b; return c; }

and WString has got
friend WString operator+(const WString& a, char b)

but
Cout() << (s + 4) << '\n';

appends any "fun character" at screen only. Reading the code its no surprise but I cannot see the sense of. I would prefer the same result as with char-pointers.

Martin

Re: String [FEATURE REQUEST] [message #19428 is a reply to message #19418] Wed, 03 December 2008 10:07 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
I am sorry, while it sounds reasonable, it is hitting overloading rules wall. I mean, if you add them, you have nasty problems with overloading ambiguities.

Notes:

if (s.IsEmpty()) {Cout() << "is empty.\n";}


Cout() << (~s + 4) << '\n';


Mirek
Previous Topic: FindFile problem in XP [BUG?]
Next Topic: Console Application NOT WORKS!! And still not works!
Goto Forum:
  


Current Time: Thu Apr 25 12:58:33 CEST 2024

Total time taken to generate the page: 0.02100 seconds