420chan now has a web-based IRC client available, right here
Leave these fields empty (spam trap):
Name
You can leave this blank to post anonymously, or you can create a Tripcode by using the float Name#Password
Comment
[*]Italic Text[/*]
[**]Bold Text[/**]
[~]Taimapedia Article[/~]
[%]Spoiler Text[/%]
>Highlight/Quote Text
[pre]Preformatted & Monospace text[/pre]
1. Numbered lists become ordered lists
* Bulleted lists become unordered lists
File

Sandwich


Community Updates

420chan now supports HTTPS! If you find any issues, you may report them in this thread
C++ Templates beyound trivial stuff by Nell Nagglefot - Sat, 02 Dec 2017 15:40:10 EST ID:9QSfnS0r No.37248 Ignore Report Quick Reply
File: 1512247210926.jpg -(155896B / 152.24KB, 977x1488) Thumbnail displayed, click image for full size. 155896
What's the deal with C++ templates?
I'm looking for explanatory videos on it that is reasonably well produced
(not some autistic dude rambling to a screen recording)

Doesn't have to be a video though if it's well written. All explanations I've found so far don't give me any reason of why to use them at all (instead for instance method overloading)

Some time I'd need to for instance loads of static data that I could define by hand but still would like to take advantage of encapsulating things that resemble state machines in classes.
I use C++ for microcontrollers, never on a PC and some times access to hardware can't be done inside a class the straight forward way, like storing pointers to a hardware pin, timer register, etc... inside anything non-static.
>>
Nicholas Banningpat - Sat, 02 Dec 2017 19:30:43 EST ID:v79vrqu4 No.37249 Ignore Report Quick Reply
Templates are about generics and generics are about types. You should understand the type system and how generics work if you want to call yourself a C++ programmer, but that's not to say your embedded code will suffer if you don't.
>>
Nathaniel Clublingson - Sat, 02 Dec 2017 20:00:31 EST ID:BW3MomrQ No.37250 Ignore Report Quick Reply
For embedded code, you probably don't need templates for much. Maybe if you have 8, 16, and 32-bit data types you could write code that could use any of those interchangeably, but I don't think it'd be as useful for you as for someone writing for more flexible systems.
>>
James Brocklecocke - Fri, 23 Feb 2018 16:55:05 EST ID:9QSfnS0r No.37449 Ignore Report Quick Reply
OP here

Somebody did make a video yesterday showing off code that does the thing I posted about, namely template programming for embedded.
https://www.youtube.com/watch?v=A_saS93Clgk ... if anyone is interested
>>
Graham Gublingwidge - Wed, 21 Mar 2018 05:04:05 EST ID:22oSMVrj No.37481 Ignore Report Quick Reply
>>37248
You can do a lot more with templates than just generic types like some noobs would say. There is a famous book on templates called C++ Templates: The Complete Guide. You can find the first edition easily and I have also found the second edition online for free but it seems to have been taken down by now.
>>
Oliver Wonninghud - Thu, 22 Mar 2018 18:45:14 EST ID:LJ4pKTeI No.37482 Ignore Report Quick Reply
>>37481
Libgen my dude.


Report Post
Reason
Note
Please be descriptive with report notes,
this helps staff resolve issues quicker.