BOOST ライブラリのinterval_mapを使用しています。
typedef set<int> Tpopulations;
interval_map<int, Tpopulations> populations;
私は集団でこれを持っているとしましょう
[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,
今、私はいくつかの番号にマッピングされているものを見つけたいと思っています:私は次のようなものを期待します:
cout << populations[1006313]; // 1611,1653
また
cout << populations.at(1006313); // 1611,1653
しかし、私はそのような方法を見つけていないようです。
別の間隔マップを「ウィンドウ」として定義し、交差を行う必要は本当にありますか? 何かのようなもの:
interval_map<int, Tpopulations> window;
set<int>empty_set;
window +=(make_pair(1006313,empty_set));
cout << populations & window