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 » Suggestion for StringBuffer
Re: Suggestion for StringBuffer [message #45084 is a reply to message #44904] Sat, 29 August 2015 07:36 Go to previous message
mirek is currently offline  mirek
Messages: 14261
Registered: November 2005
Ultimate Member
Hi,

after carefully considering this, I tentatively decided it is not a good idea:

a) by adding StringBuffer(const String& s) the action that is going to happen would be quite strangely defined. Consider

void Fn(const String& p) { StringBuffer b(p); }


vs

void Fn(String p) { StringBuffer b(p); }


I would say this would be a great source of accidental errors...

b) Set is in function almost identical to Cat

So, if you need to assign data now, you can use

String s;
StringBuffer b;
b.Cat(s);


I think this is sufficient.

Anyway, all of this is not final. But if I could be convinced we need anything new here, I would rather use

StringBuffer(const String& s, int); // standard way of saying 'deep copy'
void Set(const String& s) { Clear(); Cat(s); } // simpler implementation


Mirek
 
Read Message
Read Message
Previous Topic: Dehaviour of DirectoryExists
Next Topic: VectorMap.Get
Goto Forum:
  


Current Time: Mon Jun 23 16:00:56 CEST 2025

Total time taken to generate the page: 0.04594 seconds