We help IT Professionals succeed at work.
Get Started

Cannot push back a CLI vector of strings.

0av067
0av067 asked
on
965 Views
Last Modified: 2012-05-06
I created a CLI vector of vectors of string handles.  Next, I tried to push back a vector of strings into the outer vector but this resulted in an error.  Intellisense does not open when I add the "->" after the name of my vector, however, it lets me push back a string handle into the vector within the vector of strings.  
Finally, If I just push back handles to strings to the vector of strings without first pushing back a vector of strings into the outer vector it results in a runtime error.  Please let me know if I can clarify anything.
#include "stdafx.h"
#include <cliext/vector>
 
using namespace System;
 
int main(array<System::String ^> ^args)
{
	//Declare a vector of vectors of strings called myvector
cliext::vector<cliext::vector<String^>^> myvector = gcnew cliext::vector<cliext::vector<String^>>;
 
//Declare and initialize a string
String^ mystring;
mystring = L"test string";
 
//The line below is the one that I can't figure out what I'm doing wrong
//myvector->push_back(cliext::vector<String^>^);   //(uncomment for the error)
 
//Push back the test string into a vector of strings within the vector, myvector
myvector[0]->push_back(mystring);
myvector[1]->push_back(mystring);
 
//This program results in a runtime error
 
    return 0;
}

Open in new window

Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE