Reminder: SIGCPP is also on Mastodon. We'd love for you to follow us there. Or you can just read our posts there and you won't even need a Mastodon account. ๐
PS: SIGCPP posts continue on Twitter as long as the site is free and makes sense to stay. ๐ค
https://t.co/iHXB8OmivT
Reminder: SIGCPP is also on Mastodon. We'd love for you to follow us there. Or you can just read our posts there and you won't even need a Mastodon account. ๐
PS: SIGCPP posts continue on Twitter as long as the site is free and makes sense to stay. ๐ค
https://t.co/iHXB8OmivT
Logan Smith illustrates the pitfalls of using C-style casts in C++ code. Bottomline, instead of C-style cast, use an appropriate C++ cast such as static_cast and dynamic_cast depending on the situation.
https://t.co/kVOU88cpZJ
#cpp#cplusplus#programming#video
If you're a CS student/faculty in India, Africa, or South America, and are interested in a SIGCPP event on your campus, pls DM to discuss topics, schedules.
And thx @CompileExplore for the awesome service.
https://t.co/MA5QFK8fzO
#cpp#cplusplus#teaching#learning#education
It's been >6 years now since @ben_deane and I presented "constexpr All The Things!"
And 6 years of C++ Weekly and conference presentations about constexpr...
And I'm finally seeing a shift in conversation from "why do I need constexpr?" to "of course I need constexpr!"
Just published my 35th video about C++ lambdas!
Why?
Because lambdas follow the evolution of C++. If you fully understand lambdas, you understand most of the core of C++!
The last episode is about a new C++23 feature.
https://t.co/U5WKaLsZCt
Exact performance difference is implementation dependent but Approach 2 is most certainly faster due to avoiding initial copy.
The std requires Approach 2 to be linear in the distance between iterators and so it will be odd for Approach 2 to be slower.
https://t.co/JKKnABbslM
If you need a string to be the reverse of another:
1. Copy source and reverse the copy, or
2. Create a new string inited from reverse iterators on the source
Approach 2 can be faster, and the new string can even be const.
https://t.co/MQf6BqDPFe
#cpp#cplusplus#programming
Use templates like these if you have many enum types and you often convert to integers. The 1-arg template converts enum type to its underlying type.
PS: std::to_integer converts only from std::byte and the integer type must be explicit.
https://t.co/RXalTPVnEX #cpp#cplusplus
I'm toying with making a list of C++ Tricks, Tips and Tidbits. They are intended for like one of those pop up "did you know?" dialog boxes.
https://t.co/EFuVwazTQP
Add some via comment or PR if you are interested!
C++23 std::to_underlying converts enum to underlying type, which you can then cast to other type. The to_integer templates โ๏ธ do all that with a uniform interface, but they may not always be the right choice. As OP says use such templates to suit needs.
https://t.co/dsRgDFZK3d
Use templates like these if you have many enum types and you often convert to integers. The 1-arg template converts enum type to its underlying type.
PS: std::to_integer converts only from std::byte and the integer type must be explicit.
https://t.co/RXalTPVnEX #cpp#cplusplus