Having trouble creating vectors of System::String^

Posted by Justen on Stack Overflow See other posts from Stack Overflow or by Justen
Published on 2010-05-27T21:11:06Z Indexed on 2010/05/28 3:31 UTC
Read the original article Hit count: 284

Filed under:
|
|
|

So I have a regex expression to parse certain parts of a file name. I'm trying to store each part in its own vector until I use it later, but it won't let me. One error I get when I try making a vector of System::String^ is that error C3698: 'System::String ^' : cannot use this type as argument of 'new' Then, when I try just making a vector of std::string, it can't implicitly convert to type System::String^, and casting won't work either.

void parseData()
{
    System::String^ pattern = "(\\D+)(\\d+)(\\w{1})(\\d+)\\.(\\D{3})";
    std::vector < System::String^ > x, y, filename, separator;

    Regex re( pattern );

    for ( int i = 0; i < openFileDialog1->FileNames->Length; i++ )
    {
        Match^ m = re.Match( openFileDialog1->FileNames[i] );
        filename.push_back( m->Groups[0]->Value );/*
        x.push_back( m->Groups[1]->Value );
        separator.push_back( m->Groups[2]->Value );
        y.push_back( m->Groups[3]->Value );*/
    }                       
}

© Stack Overflow or respective owner

Related posts about c++

Related posts about vector