My intention is to have a vector with all substrings of a given string. I am attempting to push element by concating current strings in vector with iterated character of str
What is going wrong in below code.
void Substring(string str)
{
    vector<string> vec={""};
    for(auto i =0; i<str.length(); i++)
    {
        auto end = vec.end();
        string s(1,str[i]);
        for (auto iter = vec.begin(); iter!=end; iter++)
        {
            vec.push_back(s+ static_cast<string>(*iter)); // --> what is the problem here in concatenation
        }
    }
    for (auto iter = vec.begin(); iter!=vec.end(); iter++)
    {
        cout <<"iter_val:"<<*iter <<endl; //--> does not print concated element
    }
}
 
     
    