
10 Dec
2012
10 Dec
'12
12:55 p.m.
On 09.12.2012 17:13, Rob Stewart wrote: >>> - safe bool or explicit bool conversion operator >> I don't think this is a good idea. > Why not? This seems to be not intuitive and not so safe. The std::string has no such operator. >>> - char const * data() >>> - size_t length() >> I propose the alias size(). > string_ref isn't a container like string, so I prefer just length(). Ok. >>> (I think that's a complete list. I'm doing it from memory now.) >> What about pop_back(), pop_front(), swap()? > string_ref isn't a container, so pop_back() and pop_front() are inappropriate. However, back(), front(), and swap() are reasonable. It is not a container (i.e., it does not own the content) but pop_* methods still may remove the characters from it. Btw, there also are [r]find*(), r[c]begin()/r[c]end() and compare() groups of methods in the std::basic_string. >> And again, I propose "substring" instead of "string_ref". > I also have [const_]substring classes which have a different interface, so I disagree. (There is, of course, some overlap.) 1. Are these classes in the Boost library and/or namespace? 2. Do these classes do a different job, or they just have a different interface? -- Sergey Cheban