(C++) GetMaxLong
February 24, 2017 · View on GitHub
(C++) GetMaxLong
GetMaxLong is a checking code snippet to get the maximal value of a long.
GetMaxLong has two flavors:
STL GetMaxLong
#include <limits> ///GetMaxLong returns the highest possible value of a long. ///From http://www.richelbilderbeek.nl/CppGetMaxLong.htm long GetMaxLong() { return std::numeric_limits<long>::max(); }
Boost GetMaxLong
#include <boost/numeric/conversion/bounds.hpp> ///GetMaxLong returns the highest possible value of a long. ///From http://www.richelbilderbeek.nl/CppGetMaxLong.htm long GetMaxLong() { return boost::numeric::bounds<long>::highest(); }