const T& func() const;
Robert Knight
robertknight at gmail.com
Thu Aug 16 06:22:23 BST 2007
> and what's the preformance impact?
Zero surely? For implicitly shared classes ( which KFileMetaInfo is
), the only cost is a pointer copy and reference increment I believe.
And yes, the plan was definitely to go const T& -> T.
On 16/08/07, Nick Shaforostoff <shafff at ukr.net> wrote:
> >it's not possible to later change the function to return
> >a calculated (rather than stored) value.
>
> >In fact, I was fairly sure we were going to go the other way and change
> >const T & -> T.
>
> and what's the preformance impact?
> i suggest to use 'const T&' in core classes or in cases where we know for
> sure that the data will be always cached
> (e.g. it is obvious that we don't want to parse whole file everytime we need
> its metaInfo)
>
More information about the kde-core-devel
mailing list