我正在使用BOOST库中的interval_map.
typedef set<int> Tpopulations;
interval_map<int, Tpopulations> populations;
Run Code Online (Sandbox Code Playgroud)
说我在人群中有这个
[1006311,1006353) 1611,1653,
[1006353,1006432) 1031,1611,1653,
[1006432,1006469] 1031,1387,1523,1611,1653,
(1006469,1006484] 1031,1387,1611,1653,
(1006484,1006496] 1031,1387,1611,
(1006496,1006506] 1031,1611,
(1006506,1006547] 1031,
Run Code Online (Sandbox Code Playgroud)
现在我想找出映射在某个数字上的内容:我希望如下:
cout << populations[1006313]; // 1611,1653
Run Code Online (Sandbox Code Playgroud)
要么
cout << populations.at(1006313); // 1611,1653
Run Code Online (Sandbox Code Playgroud)
但是我似乎没有找到任何这样的方法.
我是否真的需要将其他间隔图定义为"窗口"并进行交叉?就像是:
interval_map<int, Tpopulations> window;
set<int>empty_set;
window +=(make_pair(1006313,empty_set));
cout << populations & window
Run Code Online (Sandbox Code Playgroud)