News for hackers. Stuff that matters.

joebaf

Re:Initialization in Modern C++ (295 pages) on Tuesday March 28, 2023 @10:06AM (#35341318)
Here's the direct link to the blog post on the book:

https://www.cppstories.com/2023/init-story-print/

And the book at Leanpub:

https://leanpub.com/cppinitbook

Do you have more examples where zip is handy? I've noticed it's a quite common feature of other languages like Python...
Do you us std::initializer list in your code?
Re:C++ at the End of 2022 on Monday January 02, 2023 @02:41AM (#34215386)
is ChatGPT actually the most important thing that happens... not just for C++, but in terms of all programming languages? How will it affect programming?
Re:C++ at the End of 2022 on Sunday January 01, 2023 @02:52PM (#34210121)
is ChatGPT actually the most important thing that happens... not just for C++, but in terms of all programming languages? How will it affect programming?
Re:Const vs. constexpr vs. consteval vs. constinit in C++20 on Monday November 28, 2022 @01:59PM (#33777934)
on the other hand with more options you can express more and write safer code (for example with constinit which solves static order init fiasco...) And if you don't have enough knowledge you can just stick to const.

What re alternatives for a system programming language? (Rust seems to be fine, but still it's not super easy...)

Re:Custom types and std:format from C++20 on Tuesday July 26, 2022 @05:11AM (#32235987)
and std::print is already voted into C++23!
Hi, Author here - I went to lambdas because I got some compilation issues... because some stupid mistakes the code with std::apply(printImpl<Args...>, tp) didn't compile...

But now I see the issue and it's improved. So the version:

template <typename... Args> void printTupleApplyFn(const std::tuple<Args...>& tp) { std::cout << "("; std::apply(printImpl<Args...>, tp); // << std::cout << ")"; }

is fine and probably the easiest

Re:How to Refactor new/delete into unique ptr on Monday October 18, 2021 @01:27PM (#28908065)
Yep, smart pointers are essential for modern C++, and they provide improved security over raw pointers.

How do you use smart pointers? What’s your common use case to refactor into smart pointers?

Re:C++20 Oxymoron: Constexpr Virtual on Monday September 13, 2021 @08:12AM (#28510475)
Do you have any better use cases for those constexpr techniques? maybe we could make simpler code to CRTP?
do you have any useful use cases for such expressions? computing values based on text config? generating lookup tables? something else?

Older »