生成模板所有专业化的脚本

问题描述

我正在编写一个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 (将#修改为@)