• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 512
  • Last Modified:

Visual Studio 2008 C++ cannot convert parameter 2 from

I am getting the following compiler error in Visual Studio C++ that I am stumped on.

cannot convert parameter 2 from 'std::vector<_Ty>' to 'std::vector<_Ty> *'
with
1>        [
1>            _Ty=std::string
1>        ]
1>        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

Whats the correct way to do this?
std::vector<std::string> tokens;
Tokenize(parameterArr[i]->Text,tokens);
 
void Tokenize(const String^ str,std::vector<std::string*>& tokens) {

Open in new window

0
seanmccully
Asked:
seanmccully
  • 2
1 Solution
 
LordOfPortsCommented:
If your vector contains values by string value vs. pointers to strings which seems to be the case according to your declaration:

std::vector<std::string> tokens;

then try changing the second parameter of the Tokenize function to std::vector<std::string>& tokens, e.g.:
void Tokenize(const String^ str,std::vector<std::string*>& tokens) {

Open in new window

0
 
seanmccullyAuthor Commented:
I gave up, the easier solution was to use Microsofts String method Split.
0
 
LordOfPortsCommented:
...sorry, correction:
void Tokenize(const String^ str,std::vector<std::string>& tokens) {

Open in new window

0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now