POV-Ray : Newsgroups : povray.off-topic : STL in public interfaces (C++) : Re: STL in public interfaces (C++) Server Time
7 Sep 2024 11:24:06 EDT (-0400)
  Re: STL in public interfaces (C++)  
From: Warp
Date: 22 May 2008 18:40:25
Message: <4835f659@news.povray.org>
Nicolas Alvarez <nic### [at] gmailcom> 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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.