Gent's,

I was wondering the same.

A templated Vec class isn't all that hard to implement and maintain, it's 
pretty straight forward.  What's a pain is a templated Matrix class, although 
totally doable (from experience).  I would gladly help if someone wanted to 
start taking on the task.

-B


-----Original Message-----
From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Mathias Goldau
Sent: Friday, October 22, 2010 6:46 AM
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] Why is Vec not a template?

Am 22.10.2010 14:37, Robert Osfield wrote:
> Hi Mathias,
> 
> On Fri, Oct 22, 2010 at 1:01 PM, Mathias Goldau
> <m...@informatik.uni-leipzig.de> wrote:
>> I just wondered why Vec3 and related Vec classes are all different classes 
>> and
>> why they aren't realized as templates?
> 
> Because templates aren't always the perfect tool for the job.
>
> Three main reasons : specialization of types required in various
> methods makes templates more awkward to write and maintain, secondly
> templates are slow to compile - the more low level templates you use
> the greater the slow down,  and finally templates are pain in the butt
> to decifer when you get compile errors.

ok, I could imagine that at least the value_type for all Vec3 derivates would
be a good choice for a template, since the operations for Vec3f and Vec3d,
etc. are exactly the same (I guess).
I really could imagine that a template< size_t, typename value_type > is
indeed really awkward and hard to maintain. But so you will have much more
code duplication.
In point of compile time: Hmm the Vec[2-4] classes are not very big, there are
many other templates in OSG which have much higher complexity.

Mathias

-- 
Institut für Informatik
Universität Leipzig
Johannisgasse 26, 04103 Leipzig
Phone: +493419732283
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to