Category "solid-principles"

How to sort vector of structs by given field?

I need to sort vector of structures by a given field. To anyone who faces the same problem: I just made my own sort function and there you can pass in lambda as

Variable Declared Outside of For Loop Vs Inside

//assume there is a java class call Node, and node is an array of Node for(Node i: node){ Node j = i; } Node j; for(Node i: node){ j = i; } Can some