nike0good / GSoC-pgRouting

Semi-mirror repository for GSoC students work
GNU General Public License v2.0
0 stars 0 forks source link

Get familiar with C++ #2

Open nike0good opened 5 years ago

nike0good commented 5 years ago
nike0good commented 5 years ago

Michael VanLoon “STL Algorithms in Action ”

STL in C++ is useful. By using STL, we spend less time coding and focus on other important things. For instance, by using accumulate(s.begin(),s.end()), which is used for calc the sum of a container, we can save time in writing sth. like:

ll ans=0;
for(auto p:s) ans+=p;
return p;

There are various useful algorithms:

 - sort
 - nth_element
 - rotate(it_fir, it_mid, it_end)
 - slide
 - gather //means gather element with same types together
 - set_difference(a.begin(),a.end(),b.begin(),b.end().back_inserter(new_items)); // return new_items (set of what is exist in $a$ and not exist in $b$ )
 - stable_partition

WeChat Image_20210522165425

nike0good commented 5 years ago

T. Winters & H. Wright “All Your Tests are Terrible..."

How to make good tests?

Correctness

nike0good commented 3 years ago

WeChat Image_20210522170942

img4

nike0good commented 3 years ago

img5

nike0good commented 3 years ago

img6