Hi again,
Sorry, I think my previous demonstrator code was too simple for the target
application in hand. I hoped the lesson learned would translate, but in
this case it didn't.
The following code is *much* closer to the actual code, but hopefully still
stripping out the main complexity of it. The actual problem I'm having
comes where the static data member has a type that is a template class that
takes a pointer to another member data type. It really seems this specific,
I'm afraid. The "revised" demonstrator code is as follows:
template <char* T>
struct C1
{
C1() { }
/*C1(const C1& other) = delete;*/
char operator()()
{ return *T; }
};
struct C2
{
static char m;
static C1<&m> op;
};
template <typename T>
struct C3
{
static char m;
static C1<&m> op1;
static C1<&C2::m> op2;
};
// Initialise C2::m and C2::op
char C2::m = 'a';
C1<&C2::m> C2::op;
// Initialise C3::m for type int
template<> char C3<int>::m = 'b';
// Initialise C3::op2 for type int
template <typename T> C1<&C2::m> C3<T>::op2;
template C1<&C2::m> C3<int>::op2;
// Initialise C2::op1 for type int
#if 0
/** This doesn't work **/
template <typename T> C1<&C3<T>::m> C3<T>::op1;
template C1<&C3<int>::m> C3<int>::op1;
#elif 0
/** This doesn't work either **/
template<>
C1<&C3<int>::m> C3<int>::op1;
#else
/** This requires the copy-constructor - bad! **/
template<>
C1<&C3<int>::m> C3<int>::op1 = C1<&C3<int>::m>();
#endif
int main()
{
printf("%c\n", C2::op());
printf("%c\n", C3<int>::op1());
printf("%c\n", C3<int>::op2());
return 0;
}
The code as presented will compile and run, but as before, I wish to disable
the copy constructor in C1. The two alternative syntaxes that I tried are
in the code disabled with #if 0. I expect that I'm missing a 'typename' or
a 'template' keyword somewhere, but I cannot find where.
Thank you again for any help you can give me!
Andy