Hey man I'm only 1:46 into the video and am in love with the clean, concise, and BRILLIANT logical trace of what programming is, what a metaprogram is, and how reflection is involved. Looking forward to the brain feast that this video series will be
there really is some small channel out there, unoticed by many but offers gold knowledgeable content, this channel is one of those, still at the first episodes and I already love what I learned.
Happy to hear! I'm actually working on another episode for this series right now. Please consider subscribing if you haven't done so already and if you have any questions or suggestions you can always leave a comment!
@@ujjwalarora4159 Thanks! I'm currently working on a new series with more of a software engineering focus than will start airing in a month or so, as we are slowly wrapping up the metaprogramming series. I think you'll like it, so stay tuned 😉
strip_pointer can also be implemented by recursion! template struct strip_pointer{ using type = T; }; template struct strip_pointer{ using type = typename strip_pointer::type; };
Thanks! Happy to hear you like the content and great thay you are recommending to others! This was the first upload to the channel, don't worry, I improved my audio setup since, you'll find it gets a lot better a few episodes in.
Thanks for the video. At 15:33 line 26, only works for c++20. For older version we have to use: using T_without_pointer = typename strip_pointer::type; Otherwise I get the error: need 'typename' before 'strip_pointer::type' because 'strip_pointer' is a dependent scope Could someone explain why this is the case? Thanks
Thanks, happy you liked the video! The typename keyword is needed because strip_pointer::type is a so-called "dependent name". A name that depends on a template parameter. This is explained in more detail in episode 2, but the gist of it is as follows: if you have a name that depends on a template parameter, the compiler can't determine whether this name refers to a type or a value, without knowing the template parameter (perhaps there is a specialization of strip_pointer where the ::type member is an integer instead of a type?). In general, if the compiler can't deduce what it is dealing with, it will default to assuming a value. By adding the typename keyword, we tell it that this name will always deduce to a type. As compilers improved and the standard got updated, there are more and more situations where the compiler is smart enough to figure out what such a name represents and hence it can fill in the typename keyword for you. That's probably why it didn't work for you. Different compiler and/or language version. Again, this is explained in more detail in the next episode, so I recommend continuing the series ;)
I worked it out using specialization for prev chapter: template struct is_floating_pointer { static constexpr bool value = false; }; template struct is_floating_pointer { static constexpr bool value = true; }; but it would require to create it also for double and long double for consistency.
Thanks! You are in luck, the next two videos which I have planned are on concepts and requires expressions respectively. I just need to wrap up the editing on the concepts one. It'll probably be online on Friday.
When the compiler tries to match a type like char** to a template argument T*, it will deduce the type T to be char*. As such, if you use strip_pointer or the std::remove_pointer_t on which it is based you will only remove the outermost pointer. If your goal is to remove all pointers and find the "base type", you could repeatedly remove the outermost pointer until the remaining type is no longer a pointer. A simple approach would be to use recursion and if constexpr for this.
Oh my goodness, the audio quality.... Please put your videos in an editor like Davinci Resolve or Shotcut or something and play with some EQ, Compression, or at least hit the normalize button. Also, do not point the mic at your throat, we can hear every single drop of saliva.
This was my very first video on TH-cam, audio quality will improve in a few episodes as I get a proper mic and better editing software. Hope the content was useful!
Hey man I'm only 1:46 into the video and am in love with the clean, concise, and BRILLIANT logical trace of what programming is, what a metaprogram is, and how reflection is involved. Looking forward to the brain feast that this video series will be
there really is some small channel out there, unoticed by many but offers gold knowledgeable content, this channel is one of those, still at the first episodes and I already love what I learned.
I'm glad that I've found this channel.
Happy to hear! I'm actually working on another episode for this series right now. Please consider subscribing if you haven't done so already and if you have any questions or suggestions you can always leave a comment!
@@bitsofq Hi Q, can you consider creating a series on software engineering with C++? Awesome video ! Every submodule isa chapter of a book itself
@@ujjwalarora4159 Thanks! I'm currently working on a new series with more of a software engineering focus than will start airing in a month or so, as we are slowly wrapping up the metaprogramming series. I think you'll like it, so stay tuned 😉
@@bitsofq looking forward to it! 😊
10:53 ok this absolutely blew my mind!
Yeah, it's compile time programming that's why. everything is evaluated at compile time. so there is no run time overhead.
Great lesson!
Great c++ metaprogramming tutorial. I so glad I finally found it
Thank you! Your telling is blazingly clear!
Such good grasp on content. Wow. Thanks for the videos.
Thank you for all your hard work! Your channel is super helpful!
Great video. Well done Q!!!
Thank you!
strip_pointer can also be implemented by recursion!
template
struct strip_pointer{
using type = T;
};
template
struct strip_pointer{
using type = typename strip_pointer::type;
};
Very nice. You are getting ahead of the series 😉!
Haha. Last time I watched till 6th episode. Rewatching it with a better understanding this time.
Good to hear you've come back to the series!
Audio quality is not good but nvm content is great on your channel. Looking forward for more content on C++ from you. Gonna recommend to others also.
Thanks! Happy to hear you like the content and great thay you are recommending to others!
This was the first upload to the channel, don't worry, I improved my audio setup since, you'll find it gets a lot better a few episodes in.
Thanks for the video.
At 15:33 line 26, only works for c++20. For older version we have to use:
using T_without_pointer = typename strip_pointer::type;
Otherwise I get the error: need 'typename' before 'strip_pointer::type' because 'strip_pointer' is a dependent scope
Could someone explain why this is the case? Thanks
Thanks, happy you liked the video!
The typename keyword is needed because strip_pointer::type is a so-called "dependent name". A name that depends on a template parameter. This is explained in more detail in episode 2, but the gist of it is as follows: if you have a name that depends on a template parameter, the compiler can't determine whether this name refers to a type or a value, without knowing the template parameter (perhaps there is a specialization of strip_pointer where the ::type member is an integer instead of a type?). In general, if the compiler can't deduce what it is dealing with, it will default to assuming a value. By adding the typename keyword, we tell it that this name will always deduce to a type.
As compilers improved and the standard got updated, there are more and more situations where the compiler is smart enough to figure out what such a name represents and hence it can fill in the typename keyword for you. That's probably why it didn't work for you. Different compiler and/or language version.
Again, this is explained in more detail in the next episode, so I recommend continuing the series ;)
I worked it out using specialization for prev chapter:
template
struct is_floating_pointer {
static constexpr bool value = false;
};
template
struct is_floating_pointer {
static constexpr bool value = true;
};
but it would require to create it also for double and long double for consistency.
wow! you're awesome or what! Just discovered you. Thank you great video!
awesome!
your knownledge is helpul so i'm subscribe your channel, keep spirit and Don't get tired of helping people😊😉
Do you have a video covering concepts in C++20? Great video btw
Thanks!
You are in luck, the next two videos which I have planned are on concepts and requires expressions respectively. I just need to wrap up the editing on the concepts one. It'll probably be online on Friday.
so what about double pointers? how would one treat that?
When the compiler tries to match a type like char** to a template argument T*, it will deduce the type T to be char*. As such, if you use strip_pointer or the std::remove_pointer_t on which it is based you will only remove the outermost pointer. If your goal is to remove all pointers and find the "base type", you could repeatedly remove the outermost pointer until the remaining type is no longer a pointer. A simple approach would be to use recursion and if constexpr for this.
nice video
Amazing 🤩
Happy you liked the episode! The series is still running so make sure to subscribe to stay up to date as new episodes are being released 😉
Oh my goodness, the audio quality.... Please put your videos in an editor like Davinci Resolve or Shotcut or something and play with some EQ, Compression, or at least hit the normalize button. Also, do not point the mic at your throat, we can hear every single drop of saliva.
This was my very first video on TH-cam, audio quality will improve in a few episodes as I get a proper mic and better editing software.
Hope the content was useful!
Difficult to follow the accent.
next time try to speak more clearly its difficult to understand you
Audio quality will improve in later videos as I upgrade my mic and get more practice