I understand that you cannot declare a virtual method as a template, because the compiler does not know how many records to reserve in the virtual table. This, however, is a technical limitation, not a language one. The compiler could know how many instances of the template are really needed, and “return” to select the correct vtable size.
Is there a planned technical solution in the upcoming standard?
. . .
, , . , . , , ! "" .
, . , , .
, , , . , . ++ , ; , . , , ; - , , all , , , , , , . , , .
Nothing is currently planned based on the C ++ standards committee and papers with the main language . The C ++ standard specifies requirements for C ++ implementations, but does not define the technical implementation itself. Therefore, template virtual functions are clearly not a technical limitation, but rather a limitation of the language defined by the standard. However, language restriction may result from the risk associated with changing existing implementations, rather than being imposed as a result of technical limitations of the implementation.