Skip to content

Commit 32cba64

Browse files
committed
Update cpp-for-cscharp.md
1 parent 39b12a8 commit 32cba64

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

content/posts/cpp-for-cscharp.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ Type test = {x, y, z}; // works on collections like arrays
163163
```cpp
164164
Type* test = new Type(x);
165165
Type* test = new Type{x};
166+
Type& test = *new Type(x); // get as reference instead of pointer
166167
```
167168

168169
**C# initialization:**
@@ -246,6 +247,10 @@ typedef struct Point // <- typedef is required
246247

247248
A lambda expression like in C# is a lambda calculus function. In simple terms it can be described as an inline function.
248249

250+
The basic structure of a lambda:
251+
- csharp: ``(input)=>{body};``
252+
- cpp: ``[catch](input){body};``
253+
249254
This is how lambdas in C# look:
250255
```csharp
251256
// csharp

0 commit comments

Comments
 (0)