Article View: comp.std.c++
Article #1909size and length
From: Cay Horstmann
Date: Tue, 05 Sep 1995 05:25
Date: Tue, 05 Sep 1995 05:25
16 lines
1169 bytes
1169 bytes
The number of elements in a vector is obtained by size(), the number of elements in a valarray by length() and the number of characters in a string by, you guessed it, either size() or length(). All other STL containers use size(). (There is also a length(const char[]) function in ios_traits, but it is not terribly related to this discussion.) Has the library workgroup spent any conscious thought on this weighty issue, or is all this just an accident? The obvious fix would be to add size(0 as a synonym to length() in valarrays. Cay horstman@cs.sjsu.edu --- [ 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. ]
Technical Details
Message-ID:
<42g8cr$3h6@jupiter.SJSU.EDU>Path:
arc1-ca.pugleaf.net!in1.uu.net!bounce-backShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back Date: 05 Sep 95 05:25:37 GMT Approved: fjh@cs.mu.oz.au From: horstman@jupiter.SJSU.EDU (Cay Horstmann) Newsgroups: comp.std.c++ Subject: size and length X-Original-Date: 5 Sep 1995 01:16:11 GMT Organization: San Jose State University - Math/CS Dept Message-ID: <42g8cr$3h6@jupiter.SJSU.EDU> X-Newsreader: TIN [version 1.2 PL2]