educative.io

C++17 in Detail: A Deep Dive (Bartłomiej Filipek)


std::variant - Wrap up Here’s a summary of all the concepts we learned in this chapter! std::variant - Quiz Here’s a short quiz to test your understanding of this chapter! std::any - Object Creation The different methods of in-place object creation are discussed briefly in this lesson. std::any - Performance & Memory Considerations This module provides a comparison of std::any with std::variant and std::optional evaluating based on efficiency and memory allocations. std::string_view - The Basics Let’s begin our study on std::string_view with a simple use case. std::string_view - General Solution There are always some steps you can take to ensure that your string_view will work with third party APIs. Find out more below. std::string_view - Choosing between string & string_view We should be clear on why we choose a string_view instead of a string. Let’s figure it out with the help of an example. std::string_view - Initializing string Members from string_view We’ll continue our analysis of the example from the last chapter, this time using std::string_view instead of std::string. std::string_view - Printing With printf() This is a third party API which may cause problems with std::string_view. We’ll learn how to use them together correctly. std::string_view - Quiz Have questions about Quiz? Go for it! String Conversions - The benchmark This section introduces a benchmark that measures performance of from_chars and to_chars<br> against other conversion methods. Filesystem - Introduction Here’s a brief look at what we’ll tackle in this section std::string_view - Wrap Up Have questions about Wrap Up? Go for it! String Conversions - Elementary string conversions This lessons discusses the shortcomings of the string conversion functions present in older versions of C++ and the new more efficient string manipulation functions introduced in C++ 17. std::string_view - Performance & Memory Considerations It’s time to see how string_view fares in terms of memory efficiency. std::string_view - Migration from boost::string_ref and boost::string_view In this lesson, we’ll learn about the classes from which std::string_view was developed. std::string_view - Example: Working with Different String APIs Does string_view offer usage with APIs like CString and QString? Let’s find out. std::string_view - Example: String Split Here, we’ll determine whether string_view can be used for splitting a string into several view objects. Searchers and String Matching - Introduction The lesson pitches a brief overview of why and what you’ll be learning next. String Conversions - Introduction Let’s take a look at the concepts to look forward to in this chapter! String Conversions - from_chars This lesson mainly elaborates on from_chars function types. Searchers and String Matching - Examples - Using Searchers In this lesson you will see the results of various experiments done using searchers. String Conversions - Summary Here’s a summary of everything we learned in this chapter! Filesystem - Overview This section deals with the filesystem library in C++. We’ll be looking at the new features of the filesystem one by one. Filesystem - Demo Example for Path Object This lesson shows a demo code sample that we are going to discuss in the upcoming lessons. The code basically displays files in a given directory. Filesystem - The Path Object Let’s explore the Path Object in detail! Parallel STL Algorithms - Execution Policies This lessons discusses the three types of execution policies as well as the differences between them. Filesystem - The Directory Entry & Directory Iteration In this lesson, we’ll see different ways of iterating over a path. Parallel STL Algorithms - Erroneous Techniques in Parallel Algorithms This sections discusses zip iterators and erroneous technique in detail. Filesystem - Path Composition C++ allows us to create a path in the form of a string. Let’s find out how. Filesystem - Error Handling & File Races Let’s briefly discuss how errors are handled in std:filesystem library. Parallel STL Algorithms - Algorithm Update This section lists all the algorithms that can handle execution policy parameter. It further looks at the usage of the Run and Measure function. Parallel STL Algorithms - Processing Containers This section discusses how to process several containers and the same time using the example of separate containers of indices. Parallel STL Algorithms - Quiz Now that you’re familiarized with the concept of Parallel Algorithms. Let’s put them to test! Parallel STL Algorithms - Benchmark II This section gives another example of benchmark measurement by computing the sum of all elements in a vector. Parallel STL Algorithms - Par/Seq Policy Usage Let’s compare different situations to see where parallel execution works better. Parallel STL Algorithms - Benchmark I This section will give a comparison of sequential vs parallel computing using Run and Measure. Parallel STL Algorithms - For_Each and Reduce Algorithms This lesson goes into the details of reduce algorithm and its working. Other Changes in the Library - Improvements for Maps and Sets In the next few lessons, we will test the functionality of the new features introduced for maps and sets. Parallel STL Algorithms - Exceptions This section touches upon the exceptions that can arise while using execution policies. Parallel STL Algorithms - More Algorithms This section introduces two more algorithms, the fused and scan algorithms! Parallel STL Algorithms - Performance of Parallel Algorithms This lesson explains in detail the performance of parallel algorithms and the factors that affect it. Parallel STL Algorithms - Counting Elements This lesson discusses in detail, an algorithm that counts the number of elements in a container. Parallel STL Algorithms - Summary This section provides a summary of all the major concepts discussed throughout the section. Other Changes in the Library - Introduction Below, you can find a list of the topics that we’ll cover in the section. Refactoring with std::optional and std::variant - Introduction Intro provides a short overview of what refactoring with std::variant and std::optional means. Refactoring with std::optional and std::variant - The Use Case The lesson provides the implementation of a particular use case of std::variant and std::optional Other Changes in the Library - std::byte C++ now allows us to convert data types into bytes using std::byte. Other Changes in the Library - Emplace Enhancements for Maps and Unordered Maps Here we’ll work with some of the new methods available in maps. Other Changes in the Library - Return Type of Emplace Methods This is the last topic of discussion for map enhancements. Other Changes in the Library - Non-member size(), data() and empty() Here, we’ll discuss the functionality of these new non-member functions. Enforcing Code Contracts With [[nodiscard]] - Summary Have questions about Summary? Go for it! Other Changes in the Library - Sampling Algorithms Check out the cool new sampling feature added to C++. Other Changes in the Library - constexpr Additions to the Standard Library C++17 brings a diverse range of new methods to the constexpr class. We’ll talk about them below. How to Parallelise CSV Reader - Converting Lines into Records This lesson explains the functionality of the LoadRecords function. How to Parallelise CSV Reader - The OrderRecord Class Now, we’ll examine the class which converts CSV lines to records. Refactoring with std::optional and std::variant - The Tuple Version The lesson elaborates how to return multiple values using tuple. Refactoring with std::optional and std::variant - A Separate Structure The lesson elaborates the use of a separate struct to return multiple values. Refactoring with std::optional and std::variant - With std::optional The lesson shows why std::optional is the right choice for nullable types. Enforcing Code Contracts With [[nodiscard]] - Introduction The [[nodiscard]] attribute is a way of conveying our intentions to the compiler. We’ll find out more in this section. Other Changes in the Library - New Mathematical Functions With C++17 we get lots of new mathematical functions like gcm, lcm, clamp and other special ones. Enforcing Code Contracts With [[nodiscard]] - How to Ignore [[nodiscard]] In some circumstances, you may not want the [[nodiscard]] functionality. There are methods of ignoring its warnings. We’ll discuss them below. How to Parallelise CSV Reader - Introduction Let’s take a look at what we’ll learn about parallel algorithms in this section. Replacing enable_if with if constexpr - Factory with Variable Arguments - With if constexpr This section discusses the use of enable_if in pre C++17 versions and the use of if_constexpr in C++ 17. Replacing enable_if with if constexpr - Factory with Variable Arguments - Summary Here’s a brief summary of all the concepts discussed in this chapter! How to Parallelise CSV Reader - The Core Parts Let’s examine the core parts of our CSV Reader application. How to Parallelise CSV Reader - Application Requirements In this lesson, we will look at the requirements of an application which makes computations on the data from a CSV file. How to Parallelise CSV Reader - The Serial Version Let’s take a look at the serial implementation of the CSV application from the previous lesson. How to Parallelise CSV Reader - Calculations Let’s write the summing function for our CSV reader app and compile the code. How to Parallelise CSV Reader - Using Parallel Algorithms This lesson highlights the advantages of using parallel algorithms to implement the CSV reader application we just made. How to Parallelise CSV Reader - Data Size and Instruction Count Matters Let’s learn about factors which improve the performance of parallel algorithms. How to Parallelise CSV Reader - Parallel Data Conversion In this lesson, we will begin refactoring the data conversion part of our program. How to Parallelise CSV Reader - Parallel Calculations Now, it’s time to refactor the CalcTotalOrder function using parallel algorithms. How to Parallelise CSV Reader - Wrap Up & Discussion Some final words on this topic. How to Parallelise CSV Reader - Tests In this lesson, we’ll be running tests to see if the parallel version of our app is better than the serial version. std::variant - The basics Have questions about The basics? Go for it! Parallel STL Algorithms - Introduction Let’s take a look at the concepts to look forward to in this chapter! Refactoring with std::optional and std::variant - Wrap Up Have questions about Wrap Up? Go for it! Refactoring with std::optional and std::variant - With std::variant The lesson describes how std::variant is better than std::optional in terms of error handling. Enforcing Code Contracts With [[nodiscard]] - Everywhere?! Let’s make a general outline about the appropriate use of [[nodiscard]]. General Language Features - Init Statement for if and switch C++17 adds new features to ‘if’ and ‘switch’ statements. See more details in this lesson. Introduction - Working With Maps Let’s examine the new behavior of maps in C++17. Introduction - Language Features We’ll start things off with a brief introduction of what to expect in this course. std::variant - Changing the values This lesson addresses the ways of changing values of the variant. std::optional - Returning std::optional Let’s learn the different ways to return an optional. Standard Attributes - Before C++11 This section explains how attributes used to work before C++ 11. std::string_view - Handling Non-Null Terminated Strings A string_view works well with null-terminated strings. Let’s see what happens when we point it to a substring which does not have a null character at the end. Searchers and String Matching - Summary Have questions about Summary? Go for it! std::optional - std::optional Creation This lesson explains the different ways of creating std::optional variables. Searchers and String Matching - New Algorithms Available in C++ 17 The lesson provides a brief overview Filesystem - Supporting Functions Let’s look at some additional functions the Filesytem library has to offer. std::string_view - Reference Lifetime Extension This lesson deals with the lifetime of temporary objects. std::string_view - Risks Using string_view Let’s look at some cases where string_view may cause problems. std::string_view - When to Use This lesson lists the various areas where std::string_view is recommended. std::optional - Performance & Memory Consideration Let’s weigh the memory and performance constraints when working with std::optional. std::string_view - Strings in Constant Expressions Now, we’ll learn why string_view works with constant expressions. std::string_view - The std::basic_string_view Type std::string_view is built upon the std::basic_string_view type. We’ll see the implementation below. Searchers and String Matching - DNA Matching The lesson explains the use and working of searcher functions using the DNA structure. Introduction - Let's Start! We are at the end of our introductory section. Let’s see what lies ahead. Language Clarification - Guaranteed Copy Elision This part introduces the concept of Copy Elision and its role in optimization. Language Clarification - Simplification of gl/prvalue This section further touches upon the concept of glvalue/prvalue in C++ 17. Filesystem - Examples of using std:filesystem In this section, we’ll analyze a few examples where <code>std::filesystem</code> is used. We’ll go from a simple code - loading a file into a string, and then explore creating directories, or filtering using <code>std::regex</code>. Fixes and Deprecation - Fixes Let’s get started with the major fixes and improvements in C++17. General Language Features - Structured Binding Declarations This lesson sheds light on the modifications made to tuple functionality. General Language Features - Using if In A Search Statement Let’s test the ‘if’ statement feature we discussed in the last lesson. Language Clarification - Evaluation Order in C++17 Now let’s try and understand evaluation order in C++ 17! General Language Features - Inline Variables Let’s take a look at how C++ deals with inline variable declaration. General Language Features - Modifiers To further specify the nature of our structured bindings, we can use modifier types. General Language Features - Binding In this lesson, we will list down the different initializers which support structured binding. Language Clarification - Introduction Have questions about Introduction? Go for it! Fixes and Deprecation - Removed Features The new update has deprecated some existing features. Fixes and Deprecation - Removing Deprecated Operator ++ (bool) For the history of the operator ++, read below. Introduction - Debug Printing Now, we shall study a print function which uses several new facilities of C++. Fixes and Deprecation - Removing auto_ptr The lesson introduces how the pointers have been revamped for the better. Fixes and Deprecation - Introduction Have a look at what we’ll be covering in this section. Language Clarification - Expression Evaluation Order Let’s take a look at how C++ 14 and C++ 17 address Expression Evaluation Fixes and Deprecation - Removing Deprecated Exception Specifications This lesson shows how exception handling has evolved in C++17. Fixes and Deprecation - Other Removed Features This lessons lists some more obsolete C++ functions. Language Clarification - Non-movable/Non-copyable type To understand further let’s take a look at an example of non-movable/non-copyable type. General Language Features - Nested Namespaces C++17 has restructured the way we write nested namespaces, making the syntax more readable. Language Clarification - Named Return Value Optimization Here we learn about how compilers use NRVO and Eliding to optimize. std::optional - The Standard Library Changes This section delves deep into the std::optional utility introduced in C++17. Language Clarification - Dynamic Memory Allocation This lesson explains memory alignment in C++ 17 and how it fixes the holes in C++11/14 memory alignment. General Language Features - Introduction Let’s see which concept will we deal with in this section. Templates - Deduction Guides The lesson focuses on how compiler uses special rules called “Deduction Guides” to work out the template class types. Templates - Template Argument Deduction for Class Templates The lesson will make you learn how to skip make_Type functions to construct a template object. Language Clarification - Quiz This short quiz tests your understanding of the various concepts learned in this chapter! Templates - Fold Expressions This lesson explains how variadic templates in C++ 17 are better than available in C++ 11. Language Clarification - Exception Specifications This lesson touches upon specifying exception and the reasons for adding this feature. Templates - Introduction This introduction will give us a brief glimpse of what to expect in this section. Templates - Examples - Fold Expression This lesson focuses the implementation of the Fold Expression Templates. Templates - Template Code Simplification The lesson highlights the updates used for Templates Simplification for picking one implementation of Algorithm. Templates - if constexpr The lesson explains why ‘if constexpr’ should be used, and how it is different from simple if statements. Templates - Examples - Template Code Simplifications Let’s see a couple of examples! Templates - Declaring Non-Type Template Parameters With auto This lesson teaches you how C++ 17 uses auto for deducing non-type template parameters. Templates - Other Modifications in C++ 17 This lesson highlights some of the prominent features of C++ 17 that are worth adding to your set of tools. Templates - Quiz Have questions about Quiz? Go for it! General Language Features - The Syntax Below is the syntax we can use to access and bind tuple values with variables safely. std::optional - Default Construction Using std::optional with class constructors can be slightly inefficient sometimes. In this lesson, we’ll learn a way to fix that. std::optional - Examples Of std::optional Shown here are some practical examples where std::optional is useful. Language Clarification - Updated Value Categories C++ 17 introduces some updated value categories. This part helps familiarize with them. Read below to find out more! General Language Features - Quiz Have questions about Quiz? Go for it! std::any - Summary Have questions about Summary? Go for it! std::variant - Examples of std::variant This lesson explains the basic idea of ErrorCode. std::variant - Introduction Let’s take a look at what you’ll learn in this chapter! std::optional - Quiz Have questions about Quiz? Go for it! std::string_view - Other Operations A string_view borrows a limited number of methods from the string type. Check them out below. std::variant - Ambiguity and complex types What if we want to create objects of complex types?, what if there’s ambiguity when you initialize std::variant? Read below to find out the answers. std::optional - A Basic Example Of std::optional Let’s look at std::optional in action. std::string_view - std::string_view Creation The different ways of initializing a string_view are listed in this lesson. std::any - Accessing The Stored Value Here are discussed the different modes of accessing a stored value in std::any. Standard Attributes - Third standard attribute This section delves into the details of the third standard attribute called nodiscard. General Language Features - constexpr Lambda Functions Lambda functions are now compatible with constant expressions. std::optional - Be Careful With Braces When Returning Let’s observe some seemingly ordinary code and understand why it can potentially be harmful. std::string_view - Introduction Let’s take a look at what we’ll cover in this section. Standard Attributes - Quiz Now that you’ve learned about Standard Attributes, let’s test your concepts in this quiz. Standard Attributes - Introduction Let’s take a look at what you should be expecting from this chapter. std::optional - Introduction Find out what this section is all about below! std::string_view - Problem With The Initial Example We’ve learned about several risks associated with std::string_view. Let’s check if they apply to the first example in this section. String Conversions - to_chars In this part we learn about the to_char function and it’s two types of declarations; the integral and floating point. String Conversions - Quiz This short quiz will test your understanding of String Conversions! Filesystem - Summary Here’s a brief summary of what we have covered so far! Standard Attributes - Namespaces/enumerators attributes This lessons discusses attributes when they were applied on namespaces/enumerators, the problems with it in C++ 11 and the fix C++ 17 offers. Standard Attributes - More on attributes This lesson touches upon some more features of the attributes in C++ 17 std::optional - Accessing The Stored Value This lesson goes into detail on the different ways to access optional type values. std::optional - in_place Construction Here, we will discuss why it is a good practice to use in_place with std::optional. std::optional - Special case: optional<bool> and optional<T*> This lesson highlights a case where using std::optional is not recommended. std::optional - Operations on std::optional Creating and accessing is just the tip of the iceberg. There are several operations that can be performed on std::optional. std::optional - Summary Have questions about Summary? Go for it! std::variant - std::variant demo Let’s take a look at the basic example of std::variant and it’s explanation! Standard Attributes - Section summary Have questions about Section summary? Go for it! std::variant - In place construction std::variant has two in_place helpers which this lesson elaborates on. Let’s read more about them below! std::variant - Object lifetime This lesson discusses how std::variant handles object lifetime. std::variant - Polymorphism In this lesson we deal with the concept of using std::vector and std::variant in Polymorphism. Interesting? Read on to find out more! Fixes and Deprecation - static_assert With No Message C++17 has built upon the previous functionality of ‘static_assert’ to provide a more convenient experience. std::variant - Accessing stored value This part discusses how to access stored values using helper functions. std::variant - When to use This section explains some possible uses of std::variant std::variant - Overload In this part we’ll take a look at overloading and C++ 17 overload uses. std::variant - Exception safety guarantees This part discusses exception safety with an example! std::variant - Parsing command line Here we discuss how to parse command line to test for the existence of parameters. Read below to find out more! std::variant - Parsing and state machines This section daily deals with state machines and the use of visitors as events. std::any - The Basics The basics talk about the former kind of exceptions thrown, and when to use std::any. std::any - Introduction The intro to std::any elaborates why and how it is used(explained in later modules)! std::variant - std::variant creation This lesson elaborates on creating and initializing std::variant std::variant - Visitors for std::variant This lesson explains std::visit, it’'s declaration and use. Standard Attributes - Why do we need attributes? In this part we learn about attributes! Fixes and Deprecation - Removing the 'register' Keyword ‘register’ allowed us to store a variable in a registers. Let’s see why it has been deprecated. Standard Attributes - C++17 additions Fallthrough, maybe_unused and nodiscard are the three new attributes in C++ 17 that this lesson talks about. General Language Features - How Can It Simplify The Code If you still aren’t on board with the concept of inline variables, the example below will prove their importance. Standard Attributes - Attributes in C++11/C++14 Let’s take a look at specific attributes in C++ 11 and attribute additions in C++ 14. Replacing enable_if with if constexpr - Factory with Variable Arguments - Introduction One of the most powerful language features that we get with C++17 is the compile-time if in the<br> form of <code>if constexpr</code>. It allows you to check, at compile time, a condition and depending on the<br> result the code is rejected from the further steps of the compilation. std::variant - Visiting multiple variants This lessons discusses visiting multiple variants. Let’s take a look at it in detail! Enforcing Code Contracts With [[nodiscard]] - Where Can It Be Used? This lesson showcases some situations where the use of [[nodiscard]] is beneficial. General Language Features - Providing Structured Binding Interface for Custom Class To work with custom classes, we need three things: std::optional - Constructors With Many Arguments The basic principle is the same as it was with default constructors. The ‘in_place’ command will come in handy once again. String Conversions - Examples Below we take a look at the floating and integral type string conversions! Parallel STL Algorithms - C++17's Parallelism This chapter talks about CPU and GPU computing. It also gives a basic overview of the execution policy parameter introduced in C++ 17 std::any - Migration from boost::any The lesson shows how transition from boost to std can make things more flexible for you. std::string_view - Conversion Functions Like atoi()/atof() This lesson explains why conversion using atof() is not possible with string_view. Searchers and String Matching - Using Searchers The lesson will elaborate the syntax and methods for using Searchers.
About the C++17 in Detail: A Deep Dive (Bartłomiej Filipek) category [C++17 in Detail: A Deep Dive (Bartłomiej Filipek)] (1)
Examples not compiling [Introduction - Working With Maps] (3)