On Jul 20, 12:51 pm, "Jim Langston" <tazmas...@rocketmail.comwrote:
Microsoft Visual C++ .net 2003. I was just curious what
numeric_limits for std::string would give me so wrote this:
std::cout << std::numeric_limits<std::string>::max() << '\n';
When I run it I get an access violation reading location 0x00000000
I couldn't quite figure out why however. Any thoughts?
Well, the standard just says that using max()
on a type without numeric limits, is "not meaningful".
I don't know if this is licence to exit the program though.
BTW you can check if numeric_limits is defined for a
type, by reading the bool std::numeric_limits<T>::is_specialized.
Also, it is defined that non-fundamental standard types
(such as std::string) do not have specializations of
numerc_limits, so this property should always be
false for std::string.