blue-nebula / base

Main repository of Blue Nebula, a fast-paced shooter with a unique parkour system. It is a fork of Red Eclipse and is free software.
https://blue-nebula.org
16 stars 7 forks source link

Replace custom implementation of min() and max() with std::min() and std::max() #188

Open MoonPadUSer opened 4 years ago

MoonPadUSer commented 4 years ago

This PR removes the custom implementation of min() and max() and replaces it with std::min() and std::max()

robalni commented 4 years ago

Why was this done? What is the reason to use min and max from std?

MoonPadUSer commented 4 years ago

yes, we wanna get rid of most custom written functions and types and switch to using their standard alternatives. that way we might be able to get rid of geom.h and tools.h some day

robalni commented 4 years ago

Why do we not want to have geom.h and tools.h?

TheAssassin commented 4 years ago

Many of the things written in tools.h behave in strange ways, hide memory problems or behave unexpectedly otherwise. Also, they're redundant to the STL. And they lack the necessary interface so you cannot use STL algorithms with them. They don't support modern C++ features like e.g., rvalue references. There is no point in having implemented everything by yourself. The STL is well tested and known to work, also most C++ developers know how to use it.

Also, most headers with these custom template classes are e.g., included more than once, among with other weirdnesses. I've never seen code have to include headers more than once without having header guards or #pragma once the way it's done here.

voidanix commented 2 years ago

@MoonPadUSer can you please rebase and squash both this and #189?