KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Essentially, the situation is as follows: I have a class template (using one template parameter length of type int ) and want to introduce a static array. This array should be of length length and contain the elements 1 to length . The code looks as follows up to now: template<int length> class myClass{ static int array[length]; }; Then I wanted to write a line for initalizing the array // of course, the line below does not work as intended. template<int length> int myClass<length>::array[length]={1,2, ..., length}; (How) can this be achieved?
Tags (comma-separated)
Save Edits
Cancel