Skip to content

Commit 21fe47f

Browse files
authored
Merge pull request #3319 from BsAtHome/fix_postfix-iterator
Use prefix ++ on iterators
2 parents 18c03fd + f0ea9cd commit 21fe47f

3 files changed

Lines changed: 13 additions & 13 deletions

File tree

src/emc/rs274ngc/interp_g7x.cc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ class g7x:public std::list<std::unique_ptr<segment>> {
623623
auto p(h); --p;
624624
(*h)->do_finish((*p).get(),(*(++h)).get());
625625
}
626-
for(auto p=begin(); p!=end(); p++)
626+
for(auto p=begin(); p!=end(); ++p)
627627
if((*p)->radius()<1e-3)
628628
erase(p--);
629629
}
@@ -741,7 +741,7 @@ void g7x::pocket(int cycle, std::complex<double> location, iterator p,
741741

742742
if(cycle==2) {
743743
// This skips the initial roughing pass
744-
for(; p!=end(); p++) {
744+
for(; p!=end(); ++p) {
745745
if((*p)->dive(location,-1e9,out,p==begin()))
746746
break;
747747
}
@@ -756,13 +756,13 @@ void g7x::pocket(int cycle, std::complex<double> location, iterator p,
756756
/* After the initial roughing pass, move along the final
757757
contour and we're done
758758
*/
759-
for(; p!=end(); p++)
759+
for(; p!=end(); ++p)
760760
(*p)->climb_only(location,out);
761761
} else {
762762
/* Move along the final contour until a pocket is found,
763763
then start cutting that pocket
764764
*/
765-
for(; p!=end(); p++) {
765+
for(; p!=end(); ++p) {
766766
if((*p)->climb(location,out)) {
767767
if(cycle==3) {
768768
if(imag(location)>imag(pocket_starts.back())
@@ -791,11 +791,11 @@ void g7x::pocket(int cycle, std::complex<double> location, iterator p,
791791
/* Our x coordinate is beyond the current segment, move onto
792792
the next
793793
*/
794-
p++;
794+
++p;
795795
continue;
796796
}
797797

798-
for(auto ip=p; ip!=end(); ip++) {
798+
for(auto ip=p; ip!=end(); ++ip) {
799799
segment::intersections_t is;
800800
(*ip)->intersection_z(location.imag(),is);
801801
if(is.empty())
@@ -857,13 +857,13 @@ void g7x::add_distance(double distance) {
857857
if(distance<0)
858858
max_distance=-max_distance;
859859

860-
for(auto p=begin(); p!=end(); p++) {
860+
for(auto p=begin(); p!=end(); ++p) {
861861
(*p)->offset(max_distance);
862862
if((*p)->radius()<1e-3)
863863
erase(p--);
864864
}
865865

866-
for(auto p=begin(); p!=--end(); p++) {
866+
for(auto p=begin(); p!=--end(); ++p) {
867867
auto n=p; ++n;
868868
if(real((*p)->ep()-(*n)->sp())>1e-2) {
869869
// insert connecting arc
@@ -874,11 +874,11 @@ void g7x::add_distance(double distance) {
874874
auto center=(s->ep()+e->sp())/2.0;
875875
emplace(n, std::make_unique<round_segment>(
876876
distance>0,(*p)->ep(),center,(*n)->sp()));
877-
p++;
877+
++p;
878878
}
879879
}
880880

881-
for(auto p=begin(); p!=--end(); p++) {
881+
for(auto p=begin(); p!=--end(); ++p) {
882882
if(!(*p)->monotonic()) {
883883
std::cout << "Oops " << (*p)->sp()-(*p)->ep() << std::endl;
884884
auto pp=p; --pp;
@@ -897,7 +897,7 @@ void g7x::add_distance(double distance) {
897897
}
898898
current_distance+=max_distance;
899899
}
900-
for(auto p=begin(); p!=--end(); p++) {
900+
for(auto p=begin(); p!=--end(); ++p) {
901901
auto n=p; ++n;
902902
auto mid=((*p)->ep()+(*n)->sp())/2.0;
903903
(*p)->ep()=(*n)->sp()=mid;

src/emc/task/emccanon.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ linkable(double x, double y, double z,
978978
if(x==canon.endPoint.x && y==canon.endPoint.y && z==canon.endPoint.z) return false;
979979

980980
for(std::vector<struct pt>::iterator it = chained_points.begin();
981-
it != chained_points.end(); it++) {
981+
it != chained_points.end(); ++it) {
982982
PM_CARTESIAN M(x-canon.endPoint.x, y-canon.endPoint.y, z-canon.endPoint.z),
983983
B(canon.endPoint.x, canon.endPoint.y, canon.endPoint.z),
984984
P(it->x, it->y, it->z);

src/hal/halmodule.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ static PyObject *pyhal_get_pins(PyObject *_self, PyObject * /*o*/) {
529529
EXCEPTION_IF_NOT_LIVE(NULL);
530530

531531
PyObject *d = PyDict_New();
532-
for(itemmap::iterator i = self->items->begin(); i != self->items->end(); i++) {
532+
for(itemmap::iterator i = self->items->begin(); i != self->items->end(); ++i) {
533533
halitem * pin = &(i->second);
534534
name = strdup(i->first.c_str());
535535
PyDict_SetItemString(d, name, pyhal_read_common(pin));

0 commit comments

Comments
 (0)