P
Peter Ammon
I have a template class:
#include <cassert>
#include <algorithm>
template <class T, int N>
class Point {
private:
T components[N];
public:
T& operator[](unsigned x) {
assert(x < N);
return components[x];
}
const T& operator[](unsigned x) const {
assert(x < N);
return components[x];
}
Point(const T* val) {
std::copy(val, val + N, components);
}
};
I would like to have another template
template <int N>
class FloatPoint
where FloatPoint<N> is equivalent to Point<float, N>
Is this doable? If not, what's the closest alternative?
Thanks,
-Peter
#include <cassert>
#include <algorithm>
template <class T, int N>
class Point {
private:
T components[N];
public:
T& operator[](unsigned x) {
assert(x < N);
return components[x];
}
const T& operator[](unsigned x) const {
assert(x < N);
return components[x];
}
Point(const T* val) {
std::copy(val, val + N, components);
}
};
I would like to have another template
template <int N>
class FloatPoint
where FloatPoint<N> is equivalent to Point<float, N>
Is this doable? If not, what's the closest alternative?
Thanks,
-Peter