From -3236156337196202530
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,e0a6ddd251fe0f72,start
X-Google-Attributes: gidf78e5,public
From: harald@bion.kth.se (Harald Winroth)
Subject: Inconsistent use of default arguments in string class?
Date: 1995/11/01
Message-ID: <HARALD.95Nov1105205@moon.bion.kth.se>#1/1
X-Deja-AN: 118471447
approved: fjh@cs.mu.oz.au
x-original-date: 01 Nov 1995 09:52:05 GMT
content-type: text/plain; charset=iso-8859-1
organization: CVAP/NADA, Royal Institute of Technology, Stockholm, Sweden
x-auth: PGPMoose V1.1 PGP comp.std.c++
newsgroups: comp.std.c++

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. ]



