No video

STL std::map | Modern Cpp Series Ep. 126

  Рет қаралды 3,487

Mike Shah

Mike Shah

Күн бұрын

►Full C++ Series Playlist: • The C++ Programming La...
►Find full courses on: courses.mshah.io/
►Join as Member to Support the channel: / @mikeshah
►Lesson Description: In this lesson I give you a tour of the std::map. std::map is an associative and ordered container for storing keys and values. In general you will get logarithmic performance using this data structure for insertion, removal, and updates. I'll show you how to iterate through the map several different ways, some tips on 'using' for creating your maps, and how to create a custom comparator if you use a custom key.
►KZfaq Channel: / mikeshah
►Please like and subscribe to help the channel!
►Join our free community: courses.mshah....

Пікірлер: 34
@willadem8643
@willadem8643 7 ай бұрын
Man, you are criminally underrated. Wishing you a lot of success.
@MikeShah
@MikeShah 7 ай бұрын
Thanks for the kind words 🙂 The views will come 🙏
@nicolaschan3335
@nicolaschan3335 8 ай бұрын
I'm going through the STL series rn and I just wanted to say thanks, these videos are super helpful!!
@MikeShah
@MikeShah 8 ай бұрын
Cheers! I'm happy to hear that!
@qcnck2776
@qcnck2776 Жыл бұрын
Mike, I really appreciate seeing the non-trivial uses. Few online examples cover anything more than just a rehash of what the basic definition states. And it is always good to see the places where your code doesn't compile on the first pass: really helpful to those of us learning the quirks of the language😅. While it may add a few seconds to the video, it adds miles to troubleshooting.
@MikeShah
@MikeShah Жыл бұрын
Thank you for the kind words! Agreed, I like to leave the mistakes in -- showing how to get out of trouble is valuable and also humanizing 🙂 At the least, a different style than what is out there for folks who prefer my style 😛
@robertstrickland9722
@robertstrickland9722 Жыл бұрын
Excellent video again! Would love to see a series on streams, especially with binary data!
@MikeShah
@MikeShah Жыл бұрын
Cheers, thanks Robert! Streams are on the todo list, and some related topics eventually like serializing/deserializing data as well.
@robertstrickland9722
@robertstrickland9722 Жыл бұрын
@@MikeShah One thing I would like an explanation on, or a video on similar topics, would be why exactly having a Functor can be used as a comparison object to be inserted into a map's template argument. I understand it can be used because a map needs a comparison operation but I'm interested, and fairly uncertain, as to how the syntax and semantics or C++ allows it.
@MikeShah
@MikeShah Жыл бұрын
@@robertstrickland9722 Noted! I think that would be a good video
@thestarinthesky_
@thestarinthesky_ Жыл бұрын
Thanks Mike for these great STL series. I am learning a lot. I just have a question: if i have a vector of size n and want to create a std::map from this vector , would that be o(log(n))*n?!
@MikeShah
@MikeShah Жыл бұрын
correct, n insertions each taking log(n) time.
@joebosah2727
@joebosah2727 Жыл бұрын
Quintessential Prof, Thanks a lot. From the above, is Set, Map without value?
@MikeShah
@MikeShah Жыл бұрын
Yup, that's essentially it 🙂we might think of 'set' more naturally with union/intersection operations mathematically, but from a programming perspective, set lacks a value :) both usually rb-tree, ordered, and store unique values.
@edkachalov
@edkachalov 6 ай бұрын
New standarts of C++ become more and more ASCii art.
@MikeShah
@MikeShah 6 ай бұрын
😅
@gatita_liliana
@gatita_liliana Жыл бұрын
ahhhhhhhhhh thanks a lot for this great video
@MikeShah
@MikeShah Жыл бұрын
You are most welcome!
@user-cs2qb1pg9o
@user-cs2qb1pg9o Жыл бұрын
Hello Mike! Nice vibe on your videos, thank you! Btw, I tried understanding why the member operator< didn't work for you, but couldn't come up with any explanation. I had no problems with both a member operator< and a friend one 🤔.
@MikeShah
@MikeShah Жыл бұрын
Hmm, let me know if it is not working at what timestamp and I'll take a look
@VoidloniXaarii
@VoidloniXaarii Жыл бұрын
Oooo! Great one! Thank you!
@MikeShah
@MikeShah Жыл бұрын
Cheers!
@VoidloniXaarii
@VoidloniXaarii Жыл бұрын
@@MikeShah so great to see in your videos a mix of the three things I love: gfx, c++ & Linux... A maybe rare but truly heavenly mixture
@MikeShah
@MikeShah Жыл бұрын
@@VoidloniXaarii Agreed! Truly enjoy developing on Linux 😀
@thestarinthesky_
@thestarinthesky_ Жыл бұрын
@16:50 is it Ok to use negative numbers for types that is unsigned long int?
@MikeShah
@MikeShah Жыл бұрын
Ooops, I probably should have used a signed type. I think I was meaning to use -1 as an 'initial value'.
@thestarinthesky_
@thestarinthesky_ Жыл бұрын
Would you please make a video on structured bindings? thank you. 😍
@MikeShah
@MikeShah Жыл бұрын
Will add to the list -- this will come at some point :)
@nagenHARP
@nagenHARP 5 ай бұрын
how this working : mymap["edge1"] = Edge(0, 0 ) ; // for me this is giving error , means there should be constructor ? need your help ...
@nagenHARP
@nagenHARP 5 ай бұрын
nagendrasingh@192 mapsByMikeShah % g++ -std=c++20 mike.cpp -o prog && ./prog mike.cpp:16:19: error: no matching constructor for initialization of 'Edge' mv["Krishna"] = Edge( 1, 2 ) ; ^ ~~~~ mike.cpp:8:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided struct Edge{ ^ mike.cpp:8:8: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 2 were provided mike.cpp:8:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 2 were provided 1 error generated
@nagenHARP
@nagenHARP 5 ай бұрын
v_map["edge1"] = Edge{1,2}; with curly braces it is working ...please help me to explain this .
@syed6044
@syed6044 Жыл бұрын
Thank you very much! :)
@MikeShah
@MikeShah Жыл бұрын
You are most welcome!
@user-cs2qb1pg9o
@user-cs2qb1pg9o Жыл бұрын
fds
STL std::unordered_map (C++11)  | Modern Cpp Series Ep. 129
40:42
王子原来是假正经#艾莎
00:39
在逃的公主
Рет қаралды 18 МЛН
PEDRO PEDRO INSIDEOUT
00:10
MOOMOO STUDIO [무무 스튜디오]
Рет қаралды 19 МЛН
КАКУЮ ДВЕРЬ ВЫБРАТЬ? 😂 #Shorts
00:45
НУБАСТЕР
Рет қаралды 3,5 МЛН
STL C++ Container High Level Review | Modern Cpp Series Ep. 134
22:25
How much faster has Mojo's dictionary gotten?
7:40
EKB PhD
Рет қаралды 3,6 М.
Лекция 32. Внутреннее устройство std::list и std::map
1:35:21
All Rust string types explained
22:13
Let's Get Rusty
Рет қаралды 166 М.
One reason to Modify your Memory Allocator (C/C++)
10:23
Jacob Sorber
Рет қаралды 33 М.
王子原来是假正经#艾莎
00:39
在逃的公主
Рет қаралды 18 МЛН