Learn C++ With Me #16 - Tuples

  Рет қаралды 31,337

Tech With Tim

Tech With Tim

Күн бұрын

Пікірлер: 70
@KyranFindlater
@KyranFindlater 3 жыл бұрын
i'm glad you discouraged the use of using Auto for type inference. I had a software engineer intern interview for a position and my feedback to him was to avoid using Auto so much, his code was full of it. Also liberal use of Double, when float would work just as well for the application, and take less space (and time, for embedded systems).
@yxlxfxf
@yxlxfxf 3 жыл бұрын
btw, there is a simpler method of decomposing tuples nowadays called structured bindings: auto t = std::make_tuple(1, "hello"); auto [x, y] = t; // x==1, y=="hello" auto &[x, y] = t; // if you want to decompose by reference
@raghavgupta6186
@raghavgupta6186 3 жыл бұрын
Thanks 🙏
@kashtonmario1379
@kashtonmario1379 3 жыл бұрын
i guess it is kinda off topic but do anybody know of a good site to stream newly released series online ?
@robertodamian7544
@robertodamian7544 3 жыл бұрын
@Kashton Mario I use FlixZone. Just google for it :)
@thatisthatoof
@thatisthatoof 3 жыл бұрын
Cool. What situations would require the decomposition by reference?
@yxlxfxf
@yxlxfxf 3 жыл бұрын
@@thatisthatoof when you want to modify the contents of the tuple by assigning each element to a reference
@solarsystem8424
@solarsystem8424 3 жыл бұрын
In newer versions of the C++ standard you can get the value of a variable in a tuple by specifying the type. It makes the code more readable and understandable, IMO. That only works though when the specified variable is the only variable of that type.
@AnonyoZarifAkand
@AnonyoZarifAkand 3 жыл бұрын
I use this series to review C++ topics every night before I go to sleep. :P Edit: cuz I don't use C++ frequently
@dimasveliz6745
@dimasveliz6745 3 жыл бұрын
Thanks Tim, fantastic as usual! I'm gonna ask after reading many comments: Am i the only one person surprised by the Tie function?? 😳 1)How is that function taking a value type variable, and magically inside of it, assigns its value??? 2) why is a call to a function on the left side and not on the right? Is that then a function? If you or anyone could provide an explanation for that, I'll highly appreciate it
@QuangLe-qk3nv
@QuangLe-qk3nv 9 ай бұрын
Tim: I call it Tuple other people: "toople" me: Turtle.
@softwhere07
@softwhere07 3 жыл бұрын
Oh that was great. This was very interesting and I understood it well. Thank you for teaching us. I can see there would be a lot of uses for this. Seeing that I use it often when dealing with python.
@raghavgupta6186
@raghavgupta6186 3 жыл бұрын
Great content ^_^ btw definition: simply means the allocation of memory for a variable and declaration: means telling the compiler about the type of variable, variable, no memory is allocated. in CPP, both declaration and definition happen simultaneously,(but when we use extern storage class only the declaration is done). Just for the info :)
@TechWithTim
@TechWithTim 3 жыл бұрын
Thank you!!
@doaamahmoud7135
@doaamahmoud7135 3 жыл бұрын
اللهم صل على نبينا محمد وعلى اله وصحبه اجمعين ❤️🥰
@RekhaRani-mu9od
@RekhaRani-mu9od 3 жыл бұрын
I can't read Urdu lang so please translate it to English or hindi
@doaamahmoud7135
@doaamahmoud7135 3 жыл бұрын
I say, O God, bless our prophet Muhammad and his family and all his companions.🥰
@RekhaRani-mu9od
@RekhaRani-mu9od 3 жыл бұрын
@@doaamahmoud7135 thanks for translating
@doaamahmoud7135
@doaamahmoud7135 3 жыл бұрын
Forgive, thank God.😊
@doaamahmoud7135
@doaamahmoud7135 3 жыл бұрын
@@RekhaRani-mu9od can you help me Where is the mistake? using namespace std; //Compiler version g++ 6.3.0 int main() { int count=1; For( count=1;count
@keshav.mishra
@keshav.mishra 3 жыл бұрын
Hey Tim can you help me What should I choose i3 9 generation. Or i5 5-6 generation As high school student
@lifesgood5065
@lifesgood5065 3 жыл бұрын
i3 9th gen
@AbhishekBM
@AbhishekBM 3 жыл бұрын
You have to be a little more specific. If the clock speed, cache, amount of cores etc. are almost the same, I'd go with i3 9th gen.
@madboy2476
@madboy2476 3 жыл бұрын
c++ is a valuable language to learn for engineers and such. So stop the hate.
@abrarmasumabir3809
@abrarmasumabir3809 3 жыл бұрын
plz cover literally everything on c++ and make some project videos on it like you made pygames for python...
@OutlawJackC
@OutlawJackC 3 жыл бұрын
If you want literally EVERYthing covered in c++ and don't mind if its not Tim, then The Cherno has a super in depth playlist with hours of videos which I used to learn the language But I dont think he has a specific project tutorial using c++ other than short examples to demonstrate how some features are used
@yourdadsbestfriend7101
@yourdadsbestfriend7101 3 жыл бұрын
bro you are amazing
@erickcardozo462
@erickcardozo462 3 жыл бұрын
Why angle brackets for indexing? How tf it works? I thought angle brackets were for types, for templates.
@yxlxfxf
@yxlxfxf 3 жыл бұрын
You can put non-type parameters in templates as well. The reason std::tuple needs such indexing is because it has a very complex implementation based on chained inheritance, so they have a special helper function for accessing its members. C++ is just not made for having containers with arbitrary data types, like python, so you have to use template tricks for that.
@djupstaten2328
@djupstaten2328 Жыл бұрын
@@yxlxfxf the coolest trick would be to make tuples not need tricks. The std::people have no excuse. C++ Tuples atm are just poor design.
@yxlxfxf
@yxlxfxf Жыл бұрын
@@djupstaten2328 I'm sure you are smarter than the people who standardize C++. Please describe me how you would implement an efficient, generic tuple type in C++, I'd like to amuse myself
@manipurihunabopa
@manipurihunabopa Жыл бұрын
I don't know when i should use tuples. What are some of the useful situations to use it? Specify on that please
@UnofficialXuno
@UnofficialXuno 4 ай бұрын
just solve problems or build projects and the time for the use of it will come
@harshitpandit188
@harshitpandit188 3 жыл бұрын
if we use strings instead of int for x,y while decomposing the tuple, we get emojis. it worked for me atleast you guys should try that out :)
@subee128
@subee128 2 жыл бұрын
Thanks
@tanmayunhale1319
@tanmayunhale1319 2 жыл бұрын
tuple and map is not working the way its supposed to on my device. what is the fix?
@jrupp2823
@jrupp2823 3 жыл бұрын
i needed you in college lmao i never understood these
@Davidku632
@Davidku632 3 жыл бұрын
What theme are you using in vscode? I really like it
@OutlawJackC
@OutlawJackC 3 жыл бұрын
Tim is using Sublime Text not VSC Im hoping that was a serious comment ortherwise im going to get roasted for not knowing if its a joke
@Davidku632
@Davidku632 3 жыл бұрын
I didn t meant for this video. I Just saw it in other videos and asked it here
@warboom198
@warboom198 3 жыл бұрын
i cant use tuples on mc for some reason. Says it does not recognize it
@warboom198
@warboom198 3 жыл бұрын
@Peterolen it kind of works now
@t0talslag
@t0talslag 3 жыл бұрын
Hi witch IDE are you using i like the interface
@ag88301
@ag88301 Жыл бұрын
its sublime text
@codex9117
@codex9117 3 жыл бұрын
Is it possible to loop through a tuple (for example to cout it's values)?
@djupstaten2328
@djupstaten2328 Жыл бұрын
It is but don't be fooled into thinking you can use Get() for that. It will only accept const ints (size_t). :D Instead you will have to use a lambda workaround such as this: std::apply([&whatever](auto const& ...extractedelem) { ((functionthatdoesthings(extractedelem, whatever),...)); }, yourtuple);
@Jfti9200
@Jfti9200 2 жыл бұрын
Help me with my survey.❤ What do you guys personally want the features of your device but it is not available yet? Or what you want to bring change in your device? I hope this is understandable🙏
@MusicalGeniusBar
@MusicalGeniusBar 3 жыл бұрын
So a tuple is like a class ?
@OutlawJackC
@OutlawJackC 3 жыл бұрын
tuple is from the std namespace Without 'using namespace std;' at the top you would need to do 'std::tuple' instead of 'tuple' which is saying to go to the 'tuple' class inside the 'std' namespace
@OutlawJackC
@OutlawJackC 3 жыл бұрын
5:55 just wanna complain again about u saying its a float when actually its a double U need to use f for it to be a float 24.3f is a float 24.3 is a double that gets implicitly converted to a float And to prove that they are actually different u can use auto and sizeof and they should be different auto var1 = 24.3; auto var2 = 24.3f; cout
@s.dh29
@s.dh29 3 жыл бұрын
B4 100 views 😊
@ayush.kumar.13907
@ayush.kumar.13907 3 жыл бұрын
tuple is similar to pair, rather than array or vector
@Gaelrenaultdu06
@Gaelrenaultdu06 3 жыл бұрын
Tuples can be helpful, but the fact that iterating through them is so difficult, their field of use is to me, amazingly reduced...
@oximas-oe9vf
@oximas-oe9vf Жыл бұрын
lol
@melissaleigh3013
@melissaleigh3013 3 жыл бұрын
Tim youre always handsome
@HamiltonGJr
@HamiltonGJr 3 жыл бұрын
Pronunciación of tuples? Google Is our friend! It is something like 2Pauls...
@thecscontent5110
@thecscontent5110 3 жыл бұрын
I also do videos about programming!😁
@TheDezmen3
@TheDezmen3 3 жыл бұрын
Soooo... it's basically a structure
@shubhrajit2117
@shubhrajit2117 Жыл бұрын
Having learnt python before, this syntax is _cough_ _cough_
@ag88301
@ag88301 Жыл бұрын
the fact that it isnt a const by default is triggering
@dr.merlot1532
@dr.merlot1532 2 жыл бұрын
the correct pronunciation is tuples.
@usercommon1
@usercommon1 3 жыл бұрын
Sheeesh
@aditgaur1585
@aditgaur1585 3 жыл бұрын
First!
@djupstaten2328
@djupstaten2328 Жыл бұрын
Tuples in c++ are breathtakingly stupid. Get() will only let you iterate over them with *const* scalars (yes lambda workarounds exist -- they shouldn't be necessary). They can only be created and manipulated *at compile time* . Who are these people who can't keep their compile time variables neat? Things like tuples, variadic arguments, parameter packs and auto were made for dynamic and unpredictable input at runtime. They have no point unless you completely open up for it. There's a typical 's* or get off the pot' scenario behind this stwongly typed weakness.
@ethiogazeta
@ethiogazeta 3 жыл бұрын
Why I learn c ++ its dying language
@lifesgood5065
@lifesgood5065 3 жыл бұрын
it's not a dying language
@pravachanpatra4012
@pravachanpatra4012 3 жыл бұрын
Dude nobody cares about C++
Learn C++ With Me #17 - Maps
24:35
Tech With Tim
Рет қаралды 79 М.
Learn C++ With Me #20 - Functions
26:14
Tech With Tim
Рет қаралды 57 М.
«Жат бауыр» телехикаясы І 30 - бөлім | Соңғы бөлім
52:59
Qazaqstan TV / Қазақстан Ұлттық Арнасы
Рет қаралды 340 М.
Who is More Stupid? #tiktok #sigmagirl #funny
0:27
CRAZY GREAPA
Рет қаралды 10 МЛН
Forbidden C++
33:07
javidx9
Рет қаралды 1 МЛН
you will never ask about pointers again after watching this video
8:03
lvalues and rvalues in C++
14:13
The Cherno
Рет қаралды 328 М.
The Self Taught Developer Checklist
17:38
Tech With Tim
Рет қаралды 122 М.
Learn C++ With Me #10 - For Loops
16:11
Tech With Tim
Рет қаралды 34 М.
Learn C++ With Me #18 - Vectors
13:05
Tech With Tim
Рет қаралды 161 М.
31 nooby C++ habits you need to ditch
16:18
mCoding
Рет қаралды 841 М.
10 Design Principles For Software Engineers
14:38
Tech With Tim
Рет қаралды 63 М.
Python laid waste to my C++!
17:18
Sheafification of G
Рет қаралды 153 М.
Learn C++ With Me #15 - Pointers (*)
14:25
Tech With Tim
Рет қаралды 30 М.