POV-Ray : Newsgroups : povray.programming : Object oriented POV scene language? : Re: Object oriented POV scene language? Server Time
28 Jul 2024 18:21:11 EDT (-0400)
  Re: Object oriented POV scene language?  
From: Thorsten Froehlich
Date: 25 Jul 2000 10:44:22
Message: <397da7c6@news.povray.org>
In article <397d8cb8@news.povray.org> , Warp <war### [at] tagpovrayorg>  wrote:

>   What is shorter, to write the 6 lines of code above for every pair of
> structs you use, or just write the swap function directly?
>
>   Perhaps in this case it could be better to have a 'swap' method inside
> the classes/structs, so you could write:
>
>   a.swap(b);

For the swap function this is to long, yes, but what about classes similar
to ones link vector<>, list<> or map<> templates in C++?  While in many
cases good old void pointers will do, it is possible to use macros instead.

Anyway, my point was not that templates are easy and good to do in C, just
that it is possible with a little bit of work to get a lot of features of
C++ in C - and the three lines would be exactly what it would takes to
implement a vector<> template of any class in C.


     Thorsten


____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

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