
C++ → Leet Code Solutions - 003 - Longest Substring Without Repeating Characters
cpp, LeetCode, C++, C++17, string
Solution "Longest Substring Without Repeating Characters" on Leet Code

C++ → C ++ 17 - Lazy template functor with caching heavy function computation result
Developing the idea of caching the result of calculations of heavy functions , I propose to write a small template class, which will take the function as an argument, namely the lambda function, as the most universal an instrument within which a heavy function will be performed.
In this case, the result of the function will not be calculated at the time of creation of the Functor, but at the time of calling the operator parentheses () . And at the same time, the result will be cached. That will allow not to call a heavy function more than once as part of the execution of a method.

C++ → Using SFINAE to specialize template methods, depending on the type of container std::map or std::vector, passed as an argument
There was a problem: "write the second implementation of the template function", in which the same arguments are passed. That is, the signature of both functions completely coincides. The difference is that, as an argument, the std::vector containers and the std::map containers can be passed to the function. And depending on whether std::vector is or std::map, this or that implementation should be selected.
In this case, the SFINAE rule will be used, which states: If the final types of arguments cannot be calculated (to perform substitution of template parameters) of an overloaded template function, the compiler does not throw an error, but searches for another suitable overload. The error will be in three cases:
- No suitable overload was found.
- Several such overloads were found, and C ++ cannot decide which one to take.
- The overload was found, it turned out to be a template, and an error occurred when instantiating the template.
Our case will be the second. There are two overload template functions.

C++ → C++ 17 - [[fallthrough]] attribute
Start at work to use a compiler that supports the standard C++17.
Actively we begin to use various features from this standard..
I was pleased with the [[fallthrough]] attribute for switch case constructions.

Fornex
Let me recommend you a great European Fornex hosting.
Fornex has proven itself to be a stable host over the years.
For Django projects I recommend VPS hosting
Following the link you will receive a 5% discount on shared hosting services, dedicated servers, VPS and VPN
View HostingShare on social networks
Donate
The EVILEG project has switched to a non-commercial basis and will develop solely on the enthusiasm of the site creator, the enthusiasm of users, donations and the hosting referral system
Thank you for your support
Available ways to support the project
PayPal
PatreonYandex.MoneyMore