Commits
Ken Cunningham authored 9d1d11bac13
1 + | --- lib/Menu.cc.orig 2019-09-24 18:24:46.000000000 -0700 |
2 + | +++ lib/Menu.cc 2019-09-24 18:24:50.000000000 -0700 |
3 + | |
4 + | } else { |
5 + | index = std::min(static_cast<size_t>(index), _items.size()); |
6 + | it = _items.begin(); |
7 + | - std::advance<ItemList::iterator, signed>(it, index); |
8 + | + std::advance(it, index); |
9 + | } |
10 + | |
11 + | it = _items.insert(it, item); |
12 + | |
13 + | |
14 + | void bt::Menu::removeIndex(unsigned int index) { |
15 + | ItemList::iterator it = _items.begin(); |
16 + | - std::advance<ItemList::iterator, signed>(it, index); |
17 + | + std::advance(it, index); |
18 + | if (it == _items.end()) |
19 + | return; // item not found |
20 + | removeItemByIterator(it); |
21 + | |
22 + | const ItemList::const_iterator &end = _items.end(); |
23 + | ItemList::const_iterator anchor = _items.begin(); |
24 + | if (_active_index != ~0u) { |
25 + | - std::advance<ItemList::const_iterator, signed>(anchor, _active_index); |
26 + | + std::advance(anchor, _active_index); |
27 + | |
28 + | // go one paste the current active index |
29 + | if (anchor != end && !anchor->separator) |
30 + | |
31 + | ItemList::const_reverse_iterator anchor = _items.rbegin(); |
32 + | const ItemList::const_reverse_iterator &end = _items.rend(); |
33 + | if (_active_index != ~0u) { |
34 + | - std::advance<ItemList::const_reverse_iterator, signed> |
35 + | - (anchor, _items.size() - _active_index - 1); |
36 + | + std::advance(anchor, _items.size() - _active_index - 1); |
37 + | |
38 + | // go one item past the current active index |
39 + | if (anchor != end && !anchor->separator) |