Thread View: comp.std.c++
3 messages
3 total messages
Started by Rich Paul
Fri, 12 Apr 1996 14:57
char_traits<T> return values
Author: Rich Paul
Date: Fri, 12 Apr 1996 14:57
Date: Fri, 12 Apr 1996 14:57
23 lines
1720 bytes
1720 bytes
I have noticed, while working on the standard string class, that the char_traits functions copy, move, etc, would be much more useful if they returned a pointer to the END of the area in which they worked, rather than to the beginning. I know c liked to return the pointers you gave it when it was done with them, but isn't there something more useful that could be done? Also, when these functions get a string that contains eos(), do they stop, or do they carry on to the bitter end? -- #include <legalbs/standarddisclaimer> Rich Paul | If you like what I say, tell my C++, OOD, OOA, OOP, | employer, but if you don't, OOPs, I forgot one ... | don't blame them. ;-> [ comp.std.c++ is moderated. To submit articles: try just posting with ] [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ] [ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ] [ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ] [ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Re: char_traits<T> return values
Author: Nathan Myers ncm
Date: Sat, 13 Apr 1996 23:17
Date: Sat, 13 Apr 1996 23:17
22 lines
1681 bytes
1681 bytes
Rich Paul wrote: > I have noticed, while working on the standard string class, that the > char_traits functions ... > ... when these functions get a string that contains eos(), do they > stop, or do they carry on to the bitter end? C++ strings don't pass judgment on what's in them; eos() is used purely as the value to slap onto the end when producing a c_str() value, or the terminator when constructing from a const char*. It only matters when you convert back via c_str(); then, of course, to C the string will look shorter than it is. Tough. Nathan Myers ncm@cantrip.org http://www.cantrip.org/ [ comp.std.c++ is moderated. To submit articles: try just posting with ] [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ] [ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ] [ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ] [ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Re: char_traits<T> return values
Author: Rich Paul
Date: Mon, 15 Apr 1996 16:37
Date: Mon, 15 Apr 1996 16:37
16 lines
1457 bytes
1457 bytes
Nathan Myers <ncm@cantrip.org> wrote:
> It only matters when you convert back via c_str(); then, of course,
> to C the string will look shorter than it is. Tough.
Aha ... well, that solves the length cacheing problem ... given
that operator[] could insert an eos() I've been avoiding keeping
track of string length ... well that's a wrinkle.
Thanks alot fo the input!
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads