Topic: Inconsistent use of default arguments in string class?
Author: harald@bion.kth.se (Harald Winroth)
Date: 1995/11/01 Raw View
I have a question regarding the proposed string class. In the April WP
there are string member functions taking both string and char* arguments.
For example, there are
class basic_string : ... {
...
basic_string& append(const basic_string& str, size_t pos=0,
size_t n=NPOS);
basic_string& append(const charT* s, size_t n);
...
};
As I understand the WP,
str.append("abc123", 3)
would append "abc" to str, while
str.append((string)"abc123", 3)
would append "123" to str. Is that interpretation correct? If so, I think
this could cause a lot of bugs in application code. Is there a good reason
why string member function taking charT* arguments won't also take the
same position/size arguments as their basic_string-argument counterparts?
-----------------------------------------------------------------------------
Harald Winroth | Computational Vision and Active Perception Laboratory,
harald@bion.kth.se | Royal Institute of Technology, S-10044 Stockholm, Sweden
-----------------------------------------------------------------------------
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]