I was reading Peter Shirley's Ray Tracing in One Weekend when I found this in one of his code's classes: vec3() : e{0,0,0} {}
I've searched for a while and I think this is Singleton pattern, but I may be wrong.
Can anyone tell me what is this sintax? It would also be helpful if you could tell why is the last {}
necessary.
Here's a bigger snippet of the code:
#define VEC3_H
#include <cmath>
#include <iostream>
using std::sqrt;
class vec3 {
public:
vec3() : e{0,0,0} {}
vec3(double e0, double e1, double e2) : e{e0, e1, e2} {}
The full header file is too big to put here, but you can find it on chapter 3.1 of the book