Chapters 6 to 8 C++20 Fundamental
<ranges>
header: Lazy generation features likecount_if
,view::iota
,view::filter
, andview::transform
.<span>
header: Can receive built-in arrays, vectors, standard arrays, or any contiguous iterable collections. used for passing arrays to functions in safer ways.to_array
: Converts aggregate data into astd::array
.
string_view
: Used for read-only string operations.constexpr
: Allows variables to be initialized at compile time.:02d
: Fills with zeros if the number is smaller than two characters.|
(Pipeline Operation): Used in conjunction with range views for functional style transformations.ex.what()
: Used to retrieve a string describing the exception.int* const
vs.const int*
: Differentiates between constant pointer to mutable data and mutable pointer to constant data.- Alignment:
<
for left-aligned and>
for right-aligned text. seekg
,seekp
,tellg
,tellp
: Functions for positioning and querying position in streams.quoted(name)
: From C++14, simplifies output of strings that include spaces or special characters.- Raw String Literal: Represents string literals that contain multiple lines or escape characters naturally.
- Static Variables: Initialized to default values if not explicitly set.
- Argument Deduction in Templates (since C++17): Simplifies template usage by automatically determining types.
<numeric>
header functions: Includes functions likeaccumulate
for operations on data sequences.- Built-in Arrays: Limited capabilities, such as no knowledge of their own size, non-assignable, and lack of automatic bounds checking.
- Pointer Usage: Should point to a single element rather than an array.
- String Literal Concatenation: If only whitespace separates two string literals, the compiler will merge them; useful for multiline strings for better readability.
Tags: C++
, Programming
, Coding Standards