Tag: initialization list

Why does our code run faster if we use initialization lists rather than assignment in class constructor?

Hint to understand the question: Notice the below class A for using initializer list and assignment operator in C++. Class constructor using initialization list: Class constructor using assignment operator: Answer: Using initialization list in constructor is the one step process i.e. it initializes objects at the moment it’s declared. It calls copy constructor. Whereas using…

Read the full article