Dude - what if we made C++'s syntax uglier lmao

Dude - what if we made C++'s syntax uglier lmao

class:main::std::cout >> "lets try" >> endl;

Why is endl scoped differently?

Because I don't know C++

In C++19, endl is non-deterministically scoped to simplify the syntax. In fact, all tokens that have a prime + 1 number of characters are non-deterministically scoped.

kek

With more template stuff and metaclasses potentially coming up, that should be an easy task.

String reversing in (((rust)))
use std::io;

fn main() {

let mut x = String::new(); //or let mut x: String = String::new();
io::stdin().read_line(&mut x);

println!("{}", x.chars().rev().collect::());

}

String reversing in C++
#include
#include

int main ()
{
std::string str ("now step live...");
for (std::string::reverse_iterator rit=str.rbegin(); rit!=str.rend(); ++rit)
std::cout

what if we made an SJW language? lmao

kek

String reversal in C++

#include
#include

int main()
{
std::string str ("now step live...");
for (auto rit = str.rbegin(); rit != str.rend(); ++rit)
std::cout

str.reverse;

String reversal in (((Rust))) xdXDDDDDDDD
str.chars().rev().collect::())

Not him, but does C++ have map, fold, filter, zip, toArray yet?

That's not string reversal though

map = std::transform
fold = std::accumulate
filter = std::copy_if (or std::remove_if with negative logic if you want to do it inplace)
zip or convolution = you'd need to hack it together with std::transofrm
toArray = not to my knowledge, no.

Of course, there's always an option to use boost for convenience.

>Just do this for the first example to make it less needlessly convoluted:
That's not reversing the string, though.

>toArray
Oh, does it have things like split() or chars()
>no zip
hmm, if I was using C++ I'd actually make a seperate library for this, I use these very heavily

>map
Make a copy, and use std::transform

>fold
No idea what that is

>filter
std::remove_if

>zip
Not in the standard library, I think. Might be able to get it with everyone's favourite second standard library though (boost).

>toArray
What is this?

>What is this?
Think of it as a generic lazy splitter function

It can also take varargs and return an array

What about enumerate?

>Oh, does it have things like split() or chars()
Yes

>hmm, if I was using C++ I'd actually make a seperate library for this, I use these very heavily
Use boost, it has everything and more.

Is chars() lazy? If I have a billion character long string, str.chars().take(100000) should not take much time?

awww sweetie are you sad because your language is just a fad with no actual spot in workspaces? maybe you should go learn real programming, dear.

Your C++ string reversing doesn't handle Unicode properly.

None of the C++ examples work consistently for anything other than ASCII. Fucking retards.

Heh, I kinda expected that. I was trying out C++ again after all these years and I see it made 0 progress.

I'll just stick to my ((((((((Rust)))))))) since it's actually not a pain in the ass, at least for me

>Is chars() lazy? If I have a billion character long string, str.chars().take(100000) should not take much time?
That's correct.

You can do this in multiple ways, even,.

It's more of an indictment of the C++ """programmers""" criticizing you. They don't actually know C++ either and their versions are just as bad. Several of them are blatantly ignoring error cases as well.

Does McDonald's sell salads? Yes. Do you want to eat salads at McDonald's? No.


I'll never understand why people pretend it's so great to have crippled FP in imperative languages.

I respect C++ and C++ programmers. It's just the kids of Sup Forums and 8ch that make me cringes

Who knows, I'll come back to C++ once it gets modules and UFCS, it's just my style

What is ``FP``? Functional programming? C++ doesn't have functions? Rust does?

They have extra time to remove the errors while you are waiting for your Rust code to compile.

Only newfags stay stuck, it's true in both of the languages

I program in C++ professionally, and in Rust for fun, and I'd love to be able to the Rust for work. The syntax and semantics are way more clear than C++.

std::string doesn't give a shit about encodings, it just operates on chars. That said I have no clue if you could try stuffing in Unicode characters since it's all just bytes anyways.

>The standard std::string type is used for a string reversing example, which may not handle unicode characters. Surely this must mean that C++ programmers suck!

C++19 on Linux when

It doesn't mean all C++ programmers suck it just means you suck like all of the other C++ larpers on Sup Forums. The fact that you don't know if "you could try stuffing in Unicode characters since it's all just bytes" means you're a moron.

Are you having a stroke or what?

I've never had to deal with Unicode characters before when working in C++, so I don't know from experience. Does this automatically make me bad? Is someone who isn't very knowledgable about Unicode automatically a bad programmer?

What I'd expect to happen is that it would work normally, but that as soon as you start to muck with individual bytes (chars), you'd run into trouble if you're not careful.

>Does this automatically make me bad? Is someone who isn't very knowledgable about Unicode automatically a bad programmer?

Absolutely.

>Is someone who isn't very knowledgable about Unicode automatically a bad programmer?
yes. your program doesn't reliably work.

You should be careful when parsing texts

>Is someone who isn't very knowledgable about Unicode automatically a bad programmer?
Yes. Handling text data is the most important part of computing.

String handling in C and C++ is extremely error prone and the source of tons of vulnerabilities. If you're going to use either language you should know the intimate details of how it works.

Compile times are going to kill Rust. It's gotten so ridiculous and they just keep merging more language features. It's already starting to piss off the Firefox team and Firefox only has a tiny bit of Rust in it.

>C++ by a rust developer
Wow that is fucking disgusting.

You can reverse a string with:

std::reverse(s.begin(), s.end())


All you need to include is string and algorithm. Interesting you feel you feel to lie to put rust ahead.

You can't write proper C++ because you don't understand what the compiler does under the hood. You lack the understanding of computer architecture to write proper code.

You would know right away that UTF-8 and wide strings wouldn't be able to handle a reversing that easily. If you wanted to you could wstring, but the smart way is to use the locale header, covert the utf-8 into char_32t via codecvt and construct a basic_string and use reverse on that.

But you would know that already if you understood how computers work, which rust faggot do not understand as they are crippled by the safety concerns.

And before you say it's slower, it's the same speed since you don't have to deal with the characters byte by byte when reversing. And you'll have a form that's easier to slice and manipulate.

Learn how computers work before embarrassing yourself and other rust lepers.

fold = reduce, which is std::accumulate

>rust getting this BTFO
What a good start to the day

No one uses Rust. Why do we keep having these threads?