[英]std::map::lower_bound with a range
如何在具有對數復雜度(類似於std::map::lower_bound
)的兩個迭代器(類似於std::lower_bound
)之間的std::map
切片中獲得下界?
你不能那樣做。 std::map
接口不合適。 解決方案是使用平面數據結構。 這可以是一個簡單的排序std::vector
,或者更方便的是boost::container::flat_map
。 然后,像往常一樣使用std::lower_bound
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.