syntax error in a template class including a struct

Hi all,

I want to declare this :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
template <typename T, int s>
class D {
public:
	D(T a1, T a2);
	~D();
	bool get(T& a);
private:
	struct triple {
		T val;
		float x;
		float y;
	};
	std::list<triple> t(2*s);
};


but the editor claims for a syntax error here : std::list<triple> t(2*s);

I tried also to declare triple as a template struct, but it is the same.

Any clue please ?
You should specify the list constructor in the D constructor definition instead.

1
2
3
4
5
6
template <typename T, int s>
D<T, s>::D(T a1, T a2)
:	t(2*s)
{
	...
}

Last edited on
Thanks Peter87.

I cannot check yet if it compiles, but at least the syntax error has gone.

But I am puzzled. Could you please explain ?
Topic archived. No new replies allowed.