Блог пользователя hwangganzi

Автор hwangganzi, история, 4 года назад, По-английски

I want to find a pair that both first and the second value are bigger than s.lower_bound({a,b})

for example ~~~~ set<pair<int,int>> s; s.insert({50, 40}); s.insert({100, 20}); s.insert({120, 80}); auto it = s.lower_bound({80 , 60 }); ~~~~ if I do like this, iterator will find pair({100,20}). But What I want is pair ({120, 80}) because both first and the second value are bigger than ({80, 60}). for ({100, 20}) the first value is bigger than 80 but the second value is smaller than 60. This is not what I want. Sorry for my bad english, Thank you in advance.

  • Проголосовать: нравится
  • +6
  • Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится +13 Проголосовать: не нравится

a set can't do that because the order you describe is not a total order.

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    I think using lower_bound at max 2 times will work .
    You can see my comment below and tell me if I am wrong .

»
4 года назад, # |
Rev. 4   Проголосовать: нравится +15 Проголосовать: не нравится

Edit : I was wrong .