fork(4) download
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4. #include <cwctype>
  5. #include <locale>
  6.  
  7. int main()
  8. {
  9. std::wstring wstr1 = L"dll", wstr2 = L"DLL";
  10.  
  11. auto icompare = [](wchar_t const &c1, wchar_t const &c2)
  12. {
  13. return std::tolower(c1, std::locale()) == std::tolower(c2, std::locale());
  14. };
  15.  
  16. if (std::equal(wstr1.begin(), wstr1.end(), wstr2.begin(), wstr2.end(), icompare))
  17. std::cout << "equal" << std::endl;
  18. else
  19. std::cout << "notEqual" << std::endl;
  20.  
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0s 4556KB
stdin
Standard input is empty
stdout
equal