1
2
3
4
5
6
7
8
 
 

#include

template <typename T, const int length=5> class vector { public: T v[length]; vector operator +(const vector &obj) { vector tmp; for(int i = 0; i < length; i++) tmp.v[i] = v[i] + obj.v[i]; return tmp; /* This method below only works if length is a fixed size return {v[0] + obj.v[0], v[1] + obj.v[1], v[2] + obj.v[2], v[3] + obj.v[3], v[4] + obj.v[4]};*/ } }; int main() { vector a={1,2,3,4,5}; vector b={1,2,3,4,5};

auto c = a + b;

std::cout << "(int) ";
for(int i = 0; i < 5; i++)
    std::cout << c.v[i] << " ";
std::cout << std::endl;

}

9
10
11
12
13
14
 
 

This webinar will explore how to represent the results of computations in a custom language and show how to evaluate expressions step by step. Join the live session on September 24, 1:00 PM UTC+1.

15
16
17
18
C++23 mdspan (2025) (alexsyniakov.com)
submitted 2 months ago by to c/cpp@programming.dev
19
20
C++26: std::inplace_vector (www.sandordargo.com)
submitted 2 months ago by to c/cpp@programming.dev
21
 
 

A static analysis of the PS4 emulator's codebase, with examples of issues found along the way

22
23
24
25
view more: next ›