This is (a small part of) my struct:
` struct BASE {
struct s
{
//...
};
template<typename T>
struct DerivedTemplate : public s
{
struct SW
{
short ndx = 0;
double val = 0;
bool glch = false;
SW(short ndx, double val, bool glch){this->ndx = ndx;this->val = val;this->glch = glch;}
};
static vector<SW> SW__BIGGR;
};
};`
Then I seek to initialize the vector "SW__BIGGR" in the following way:
template <typename T>
vector<BASE::DerivedTemplate<T>::SW> BASE::DerivedTemplate<T>::SW__BIGGR = BASE::DerivedTemplate<T>::SW(0, 0, false);
And I get this compiler error:
error: type/value mismatch at argument 1 in template parameter list for ‘template<class _Tp, class _Alloc> class std::vector’
vector<BASE::DerivedTemplate<T>::SW> BASE::DerivedTemplate<T>::SW__BIGGR = BASE::DerivedTemplate<T>::SW(0, 0, false);
^
[...] note: expected a type, got ‘BASE::DerivedTemplate<T>::SW’
When I do the same operation with a vector of simple type such as "int", everything works fine. What am I doing wrong? Thank you!
EDIT:
After adding "typename" before "BASE:: ..." as I was kindly told to do in a comment, I get this error:
error: expected unqualified-id before ‘=’ token vector<typename BASE::DerivedTemplate::SW> typename BASE::DerivedTemplate::SW__BIGGR = typename BASE::DerivedTemplate::SW(0, 0, false); ^
Obviously, the vector cannot be initialized like that (as I am doing without problem with an "int" or "double" vector), but how can it?
EDIT 2:
After deleting "typename" before " ... SW__BIGGR" as kindly suggested, I now get this error for which I could not find an answer googling ("sgnl__01" is a struct based on the struct template "DerivedTemplate"):
"error: conversion from ‘BASE::DerivedTemplateBASE::sgnl__01::SW’ to non-scalar type ‘std::vectorBASE::DerivedTemplate<BASE::sgnl__01::SW, std::allocatorBASE::DerivedTemplate<BASE::sgnl__01::SW> >’ requested vector<typename BASE::DerivedTemplate::SW> BASE::DerivedTemplate::SW__BIGGR = typename BASE::DerivedTemplate::SW(0, 0, false);" Lost again :-(