RSSAmplifier

Blog

C++ Senioreas

C++ - "Look beyond what you see" - Lion King

cppsenioreas.wordpress.comRSS feed ↗46 posts

Latest posts

Talk: Who’s Afraid of the Big Bad Template

Templates and metaprogramming considered as the big bad wolf of C++, and it s time to stop being scared of this wolf, as it s one of the most powerful creatures of C++. In this talk I ve demonstrated the power of this incredible creature, while I hope that this talk would be an easy enterence to this Continue reading Talk: Who s Afraid of the Big Bad Template

Reverse Iterations

Learn the ways to iterate in a reverse order on a container - C++11 to C++20 with a custom, easy to use, method to allow a reverse iterations in a simple way prior to C++20 and without the ranges library.

ADL – Avoid Debugging Later

In C++, Argument-Dependent Lookup (ADL) can be a tempting feature to use for cleaner code, but its reliance on context-specific resolution often leads to unexpected behavior. While ADL may seem like an elegant shortcut for function resolution, it can introduce ambiguity and make debugging significantly more challenging. In this article, we explore why you should avoid using ADL in favor of more…

It’s just ‘,’ – The Comma Operator

The comma operator in C++ allows you to evaluate two expressions in a single statement. It evaluates the first expression, discards its result, and then evaluates the second expression, returning its result. While this operator can enhance coding efficiency, it can also lead to unclear code and potential pitfalls if misused, making it important to use it judiciously in your programs. To explore…

Stream Recommendation: Daisy Hollman

Daisy Hollman is an extremely talented developer, who is highly involved in many advanced fields of C++. She is a very close friend of mine, and I highly encourage you to go and check her stream: Good luck Daisy 🩷

Watch: From Modern to Unbelievably Modern C++

From Modern to Unbelievably Modern C++ talk YouTube recording. All the reasons to migrate into a modern C++ standard version.

LConst PConst

const qualifier not always work the way we expect it to. In this article we will see some cases when the const doesn't protect us from modifications at all.

From Modern to Unbelievably Modern C++

From Modern to Unbelievably Modern C++ CoreC++ talk - experience summarize, and self opinions.

Into the Extreme – Fold-Expressions

Fold-expressions in the extreme. How do fold-expressions behave when there is no arguments? what about a single argument case?

The View of The String

std::string_view can optimize both performance and code readability in code sections which handle strings. However it can also lead to UB and to memory issues if used incorrectly.

explicit(To Be || !(To Be))

explicit(bool) C++20 feature discussion, motivation, usage example, proposal and more. Basic explanation about explicit and implicit conversions pros and cons.

New Discord & Telegram servers

You can now discuss about new articles, offer ideas for the next posts, and get updates about the blog on our new Discord server and Telegram channel. Stay tuned!

[Solution] Riddle – The Shared View

The Shared View riddle solution. Involves usage example of shared_ptr aliasing constructor, design patterns reflection and factory, metaprogramming, string_view and variant/visit.

Riddle – The Shared View

C++ Riddle - involves shared_ptr, string_view and some metaprogramming.

The Mystery of The Missing Bytes

How to save bytes and alignment when containing some types inside a structure. Techniques to avoid wasting space on unique_ptr deleter and on another structures allocators like std vector or map. Taking into account Empty Base Optimization (EBO) and no_unique_address attribute sice C++20. Internal GCC and LLVM compilers implementations.

The Shared The Unique and The Weak – Initialization – Part 2

unique_ptr and weak_ptr constructors, initializers and usage examples. make_unique advantages and disadvantages. unique_ptr custom deleters usage examples and important notes to pay attention to.

The Shared The Unique and The Weak – Initialization – Part 1

Shared ptr allocations, initializations, and behind the scenes functionality. Constructors' usage summaries, the aliasing conatructor, make_shared allocate_shared advantages and disadvantages.

The Shared, The Unique and The Weak

Smart memory management - the ability to maintain pointers "without worrying when they should be released" sounds really utopic, but is it really the entire truth about "smart pointers"?

Design Patterns: RunTime Reflection – C++

One of the most desired Design Patterns is reflection- The ability to use classes metadata (names, functions, properties, etc...) at runtime. By default this is not possible on C++, and sometimes the selected solution is to use macros, but today we are going to archive it without them.

Design Patterns: Decorators – C++

Design Patterns were always different in C++, and a usual use of these patterns in C++ might cause more complications and problems in this language. In this series of articles, I’ll show how to correctly implement them in C++. In this article we’ll see how to implement a compile-time Decorator.

Design Patterns: Factories – C++

Design Patterns were always different in C++, and a usual use of these patterns in C++ might cause more complications and problems in this language. In this series of articles, I'll show how to correctly implement them in C++. In this article we'll see how to build a factory for a template base class.

Hash your Conditions – C++

