Today, using the MongoDB C + + driver, there was an error when compiling the connection, and the string_data.h of the 93-line Max macro is displayed, which is not itself called the Max macro, but instead calls the
Std::numeric_limits<size_t>::max
This is to generate an error, by searching for a workaround (reference URL: http://blog.chinaunix.net/uid-17102734-id-2830143.html), enclose the function in parentheses to avoid confusion with Windows definitions, as detailed below
Original definition:
StringData substr (size_t pos, size_t n = Std::numeric_limits<size_t>::max ()) const;
Modified after definition:
StringData substr (size_t pos, size_t n = (Std::numeric_limits<size_t>::max) ()) const;
Note that the parentheses are added so that you can solve the compilation problem
This work is licensed under the Creative Commons Attribution-NonCommercial use-Share 4.0 International license agreement in the same way.