I have read about the usage of explicit in constructors and some of its possible outcomes. There are many posts available at stack overflow but my primary problem is that I need some concrete points to bear in mind when designing a constructor and deciding about its convertibility. From my current research:
- I consider that explicit constructors are more verbose. This has both pros (no implicit conversions, more readable code) and cons (no converting constructors as return values, more to write).
- Additionally, with explicit constructors there cannot be copy initializations. In this case, I cannot grasp all the outcomes of such a behavior considering I am relatively new to C++. Copy constructors could be an exception.
- The context of the constructed class' usage also affects the decision of explicit.
So, my question is:
- Are there any other key points or rules (at least for a beginner) to bear in mind when deciding explicit's usage in C++11?
Although the general rule to make single argument constructors explicit is not that suitable (implicit conversion to a multiple-argument constructor with C++11's list initializers) should it be followed?