Here is a rookie question. Is the following code safe ?
boost::unordered_set<std::string> func()
{
boost::shared_ptr<boost::unordered_set<std::string>> list = boost::make_shared<boost::unordered_set<std::string>>();
// Code to populate the shared_ptr to unordered_set goes here and I do populate my set.
return *list;
}
What will happen first ? Copying/NRVO/Moving or Destruction of shared_ptr there by causing memory fault? If unsafe, what are my alternatives ?
Aucun commentaire:
Enregistrer un commentaire