Segui il video qui sotto per vedere come installare il nostro sito come web app sulla tua schermata principale.
Nota: Questa funzionalità potrebbe non essere disponibile in alcuni browser.
Pubblicità
Si conosco abbastanza bene ma fino alla versione 13 , ho visto che hanno implementato nuove funzioni come i moduli...Dipende a che livello. Lo conosci già oppure no?
Between C++13 (which is often referred to as C++14) and C++20, the language has seen several significant changes and additions. Here's an overview of the major features introduced in each version:
C++14 (2014)
- Binary Literals:
- You can now use binary literals for integral values using the prefix 0b or 0B.
- Example: int bin = 0b1010; // 10 in binary
- Digit Separators:
- The single quote (') can be used to separate digits in numeric literals for better readability.
- Example: int large_number = 1'000'000;
- Generic Lambdas:
- Lambdas can now have auto parameters, making them generic.
- Example: auto lambda = [](auto x, auto y) { return x + y; };
- Return Type Deduction for Functions:
- You can omit the return type, and it will be automatically deduced.
- Example: auto add(int a, int b) { return a + b; }
- Relaxed constexpr Restrictions:
- constexpr functions can now have more complex logic, including multiple statements and loops.
- Example: constexpr int factorial(int n) { return n <= 1 ? 1 : (n * factorial(n - 1)); }
- std::make_unique:
- Provides a safer way to create unique pointers.
- Example: auto ptr = std::make_unique<int>(10);
- Extended constexpr:
- More complex expressions and functions are allowed in constexpr contexts.
- Variable Templates:
- Allows the definition of variable templates, which are templates that represent variables.
- Example: template<typename T> constexpr T pi = T(3.1415926535897932385);
C++17 (2017)
- Structured Bindings:
- Allows you to unpack tuples and other types with multiple return values.
- Example: auto [a, b] = std::pair<int, int>{1, 2};
- If and Switch with Initializers:
- You can now include an initializer in the if and switch statements.
- Example: if (auto x = foo(); x > 0) { /* ... */ }
- Inline Variables:
- Variables can be declared inline to avoid multiple definitions.
- Example: inline int x = 10;
- std::optional:
- Represents an optional value that might or might not be present.
- Example: std::optional<int> opt = 5;
- std::variant:
- A type-safe union, allowing a variable to hold one of several types.
- Example: std::variant<int, double> v = 42;
- std::any:
- A type-safe container for single values of any type.
- Example: std::any a = 10;
- Fold Expressions:
- Simplifies the syntax for variadic templates.
- Example: template<typename... Args> void print(Args... args) { (std::cout << ... << args) << '\n'; }
- constexpr if:
- Allows compile-time conditionals within templated code.
- Example: if constexpr (condition) { /* code */ }
- std::filesystem:
- Provides facilities for performing operations on file systems and their components.
- Example: std::filesystem::path p = "/tmp";
- Parallel Algorithms:
- Standard algorithms can now be executed in parallel.
- Example: std::vector<int> v = /* ... */; std::sort(std::execution::par, v.begin(), v.end());
- std::string_view:
- Provides a non-owning view into a string.
- Example: std::string_view sv = "Hello, World!";
C++20 (2020)
Each version of C++ introduced features to make the language more expressive, safer, and more efficient. It's beneficial to be familiar with these new features to write modern, idiomatic C++ code.
- Concepts:
- Provides a way to specify constraints on template parameters.
- Example: template<typename T> requires std::integral<T> T gcd(T a, T b) { /* ... */ }
- Ranges:
- Introduces a new way to work with sequences of elements.
- Example: std::vector<int> v = {1, 2, 3, 4}; auto even = v | std::views::filter([](int n) { return n % 2 == 0; });
- Coroutines:
- Allows the definition of functions that can suspend execution to be resumed later.
- Example: std::future<int> async_func() { co_return 42; }
- Modules:
- Provides a way to modularize code and improve compilation times.
- Example: import module_name;
- Three-Way Comparison (Spaceship Operator):
- Introduces a new comparison operator (<=>) to simplify the definition of ordering.
- Example: auto result = a <=> b;
- Calendar and Time Zone Library:
- Enhances support for handling dates, times, and time zones.
- Example: std::chrono::year_month_day date = std::chrono::year{2020}/12/25;
- std::span:
- A non-owning view into a contiguous sequence of elements.
- Example: std::array<int, 3> arr = {1, 2, 3}; std::span<int> s(arr);
- Constexpr Improvements:
- Many standard library functions are now constexpr, allowing more compile-time computation.
- Example: constexpr int max = std::max(10, 20);
- Enhanced Lambdas:
- Lambdas can now capture *this and use template parameters.
- Example: auto lambda = [*this](auto x) { return x + value; };
- Expanded Immediate Functions (consteval):
- Introduces consteval for functions that must produce a compile-time constant.
- Example: consteval int square(int x) { return x * x; }
- Concepts and Requires Clauses:
- Constraints can be explicitly stated for templates.
- Example: template<typename T> requires std::integral<T> T add(T a, T b) { return a + b; }
- Template Syntax Improvements:
- Simplifies and extends template syntax, including abbreviated function templates.
- Example: auto add(T a, T b) -> decltype(a + b);
- std::format:
- Provides a type-safe and efficient way to format strings.
- Example: std::string s = std::format("Hello, {}!", "World");
Si lo so , potrei anche verificare il sito ufficiale ed aggiornarmi oppure chatgpt ma sono un nostalgico dei libri mi piace avere un supporto cartaceo..Se lo conosci già, eviterei di comprare un testo... piuttosto guarderei il reference ufficiale online.
Rischi di prendere un libro del quale conosci l'80% delle cose; fosse anche il 70%, avresti comunque buona parte del testo li per nulla.
Puoi sfruttare ChatGPT per queste cose secondo me.
Ho scoperto che siamo a C++26.... ho un libro "The C++ Programming Language", versione 11.
Ah grazie per il link è quello che cercavoI libri avanzati che ricordo purtroppo non sono aggiornati (Modern C++, per dire).
Gli altri aggiornati sono più che altro per beginners, quindi anche se vedi molte delle cose nuove secondo me non avrei una trattazione adeguata al livello.
Puoi provare a dare un occhio a repo come questo: https://github.com/federico-busato/Modern-CPP-Programming