I don't know how odd this is, but I need to have the
differentiation of a template happen in the implementation
code, not in the header file. Confused? I'm trying to
develop a template class called point. A point can have
2, 3 or 6 dimensions. Two dimensions as in a location on
a graph or chart, three dimensions if the point is in the
air and the point would have six dimensions if it also has
an orientation. I'm not a mathematician, Ed, the
mathematician may find a need for 4 and 5 dimensions as
well.
The differentiation happens in the header file to declare
an array of the correct size. But it also needs to happen
in the implementation code since a cross product(?) only
makes sense for a pair of three dimensional points, etc.
I have some beginning test code trying to work this out.
This is the header file:
// SimpleTemplate.h: interface for the Simple class.
//
//////////////////////////////////////////////////////////////////////
#if !defined SIMPLETEMPLATE_H
#define SIMPLETEMPLATE_H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
template <int NUMDIMS>
class SimpleTemplate
{
public:
SimpleTemplate();
SimpleTemplate(double);
virtual ~SimpleTemplate();
void show();
/*
* methods dependent on number of dimensions
*
* I'm doubtful this is actually the appropriate
* syntax, but it might get the notion across
*/
#if NUMDIMS == 2
// dotproduct
#endif
#if NUMDIMS == 3
// crossproduct
#endif
#if NUMDIMS == 6
// something else
#endif
private:
double p[NUMDIMS];
};
#endif // SIMPLETEMPLATE_H
This is the implementation file:
// SimpleTemplate.cpp: implementation of the Simple class.
//
//////////////////////////////////////////////////////////////////////
#include "SimpleTemplate.h"
#include <iostream>
using namespace std;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
SimpleTemplate<NUMDIMS>::SimpleTemplate()
{
for (int i=0; i< NUMDIMS; i++)
{
p[i] = i;
}
}
SimpleTemplate::SimpleTemplate(int i1)
{
for (int i=0; i< NUMDIMS; i++)
{
p[i] = i1;
}
}
SimpleTemplate::~Simple()
{
}
void SimpleTemplate::show()
{
for (int i=0; i< NUMDIMS; i++)
{
cout << "p[" << i << "] = " << p[i] << endl;
}
}
The error I'm getting for the first method (the constructor)
is "SimpleTemplate' : use of class template requires template
argument list". I've also tried
SimpleTemplate::SimpleTemplate<int NUMDIMS> () with similiar
results.
So I suppose my number one (and two) question is how do I
implement templates in code and can I have some sort of
control flow on what methods are generated?
--
Take care | This clown speaks for himself, his job doesn't
Wayne D. | pay for this, etc. (directly anyway)
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
0
|
|
|
|
Reply
|
Wayne
|
11/13/2003 9:30:26 PM |
|
> The error I'm getting for the first method (the constructor)
> is "SimpleTemplate' : use of class template requires template
> argument list". I've also tried
> SimpleTemplate::SimpleTemplate<int NUMDIMS> () with similiar
> results.
Define the member functions of your class template like this:
template<int NUMDIMS>
SimpleTemplate<NUMDIMS>::SimpleTemplate()
{
//...
}
template<int NUMDIMS>
void SimpleTemplate<NUMDIMS>::show()
{
//...
}
>
> So I suppose my number one (and two) question is how do I
> implement templates in code and can I have some sort of
> control flow on what methods are generated?
>
You can use member templates.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
0
|
|
|
|
Reply
|
Jack
|
11/14/2003 10:55:31 AM
|
|
Wayne,
First, you have a syntax error. If you define a class as taking an
int as a template parameter (as you have here), then the definition
for a member function should be
void SimpleTemplate<int NUMDIMS>::func() { /* ... */ }
not
void SimpleTemplate<NUMDIMS>::func() { /* ... */ }
Second, I think it would be better to use an unsigned integer - what
would it mean if a user supplied a dimension of -3?
Third, if you want to separate the template function bodies from the
class definition, don't try to do it using a .cpp file which includes
the header at the top. This works fine for normal classes, but for
templates, the bodies of all functions must be visible to the compiler
when it parses the header. So, either tack them onto the end of the
header, or put the bodies in a separate file (say, a .hxx file), and
include that at the end of the header, i.e.
// Header file myclass.h
template<size_t N> class MyClass {
/* Class definition - function prototypes etc */
};
#include "myclass.hxx"
// Implementation file myclass.hxx
/* Function bodies go here.... */
Now, this is a classic case for template specialisation. You have a
class which is templated on a value (NUMDIMS). Most of the functions
of the class have the same behaviour for all values of this parameter
- except the product function, which must be different for different
dimensionalities. Therefore, you can specialise one function (say,
product), for the different values. I'd write it like this:
// Header file simple.h
#ifndef SIMPLETEMPLATE_H
#define SIMPLETEMPLATE_H
#include <cstddef>
template <size_t NUMDIMS>
class SimpleTemplate {
public:
SimpleTemplate() { }
SimpleTemplate(double d)
{ for(size_t i=0; i<NUMDIMS; ++i) p[i] = d; }
virtual ~SimpleTemplate() { }
// Just define one product function - we will
// use specialisation to do the appropriate
// computations for each number of dimensions
SimpleTemplate product(const SimpleTemplate&);
private:
double p[NUMDIMS];
};
#include "simple.hxx"
#endif
// Implementation file simple.hxx
#include <iostream>
template<>
SimpleTemplate<2>
SimpleTemplate<2>::product(const SimpleTemplate& rhs) {
std::cout << "NUMDIMS=2: Doing dot product..." << std::endl;
SimpleTemplate t;
/* Dot product code here */
return t;
}
template<>
SimpleTemplate<3>
SimpleTemplate<3>::product(const SimpleTemplate& rhs) {
std::cout << "NUMDIMS=3: Doing cross product..." << std::endl;
SimpleTemplate t;
/* Cross product code here */
return t;
}
template<>
SimpleTemplate<6>
SimpleTemplate<6>::product(const SimpleTemplate& rhs) {
std::cout << "NUMDIMS=6: Doing something else..." << std::endl;
SimpleTemplate t;
/* Something else code here */
return t;
}
// Main function
#include "simple.h"
int main() {
SimpleTemplate<2> s2a, s2b, s2c;
s2c = s2a.product(s2b);
SimpleTemplate<3> s3a, s3b, s3c;
s3c = s3a.product(s3b);
SimpleTemplate<6> s6a, s6b, s6c;
s6c = s6a.product(s6b);
}
Note that there is no implementation of the generic templated version
of product - only explicit specialisations are written. So if a
client tries to write
SimpleTemplate<5> t1, t2, t3;
t3 = t1.product(t2);
the compiler will choke on the product statement.
Gareth
P.S. The product function above would be better written as a friend of
the SimpleTemplate class, but specialising template friend functions
is a whole new can of worms as not all compilers support the standard
syntax.
Wayne Dernoncourt <wayned@panix.com> wrote in message news:<bouo2e$2bd$1@reader2.panix.com>...
> I don't know how odd this is, but I need to have the
> differentiation of a template happen in the implementation
> code, not in the header file. Confused? I'm trying to
> develop a template class called point. A point can have
> 2, 3 or 6 dimensions. Two dimensions as in a location on
> a graph or chart, three dimensions if the point is in the
> air and the point would have six dimensions if it also has
> an orientation. I'm not a mathematician, Ed, the
> mathematician may find a need for 4 and 5 dimensions as
> well.
>
> The differentiation happens in the header file to declare
> an array of the correct size. But it also needs to happen
> in the implementation code since a cross product(?) only
> makes sense for a pair of three dimensional points, etc.
>
> I have some beginning test code trying to work this out.
>
> This is the header file:
> // SimpleTemplate.h: interface for the Simple class.
> //
> //////////////////////////////////////////////////////////////////////
>
> #if !defined SIMPLETEMPLATE_H
> #define SIMPLETEMPLATE_H
>
> #if _MSC_VER > 1000
> #pragma once
> #endif // _MSC_VER > 1000
>
> template <int NUMDIMS>
> class SimpleTemplate
> {
> public:
> SimpleTemplate();
> SimpleTemplate(double);
> virtual ~SimpleTemplate();
>
> void show();
>
> /*
> * methods dependent on number of dimensions
> *
> * I'm doubtful this is actually the appropriate
> * syntax, but it might get the notion across
> */
> #if NUMDIMS == 2
> // dotproduct
> #endif
>
> #if NUMDIMS == 3
> // crossproduct
> #endif
>
> #if NUMDIMS == 6
> // something else
> #endif
>
>
> private:
> double p[NUMDIMS];
> };
>
> #endif // SIMPLETEMPLATE_H
>
> This is the implementation file:
> // SimpleTemplate.cpp: implementation of the Simple class.
> //
> //////////////////////////////////////////////////////////////////////
>
> #include "SimpleTemplate.h"
>
> #include <iostream>
> using namespace std;
>
> //////////////////////////////////////////////////////////////////////
> // Construction/Destruction
> //////////////////////////////////////////////////////////////////////
>
> SimpleTemplate<NUMDIMS>::SimpleTemplate()
> {
> for (int i=0; i< NUMDIMS; i++)
> {
> p[i] = i;
> }
> }
>
> SimpleTemplate::SimpleTemplate(int i1)
> {
> for (int i=0; i< NUMDIMS; i++)
> {
> p[i] = i1;
> }
> }
>
> SimpleTemplate::~Simple()
> {
>
> }
>
> void SimpleTemplate::show()
> {
> for (int i=0; i< NUMDIMS; i++)
> {
> cout << "p[" << i << "] = " << p[i] << endl;
> }
> }
>
> The error I'm getting for the first method (the constructor)
> is "SimpleTemplate' : use of class template requires template
> argument list". I've also tried
> SimpleTemplate::SimpleTemplate<int NUMDIMS> () with similiar
> results.
>
> So I suppose my number one (and two) question is how do I
> implement templates in code and can I have some sort of
> control flow on what methods are generated?
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
0
|
|
|
|
Reply
|
gareth
|
11/14/2003 6:41:49 PM
|
|
Wayne Dernoncourt wrote:
> I don't know how odd this is, but I need to have the
> differentiation of a template happen in the implementation
> code, not in the header file.
Be sure to read the FAQ at parashift's.
> I'm trying to develop a template class called point. A point
> can have 2, 3 or 6 dimensions.
>
> The differentiation happens in the header file to declare
> an array of the correct size. But it also needs to happen
> in the implementation code since a cross product(?) only
> makes sense for a pair of three dimensional points, etc.
> template <int NUMDIMS>
> class SimpleTemplate
> {
> public:
> SimpleTemplate();
> SimpleTemplate(double);
> virtual ~SimpleTemplate();
^^^^^^^ You probably don't want that.
> /*
> * methods dependent on number of dimensions
> *
> * I'm doubtful this is actually the appropriate
> * syntax, but it might get the notion across
> */
> #if NUMDIMS == 2
> // dotproduct
> #endif
This won't work like that. NUMDIMS is not a preprocessor constant. What you
can do is declare dotproduct (for all dimensions) and only implement it
for 2D. It will then fail while linking. Alternatively you might be able
to use something like boost's BOOST_STATIC_ASSERT() which is (afair) a
compile-time assertion that will make the invalid versions
unintantiatable.
Just a side-note: you might be better off with a (free) function,
overloaded for all points that support the dotproduct. The reason is that
there is no such thing as 'the point' in that operation, they are both
logically equal.
Uli
--
Questions ?
see C++-FAQ Lite: http://parashift.com/c++-faq-lite/ first !
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
0
|
|
|
|
Reply
|
Ulrich
|
11/15/2003 1:15:09 AM
|
|
> I don't know how odd this is, but I need to have the
> differentiation of a template happen in the implementation
> code, not in the header file. Confused? I'm trying to
> develop a template class called point. A point can have
> 2, 3 or 6 dimensions. Two dimensions as in a location on
> a graph or chart, three dimensions if the point is in the
> air and the point would have six dimensions if it also has
> an orientation. I'm not a mathematician, Ed, the
> mathematician may find a need for 4 and 5 dimensions as
> well.
>
> The differentiation happens in the header file to declare
> an array of the correct size. But it also needs to happen
> in the implementation code since a cross product(?) only
> makes sense for a pair of three dimensional points, etc.
Maybe it's something like the following. First declare the pointclass
and then two different operator*, one for NUMDIMS=2, one for the three-
dimensional case and one for the six-dimensions.
template <int NUMDIMS>
struct SimpleTemplate
{
SimpleTemplate(double x = 0)
{
for (int i = 0 ; i < NUMDIMS ; i++)
p[i] = x ;
}
void show()
{
for (int i = 0 ; i < NUMDIMS ; i++)
cout << "p[" << i << "] = " << p[i] << endl;
}
double p[NUMDIMS];
};
// product operators
// dot product for NUMDIMS = 2
double operator*(const SimpleTemplate<2> &lhs, const SimpleTemplate<2>
&rhs)
{
return lhs.p[0] * rhs.p[0] + lhs.p[1] * rhs.p[1] ;
}
// cross product for NUMDIMS = 3
SimpleTemplate<3> operator*(const SimpleTemplate<3> &lhs, const
SimpleTemplate<3> &rhs)
{
SimpleTemplate<3> result ;
//
// dont't bother the math. I am not sure of it and does not matter here
//
result.p[0] = lhs.p[1] * rhs.p[2] - lhs.p[2] * rhs.p[1] ; result.p[1] =
....???...
result.p[2] = ...???...
return result ;
}
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
0
|
|
|
|
Reply
|
Marco
|
11/15/2003 1:15:55 AM
|
|
Gareth Stockwell <gareth@ebi.ac.uk> wrote:
> Wayne,
> First, you have a syntax error. If you define a class as taking an
> int as a template parameter (as you have here), then the definition
> for a member function should be
> void SimpleTemplate<int NUMDIMS>::func() { /* ... */ }
> not
> void SimpleTemplate<NUMDIMS>::func() { /* ... */ }
I may have tried that when I went to work the next morning.
Correct, I have syntax errors. I wasn't sure why. It turns out
the key was that there isn't a cpp file, everything happens in
the header file. Visual C++ anyway had a problem in that regards.
My officemate and I sat down with the code and looked it over
and reading through assorted books. Mike found a line in Eckel's
"Thinking in C++" that said basically "Using a template is one
place where you put implementation code _in_ a header file."
> Second, I think it would be better to use an unsigned integer - what
> would it mean if a user supplied a dimension of -3?
Again, correct, at the time I was trying to figure out how
templates worked.
> Third, if you want to separate the template function bodies from the
> class definition, don't try to do it using a .cpp file which includes
> the header at the top. This works fine for normal classes, but for
> templates, the bodies of all functions must be visible to the compiler
> when it parses the header. So, either tack them onto the end of the
> header, or put the bodies in a separate file (say, a .hxx file), and
> include that at the end of the header, i.e.
So I found out, I didn't have a clue for the reasoning behind it
other than "That's the way it is."
<snippage>
> Now, this is a classic case for template specialisation. You have a
> class which is templated on a value (NUMDIMS). Most of the functions
> of the class have the same behaviour for all values of this parameter
> - except the product function, which must be different for different
> dimensionalities. Therefore, you can specialise one function (say,
> product), for the different values. I'd write it like this:
looks like I'm going to have some reading/studying to do
on Monday.
<more snippage>
> Note that there is no implementation of the generic templated version
> of product - only explicit specialisations are written. So if a
> client tries to write
> SimpleTemplate<5> t1, t2, t3;
> t3 = t1.product(t2);
> the compiler will choke on the product statement.
Hmmm, I'm not sure I understand this and may come back after
doing some experimentation.
> P.S. The product function above would be better written as a friend of
> the SimpleTemplate class, but specialising template friend functions
> is a whole new can of worms as not all compilers support the standard
> syntax.
I know what friends are (in the C++ sense), but I don't know
that I've ever used one. It's true, I haven't written much
C++ code in years!
Next is a question about porting philosophies, but that
will be another thread.
--
Take care | This clown speaks for himself, his job doesn't
Wayne D. | pay for this, etc. (directly anyway)
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
0
|
|
|
|
Reply
|
Wayne
|
11/15/2003 10:00:55 AM
|
|
Wayne Dernoncourt <wayned@panix.com> wrote
> I don't know how odd this is, but I need to have the
> differentiation of a template happen in the implementation
> code, not in the header file.
Which is already a warning sign that templates might not be the
best solution to your problem. Another warning sign is the fact
that some of your template classes need functions that are not
needed in others (dotproduct, crossproduct, etc).
Consider writing three classes called point2, point3, and point6.
> I have some beginning test code trying to work this out.
>
> This is the header file:
> template <int NUMDIMS>
> class SimpleTemplate
> {
> public:
> SimpleTemplate();
> SimpleTemplate(double);
> virtual ~SimpleTemplate();
>
> void show();
>
> /*
> * methods dependent on number of dimensions
> *
> * I'm doubtful this is actually the appropriate
> * syntax, but it might get the notion across
> */
> #if NUMDIMS == 2
> // dotproduct
> #endif
>
> #if NUMDIMS == 3
> // crossproduct
> #endif
>
> #if NUMDIMS == 6
> // something else
> #endif
As at least one other person has already pointed out, you can't
do this. Perhaps you don't really want a template.
If you DO want a template, this isn't the right way to do it.
Instead, have one member function called "product." Don't define
it in the general case, but only in specializations.
template <int NUMDIMS>
class SimpleTemplate {
double p[NUMDIMS];
public:
SimpleTemplate();
virtual ~SimpleTemplate();
void show();
};
template <>
SimpleTemplate<2> operator*(
const SimpleTemplate<2>&lhs,
const SimpleTemplate<2>&rhs) {
SimpleTemplate<2> result;
// Multiply two SimpleTemplate<2>'s into result -- dot product
}
template <>
SimpleTemplate<3> operator*(
const SimpleTemplate<3>&lhs,
const SimpleTemplate<3>&rhs) {
SimpleTemplate<3> result;
// Multiply two SimpleTemplate<3>'s into result -- cross product
}
template <>
SimpleTemplate<6> operator*(
const SimpleTemplate<6>&lhs,
const SimpleTemplate<6>&rhs) {
SimpleTemplate<6> result;
// Multiply two SimpleTemplate<6>'s into result -- "something else"
}
OR, the non-template way:
class SimpleTemplate2 {
double p[2];
public:
SimpleTemplate2();
virtual ~SimpleTemplate();
void show();
};
SimpleTemplate2 operator*(
const SimpleTemplate2&lhs,
const SimpleTemplate2&rhs) {
SimpleTemplate2 result;
// Multiply two SimpleTemplate2's into result -- dot product
}
SimpleTemplate3 operator*(
const SimpleTemplate3&lhs,
const SimpleTemplate3&rhs) {
SimpleTemplate3 result;
// Multiply two SimpleTemplate3's into result -- cross product
}
SimpleTemplate6 operator*(
const SimpleTemplate6&lhs,
const SimpleTemplate6&rhs) {
SimpleTemplate6 result;
// Multiply two SimpleTemplate6's into result -- "something else"
}
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
0
|
|
|
|
Reply
|
allan_w
|
11/18/2003 4:26:34 PM
|
|
Allan W <allan_w@my-dejanews.com> wrote:
> Wayne Dernoncourt <wayned@panix.com> wrote
> > I don't know how odd this is, but I need to have the
> > differentiation of a template happen in the implementation
> > code, not in the header file.
> Which is already a warning sign that templates might not be the
> best solution to your problem. Another warning sign is the fact
> that some of your template classes need functions that are not
> needed in others (dotproduct, crossproduct, etc).
<snip>
I'm not sure if this is going to work or not. It turns out
one application uses the dot product method and I haven't
found anything that uses cross product. There is also a
math vector class (which is different from a C++ Vector
from the STL, that's a container). Both dot product and
cross product are math matrix/vector operations. Why
aren't those methods there instead?
The way the current class structure that I'm trying to
replace with templates is accepted by most people to be a
kluge. There is a file, a.h, that is the following:
/*
* a.h
*/
class SIMPLEVARYCLASS {
public:
SIMPLEVARYCLASS();
~SIMPLEVARYCLASS();
#if (NUMDIMS == 2)
dotProduct( SIMPLEVARYCLASS){};
#endif
#if (NUMDIMS == 3)
crossProduct (SIMPLEVARYCLASS) {};
#endif
// more stuff follows
private:
pDataType _p[NUMDIMS];
};
This code is used as follows:
/*
* b.h
*/
#define SIMPLEVARYCLASS SimpleTemplate2D
#define NUMDIMS 2
#include "a.h"
#undef SIMPLEVARYCLASS
#undef NUMDIMS
#define SIMPLEVARYCLASS SimpleTemplate3D
#define NUMDIMS 3
#include "a.h"
#undef SIMPLEVARYCLASS
#undef NUMDIMS
#define SIMPLEVARYCLASS SimpleTemplate6D
#define NUMDIMS 6
#include "a.h"
#undef SIMPLEVARYCLASS
#undef NUMDIMS
The current discussion is should the existing code base be
ported as it stands. That is, the method dotProduct which
is in the SimpleTemplate class, should it be there or should
it be moved to the math vector class? The current code has
a way to read and write ASCII and binary objects - I don't
know that we've ever used that, but we might so Ed want's
to keep it.
Once we get code working, in whatever form it is, I doubt
it will be changed. Ed says we can redesign the codebase
after code has been ported. What is the experience of the
guys here? Should cleaing up code be done while it's being
ported or wait until the porting is done?
--
Take care | This clown speaks for himself, his job doesn't
Wayne D. | pay for this, etc. (directly anyway)
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
0
|
|
|
|
Reply
|
Wayne
|
11/19/2003 8:53:11 PM
|
|
Wayne Dernoncourt <wayned@panix.com> wrote:
> I'm not sure if this is going to work or not. It turns out
> one application uses the dot product method and I haven't
> found anything that uses cross product. There is also a
> math vector class (which is different from a C++ Vector
> from the STL, that's a container). Both dot product and
> cross product are math matrix/vector operations. Why
> aren't those methods there instead?
Parts of this post are seriously incoherent!
You guys already know what a vector class is. You
also probably know that a C++ vector is different
than a mathematical vector.
That should be me asking myself and the rest of my team
"why they aren't in the math/vector class instead of
the point class (this was called the SimpleTemplate)
class". As in 2D point, 3D point and 6D point.
> The way the current class structure that I'm trying to
> replace with templates is accepted by most people to be a
> kluge. There is a file, a.h, that is the following:
This should be "accepted by most people here to be a kluge"
> /*
> * a.h
> */
> class SIMPLEVARYCLASS {
> public:
> SIMPLEVARYCLASS();
> ~SIMPLEVARYCLASS();
> #if (NUMDIMS == 2)
> dotProduct( SIMPLEVARYCLASS){};
> #endif
> #if (NUMDIMS == 3)
> crossProduct (SIMPLEVARYCLASS) {};
> #endif
> // more stuff follows
> private:
> pDataType _p[NUMDIMS];
> };
> This code is used as follows:
> /*
> * b.h
> */
> #define SIMPLEVARYCLASS SimpleTemplate2D
> #define NUMDIMS 2
> #include "a.h"
> #undef SIMPLEVARYCLASS
> #undef NUMDIMS
> #define SIMPLEVARYCLASS SimpleTemplate3D
> #define NUMDIMS 3
> #include "a.h"
> #undef SIMPLEVARYCLASS
> #undef NUMDIMS
> #define SIMPLEVARYCLASS SimpleTemplate6D
> #define NUMDIMS 6
> #include "a.h"
> #undef SIMPLEVARYCLASS
> #undef NUMDIMS
> The current discussion is should the existing code base be
> ported as it stands. That is, the method dotProduct which
> is in the SimpleTemplate class, should it be there or should
> it be moved to the math vector class? The current code has
> a way to read and write ASCII and binary objects - I don't
> know that we've ever used that, but we might so Ed want's
> to keep it.
At work, the current discussion is "should the existing code
base be ported as it stands, with extraneous methods/classes,
etc. or should there be some redesign at the same time?"
> Once we get code working, in whatever form it is, I doubt
> it will be changed. Ed says we can redesign the codebase
> after code has been ported. What is the experience of the
> guys here? Should cleaing up code be done while it's being
> ported or wait until the porting is done?
In your experiences, how often have teams gone back into
working code to reduce & eliminate cruft?
--
Take care | This clown speaks for himself, his job doesn't
Wayne D. | pay for this, etc. (directly anyway)
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
0
|
|
|
|
Reply
|
Wayne
|
11/20/2003 11:22:53 AM
|
|
|
8 Replies
104 Views
(page loaded in 0.138 seconds)
|