Тёмный

C++ STL algorithm - std::generate and generate_n | Modern Cpp Series Ep. 152 

Mike Shah
Подписаться 23 тыс.
Просмотров 851
50% 1

Опубликовано:

 

27 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 10   
@ambiennt
@ambiennt Год назад
There aren’t many modern intermediate/advanced c++ channels on youtube, and yours is a nice breath of fresh air. Enjoying your videos !!
@MikeShah
@MikeShah Год назад
Cheers!
@Stephan_London-ps6ug
@Stephan_London-ps6ug 4 месяца назад
These videos seem absolutely underrated. I’ve been working with Python for the last 17 years and not much with C++, so I really need to brush up my STL knowledge. Your videos have a good intermediate level, which is quite rare.
@MikeShah
@MikeShah 4 месяца назад
Cheers, thank you for the kind words!
@KyrychenkoAnton
@KyrychenkoAnton 9 месяцев назад
Hmm, was so interesting to see [n=0] as mutable, basically as I understood, you can declare variables in lambda catches block, but because its "mutable" - that variable is not only "catched", its actually created in outside scope of where lambda is runned from? So basically creates new N variable in main() function, right? And its not static, its just normal variable, but not only in lambda, in main too?
@MikeShah
@MikeShah 8 месяцев назад
Correct, we can create variables in the lambda such that they become 'member variables' in the functor. Still remains private to the scope however -- take a look here: cppinsights.io/lnk?code=I2luY2x1ZGUgPGNzdGRpbz4KCmludCBtYWluKCkKewogICAgY29uc3QgY2hhciBhcnJbMTBdezIsNCw2LDh9OwoKICAJLy8gT2JzZXJ2ZSBpbiBjcHBpbnNpZ2h0cyBob3cgJ24nIGlzIGEgbmV3ICdtZW1iZXIgdmFyaWFibGUnIGluCiAgICAvLyB0aGUgZnVuY3RvciBnZW5lcmF0ZWQuCiAgICBhdXRvIGV4YW1wbGUgPSBbbj0wXSgpIG11dGFibGV7CiAgICAgIAogICAgIAlyZXR1cm4gbisrOyAvLyBhbGxvd2VkIHdpdGggbXV0YWJsZQogICAgfTsKICAKICAJLy9zdGQ6OmNvdXQgPDwgbiA8PCBzdGQ6OmVuZGw7IC8vICduJyBpcyBub3QgYXZhaWxhYmxlIG91dHNpZGUgb2YgY2FwdHVyZQp9&insightsOptions=cpp20&std=cpp20&rev=1.0 (Code here for the above cppinsight) #include int main() { const char arr[10]{2,4,6,8}; // Observe in cppinsights how 'n' is a new 'member variable' in // the functor generated. auto example = [n=0]() mutable{ return n++; // allowed with mutable }; //std::cout
@SBcode-s3n
@SBcode-s3n Год назад
vim + linux+ c++ +mike=❤❤❤❤❤❤❤❤❤
@MikeShah
@MikeShah Год назад
Cheers!
@__hannibaal__
@__hannibaal__ Год назад
I don’t know that exist : good thing that push me to make 3 library Container_utility Random_generator Vector_utility.
@MikeShah
@MikeShah Год назад
Cheers!
Далее
Premature Optimization
12:39
Просмотров 825 тыс.
Master Pointers in C:  10X Your C Coding!
14:12
Просмотров 319 тыс.
ARRAYLIST VS LINKEDLIST
21:20
Просмотров 70 тыс.
Programming Languages I used at Google (C++ rant)
6:14