C ++ is such a complex language that can be divided into four major parts:
1. C language: for example, built-in data types, arrays, pointers, preprocessing, and statements are all from C.
2. Object-oriented C ++: Class, constructor, destructor, encapsulation, inheritance, derivation, polymorphism, and virtual function.
3. Generic C ++: use template programming.
4. STL Library: various containers, iterators, algorithms, and function objects.
Because of these four different styles, it is more efficient to pass the value when you operate on the built-in data type than to pass through the reference; however, if you are using a custom object, it is better to pass the const reference because of the existence of constructor and destructor. But when you use the STL library, because STL is implemented through pointers, it is generally better to pass values.