-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added std:: where it was missing #544
Changes from all commits
d999f0c
f31dc12
4d5f7a8
20799cc
5860fdf
a84ca2e
7ae2f08
8472c10
8c80abe
bcab445
998e801
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ | |
#ifndef TWOBLUECUBES_CATCH_COMMON_HPP_INCLUDED | ||
#define TWOBLUECUBES_CATCH_COMMON_HPP_INCLUDED | ||
|
||
#include <cctype> | ||
|
||
#include "catch_common.h" | ||
|
||
namespace Catch { | ||
|
@@ -22,7 +24,7 @@ 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(), static_cast<int(*)(int)>(std::tolower) ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will the code work with just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. std::tolower should already be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's also There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't use lambdas due to C++-03 compatibility. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From what I can gather this was the only resolution. it is not undefined behavior. It is required to resolve the ambiguity due to the two different impleemntations of std::tolower as @nabijaczleweli mentions there is a second and is the reason why I had issues. The cast is there to tell the compiler to select the desired function, if there isn't a matching function. If it really isn't liked (i wasn't toosure either) then creating a function object which calls std::tolower internally would be a practical way to resolve this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another reasonable approach might be:
That will select the correct overload, but avoids actually writing |
||
} | ||
std::string toLower( std::string const& s ) { | ||
std::string lc = s; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't look good to me...