non-static template member : possible?
问题 Is it possible to create non-static template field in a class? If no, how to workaround? Such fields should be created at compile time as needed. Example I have a lot of B -class, like B1 , B2 , B3 . (In real case, they have more meaningful names.) I want to create a class D that has non-static template function add<BX>() that have to counter++ every time I call it, for each individual BX , for a certain instance of D. (In real case, it does somethings more complex.) Here is a working demo to