Skip to content

Commit ddf62fd

Browse files
committed
Minor fix for template
1 parent 029769f commit ddf62fd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

content/posts/forwarding-ref-trap.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
date = '2026-03-15T12:23:42+02:00'
33
draft = false
44
title = "The 'T&&' Trap: Forwarding References in Templated Classes"
5-
tags = ["advanced-level", "templates", "Move-Semantics", "concepts"]
5+
tags = ["advanced-level", "templates", "performance", "Move-Semantics", "concepts"]
66
+++
77

88

@@ -48,7 +48,7 @@ public:
4848
But, now we always copy the element when we need to push it inside our stack. The `push` function should be able to distinguish if the element that is being pushed should be copied or not, in order to save copies. Why to copy a temporary anyways?
4949

5050
``` cpp
51-
MyStack st;
51+
MyStack<std::string> st;
5252
// We dont want to copy a temporary
5353
st.push("Temporary");
5454
```

0 commit comments

Comments
 (0)