template class with different members
| chameleon (49) |
|
Can I join the following 2 (simplified) classes with templates?
1 2 3 4 5 6 7 8 9
|
struct A
{
constexpr size_t offset = 0;
}
struct B
{
size_t offset;
}
|
|
|
|
| chameleon (49) |
|
something like this: (not working of-course)
1 2 3 4 5 6 7 8
|
template<class T>
struct Vector
{
T offset;
};
typedef Vector<constexpr size_t = 0> ShiftedVector;
typedef Vector<size_t> NonShiftedVector;
|
As you can imagine, constexpr size_t offset produce very fast code.
|
|
|
| Framework (3116) |
|
I don't understand what you're trying to do. What's the difference between the two?
Wazzak
|
|
|
Topic archived. No new replies allowed.