lundi 22 juillet 2019

How does vector range constructor work in the below class?

In the below class -

class my_string_adapter
{
   string s;
   public:
   my_string_adapter(const string& s):s(s){}


   vector<my_string_adapter> break_strings_into_vector(const string delimiter =" ") const
   {
      string s_lo = boost::to_lower_copy(s);
      vector<string> parts;
      boost::split(parts,s_lo,boost::is_any_of(delimiter),boost::token_compress_on);
      return vector<my_string_adapter>(parts.begin(),parts.end());
   } 

};

How does vector<my_string_adapter>(parts.begin(),parts.end()) Type casting work from string to class . In what all cases does this casting of vector range constructor work.

Aucun commentaire:

Enregistrer un commentaire