mirror of https://github.com/odrling/Aegisub
Use std::prev and std::next where applicable
This commit is contained in:
parent
174a992974
commit
0b19908e7b
|
@ -85,9 +85,7 @@ std::string const& MRUManager::GetEntry(std::string const& key, const size_t ent
|
|||
if (entry >= map->size())
|
||||
throw MRUErrorIndexOutOfRange("Requested element index is out of range.");
|
||||
|
||||
MRUListMap::const_iterator index = map->begin();
|
||||
advance(index, entry);
|
||||
return *index;
|
||||
return *next(map->begin(), entry);
|
||||
}
|
||||
|
||||
void MRUManager::Flush() {
|
||||
|
|
|
@ -610,8 +610,7 @@ static void duplicate_lines(agi::Context *c, bool shift) {
|
|||
|
||||
// And the last line in this contiguous selection
|
||||
entryIter insert_pos = find_if_not(start, end, sel);
|
||||
entryIter last = insert_pos;
|
||||
--last;
|
||||
entryIter last = std::prev(insert_pos);
|
||||
|
||||
// Duplicate each of the selected lines, inserting them in a block
|
||||
// after the selected block
|
||||
|
|
|
@ -164,10 +164,8 @@ void Spline::DecodeFromAss(wxString str) {
|
|||
}
|
||||
|
||||
void Spline::MovePoint(iterator curve,int point,Vector2D pos) {
|
||||
iterator prev = curve;
|
||||
if (curve != begin()) --prev;
|
||||
iterator next = curve;
|
||||
++next;
|
||||
iterator prev = std::prev(curve, curve != begin());
|
||||
iterator next = std::next(curve);
|
||||
if (next != end() && next->type == SplineCurve::POINT)
|
||||
next = end();
|
||||
|
||||
|
@ -279,14 +277,12 @@ void Spline::Smooth(float smooth) {
|
|||
if (size() < 3) return;
|
||||
|
||||
// Smooth curve
|
||||
iterator cur_curve = end();
|
||||
--cur_curve;
|
||||
for (iterator cur = begin(); cur != end(); ) {
|
||||
iterator prev_curve = cur_curve;
|
||||
cur_curve = cur;
|
||||
++cur;
|
||||
iterator next_curve = cur == end() ? begin() : cur;
|
||||
for (iterator cur = begin(); cur != end(); ++cur) {
|
||||
iterator prev_curve = prev(cur == begin() ? cur : end());
|
||||
iterator next_curve = next(cur);
|
||||
if (next_curve == end())
|
||||
next_curve = begin();
|
||||
|
||||
cur_curve->Smooth(prev_curve->p1, next_curve->EndPoint(), smooth);
|
||||
cur->Smooth(prev_curve->p1, next_curve->EndPoint(), smooth);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -235,7 +235,7 @@ void VisualToolDrag::MakeFeatures(AssDialogue *diag, feature_iterator pos) {
|
|||
feat.line = diag;
|
||||
feat.parent = features.end();
|
||||
features.insert(pos, feat);
|
||||
feature_iterator cur = pos; --cur;
|
||||
feature_iterator cur = prev(pos);
|
||||
feat.parent = cur;
|
||||
if (selection.count(diag))
|
||||
sel_features.insert(cur);
|
||||
|
@ -252,7 +252,7 @@ void VisualToolDrag::MakeFeatures(AssDialogue *diag, feature_iterator pos) {
|
|||
feat.time = t2;
|
||||
feat.line = diag;
|
||||
features.insert(pos, feat);
|
||||
feat.parent->parent = --pos; ++pos;
|
||||
feat.parent->parent = prev(pos);
|
||||
}
|
||||
|
||||
// Create org feature
|
||||
|
|
|
@ -223,8 +223,7 @@ bool VisualToolVectorClip::InitializeDrag(feature_iterator feature) {
|
|||
feature->curve->p2 = feature->curve->p4;
|
||||
}
|
||||
else {
|
||||
Spline::iterator next = feature->curve;
|
||||
next++;
|
||||
Spline::iterator next = std::next(feature->curve);
|
||||
if (next != spline.end()) {
|
||||
if (feature->curve->type == SplineCurve::POINT) {
|
||||
next->p1 = next->EndPoint();
|
||||
|
|
Loading…
Reference in New Issue