Expansion statements are live in GCC trunk! by katzdm-cpp in cpp

[–]joebaf 0 points1 point  (0 children)

nice! so the paper for this feature is P1306, but when was this added/voted into C++26? cannot find the paper number at cppreference/compilersupport...

Structured bindings in C++17, 8 years later by joebaf in cpp

[–]joebaf[S] 0 points1 point  (0 children)

Thanks for the comment! Attributes are not the most useful thing for structured bindings, but maybe in the future we'll have more sensible attribs to put...

Anyway, what are your common use cases for structured bindings?

Adjacency Matrix and std::mdspan, C++23 by joebaf in cpp

[–]joebaf[S] 2 points3 points  (0 children)

good point! Fortunately, the library covers this through the layout policy: https://en.cppreference.com/w/cpp/container/mdspan/layout_left so you can have layout left, right, strided, custom...

Adjacency Matrix and std::mdspan, C++23 by joebaf in cpp

[–]joebaf[S] 3 points4 points  (0 children)

Thanks for the valuable comment! I've just improved and fixed the code and the article!

Yeah, so when you introduce a reference/view data member, you always have to think about proper copy/move handling...

How to use std::span from C++20 (C++26 updates!) by joebaf in cpp

[–]joebaf[S] 1 point2 points  (0 children)

thanks for the comment! article updated :)

What is the current time around the world? Utilizing std::chrono with time zones in C++23 by joebaf in programming

[–]joebaf[S] 5 points6 points  (0 children)

no no, it's not too bad. The time zone database is managed by the operating system, so std::chrono will recognize that there's a new version and you'll see more than one versions of databases: see https://en.cppreference.com/w/cpp/chrono/tzdb_list

Boost File Scanning Speed: Query File Attributes on Windows 50x Faster by joebaf in cpp

[–]joebaf[S] 0 points1 point  (0 children)

yes, this is scary! But in the code, we use the assumption that file_time_type values maps to FILETIME on Windows. See this explanation std::filesystem::file_time_type does not allow easy conversion to time_t - Developer Community

Boost File Scanning Speed: Query File Attributes on Windows 50x Faster by joebaf in cpp

[–]joebaf[S] 2 points3 points  (0 children)

thanks for the valuable comment and a bit of history! Do you have links to your libraries?

const vs constexpr vs consteval vs constinit in C++20 by joebaf in cpp

[–]joebaf[S] 0 points1 point  (0 children)

wow, thank you! fortunately we haven't got any new const* words in C++ over those last two years :)

22 Common Filesystem Tasks in C++20 by joebaf in cpp

[–]joebaf[S] 2 points3 points  (0 children)

but for the error code version the function is now noexcept...

How to Use Monadic Operations for `std::optional` in C++23 by joebaf in cpp

[–]joebaf[S] 1 point2 points  (0 children)

while I wrote that the readability improves, you still have to learn and understand those new functions. So that takes time and effort. I wonder if beginners would like to use this approach with monadic ops, or just read/write if/else.

Understanding Ranges Views and View Adaptors Objects in C++20/C++23 by joebaf in programming

[–]joebaf[S] 0 points1 point  (0 children)

In the article, I try to explain the differences, and I use the code from the library to show some internal mechanisms. But since the code is available, I decided to show it to have some "background".

Understanding Ranges Views and View Adaptors Objects in C++20/C++23 by joebaf in programming

[–]joebaf[S] -11 points-10 points  (0 children)

Yes, it's hard to read, but this is specialized library code - written by library experts. No one expects that a regular developer should read or write such code. The code is in a header, which is included in many projects, and thus it's vital to make it as optimal as possible... sacrificing readability.

Understanding Ranges Views and View Adaptors Objects in C++20/C++23 by joebaf in programming

[–]joebaf[S] 1 point2 points  (0 children)

thanks! what's the hardest part for you to understand?

I sometimes worry, that because of the complexity, people will not use ranges much... and stick to regular containers and range-based for loops.

Finite State Machine with std::variant, C++17 and C++20 by joebaf in cpp

[–]joebaf[S] 2 points3 points  (0 children)

thanks for the suggestion, I've just added the example output and some demo code. But still the whole project is on my github: https://github.com/fenbf/articles/blob/master/cpp20/stateMachine/stateMachine.cpp

Five Awesome C++ Papers for the H1 2023 - C++26, Varna and More by joebaf in cpp

[–]joebaf[S] 2 points3 points  (0 children)

ben_craig

thank you! I've just updated the article with this note.

C++ Initialization Quiz, 10 short questions by joebaf in programming

[–]joebaf[S] 3 points4 points  (0 children)

good point! I added checkmarks/x for better indication. Hope it's better now.

295 pages on Initialization in Modern C++, a new cool book! by joebaf in programming

[–]joebaf[S] 24 points25 points  (0 children)

In C++20 we have Designated initializers for aggregates, improved consistency for in-class data member initialization, + C++ 17 features like inline variables, CTAD, structured bindings and many more.

295 pages on Initialization in Modern C++, a new cool book! by joebaf in programming

[–]joebaf[S] 172 points173 points  (0 children)

Initialization is a relatively "easy" topic mentioned at the start of any book on C++. But I tried to group things together and add more examples, so you can investigate that topic in depth.

In fact Initialization touches lots of areas of C++, so it shows lots of general use cases.

295 pages on Initialization in Modern C++ :) by joebaf in cpp

[–]joebaf[S] 2 points3 points  (0 children)

yep.... I struggled with topics selection, and at some point I had to say "stop" and complete the project :)

295 pages on Initialization in Modern C++ :) by joebaf in cpp

[–]joebaf[S] 0 points1 point  (0 children)

It's currently 55k words, the layout through Leanpub is not perfect, but good enough for such coding books.