Best video for Lambda functions. I wasted a lot of time with other articles and videos and finally came here. Your explanation is awsome.
@alltheway994 жыл бұрын
Agree, a good one, Another one I liked kzbin.info/www/bejne/o4jKnnV4r5WsbsU
@Manishbhaiya_rock4 жыл бұрын
Agree
@zijiezhou41792 жыл бұрын
This is absolutely the clearest video for explaining the lambda function in C11! 😃
@benvaldivieso3326 Жыл бұрын
Thank you sir for posting the only lambda tutorial that makes any sense whatsoever, finally
@krantimadineni5857 жыл бұрын
OH! This is an amazing video ever made on c++11 Lambdas...All my doubts about Lambdas got resolved today. Thank You great man.
@Muhammad_Waleed Жыл бұрын
"And You are all bunch of Legends" touched my Heart❤️ Thank You Sir I have been trying to learn lambda functions from websites and didn't understand a single word A teacher is really Important Thanks a Lot again ❤️
@HiltonFernandes4 жыл бұрын
Amazing ! Certainly the best introduction to C++ lambda functions, both in breadth of coverage and good humor.
@shvideo16 жыл бұрын
A great tutorial that builds gradually from the very basic to the more complex syntax, explaining all the aspects of lambda functions so clearly. Thank you!
@logomoniclearning66807 жыл бұрын
best lamda function explanation on the tube yet
@Kenforbes33 жыл бұрын
Best Lamda introduction I've found, very helpful. Thank you!
@frozenfirebat7 жыл бұрын
Man, you just made my day... I've been trying to pass a complicated line of code into a std::thread for days now, and the Lambda function solved it.
@mohanrajanna90264 жыл бұрын
Understanding lamba is made very easy here. Thumps up for posting the video.
@danielgospodinow8 жыл бұрын
""The return of the Lambda", haha sounds like a horror film." HAHAHA, love your tutorials!
@joeytribbiani17877 жыл бұрын
The Silence Of The Lambdas :D
@waqar_asgar__r72946 жыл бұрын
i was gonna type this
@poganka456 жыл бұрын
best lambda explanation on the internet, thanks
@communistgoatboy9 жыл бұрын
"i and g are read-only because we're passing by value to the body of our lambda." That's not _quite_ right. A lambda with a capture list is actually a functor whose `operator()` is const. When a variable is captured by value, it becomes a data member of the functor. Because const functions can't modify their data members (by default), then you can't modify variables captured by value. A reasonable person might then think that capturing by reference would capture by const reference. But no. Someone decided that capturing by reference would be done non-const. There is a way to allow const member functions to modify their data members: by marking them _mutable_. You can also do this with lambdas. int i = 3; auto f = [i]() mutable { i = 4; return i; }; std::cout
@WhatsACreel9 жыл бұрын
+communistgoatboy Brilliant! Thanks for sharing.
@AegirAexx7 жыл бұрын
Great video. You pushed me over the threshold. I'm finally understand lambdas. Thank you!
@IceScream7295 жыл бұрын
amazing toturial finally somebody explains clear and with good examples!! thank you for the order man!
@vintage88187 жыл бұрын
extremely informative tutorial video and extremely awesome way to deliver the lecture. Lambda functions suddenly seem so tameable to me now. Thanks. 😊
@WhatsACreel7 жыл бұрын
Welcome, thanks for watching!
@alski2592 жыл бұрын
Outstanding simplicity and informative. Top notch!
@djpeterson74799 жыл бұрын
In your "simplest lambda", I think you can omit the parenthesis and make it even simpler: []{}; (Works in Visual Studio at least, but I think this is standard).
@s-c-iulian7 жыл бұрын
4:24 "The Return of The Lambda" , I just explode in laughter, the most epic things it can be heard on your channel ...
@shrimpfights17143 жыл бұрын
Clearest video ive watched on this thank you
@majoro72519 жыл бұрын
You're the good legend here Creel :D Awesome high-quality content, generally detailed low-level explanations, and cool Aussie accent. Gotta love this channel! Wish I could be a supportive patron, but can't from here. :/ Salutes from Syria anyways. :P (The hype of "Return of Lambda" is unprecedented). xD
@WhatsACreel9 жыл бұрын
+Major O Thanks, you're a hero!
@amanuel21358 жыл бұрын
+What's a Creel? No one who uses using namespace std; is a legend... Not only that but he does using namespace std, and then still just uses std::vector ...??
@creelsmusic58148 жыл бұрын
+Amanuel Bogale Classy! Can I get you some salsa to have with that chip on your shoulder? Seriously though, thanks for watching, and have a good one!
@amanuel21358 жыл бұрын
What's a Creel? i would actually love that. As One Of my Favorite(Eat it almost all the time) is Salsa!
@bouzie80007 жыл бұрын
This is a great video. You broke it down perfectly. Could you please do a series on systems programming
@jjpark986 жыл бұрын
Thanks, this really helped me understand. Wasn't as hard as I initially thought
@mandrohz55988 жыл бұрын
your tutorial is so good. clear fast and direct. really helpfull thanks!
@RaviKumar-zp8pm7 жыл бұрын
love the way of teaching and some interesting dialogue in the middle made me laugh hahaha!!
@gprozac3 жыл бұрын
Thanks man,cool explanation about lambdas.
@emirmujezinovic55506 жыл бұрын
Very nice video, you made it fun to learn it, thanks for it😁
@修无6 жыл бұрын
It's very useful and easy to understand.
@fipabrate7 жыл бұрын
In last example ( 18:22 ) what is the difference between (function f ) and (function &f ). Basically, when should i use '&f' and when just 'f'
@asiseverything34043 жыл бұрын
&f and f can be used interchangeably. typing &f is a good practice though.
@quentinz62913 жыл бұрын
Good tutorial for cpp lambda, thank you
@KunalMukherjee37016 жыл бұрын
Very nicely put, kudos
@taitai51082 жыл бұрын
very detail explanation. thank you
@carlinconnell77159 жыл бұрын
Yeah, thanks man. Very good videos.
@xpfe5zrm6 жыл бұрын
Perfect, easy explanation. Thank you.
@IllIlIIllIlIl7 жыл бұрын
12:10 This made me laugh harder than I care to admit..
@ChillerDragon7 жыл бұрын
xxxxxxxxxxxD true
@stevejones90446 жыл бұрын
I know right! He did that "asdfasfdasdfasfd" thing a few times which cracked me up every time.
@cloveramv6 жыл бұрын
And this Guys is what is *Ultra instincts !!* . . . 15:17 *Ultra Instincts !!*
@adamodimattia4 жыл бұрын
yeah, it got me too, but when I rewatched it :) first time I was like: well that was a general example... :D
@Maduin13373 жыл бұрын
Stroke Oriented Programming I laughed way too hard aswell, it's like getting your mate showing you some programming tricks. Laid back dude!
@davidutv9 жыл бұрын
Hey mate, nicely done. I really enjoyed how you typed kjhgycikjhgfckiuy for explaining the definition of other code somewhere else :) One nit I did find, when you said end() provides a pointer to the (last) element; this isn't quite true :) I'm sure you know that end() returns one past the last element in the vector ;-) Still, great video; enjoyed it immensely! Happy New Year, BTW!
@PRATHAMPAI6 жыл бұрын
Amazing video, thank you so much.
@mohshafi30326 жыл бұрын
Thank you for your time, and a well explained lecture. Could you please explain in more detail why the ampersand(&) in front of the variable point (point&) in the sort algorithm by the lambda fragment of the code like this [ ](const point& a, const point& b). And also the purpose of the const.
@gnarfgnarf40044 жыл бұрын
'&' pass by reference, instead of by value. Reduces the size of the stack if it's an object. 'const': the function can't change the parameter.
@bestraub989 жыл бұрын
If you started your program without debugger (ctrl + F5), it would take a lot less time to start up. Also you could omit the breakpoint at the end, because the console stays open after that until you press enter. (at least in visual studio 2015)
@WhatsACreel9 жыл бұрын
+bestraub98 Cheers! Thanks for the info.
@arbadon9 жыл бұрын
Excellent explanation, thank you!
@jessprogany43453 жыл бұрын
loving your tutorials hope to see more of C++ I have a question though does lamda function capture only the variables declared over lamda function definition or does it capture all of the variables of the scope where lamda function is defined?
@ME0WMERE2 жыл бұрын
Probably only over, as otherwise you would be referring to a variable that doesn't exist
@smeagolfishy8 жыл бұрын
Thank you! You're a great teacher
@muhammadhaseeb40966 жыл бұрын
Thank you for this video.
@privateerburrows3 жыл бұрын
Can you write lambdas that evaluate at compile time or static time, such as for initializing constants and static globals? There's a wonderful thing in the Eiffel language called "once function", which is any function pre-attributed with the keyword 'once', that only compute their output the first time they are called, but on subsequent calls return the same value they originally computed. They are a great replacement for global constants. In C-ish notation, once size_t bus_cycles_per_cache_line(){ cache_line_sz() / bus_width(); } //in some other file... once size_t cache_line_sz(){ cpuid(...); } once size_t bus_width(){ whatever(...); } It forces these evaluations to happen in the right order, as opposed to C/C++ which clearly states that the order of evaluation of static initializations is undefined. So these are lazy static initializations, at run-time for the most part, really; but they may be called as early as at compile time if a result is needed at compile time. I've often wondered if there's a way to replicate once functions in C++.
@PhaseFabrication4 жыл бұрын
dude i love your videos
@sikendongol42085 жыл бұрын
Return of the Lambda
@defaultdefault8123 жыл бұрын
How does foreach 'know' what to pass to the lambda, in this case int x. Expressed alternatively, how is int x being assigned?
@Wanderlust0733 жыл бұрын
Excellent video
@ExD3aD7 жыл бұрын
shouldn't the int [&](int x) be [&](int& arr) 12:52 ?
@duydong787 жыл бұрын
Great explanation! Thanks!
@Asimov167 жыл бұрын
Can you tell me what use is Lambda's when you could easily just make a function or method instead. I understand how they are used now thanks, just can't understand their use if you can use a function
@WhatsACreel7 жыл бұрын
They're just a different way to do things. They don't offer anything new, but they're pretty convinient soemtimes. I think the best examples of how powerful they are is when you look at processing lists, like filtering of perfomring some operation on the values. I hoep that makes some sense...?
@shashi31463 жыл бұрын
here in this lambda function we are passing [] (int x) what is x and how internally it is working.please elaborate it as i am new to this.
@JL-uz1fu8 жыл бұрын
When I tried running the first program, it just says: q.cpp:10:7: error: ‘sayHelloWorld’ does not name a type
@malharjajoo73937 жыл бұрын
what is the difference between capure list ( "[=]" ) and passing by value in paramter list. ?
@nikarm227 жыл бұрын
Capture list takes values when lambda is defined, but parameter is given when you are calling the function. So when you call the same lambda, you can pass different params, but capture list is always the same.
@rafaelocariz13846 жыл бұрын
Hello! I'm facing some problems with lambda, I need to declare a function who execute something different depending on the input, on the other programs of the project this function is being called like this: int_op["add"](3, 5), but Lamba isn't supposed to be named and they are calling that way, how can I implement this int_op function?? please, help
@adamodimattia4 жыл бұрын
Good tutorial!
@ADonT1008 жыл бұрын
can you pls explain the Operator Overloading ,Element & globale Funktion
@himansumaurya28833 жыл бұрын
Can u make video on recursive lamda using y_combinator
@gnarfgnarf40044 жыл бұрын
Thank you for a clear and lucid introduction to lambdas. However, I still don't see the benefit of lambdas. The additional complexity is not offset by the convenience. In fact, defining the function in-line complicates the flow of logic. Defining the lambda as a separate function, the old-fashion way, would improve code legibility.
@malharjajoo73937 жыл бұрын
The syntax in your first few slides does not have the "=" sign after the name. Are they incorrect ?
@narayananms6208 жыл бұрын
brillaint guy/video, loved it
@jony77797 жыл бұрын
Thank you for this.
@manfredpseudowengorz3 жыл бұрын
2:45 - Uuuuuu... What does this lambda do? - It compiles.
@filipjacobsen24687 жыл бұрын
Thank you Obi One Kenobi :D
@pengzuo75517 жыл бұрын
impressed , by the way, which accent is this speaker.
@WhatsACreel7 жыл бұрын
Thanks for watching. I'm Australian :)
@novictim4 жыл бұрын
Very informative !!!
@TheGnarTube6 жыл бұрын
iterator end() points to one element past the end, not to the last element
@BryonLape8 жыл бұрын
Why is it that C++ seems to break encapsulation at every opportunity?
@t-h7876 жыл бұрын
epic video mate, very informative + i lol'd several times :P
@commentor54794 жыл бұрын
So you're that youtuber the other channel was asking about!
@WhatsACreel4 жыл бұрын
Not sure mate, what channel? Thanks for watching :)
@commentor54794 жыл бұрын
@@WhatsACreel The channel named "What's a Creel?"
@WhatsACreel4 жыл бұрын
@@commentor5479 Hahaha, that's gold! I fell for that hook line and sinker :)
@commentor54794 жыл бұрын
Wait. You're the same channel.
@WhatsACreel4 жыл бұрын
@@commentor5479 Yep, just changed the name :)
@SearchingPeaceInside7 жыл бұрын
Good Tutorial.
@Coffeemancer3 жыл бұрын
can you tell C# ?
@aioaneiadrian92328 жыл бұрын
Nice job :)
@WatchesTrainsAndRockets3 жыл бұрын
The expression "using namespace std" is an abomination created in the textbooks and should be avoided. The problem is, for those who may not know, the using expression makes ALL of the symbols within the referenced namespace local to the context enclosing the using clause. If you happen to do this for multiple namespaces, you can get some weird collisions that are hard to diagnose. This possibility is eliminated by just not employing the using clause and explicitly specifying the namespace containing the symbol being referenced. In the code here that would mean writing "std::cout
@bluehornet67526 жыл бұрын
I think this shit is what Bjarne Stroustrup meant when he said "With C++ you can blow your whole leg off."
@nikolaossmyrnioudis3976 жыл бұрын
Eric Idle, is that you ?
@WhatsACreel6 жыл бұрын
Hahaha, being likened to a Python is the greatest honor of all!!
@cloveramv6 жыл бұрын
15:17 *Ultra Instincts !!*
@schermann19957 жыл бұрын
very helpful thx :)
@tuckerhartland10012 жыл бұрын
I don't really understand why you say that the lambda function has no name. In the first example isn't "sayHelloWorld" acting like a name to the lambda?
@mahdies96203 жыл бұрын
you are the best
@yousufazad69148 жыл бұрын
make another video please! :D
@bandamkaromi9 жыл бұрын
thanks..
@Sarcasticpigeon6 жыл бұрын
Great video, but I cannot get over the lack of indentation. (0-e)
@WhatsACreel6 жыл бұрын
Hahaha, the indentation in this vid is a mess! I normally use Whitesmith. It's not popular, but it's super easy to read. But I have to save space on the slides, so I used like K&R. Then I mixed the two together because I'm a moron :S Sorry if it was confusing, hope the vid still made sense and thanks for watching!
@Sarcasticpigeon6 жыл бұрын
What's a Creel? It was definitely helpful, I loved how quickly you move through it. :)
@Rokannon9 жыл бұрын
This video is really good. Thank you very much. The only thing that I would like to have to know after this video is whether anonymous functions have any overhead comparing to classic approach. Because C++ is a great language performance-wise and using these fancy tricks by paying some performance cost would be just gay. Also I have subscribed to your channel. Many interesting videos on C++ I see. Because I am studying C++ at the moment and when you study new programming language it is really important to see someone having fun with it which you totally do, sir. But more importantly I am fading away from such politicaly incorrect languages as Java and ActionScript. If you heard some stories about garbage collection and virtual machine performance issues then you know what I mean.
@oddarnebeck7 жыл бұрын
I guess there's a reason for the guys saying "stood" instead of "ess tee dee" when talking about "std::". Good video though, thanks!
@azzam72394 жыл бұрын
I think because std usually stands for sexually transmitted disease
@RupertBruce Жыл бұрын
A new tool for obfuscation! It looks to be a way of doing functional programming in C++ but it has a lot of potential for abuse!
@spread20814 жыл бұрын
wait this is cool
@abhikghosh52202 жыл бұрын
The best
@hatedbytheworld13735 жыл бұрын
Easy as Pi😄
@sikendongol42085 жыл бұрын
in place
@srahimi50078 жыл бұрын
Lambda if not used properly produces more mess than good. I acknowledege its existance but wont use it . It is in contrarty to what the concept of OO seems to be. why would you wanna have a function within main? it is turning this language into something worse than assmembler.... however tutorial was excellent
@DuhBroadcaster8 жыл бұрын
Not every problem needs to be OO-style. In some cases, it's just a waste of time and work to try converting it into that style. Dismissing a tool can only hurt you as a programmer.
@akash-iichaudhari51234 жыл бұрын
Day saver
@abcdeereijgfhd32153 жыл бұрын
I don't like the naming of std since it also means "Sexually Transmitted Desease"
@kumu20244 жыл бұрын
It is just about making harder to read.. I don't think there is any performance benefit of this feature. Rewriting you old code and making it harder to read. That is all about .. in my opinion. Many new CPP technique is like so.. It is not really a new thing than making it harder to read.
@clifforddicarlo9178 Жыл бұрын
I REALLY don't see or appreciate the value of lambda functions. All it does is make your code less readable. Can C++ "live"without Lambda Functions?
@pasanyrebiata54306 жыл бұрын
Do you like to drink? I think do you be nice alcoholism companion
@xDR1TeK6 жыл бұрын
I haven't coded in a while. I saw it in a coding conference and raised flags on me. I think it is an abomination. It infringes on many coding conventions. Conventions that were specifically agreed upon to prevent loosely written code that ends up churning useless asm lines. Mind you that this is only churning at compile time, but still, convention says changing one line or adding few years to this code, compile is no longer guaranteed. I think behavior wouldn't be guaranteed at all. What strikes me the most, people who are in position to make changes to compilers forget that there are people in this world that are not just software oriented but also hardware oriented. This is why I think people making changes to the compiler are not fit to make changes at all. I know being old fashioned has no place in the future but just saying you know. I'm old. I don't like this new change because lambdas are imposing suggestions that infringe on conventions.
@WhatsACreel6 жыл бұрын
You don't like lambdas? Yes, they are a little strange for C++. The syntax is probably my least favourite thing about them. But, they're really fun and fairly useful time savers sometimes, so it's ok to get used to them. Thanks for watching anywho, have a good one!