mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 12:17:11 +01:00 
			
		
		
		
	Fix transform narrowing warnings
Catch passes ::tolower into std::transform with string iterators. ::tolower has the signature int(int), which triggers a stealth narrowing warning inside std::transform, because transform calls *_Dest = _Fn(*_First), which implicitly narrows an int to a char. For this particular application the narrowing is fine, so explicitly narrow in a lambda.
This commit is contained in:
		| @@ -22,7 +22,8 @@ namespace Catch { | ||||
|         return s.find( infix ) != std::string::npos; | ||||
|     } | ||||
|     void toLowerInPlace( std::string& s ) { | ||||
|         std::transform( s.begin(), s.end(), s.begin(), ::tolower ); | ||||
|         std::transform( s.begin(), s.end(), s.begin(), | ||||
|             [](char c) { return static_cast<char>(::tolower(c)); } ); | ||||
|     } | ||||
|     std::string toLower( std::string const& s ) { | ||||
|         std::string lc = s; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Billy Robert O'Neal III
					Billy Robert O'Neal III