POV-Ray : Newsgroups : povray.off-topic : C++ questions : Re: C++ questions Server Time
7 Sep 2024 05:09:40 EDT (-0400)
  Re: C++ questions  
From: Warp
Date: 30 Sep 2008 11:55:51
Message: <48e24c07@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
>   Actually if you have a function like:

>     std::vector<int> createVector(whatever) { ... }

> and then call it like:

>     std::vector<int> myVector = createVector(whatever);

> the compiler will most probably be able to optimize the copying away.

  Oh, and I forgot to say: The compiler doesn't even need to see the
implementation of 'createVector()' in order to do this optimization.
In other words, the compiler doesn't require to be able to inline that
function to do the optimization. The implementation of that function
could be in another compilation unit, or it could even be in a
precompiled library.

-- 
                                                          - Warp


Post a reply to this message

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