Hello all,

I am trying to templatize a class with a Typelist. Until here everything good. But I cannoyt create a Typelist to define the templated class. The following model reproduces the problem:

template< class TL >
class A {
	A(){}
};

int main(void){
        typedef Loki::DefaultSPStorage< std::vector<int> > AStorage;
	typedef A< TYPELIST_1(AStorage)	> MyA;
	
	MyA a();
	return 0;
}

The output for this is:

error: a function call cannot appear in a constant-expression

Then I tried to define the Typelist outside the definition of A, like this:

template< class TL >
class A {
	A(){}
};

int main(void){
        typedef Loki::DefaultSPStorage< std::vector<int> > AStorage;
	typedef TYPELIST_1(AStorage) MyTL;
	typedef A< MyTL	> MyA;
	
	MyA a();
	return 0;
}

To which the output is:

error: expected initializer before ‘MyTL’ (2nd line of main)

Am I doing something wrong? What is missing me here?

Thank you in advance
Rui

LOKI_TYPELIST_X instead of TYPELIST_X as presented in the book.

Thank you all for the interest

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.