POV-Ray : Newsgroups : povray.off-topic : My first C++ program : Re: A test Server Time
30 Sep 2024 19:29:03 EDT (-0400)
  Re: A test  
From: Invisible
Date: 24 Sep 2008 09:51:18
Message: <48da45d6$1@news.povray.org>
>> Now what happens if you want to only process elements having some 
>> arbitrary property? (E.g., only the odd numbers.)
> 
>   I make the function take a functor which tells which elements to process.
> This is a standard technique in C++.

Right. And now what if the elements to process depends on the 
surrounding context and you have to make several passes of the list to 
identify them?

We're missing my point though. My point is that you can't write a 
specialised implementation for every possible combination of list 
processing operations. But with stream fusion, the compiler can generate 
those for you - and yet the source code stays easily readable and 
modifiably.

>   There are algorithms for which linked lists are the most efficient
> data container. You still don't want to be needlessly copying the elements
> around, though.

Agreed.

This is why people have spent years doing research and coming up with 
sophisticated optimisation techniques. :-)


Post a reply to this message

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