6.6 — Internal linkage

In lesson , we said, “An identifier’s linkage determines whether other declarations of that name refer to the same object or not”, and we discussed how local variables have no linkage. Global variable and functions identifiers can have either internal linkage or external linkage. We’ll cover the internal linkage case …

12.8 — Lambda captures

In the previous lesson (), we introduced this example: #include <algorithm> #include <array> #include <iostream> #include <string_view> int main() { std::array<std::string_view, 4> arr{ “apple”, “banana”, “walnut”, “lemon” }; auto found{ std::find_if(arr.begin(), arr.end(), [](std::string_view str) { return (str.find(“nut”) != std::string_view::npos); }) }; if (found == arr.end()) { std::cout << “No nuts\n”; …

12.7 — Introduction to lambdas (anonymous functions)

Consider this snippet of code that we introduced in lesson : #include <algorithm> #include <array> #include <iostream> #include <string_view> // Our function will return true if the element matches bool containsNut(std::string_view str) { // std::string_view::find returns std::string_view::npos if it doesn’t find // the substring. Otherwise it returns the index where …

0.12 — Configuring your compiler: Choosing a language standard

With many different versions of C++ available (C++98, C++03, C++11, C++14, C++17, C++20, etc…) how does your compiler know which one to use? Generally, a compiler will pick a standard to default to (typically not the most recent language standard). If you wish to use a different language standard (and …