5 ms·
Or instead of digging through docs, we could do cout << is_unsigned<string::size_type>::value; and check it ourselves.
by cldr 13y ago
Or instead of digging through docs, we could do
cout << is_unsigned<string::size_type>::value;
and check it ourselves.
- omegote 13y agoNice use of C++11 there.
- lelandbatey 13y agoWait, what? While this is great pragmatic advice, it's not very good for a newbie. A newer programmer should absolutely be able to go to of all things the documentation to get some kind of an understanding of what's going on. These kinds of "quick reference" techniques are great once you know the language and need information quick, but it's just proof that the docs are unapproachable to a new programmer if they have to resort to non-standard operations like the above to figure out what's going on.
- cldr 13y agoThey can do that. It's plain on any good documentation site (e.g. http://en.cppreference.com/w/cpp/string/basic_string http://en.cppreference.com/w/cpp/string/basic_string) that `string::size_type` is unsigned. The teachers just have to be knowledgeable enough to let students know of good documentation (if, by documentation, you mean what I take you to mean, which is stuff other than the standard itself, which is nearly unintelligible for new people). The technique I gave was just for fun.