如何解决生成模板所有专业化的脚本
我正在编写一个python脚本,该脚本最终将生成某些(模板化的)模板组合的所有可能的模板专业化。
我将输入两个对象:
templateds_input = {
"SimpleFlower": ["Drink","Plant","Tree"],"SimpleDrink": ["Plant"],"SimplePlant": ["Soap"]
}
templates_input= {
"Drink": [
"SimpleDrink","DependentDrink"
],"Plant": [
"SimplePlant","TypedPlant","TimeWindowPlant"
],"Tree": [
"SimpleTree","TypedTree","DurationsTree","BiasesTree"
],"Soap": [
"SimpleSoap","TaggedSoap"
]
}
鉴于这两个对象,我需要生成所有可能的专业化,包括嵌套模板。
这意味着我需要输出:
template class SimpleFlower<DependentDrink,TimeWindowPlant,TypedTree>;
以及嵌套的情况:
template class SimpleFlower<DependentDrink,SimplePlant<SimpleSoap>,DurationsTree>;
我尝试进行一些递归,但最终却一遍又一遍地重复自己,迷路了。
我尝试迭代进行并跟踪深度并“重新扩展”数组,但我也没有成功。
有什么建议吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。