[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Toon-members] Question, Function with Reference?
From: |
E. Rosten |
Subject: |
Re: [Toon-members] Question, Function with Reference? |
Date: |
Mon, 26 Oct 2009 18:28:13 +0000 (GMT) |
User-agent: |
Alpine 2.00 (LSU 1167 2008-08-23) |
On Mon, 26 Oct 2009, Gabriel Nützi wrote:
Hello
I am a bit confused about the syntax for writting functions with TooN. I have
read the FAQ, but did not get it well...
what I do is I have
void func( Vector<>a);
Matrix<> myMatrix(4,3);
which is called with func( (Vector<>) myMatrix[1] )
this does only work,
but what do I have to do to make this more correct or better to the templates
with toon?
When I write:
template<int size, typename Base> void func( Vector<size,double,Base>
a);
How do I call now the function with myMatrix[1] ?
I get linking errors
You need to put the complete code for:
template<int size, typename Base> void func( Vector<size,double,Base> >
a);
into the header file. Then the compiler can generate the code you need and
you won't get link errors. As an added bonus, the compiler sill also be
able to do a better job of optimization.
-Ed
--
(You can't go wrong with psycho-rats.)(http://mi.eng.cam.ac.uk/~er258)
/d{def}def/f{/Times s selectfont}d/s{11}d/r{roll}d f 2/m{moveto}d -1
r 230 350 m 0 1 179{ 1 index show 88 rotate 4 mul 0 rmoveto}for/s 12
d f pop 235 420 translate 0 0 moveto 1 2 scale show showpage