我一直在地图中维护一些统计数据,下面是我的typedef来创建地图
typedef Time TOTALTIME,MINM,MAXM,AVRG;
typedef std::map<std::string,std::map<status,int>> RequestStatus;//status is an enum
typedef std::tuple<int,TOTALTIME,MINM,MAXM,AVRG,RequestStatus> Attributes ;
typedef std::map<std::string,Attributes> requestStatistics ;
requestStatistics sampleStruct
//我的最终地图
我一直在初始化
sampleStruct.insert(make_pair(someskey,std::make_tuple(1,TOTALTIME(),MINM(),MAXM(),AVRG(),sampleStatus[functionName][status::READY]=1)));
我试过的其他方式
sampleStruct[somekey]=std::make_tuple(1,TOTALTIME(),MINM(),MAXM(),AVRG(),sampleStatus[functionName][status::READY]=1)
两者都没有通过编译器总是在编译错误中结束,lemme输出了一些编译错误我已经
std::map<endstor::Data::statistics::status, int, std::less<endstor::Data::statistics::status>, std::allocator<std::pair<const endstor::Data::statistics::status, int> > >,
std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::map<endstor::Data::statistics::status, int, std::less<endstor::Data::statistics::status>, std::allocator<std::pair<const endstor::Data::statistics::status, int> > > > > > > > >]
insert(const_iterator __position, _Pair&& __x)
1)我创建的结构是否有效?作业是否合适?
答案 0 :(得分:1)
# Build Tree
tree = ete3.Tree( "((a,b),c);" )
# Leaf mapping
D_leaf_color = {"a":"r", "b":"g","c":None}
# Set up style for circular tree
ts = ete3.TreeStyle()
ts.mode = "c"
# Draw Tree
tree.render("tree_test.png", dpi=300, w=500, tree_style=ts)
或insert
来电中的最后一个参数是make_tuple
,sampleStatus[functionName][status::READY]=1
,而元组期待int
。这种类型的差异将导致您的错误。