This question already has an answer here:
- What does the explicit keyword mean? 11 answers
I have a Class with a constructor taking 2 std::string parameters by reference. In this case, does it make sense to change the constructor into an explicit one?
struct Foo { Foo(std::string& a, std::string& b); };
struct Bar { explicit Bar(std::string& a, std::string& b); };
In the above code, What would be the best thing in Bar from Foo?
Aucun commentaire:
Enregistrer un commentaire