mercredi 23 décembre 2015

Should I declare conversion operators explicit in C++11?

In C++11,it is recommended:

  1. to explicitly define our own copy/move constructors, so that the compiler does not do it itself.
  2. to explicitly declare one-argument constructors as explicit, to avoid implicit conversions.

Should one, in this train of thought, declare conversion operators explicit to prevent the compiler from using them to perform implicit conversions?

Aucun commentaire:

Enregistrer un commentaire