Anonymous
6/23/2025, 4:53:39 PM No.105681001
I haven't touched C++ in a very long while.
I believe the last C++ revision I used was C++14.
I'm impressed by how much it's changed. I want to use some of its "new features" but I am afraid some might be memes that just introduce more problems
I need /g/ to enlighten me on it
Especially on ranges.
I am impressed you can do this in C++ now :
#include <string>
#include <cctype>
#include <ranges>
using namespace std;
bool isPalindrome(string s) {
auto alnum_lower = s | views::filter([](char c) {
return isalnum(static_cast<unsigned char>(c));
})
| views::transform([](char c) {
return tolower(static_cast<unsigned char>(c));
});
auto rev = views::reverse(alnum_lower);
return ranges::equal(alnum_lower, rev);
}
But there has to be some kind of catch that I simply am not aware of.
There always is with every "cool new modern feature" the Cpp committee introduces.
It's very hard to do all of these things and maintain backward compatibility with C all the while having the gigantic and old std library to maintain, and keep things consistent with all the bloated paradigms and features C++ has like templates.
And when you try to use these cool new modern features in a real code base you only realize the "catch" when it's too late and the stress is unbearable
I believe the last C++ revision I used was C++14.
I'm impressed by how much it's changed. I want to use some of its "new features" but I am afraid some might be memes that just introduce more problems
I need /g/ to enlighten me on it
Especially on ranges.
I am impressed you can do this in C++ now :
#include <string>
#include <cctype>
#include <ranges>
using namespace std;
bool isPalindrome(string s) {
auto alnum_lower = s | views::filter([](char c) {
return isalnum(static_cast<unsigned char>(c));
})
| views::transform([](char c) {
return tolower(static_cast<unsigned char>(c));
});
auto rev = views::reverse(alnum_lower);
return ranges::equal(alnum_lower, rev);
}
But there has to be some kind of catch that I simply am not aware of.
There always is with every "cool new modern feature" the Cpp committee introduces.
It's very hard to do all of these things and maintain backward compatibility with C all the while having the gigantic and old std library to maintain, and keep things consistent with all the bloated paradigms and features C++ has like templates.
And when you try to use these cool new modern features in a real code base you only realize the "catch" when it's too late and the stress is unbearable
Replies: