POV-Ray : Newsgroups : povray.off-topic : My first C++ program : Re: My first C++ program Server Time
30 Sep 2024 13:21:18 EDT (-0400)
  Re: My first C++ program  
From: Invisible
Date: 19 Sep 2008 09:35:35
Message: <48d3aaa7$1@news.povray.org>
>> I also find myself constantly cursing that I have to write an entire 5 
>> lines of (nearly identical) code for every arithmetic operation I want 
>> to implement and there's no way to abstract this. (I don't have copy & 
>> paste available!)
> 
> What you could do, is have a function like DoOperation(stack,op), and 
> use "op" as a token for the operation.

I wrote a function that returns the top element from the stack while 
simultaneously removing it. That cuts down the typing quite a bit.

Note to self: Do *not* attempt to remove an element from an empty vector...


Post a reply to this message

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