Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Algo = std::function<void (int)> ;
- double lengthMeters = 5;
- Length<Meters> a = 5;
- Length<Nm> b = 5;
- auto square = a * b;
- int sum = 0;
- auto algo = [sum](int element){sum += element;};
- Algo algo22 = [sum](int element){sum += element/2;};
- void treeWidth(Algo algo);
- {
- ...
- el = ...
- algo(el);
- ...
- print(sum)
- }
- void treeDepth(Algo algo)
- {
- ...
- el = ...
- algo(el);
- ...
- print(sum)
- }
- void run()
- {
- treeDepth(algo);
- treeWidth(algo22);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement