Special Interest Group on C++
Teaching, learning, and practicing contemporary C++
#cpp #cplusplus #education #teaching #EduSky
Moderated by @smurthys.bsky.social
- Yes, it is late 2024, but C++23 is now officially an ISO standard. www.iso.org/standard/836... #cpp #cPlusPlus #standards #ISO
- "Template Design with Policy Classes". A brief introduction to policy classes in C++. www.youtube.com/watch?v=23iz... #cpp #video #eduSky
- "Complete Guide to Class Template Argument Deduction". Excellent talk by Nina Ranns: -FTAD vs CTAD -CTAD and deduction guides -User-defined deduction guides -Pros & cons; Dos & Don'ts Well worth the hour for anyone writing class templates esp. as part of a library. #cpp #video youtu.be/c3R7aNf39o0
- Unwinding concept std::same_as up to std::integral_constant. Compilation of possible implementations from cppreference. Hope seeing it all together at once helps appreciate the behind-the-scenes. PS: read the code bottom to top; usable with no includes sigcpp.godbolt.org/z/nx6Y3sfvo #cpp #eduSky
- Delegate directly to the final ctor in a delegation chain, instead of delegating to a ctor which delegates to another, and so on. A bit more maintenance, but in general, can improves speed, size. E.g., S1() involves 4 ctors; but S2() involves only 2. sigcpp.godbolt.org/z/4e93ddd5x #cpp #eduSky
- C, C++ allow declaring struct var together w struct type. The syntax looks odd but makes sense if seen alongside var declaration for a primitive type (1). The syntax permits seemingly odd type qualifiers but the quals actually apply to the var not the type (2). sigcpp.godbolt.org/z/fvY64MMqT #cpp
- 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. www.youtube.com/watch?v=SmlL... #cpp #cplusplus #programming #video
- Constants can help find certain errors at compile time instead of runtime: constexpr over const; const over non-const; macros/literals if you must. You don't always get this benefit but strive. E.g.: sigcpp.godbolt.org/z/sjd5vWrPn (Avoid "naked new" but another time) #cpp #cPlusPlus #programming
- If you're a CS student/faculty in India, Africa, or South America, and are interested in holding a SIGCPP event on your campus, please DM to discuss topics, schedules. #cpp #cplusplus #education #teaching #learning
- Today, I'd the pleasure of introducing Compiler Explorer to ~60 students and ~6 faculty members in an undergrad Comp Sci pgm. at a university in India. And discussed some C++ in a SIGCPP event. @sigcpp.bsky.social sigcpp.github.io/resources #cpp #cplusplus #education #teaching #learning
- If you need a std::string to be the reverse of another, you can: 1. Copy source and reverse the copy or 2. Create a new string inited from reverse iterators on source Approach 2 can be faster, and the new string can even be const. sigcpp.godbolt.org/z/9coKnYTTs #cpp #cplusplus #programming
- Use templates like these if you have many enum types and often convert them to integers. The 1-arg template converts an enum type to its underlying type. PS: std::to_integer converts only from std::byte and the integer type must be explicit. sigcpp.godbolt.org/z/4Waxaojrz #cpp #cplusplus
- std::string_view has 3 modifiers: remove_prefix, remove_suffix, swap. Working with immutable strings, unless you need a modifier, use const string view. (Anecdotally, most string views don't use modifiers.) en.cppreference.com/w/cpp/string/basic_… #cpp #cplusplus #programming
- Q: Why is the size of an empty class not zero? A: To ensure that every object has a unique memory address "Empty Objects", Slide 8. Johan Berg, SwedenCpp, June 15, 2023 More at: youtube.com/watch?v=vKDQxhyyMr8 #cpp #cplusplus #programming
- Return value optimization (RVO) in C++: flavors, guarantees, limitations, workarounds, and considerations. Examples and exercises included. sigcpp.github.io/2020/06/08/return-v… #cpp #cplusplus #rvo #programming #education #learning #edusky
- There's little reason to use C-strings (null-terminated byte sequences) in C++. Use std::string, std::string_view instead. C-string literals are OK but consider string, string_view literals instead: en.cppreference.com/w/cpp/string/basic_… #cpp #cplusplus #programming
- "Guidelines for processing immutable text" Conclusion of the 3-part series on working with immutable text data in C++ sigcpp.github.io/2020/04/20/guidelin… #cpp #cplusplus #programming #strings #text
- "Guidelines for processing immutable text" Conclusion of the 3-part series on working with immutable text data in C++ sigcpp.github.io/2020/04/20/guidelin… #cpp #cplusplus #programming #strings #text
- "Safely processing immutable text" Part 2 in the 3-part series on working with immutable text data in C++ sigcpp.github.io/2020/04/07/safely-p… #cpp #cplusplus #programming #strings #text
- "Efficiently processing immutable text" Part 1 in the 3-part series on managing immutable text data in C++ sigcpp.github.io/2020/04/03/efficien… #cpp #cplusplus #programming #strings #text
- "Exploring C-strings", an introduction to C-strings sigcpp.github.io/2020/03/30/explorin… #cpp #cplusplus #programming #cstrings #strings #text
- We begin our BlueSky presence by re-posting some past posts from our Twitter and Mastodon accounts. We expect to soon catch up and post new content directly from the BlueSky account.
- Hello and welcome to the BlueSky account for SIGCPP, the Special Interest Group on C++. We are also on Twitter and Mastodon. Twitter: twitter.com/sigcpp Mastodon: hachyderm.io/@sigcpp