Trying to typedef my memory alignment I came out with the following construct (which still is a bit of work in progress because I need to correct the GNU version):
#if defined(__GNUG__)
template <typename T>
struct sfo_type {
typedef T* restrict __attribute__((aligned(32))) aptr32;
};
#elif defined(__INTEL_COMPILER)
template <typename T>
struct sfo_type {
typedef T* restrict __attribute__((aligned(32))) aptr32;
};
#endif
and then I try to use it like this:
template<typename T>
class tsfo_vector {
private:
sfo_type<T>::aptr32 m_data;
int m_size;
...
but then I get the following error message:
/Users/bravegag/code/fastcode_project/code/src/sfo_vector.h(43): error: nontype "sfo_type<T>::aptr32 [with T=T]" is not a type name
sfo_type<T>::aptr32 m_data;
^
Can anyone advice what's wrong here?
aptr32
is dependent on T
so:
template<typename T>
class tsfo_vector {
private:
typename sfo_type<T>::aptr32 m_data;
//^^^^^^^^
For further explanation on the use of typename
see Where and why do I have to put the "template" and "typename" keywords?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With