-
-
Notifications
You must be signed in to change notification settings - Fork 306
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
Fails to compile with Xcode 14.2 #1149
Comments
Looks like your C++ STL implementation is lacking the iterator range constructor. |
As indicated and visible in the build log, GHA build agent is using Xcode 14.2, which according to Wikipedia1 is bundled with LLVM/Clang 14. Footnotes |
OK, so it comes with libc++ 14 as well. Is it possible for you to check why it doesn't pick up that version of the STL but apparently an earlier one? Someone's asking about that problem on the Apple developer forum. |
I've added an assertion:
That's as much investigation as I have the time for right now. It fails on GitHub Actions, so I hope you're able to reproduce it yourself. I've downgraded to sqlite_orm 1.7.1 which builds fine. |
@mikedld sqlite_orm is currently using appveyor for build testing, so your information and help is appreciated! I took a different approach for testing the availability of string_view's iterator constructor, which you may want to try out. |
Detect the absence of string_view's iterator range ctor differently.
TBH the two code paths and concepts requirement seem like an overcomplication, one C++17 version would be sufficient IMHO, e.g. void stream_sql_escaped(std::ostream& os, std::string_view str, char char2Escape) {
while (!str.empty()) {
const size_t next = str.find(char2Escape);
os << str.substr(0, next);
if (next == std::string_view::npos) [[likely]] {
break;
}
const char escapedChar[] = {char2Escape, char2Escape};
os << std::string_view(escapedChar, std::size(escapedChar));
str.remove_prefix(next + 1);
}
} |
Oh, I see the project supports building with standards before C++17. In any case I think one implementation is possible, and even if you don't want it using C++20 features in question is far from necessary and doesn't really bring a lot of benefits here. I didn't test the new version yet, will wait for 1.8.2 or later. Feel free to close this issue if you think it's fixed. |
Your version is a very nice approach, thanks for thinking along! In my defence, I have to say that while the entire thing may be overly complicated at this stage, it can be simplified again once we are past C++17 😃. The goal was to have the most efficient implementation with the latest C++. However, your version is still great even in the light of iterator ranges. It is possible to change it even further so that we don't even need a @mikedld @fnc12 What do you think? It even uses the much simpler, non-formatting aware method inline void stream_sql_escaped(std::ostream& os, const std::string& str, char char2Escape) {
for(size_t offset = 0, next; true; offset = next + 1) {
next = str.find(char2Escape, offset);
if(next == str.npos) {
os.write(str.c_str() + offset, str.size() - offset);
break;
}
os.write(str.c_str() + offset, next - offset + 1);
os.write(&char2Escape, 1);
}
} |
@trueqbit if there is no need to pass |
Use a single implementation of `stream_sql_escaped()`
Thx @mikedld |
Using:
CMAKE_CXX_STANDARD
set to 20macos-latest
(a.k.a.macos-12
) imageGetting the following error:
Same code with
CMAKE_CXX_STANDARD
set to 17 builds fine.The text was updated successfully, but these errors were encountered: