Skip to content

Commit

Permalink
Finalize the class templates lecture
Browse files Browse the repository at this point in the history
  • Loading branch information
niosus committed May 7, 2024
1 parent 67a6cbd commit d56377f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
4 changes: 2 additions & 2 deletions animation/class_templates_why/src/scenes/example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -769,13 +769,13 @@ export default makeScene2D(function* (view) {
yield* waitFor(duration);
yield* codeRef().selection(DEFAULT, duration / 2);
yield* waitFor(duration);
yield* codeRef().selection(codeRef().findLastRange(/<Coordinate<T>>/g), duration / 2);
yield* codeRef().selection(codeRef().findLastRange(/<Coordinate<T>/g), duration / 2);
yield* waitFor(duration);
yield* codeRef().selection(codeRef().findLastRange(/IsCoordinate<Coordinate<T>>/g), duration / 2);
yield* waitFor(duration);
yield* codeRef().selection(DEFAULT, duration / 2);
yield* waitFor(duration);
yield* codeRef().selection(codeRef().findLastRange(/typename T>/g), duration / 2);
yield* codeRef().selection(codeRef().findLastRange(/typename T/g), duration / 2);
yield* waitFor(duration);
yield* codeRef().selection(codeRef().findLastRange(/Coordinate<T>/g), duration / 2);
yield* waitFor(duration);
Expand Down
2 changes: 1 addition & 1 deletion lectures/templates_how_classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ How to use templates with classes in C++
--

<p align="center">
<a href="https://youtu.be/blah"><img src="https://img.youtube.com/vi/blah/maxresdefault.jpg" alt="Video" align="right" width=50% style="margin: 0.5rem"></a>
<a href="https://youtu.be/IQ62tA51Vag"><img src="https://img.youtube.com/vi/IQ62tA51Vag/maxresdefault.jpg" alt="Video" align="right" width=50% style="margin: 0.5rem"></a>
</p>

- [How to use templates with classes in C++](#how-to-use-templates-with-classes-in-c)
Expand Down
29 changes: 29 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,35 @@ Headers with classes
----------------------------------------------------------
</details>

<details>
<summary>How to write class templates</summary>

----------------------------------------------------------
[![Video thumbnail](https://img.youtube.com/vi/IQ62tA51Vag/maxresdefault.jpg)](https://youtu.be/IQ62tA51Vag)

- [How to use templates with classes in C++](lectures/templates_how_classes.md#how-to-use-templates-with-classes-in-c)
- [Class method templates](lectures/templates_how_classes.md#class-method-templates)
- [Prefer overloading to specialization of class method templates](lectures/templates_how_classes.md#prefer-overloading-to-specialization-of-class-method-templates)
- [Sometimes overloading is not possible --- specialize in this case](lectures/templates_how_classes.md#sometimes-overloading-is-not-possible-----specialize-in-this-case)
- [Class templates](lectures/templates_how_classes.md#class-templates)
- [Class template argument deduction (min. C++17)](lectures/templates_how_classes.md#class-template-argument-deduction-min-c17)
- [Class template specialization: implicit and explicit](lectures/templates_how_classes.md#class-template-specialization-implicit-and-explicit)
- [Full explicit template specialization](lectures/templates_how_classes.md#full-explicit-template-specialization)
- [How to fully specialize class templates](lectures/templates_how_classes.md#how-to-fully-specialize-class-templates)
- [Make sure a specialization follows the expected interface](lectures/templates_how_classes.md#make-sure-a-specialization-follows-the-expected-interface)
- [Historical reference for `std::vector<bool>`](lectures/templates_how_classes.md#historical-reference-for-stdvectorbool)
- [Specialize just one method of a class](lectures/templates_how_classes.md#specialize-just-one-method-of-a-class)
- [Specialize method templates of class templates](lectures/templates_how_classes.md#specialize-method-templates-of-class-templates)
- [Type traits and how to implement them using template specialization](lectures/templates_how_classes.md#type-traits-and-how-to-implement-them-using-template-specialization)
- [More generic traits using partial specialization](lectures/templates_how_classes.md#more-generic-traits-using-partial-specialization)
- [Difference between partial and full specializations](lectures/templates_how_classes.md#difference-between-partial-and-full-specializations)
- [How to tell partial template specialization apart from a new template class definition?](lectures/templates_how_classes.md#how-to-tell-partial-template-specialization-apart-from-a-new-template-class-definition)
- [How to tell a partial template specialization apart from a full class template specialization?](lectures/templates_how_classes.md#how-to-tell-a-partial-template-specialization-apart-from-a-full-class-template-specialization)
- [Partial template specialization with more types](lectures/templates_how_classes.md#partial-template-specialization-with-more-types)
- [Summary](lectures/templates_how_classes.md#summary)

----------------------------------------------------------
</details>

## PS

Expand Down

0 comments on commit d56377f

Please sign in to comment.