Blog

Page 445 of my articles, tutorials, and thoughts

Latest Articles

Cover Image for How to check that an element is in a std::set?
contains

How to check that an element is in a std::set?

Published on September 2, 2023

# šŸ•µļøā€ā™€ļø Finding Elements in a std::set: Simplified! šŸ•µļøā€ā™‚ļø Have you ever wondered how to check if an element exists in a std::set? šŸ¤” Look no further! In this blog post, we'll explore common issues and provide easy solutions for checking the existence of

Cover Image for Why does GCC generate 15-20% faster code if I optimize for size instead of speed?
gccperformance

Why does GCC generate 15-20% faster code if I optimize for size instead of speed?

Published on September 2, 2023

# Why does GCC generate 15-20% faster code if I optimize for size instead of speed? šŸ¤” Have you ever noticed that when you optimize your code with GCC, specifically when you choose the `-Os` optimization flag for size, the generated code tends to run noti

Cover Image for "printf" vs. "cout" in C++
iostreamprintf

"printf" vs. "cout" in C++

Published on September 2, 2023

# `printf` šŸ†š `cout` in C++: Battle of the Printing Functions šŸ‘‰ Are you a C++ programmer struggling with choosing between `printf()` and `cout` for printing values? You're not alone! The battle between these two printing functions has been ongoing for ag

Cover Image for std::string to char*
charstring

std::string to char*

Published on September 2, 2023

# Converting std::string to char* So, you want to convert a `std::string` to a `char*` or `char[]`. It seems like a simple task, but encountering the error message can be frustrating 😩. Let's dive into the common issues and explore some easy solutions t

Cover Image for Why do we use the volatile keyword?

Why do we use the volatile keyword?

Published on September 2, 2023

## 🌟 Unlocking the Mysteries of the Volatile Keyword 🌟 Have you ever come across the "volatile" keyword in your code and wondered what it does and why people use it? šŸ¤” Well, you're not alone! This little keyword has sparked curiosity and confusion amon

Cover Image for What uses are there for "placement new"?
memory-management

What uses are there for "placement new"?

Published on September 2, 2023

# Unleashing the Magic of "Placement New" in C++ šŸŽ©āœØ Hey there, tech enthusiasts! Today we're going to explore the enchanting world of "placement new" šŸŖ„āœØ in C++. šŸ–„ļø ## What the heck is "placement new" anyway? šŸ¤” If you've ever wondered why you would n

Cover Image for What is the meaning of prepended double colon "::"?
namespacessyntax

What is the meaning of prepended double colon "::"?

Published on September 2, 2023

# What is the meaning of prepended double colon "::"? If you've stumbled upon code snippets with a mysterious prepended double colon (::), fear not! You're not alone in your confusion. In this blog post, we'll unravel the meaning behind this perplexing sy

Cover Image for How do I use arrays in C++?
arraysmultidimensional-array

How do I use arrays in C++?

Published on September 2, 2023

šŸ“ **Title:** A Beginner's Guide to Using Arrays in C++: Demystifying the Basics šŸ“Œ **Introduction:** Are you new to C++ and feeling overwhelmed by the concept of arrays? You're not alone! Even though arrays are a fundamental data structure in C++, they c

Cover Image for C++11 rvalues and move semantics confusion (return statement)

C++11 rvalues and move semantics confusion (return statement)

Published on September 2, 2023

# Understanding C++11 Rvalues and Move Semantics with Return Statements ## Introduction Are you struggling to understand rvalue references and move semantics in C++11? You're not alone! These concepts can be confusing, but fear not, we're here to help yo

Blog | Matheus Mello