Nicolas Alvarez <nic### [at] gmail com> wrote:
> The question is: assuming I use a std::string to keep that data internally,
> should my getter return a const std::string or a const char* (by calling
> c_str())? Note it would be const in any case (I should have mentioned this
> in my original message).
Returning a const char* would be useless overhead if your data is already
in a std::string, and would only potentially cause the calling code to be
considerably slower (for example if the calling code wants to know the
size of the string).
--
- Warp
Post a reply to this message
|