Posts
Here are the posts published or planned so far on Fluent C++.
The posts marked with a are those I believe are the most adapted for a Daily C++ session.
I will add more, but if there is something in particular you’d like to read about, let me know!
- General expressive code C++
- The STL
- Methodology
- Strong types in C++
- Function parameters in C++
- Smart pointers in C++
- Performance
- Data structures in C++
- Boost
- Word counts in code
- Refactoring in C++
- C++ Templates
- Challenges for the most expressive code
- Meta-posts
About General Expressive Code in C++
- How to choose good names in your code
- Make your functions functional – video
- Respect levels of abstraction
- Super expressive code by Raising Levels of Abstraction
- Making code expressive with lambdas
- What 70 people came up with on expressive code
- Clearer interfaces with optional<T>
- Partial queries with optional<T>
- How typed C++ is, and why it matters
- Restricting an interface in C++
- To comment or not to comment // that is the question
- How Compact Code Can Become Buggy Code: Getting Caught By The Order of Evaluations
- Expressive C++ Template Metaprogramming
- How to use toString on custom types in C++
- The real difference between struct and class – video
- The Interface Principle in C++
- How to Flatten Out Nested Switch Statements
- How to Insulate a Toxic Api from the Rest of Your Code
- Multiple error handling with the optional monad in C++
- The Optional Monad In C++, Without The Ugly Stuff
- Dealing with Multiple Paths with the Vector Monad in C++
- The Vector Monad In C++, Without The Ugly Stuff
- How to Make If Statements More Understandable
- Do Understandable If Statements Run Slower?
- A Summary of the Metaclasses Proposal in C++
- The C++ Metaclasses Proposal in Less Than 5 Minutes
- tee – Get Debug Info With Little Impact On Code
- Function Aliases In C++
- 10 Halloween code stories that will freak you out
- How Unit Tests Help Express Your Code’s Intent (by Tim Scott)
- The Complete Guide to Building Strings In C++: From “Hello, world” Up To Boost Karma
- 7 names we should never see in code
- More tips on naming
- Why expressive code matters
- How to emulate the “super” keyword in C++
- How to be clear about what your functions return
- The Most Vexing Parse: How to Spot It and Fix It Quickly
- Lvalues, Rvalues and their references
- To RAII or not to RAII, that is the question
- The right question for the right name
- On Using Guards In C++
- Replacing An Else-If Sequence With The Ternary Operator
- The issues with singletons and how to fix them
- C++ Will No Longer Have Pointers
- How to Use Tag Dispatching Effectively
- When to Use Enums And When To Use Tag Dispatching In C++
- Passing Booleans to an Interface in an Expressive Way
- A Concrete Example of Naming Consistency
- struct and Constructors in C++: an “It’s complicated” Relationship
- 3 Simple C++17 Features That Will Make Your Code Simpler (by JFT)
- The incredible const reference that isn’t const
- How to Construct C++ Objects Without Making Copies (by Miguel Raggi)
- Simplicity in C++ Code (Podcast)
- How to Convert a String to an int in C++ (by JFT)
- How to *Efficiently* Convert a String to an int in C++ (by JFT)
- Getting Along With The Comma Operator
- How to Design Early Returns in C++ (Based on Procedural Programming)
- Modern C++: 7 Ways to Fake It Until You Have It
- Function Poisoning in C++ (by Federico Kircheis)
- How to Deal with Values That Are Both Input and Output
- How to Write Simple Code to Accomplish Complex Tasks (by Miguel Raggi)
- “auto to stick” and changing your style
- A Case Where Using Auto Leads to Undefined Behaviour
- Pointers, References and Optional References
- Why Optional References Didn’t Make It In the C++ Standard
- To DRY or not to DRY? (by Damien Beaufils)
- Deprecating and Deleting Functions in C++ (by Federico Kircheis)
- Named arguments in C++
- Generalizing Unordered Named Arguments (by Till Heinzel)
- How to Design Function Parameters That Make Your Interfaces Easy To Use (1/3)
- How to Design Function Parameters That Make Your Interfaces Easy To Use (2/3)
- How to Design Function Parameters That Make Your Interfaces Easy To Use (3/3)
- An Extraterrestrial Guide to C++ Formatting
- A Simple Timer in C++
- TODO_BEFORE(): A Cleaner Codebase for 2019
- Functional Programming Is Not a Silver Bullet
- RestMyCase: A C++ Library for Formatting String Cases (by JFT)
- The Pitfalls of Aliasing Pointers in Modern C++
- for_each_arg: Applying a Function to Each Argument of a Function in C++
- 10 Code Smells a Static Analyser Can Locate in a Codebase
- How to Emulate the Spaceship Operator Before C++20 with CRTP
- Compiler-generated Functions, Rule of Three and Rule of Five
- The Rule of Zero in C++
- How to Write Safe and Expressive Multi-Threaded Code in C++11
- The Common Vocabulary of Software Developers
- Curried objects in C++
- How to output strings separated by commas in C++ (and other mutable curried objects)
- Should Private Methods Always Be Const?
- The common vocabulary of software developers
- Which programming paradigm gives the most expressive code?
- Compiler-generated Functions, Rule of Three and Rule of Five
About Methodology
The primary focus of the blog is on code so this section is slimmer than the rest, but it’s always useful to consider how to approach code from time to times.
- The Dailies: a new way to learn at work
- Spread Knowledge in Your Company With Your “Daily C++”
- 50 People’s Opinions About How To Get Better As A Software Developer
- 7 Ways to Get Better at C++ During this Summer
- What Books to Read to Get Better In C++
- CppCast: A Show For All C++ Developers
- Getting inspired by good code
- How to use bad code to learn how to write great code
- 5 Tips to Find Your Way Around A Legacy Codebase
- 7 good resolutions to write better code this year
- 10 Techniques That Will Make You Understand Other People’s Code Better (by Patricia Aas)
- Triple trip report from ACCU, C++ Russia and C++Now 2018
- 7 More Ways to Get Better at C++ This Summer (2018 Edition)
- How I Applied Coding Best Practices to Improve My Daily Life
- The Legacy Code Programmer’s Toolbox is Out
- CPPP
About Strong Types in C++
- Strongly typed constructors
- Strong types for strong interfaces
- Passing strong types by reference
- Strong lambdas: strong typing over generic types
- Good news: strong types are (mostly) free in C++
- Inheriting functionalities from the underlying type
- Making strong types hashable
- Strong Types For Strong Interfaces: my talk at Meeting C++
- Converting strong units to one another
- Metaclasses, the Ultimate Answer to Strong Typing in C++?
- Calling functions and methods on strong types
- Using Strong Types to Return Multiple Values
- Making strong types implicitly convertible
- Strong templates
- Strong optionals
- Getting the Benefits of Strong Typing in C++ at a Fraction of the Cost (by Vincent Zalzal)
About Function Parameters
- Default parameters in C++: the facts (including the secret ones)
- Should I overload or use default parameters ?
Defaulted
: a helper to work around default parameters constraints- Integrating mocking with default parameters
- Default Parameters With Default Template Type Parameters
- How to Design Function Parameters That Make Interfaces Easier to Use (1/3)
- How to Design Function Parameters That Make Interfaces Easier to Use (2/3)
- How to Design Function Parameters That Make Interfaces Easier to Use (3/3)
About Smart pointers
- Smart developers use smart pointers – Smart pointer basics
- Smart developers use smart pointers – Knowing your smart pointers to express your intentions
- Smart developers use smart pointers – Custom deleters
- Smart developers use smart pointers – How to Make Custom Deleters More Expressive
- Smart developers use smart pointers – Changing deleters during the life of a unique_ptr
- Smart developers use smart pointers – How to implement the pimpl idiom by using unique_ptr
- Smart developers use smart pointers – Polymorphic clones in modern C++
- Smart developers use smart pointers – How to return smart pointers AND use covariance (by Raoul Borges)
- How to Transfer unique_ptrs From a Set to Another Set
- A Free Ebook on C++ Smart Pointers
About Performance
Although expressiveness is crucial for the survival of code, we don’t want it to get in the way of the performance of our applications.
- Return value optimizations
- Good news: strong types are (mostly) free in C++
- Want Both Expressive And Fast Code? Provide A Minimal Interface
About the STL
For more about how to master the STL, check out the STL learning resource.
The STL-like components I have developed:
- set_aggregate, set_segregate: higher-level algorithms on sets
- A smart iterator for inserting into a sorted container in C++
- A smart iterator for aggregating data into a map in C++
- Smart output iterators
Understanding how to use the STL:
- The importance of knowing STL <algorithm>s
- Custom comparison, equality and equivalence with the STL
- STL Function objects: Stateless is Stressless
- Ranges: the STL to the Next Level – Introduction to the Ranges Library
- Functors are not dead: the double functor trick
- Inserting several elements into an STL container efficiently
- The design of the STL
- How to split a string in C++
- Better understand ranges with the new Cartesian Product adaptor
- Move iterators: where the STL meets Move semantics
- is_transparent: How to search a C++ set with another type than its key
- How to Use Overloaded Functions With The STL
- How to Handle Multiple Types in Max Without A Cast
- Size and capacity
- How the insert iterator really works
- Think of function objects as functions rather than objects
- How to Use the STL With Legacy Output Collections
- Is std::for_each obsolete?
- Make Your Containers Follow the Conventions of the STL
- How to pass a polymorphic object to an STL algorithm
- Which One Is Better: Map of Vectors, or Multimap?
- std::iterator is deprecated: Why, What It Was, and What to Use Instead
- How to Remove Elements from a Sequence Container in C++
- How to Remove Pointers from a Vector in C++ (by Gaurav Sehgal)
- How to Remove Elements from an Associative Container in C++
- How to Remove Duplicates from an Associative Container in C++
- How to Access the Index of the Current Element in a Modern For Loop
- How to Transfer unique_ptrs From a Set to Another Set
- How to Retrieve the Firsts from a Collection of Pairs
- Why You Should Use std::for_each over Range-based For Loops
- Overview of std::map’s Insertion / Emplacement Methods in C++17
- The SoA Vector – Part 1: Optimizing the Traversal of a Collection
- The SoA Vector – Part 2: Implementation in C++
- Indexing Data Structures with C++ Scoped Enums
- The Terrible Problem Of Incrementing A Smart Iterator
- STL Algorithms on Tuples
- An Alternative Design to Iterators and Ranges, Using std::optional
- A Map with Two Types of Keys in C++
- How to send an STL collection to a curried object
STL algorithms as a whole:
STL algorithms in detail:
- Know your algorithms: algos on sets – video
- How is std::set_difference implemented?
- How to (std::)find something efficiently with the STL
- Searching when you have access to an STL container
- The searching <algorithm>s the STL holds secret
- std::transform, a central algorithm
- Predicates on ranges with the STL
- Filling <algorithm>s
- Mins and maxes
- Sorting with the STL
- Partitioning
- (std::)Accumulate Your Knowledge On Algorithms
- How to Reorder Collections With the STL
- Moving Ranges Around with STL Algorithms
- <algorithm>s on heaps
- How to Remove Elements from a Sequence Container in C++
- The BooSTL Algorithms: Boost Algorithms That Extend the STL (1/3)
- The BooSTL Algorithms: Boost Algorithms That Extend the STL (2/3)
- The BooSTL Algorithms: Boost Algorithms That Extend the STL (3/3)
About Smart Output Iterators
- Smart Output Iterators: A Symmetrical Approach to Range Adaptors
- How Smart Output Iterators Avoid the TPOIASI
- Unzipping a Collection of Tuples with the “unzip” Smart Output Iterator
- Applying Several Transforms in One Pass on a Collection
- Is Unzip a Special Case of Transform?
- Partitioning Data with Output Iterators in C++
- The Demultiplexer Iterator: Routing Data to Any Numbers of Outputs
- Performance benchmark: Ranges VS STL algorithms VS Smart output iterators
About Data Structures
- Heaps and Priority Queues in C++ – Part 1: Heaps Basics
- Heaps and Priority Queues in C++ – Part 2: The STL Algorithms on Heaps
- Heaps and Priority Queues in C++ – Part 3: Queues and Priority Queues
- Heaps and Priority Queues in C++ – Part 4: What Heaps Can Do That Priority Queues Don’t
About Boost
- Introduction to Boost Phoenix
- Introduction to Boost Karma
- The BooSTL Algorithms: Boost Algorithms That Extend the STL (1/3): Sorting and partitioning
- The BooSTL Algorithms: Boost Algorithms That Extend the STL (2/3): Searching
- The BooSTL Algorithms: Boost Algorithms That Extend the STL (3/3): The other BooSTL algorithms
About Word Counts in Code
- 3 Things That Counting Words Can Reveal on Your Code
- Word Counting in C++: Implementing a Simple Word Counter
- Word Counting in C++: Extracting words from camelCase symbols
- Word Counting in C++: Parametrizing the Type of Case
- Word Counting in C++: Computing the Span of a Word
About Refactoring
About Templates
- The Curiously Recurring Template Pattern (CRTP)
- What the Curiously Recurring Template Pattern can bring to your code
- An implementation helper for the Curiously Recurring Template Pattern
- Expressive C++ Template Metaprogramming
- Template Partial Specialization In C++
- Function template Partial Specialization In C++
- Mixin Classes: The Yang of the CRTP
- How to Make SFINAE Pretty – Part 1: What SFINAE Brings to Code
- How to Make SFINAE Pretty – Part 2: the Hidden Beauty of SFINAE
- How to Turn a Hierarchy of Virtual Methods into a CRTP
- Variadic CRTP: An Opt-in for Class Features, at Compile Time
- Variadic CRTP Packs: From Opt-in Skills to Opt-in Skillsets
- How to Reduce the Code Bloat of a Variadic CRTP
- Default Parameters With Default Template Type Parameters
- Removing Duplicates in C++ CRTP Base Classes (by Sergio Adán)
- How to Store a Variable Number of Objects Known at Compile Time in C++
- How to Define A Variadic Number of Arguments of the Same Type – Part 1
- How to Define A Variadic Number of Arguments of the Same Type – Part 2
- How to Define A Variadic Number of Arguments of the Same Type – Part 3
Challenges for the most expressive code
- Can you write expressive code? – Christmas break challenge – Results
- The Pi Day Challenge for the Most Expressive Code in C++ – Results
- Can You Wield Function Overloading Like Jon Snow Wields Longclaw? – Results
- The Expressive C++17 Coding Challenge – Results
- The Most Beautiful Piece of Code That Prints 42 (Towel Day celebration) – Results
Meta posts
- About me
- Becoming Fluent in C++
- How I came to create Fluent C++
- Fluent C++ Is 1 Year Old
- Buy me a beer for Fluent C++
- Fluent C++ is open to guest posting
- Fluent C++ is 2 Years Old
- Anna
The contents of this website are distributed under the Creative Commons license CC BY-NC-SA 4.0, unless stated otherwise.