"Stuart Golodetz" <sg*******@NdOi SaPlA.pMiPpLeEx A.ScEomwrote in message
news:SK******** *************** *******@pipex.n et...
As far as the first question goes (and just off the top of my head), youthis works well, thank you.
may be able to avoid partially specializing Curve if you define a
templated DataContainer type and partially specialize that instead. In
other words, something like:
template <typename Interpolatorstr uct DataContainer;
template <struct DataContainer<C onstant>
{
typedef std::map<double ,doubletype;
};
etc.
template <typename Interpolator, typename Extrapolator, typename
Integrator>
class Curve
{
// can use (typename) DataContainer<I nterpolator>::t ype here
};
Just a thought anyway...
Note that this provides one possible solution to your problem with the
function signatures: for example, Constant::inter polate now takes a
DataContainer<C onstant>& as its first argument, etc.
i have 1 more question:
I would do this:
template <struct DataContainer<C onstant>
{
typedef std::map<double ,doubletype;
};
and
template <struct DataContainer<P loynomial>
{
typedef struct {
double* data[2];
size_t size;
} type;
};
However, in Curve<Polynomia l>, i have
double& operator(double x); // to insert a new x in the tabulated data
for Constant with map, this is trivial {
return map[x];
}
for Polynomial, with double*[2]
i have to manage it myself, the sorting/inserting into the array,
it seems like redundant work thatt can be done better by stdlib c++
is there a way to get double*[2] frm map<double, double(i cuold write it)
should i keep both map<double, doubleand the double*[2] for the case of
Poynomial,
using the map for inserting, and then using the double*[2] to do the
interpolation
(because it requires random access iterators)
rds,