高阶c++
模板就是宏。模板能不能再往一步?
enhanced c++ template grammar:
rule 1:
c++ identifier include :
const name
variable name
class name
struct name
function name
namespace
code block name (new)
expression name (new)
c++ original temple include:
class template
function template
and template parameter can only be type name or const
enhanced temple include all kind of identifier above and template parameters can be all of identifier above.
rule 2:
AST reflection can be accessed in the template.
rule 3:
identifier can be operate as string, and transfer each other.
rule 4:
some check can be done at pre-compile stage.
rule 5:
alias is used for simply the identifier.