Recently in my series on C++ algorithms, I presented the different replace functions and said that they will replace all the matching elements. If you want to replace only one element or n elements, you have to find another way.
But what’s that other way?
I hold the role of a White Hat in an organization where being a white-hat doesn’t imply that you an expert in security matters. It’s more about coordinating software security-related matters. It’s a bit like being a manager - as far as I understand what it is like being a manager - you should understand what your team does, but you don’t have to be an expert yourself. There might be teams where it’s definitely not the case, but I know about other corporations where they nominate managers in a way that they can’t even help with the daily job even if they wanted to.
We hear about the importance of gratitude at almost every corner of the internet where there is the tiniest website dedicated to self-help. In order to be more satisfied, happier with your life, you must practice gratitude. You have to actively think about events, people, or even physical objects that you are grateful for.
Extreme Ownership is the legendary leadership book written by two former Navy SEALs, Jocko Willink and Leif Babin who started to teach businesses about leadership and strategy in their civilian life and also wrote multiple books.
Maybe you have been there, maybe you’ll get into a similar situation soon. Maybe you don’t work for the type of company where this could ever happen. Yet, most of us at least heard about highly knowledgeable, so-called senior developers who spend most of their time outside coding. Let’s put it in another way, they go to the office and they don’t do what they are best in.
I’m not a Java developer - anymore - yet I find that a big part of this book can be useful for any junior programmer. Maybe not only for them, as the book has elements that are always useful to be reminded to. In addition, it gives you ideas on how and what to teach to less experienced people.
Helping is important in life. You help the weak to get stronger, you help the hungry to learn fishing, you help someone to achieve her goals. Why not help your compiler to perform some optimization? As always, help benefits both the one that helps and the one that received a hand.
A good way to help the C++ compiler is to declare whatever variable const that should not change. It requires little effort, right?