Literally yesterday I was wondering if std::cout would ever get the ability to print pairs, because I haven't yet internalised the idea that print() is a better way of doing things these days. Time to refactor some code.
Where do you find all these options? The documents I see online seem to be outdated. Also, without the ability of specifying element separator (like with `fmt::join` in fmt), the facility is pretty useless for ranges. (in clang `std::views::join_with` doesn't work yet).
can anyone help me, in a complex class, suppose the class name is Object; move obj, copy(or move) std::shard_ptr and move std::unique_ptr, which one gives the highest performance, if it has to move around 5 times
@@TsvetanDimitrov1976 I think the optimizations have to be on the compiler side, there is a lot of template constexpr magic to make the compile-time parsing validation work.
this has replaced a load of code I wrote for formatting output, plus my own print function (I wonder how many others also did their own post-C++17 and pre-C++23?). Not sure how to feel about that. Good, I guess?
Is something similar being added for enum constants? C++, as far as I know, really lacks an easy way of converting enum constants to strings. I was hoping C++26 would be adding support for that maybe.
@@jasonenns5076 I like it. 🙂 More seriously, it’s just an old development system (Borland C-builder 6 and CodeGear RAD Studio 2007), which has been enough for me for a quarter of a century.
@@cm5754 No, I'm referring to being able to print containers that have printable items. And raising a compile error, if anything is wrong. Rust actually can print any struct in an uniform way, if it's members are printable, which could be, of course, other structs and containers and anything. And all of these are opt-in.
@simonmaracine4721 fmtlib also has features implemented even before rust's own std.fmt, even many fmtlib features were not added to the standard iso, although it seems that everything comes from rust, in the case of std::format everything derives from fmtlib
As some who loved the premise of C++ at the beginning and started programming in it at 11 years old. I'm sorry but this is ridiculous. Like the implementation is so bad. C++26 reflections is horrible engineering. Like who would refuse something Jai like meta programming for whatever C++ bullshit is beingoffered. And refusing Circle meta programming proposal? What?! I watched a video on the C++26 reflections and meta programming facilities. And I was like, I'll kill myself before writing this shit. Add this to the useless coroutines and constexpr BS and OMG the safety proposal!!! And you had yourself one very angry C++ Dev. I really wonder if the C++ Committee gets high while taking these decisions. Like, I'm sorry but the hell did you mean by saying it's amazing? I sometimes wonder if you guys are just happy that C++ is getting this complicated so you can still work as C++ instructors? If you see this comment please tell why would any one still consider working with C++.
@muhdiversity7409 I know but they're not even acknowledging it. They're choosing the absolute worst way any feature could be added and then making a fucken miss of feature. And you see them talking about this shit in conferences like they invented a cure for cancer or something. And they speak in this sumg academic language to sound smart or whatever to end up producing a pile of trash. Mean while, some like Jonathan Blow is making stuff a billion times better that them on his own. Like for fuck sake how many people are working on ISO CPP committee??
For me the biggest nonsense of C++26 is defining uninitialized variables as something valid xDDDD Instead of simply disallowing read from uninitialized data (compiler does see this every time you do something bad. This is inherent property of SSA) they defined that 2 uninitialized variables are equal 😢std::span is still broken with "safety by assert". Assert doesn't exist. It's never executed. Instead they should have made all STL operators perform range checks 100% of time, and specify extra stuff like "unsafe_at", "unsafe_first", etc. which ignore the checks with assert. If you want backwards compatibility compiler should require some flag, e.g. "-fallow-unsafe-garbage-code".
printf doesn't even have all these facilities. It's primitive, unsafe ,and slow. With more flexibility comes more rules. You can always define your own types and specify how they are printed using std::formatter.
We are pretty close to write idiomatic python in c++... ;)
It's all good as long as it's not idiomatic perl xD
That's actually what I thought when I [re]started studying C++ (This time version 20 instead of 11), and it is the reason why I am loving C++ now.
@@TsvetanDimitrov1976 :D
@@TsvetanDimitrov1976 It's all good as long as int is not as long as long! 🙃
I sometimes wonder if that's where the inspiration is coming from these days
We're looking for someone with 15 years experience in the C++23 new Range Formatter features. Reach out.
Did you mean: "We're looking for a recent graduate with 15 years experience in the C++23 new Range Formatter features. Reach out" ?
@@PedroOliveira-sl6nw could be ...
or 10 years of experience with C++36
so when will c++ modules actually be ready
Literally yesterday I was wondering if std::cout would ever get the ability to print pairs, because I haven't yet internalised the idea that print() is a better way of doing things these days. Time to refactor some code.
Yeah cout feels like a deprecated way in recent versions
Content starts at 1:32.
Where do you find all these options? The documents I see online seem to be outdated. Also, without the ability of specifying element separator (like with `fmt::join` in fmt), the facility is pretty useless for ranges. (in clang `std::views::join_with` doesn't work yet).
can anyone help me, in a complex class, suppose the class name is Object; move obj, copy(or move) std::shard_ptr and move std::unique_ptr, which one gives the highest performance, if it has to move around 5 times
Alarming that a single print statement was slow to compile.
Most probably a variadic template plus a bunch of recursive template instantiations. I wouldn't be too worried about that, someone will optimize it.
@@TsvetanDimitrov1976 I think the optimizations have to be on the compiler side, there is a lot of template constexpr magic to make the compile-time parsing validation work.
this has replaced a load of code I wrote for formatting output, plus my own print function (I wonder how many others also did their own post-C++17 and pre-C++23?). Not sure how to feel about that. Good, I guess?
The standard library must be working if everyone is going to go delete a bunch of repeated code when it gets an update
Really nice!
Is something similar being added for enum constants? C++, as far as I know, really lacks an easy way of converting enum constants to strings. I was hoping C++26 would be adding support for that maybe.
Try the ”magic enum” library. It uses some __PRETTY_FUNCTION__ trickery to fetch the name of enums.
As someone still using C++99, I hope C++23 also has a corresponding "scan".
Why are you using C++98?
@@jasonenns5076 I like it. 🙂
More seriously, it’s just an old development system (Borland C-builder 6 and CodeGear RAD Studio 2007), which has been enough for me for a quarter of a century.
再次感谢
Is it C++? Or is it Python, or is it Rust?
Rust had these formatting features since the beginning. I'm happy that C++ is catching up.
C had printf from long ago… languages are just recreating the idea of format string + parameters
@@cm5754 No, I'm referring to being able to print containers that have printable items. And raising a compile error, if anything is wrong. Rust actually can print any struct in an uniform way, if it's members are printable, which could be, of course, other structs and containers and anything. And all of these are opt-in.
@simonmaracine4721 fmtlib also has features implemented even before rust's own std.fmt, even many fmtlib features were not added to the standard iso, although it seems that everything comes from rust, in the case of std::format everything derives from fmtlib
@simonmaracine4721 Last time I tried Rust the book clearly stated you can't print containers by default. When did this become a thing?
As some who loved the premise of C++ at the beginning and started programming in it at 11 years old.
I'm sorry but this is ridiculous.
Like the implementation is so bad.
C++26 reflections is horrible engineering.
Like who would refuse something Jai like meta programming for whatever C++ bullshit is beingoffered.
And refusing Circle meta programming proposal?
What?!
I watched a video on the C++26 reflections and meta programming facilities.
And I was like, I'll kill myself before writing this shit.
Add this to the useless coroutines and constexpr BS and OMG the safety proposal!!!
And you had yourself one very angry C++ Dev.
I really wonder if the C++ Committee gets high while taking these decisions.
Like, I'm sorry but the hell did you mean by saying it's amazing?
I sometimes wonder if you guys are just happy that C++ is getting this complicated so you can still work as C++ instructors?
If you see this comment please tell why would any one still consider working with C++.
C++ jumped the shark, long, long, long ago.
@muhdiversity7409
I know but they're not even acknowledging it.
They're choosing the absolute worst way any feature could be added and then making a fucken miss of feature.
And you see them talking about this shit in conferences like they invented a cure for cancer or something.
And they speak in this sumg academic language to sound smart or whatever to end up producing a pile of trash.
Mean while, some like Jonathan Blow is making stuff a billion times better that them on his own.
Like for fuck sake how many people are working on ISO CPP committee??
For me the biggest nonsense of C++26 is defining uninitialized variables as something valid xDDDD Instead of simply disallowing read from uninitialized data (compiler does see this every time you do something bad. This is inherent property of SSA) they defined that 2 uninitialized variables are equal 😢std::span is still broken with "safety by assert". Assert doesn't exist. It's never executed. Instead they should have made all STL operators perform range checks 100% of time, and specify extra stuff like "unsafe_at", "unsafe_first", etc. which ignore the checks with assert. If you want backwards compatibility compiler should require some flag, e.g. "-fallow-unsafe-garbage-code".
@@pikachulovesketchup666uninitialized read is unfortunately not always visible due to pointer arithmetic
I will still use fmt simply because of the standard library bloat
Yet more letters to remember for std::format. I already have a cheat sheet hanging over my desk. It's not as natural yet as printf ever was.
I think you watched a different video to the one I just did.
Bot?
printf doesn't even have all these facilities. It's primitive, unsafe ,and slow. With more flexibility comes more rules. You can always define your own types and specify how they are printed using std::formatter.
printf fans are an odd bunch of people
Probably meant the ":m"?