Conditions are the most natural way to control your code flow in programming, it's almost the first thing that every programmer learn at the beginning. Sometimes conditions, especially if you are conditioning strings in C++, the code become very complicated to understand and very lazy. Let's break this pattern.

C++ Help your compiler to help you

How can the compiler help our code to run faster, and how can it generate some warnings in a single cross-compilers way?

C++ Compiler Secrets: Pragma

Communicate with GCC compiler using GCC specific compiler pragmas.

C++ Illusions: Random

One of the first mistakes that every developer doe is to believe in the theoretical idea that behind "Random". The absolutely unexpected arbitrary result of some unexpected mysterious function. What random really is, and how do we use it the right way on C++?

Power Range(r)s – C++20

C++20 Ranges library. What are the ranges. how to use them, what mistakes should we avoid and how to apply ranges on custom collections.

Contributing a C++ Compiler – Experience Details

Contributing a C++ compiler personal experience details.

The Number that Broke and Spoke – C++ Investigator

How many times you find yourself writing hard-coded numbers inside your code, while trying to make sure as much as you can to make these numbers' units visible? You probably found yourself mentioning the units as part of the variable name, or at the comment, praying that who ever gets to your code will understand it. After reading this article, you will have the most maintainable way of doing so.

Maintain Your Iterations – Iterators Customization – Part 3

The third part of the iterators series. Maintain your iterations with your own containers collections. How can you create an iterators friendly collection to fit your legacy iterators-friendly code infrastructure? Create new custom iterator types in C++20.

Maintain Your Iterations – Insecure Iterations – Part 2

The second part of the iterators series. Iterators might be a dangerous thing sometimes. What is the risk they bring with them, and how to prepare to / deal with it?

Maintain Your Iterations – The Iterators Secret – Part 1

The first part of iterators explanation. Why should you use iterators? Which kinds of iterators exist? How can iterators help you to maintain and optimize your code? And what is the secret behind iterators?

Lambda, Expressions, and between them – The Lambdas Mystery – Part 2

The second part of lambda expressions explanation. Behind the scenes of lambda expressions: What lambda expressions truly are? How can they capture variables? How can we use auto params in C++14 lambdas when this feature came only in C++20? Behind the scenes from C++11 to C++20 of lambdas.

Lambda, Expressions, and between them – From 11 to 20 – Part 1

Lambda expressions usages in C++ since C++11 to C++20. Features, rules, usages and abilities. Why do we need it, and how can we get more maintainable code by using it?

Template Base Class Collection

How to create a collection of a template base class? How to create a single collection for multiple similar interfaces? Based on Sean Parent talk "Inheritance Is The Base Class of Evil".

Substitution Failure is Not an Error – SFINAE

The 11th post in C++ meta programming series. What is SFINAE? How and When to use it? And when should we avoid using it?

Become a Compile-Time Coder

The 10th post in C++ meta programming series. How to use compile-time functions from C++11 to C++20? How to define user-defined compile-time types? What is constexpr and how does it tie up all of the above?

The Exact Solution for a Generic Problem – Part 2

The 9th post in C++ meta programming series. How to protect our solution from less experienced developers in variadic template development cases? Restrictions over variadic params from C++11 to C++20.

The Exact Solution for a Generic Problem – Part 1

The 8th post in C++ meta programming series. What is the problem with a generic solution? Why should we pay extra attention when we solve a problem in a generic way? And how to protect our solution from less experienced developers?

Templates Infinity Theory – From C++11 to C++20 – Part 2

The 7th post in C++ meta programming series. Learn about variadic templates in C++17- How does C++17 helps us handle them, when to use / don't use fold expressions, and what things we need to draw a close attention to when we use them?

Templates Infinity Theory – From C++11 to C++20 – Part 1

The 6th post in C++ meta programming series. Learn about variadic templates- How to use them, and about how to make the code more flexible and maintainable with them.

C++ – Partial / Explicit specialization

This is the 5th post in C++ meta programming series. Learn about explicit partial template specializations in C++, and about the differences between them.

C++ templates – Beginners most common issue

Separation of templates functions/classes declarations from definitions always raise a common issue at the first time. Read about the reasons for this issue, and how to solve it.

Basic templates usage – Part 2

This is the third post in C++ meta programming series. Learn about basic non-type template parameters, template of templates, and passing functions as template parameters.

Basic templates usage – Part 1

This is the second post in C++ meta programming series. Learn about basic templates usage, why it's needed, and how can it help you writing a generic code.

C++ Meta Programming: Why?

Why does C++ meta programming is so important and powerful? This is a short introduction to C++ meta programming, it's abilities, and strengths. The first article in a series about C++ meta programming.

Before starting a new project – The Most Important Decision

You got an idea, know some languages, have some techniques, so what are you waiting for?! Go and code up your idea! But Is there a better/right way? Should you take something into consideration before? Will there be consequences? Before you start coding your idea, it s better to read this post, just to make sure Continue reading Before starting a new project The Most Important Decision