Namespaces
Variants
Views
Actions

Talk:cpp/algorithm/includes

From cppreference.com

Should the example be changed?

return std::tolower(a) < std::tolower(b);

Should change to std::tolower(static_cast<unsigned char>( a )) ... ?

Thank you 67.200.126.4 08:15, 15 July 2016 (PDT)

no, the values used in the example (latin letters) are guaranteed to have values that tolower can handle (standardese: "For each basic execution character set, the values of the members shall be non-negative and distinct from one another" and "The basic execution character set shall each contain all the members of the basic source character set" and "The basic source character set consists of 96 characters ... a b c ... X Y Z"). It would pretty much defeat the purpose of that function if it were otherwise. --Cubbi (talk) 09:01, 15 July 2016 (PDT)