Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8258155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:26:32+00:00 2026-06-08T02:26:32+00:00

Eclipse shows the following Error on the push_back line: Invalid arguments ‘ Candidates are:

  • 0

Eclipse shows the following Error on the push_back line:

Invalid arguments ‘
Candidates are:
void push_back(const std::basic_string<char,std::char_traits<char>,std::allocator<char>> &)

My Question is, how can i make sure that the vector contains strings and not basic_strings?

I have figured out in another piece of code where i wanted to access this vector that i have troubles compiling it, it seems to know later that it is a basic_string and not a “std::string”, in the current context i know that i only will use char but i would like to keep the superclass in there so that in the future i don’t have to adjust anything if i swap to w-char ect.

I have already tried casting it to a string but that seems not to work

 std::string test = (std::string)tokens[1];

The final goal would be to construct some object with that vector

if(tokens->size() == 3){
TestObject test = new TestObject(tokens[1],)tokens[2])
}

This is the Function i have found on Stackoverflow which was proposed by a stackoverflow user
Function Origin

Thanks for helping.

void TestClass::splitString(const std::string &str, std::vector<std::string>* tokens){
    boost::char_separator<char> sep(",");

    std::string separator;
    boost::tokenizer< boost::char_separator<char> > tok(str,sep);
    for(boost::tokenizer< boost::char_separator<char> >::iterator it=tok.begin(); it != tok.end(); ++it)
    {    
      tokens->push_back(*it);
    }    
}

no matching function for call to ‘TestObject::defineX(std::basic_string*)’

accessing with defineX(vector[1].data());

no matching function for call to ‘TestObject::defineX(std::vector >&)’

accessing with defineX(vector[1]);

The definition of the function is declared as the following(maybe this is the issue?):

typedef std::string td_MAP_KEY;
td_MAP_VALUE * TestObject::defineX(td_MAP_KEY key);

I call the method like this, if your keen to compile this, it should work, unfortunately i’ am not able to paste the complete code here but the code below should doit:

std::string x = "one,two,three,four"
std::vector<std::string> * splittedString = new std::vector<std::string>;
splitString(x,splittedString);
TestObject * object = new TestObject();
object->defineX(splittedString[1]);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T02:26:34+00:00Added an answer on June 8, 2026 at 2:26 am

    The problem with this code:

    std::vector<std::string> * splittedString = new std::vector<std::string>;
        :
    object->defineX(splittedString[1]);
    

    is that you define splittedString as a vector pointer, and point it at a single vector (rather than an array of vectors), and then try to access the second element of the (non-existent) array of vectors. You probably want

    object->defineX((*splittedString)[1]);
    

    which dereferences the vector pointer and then grabs the second element of the vector.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I try opening eclipse it opens, but it shows one error i.e Android
After updating the SDK, Eclipse shows this error: ADB server didn't ACK, failed to
Our project in eclipse approximately shows the following folders: application - src - JRE
Now I have been stuck by an error which shows the following error in
For the same code, Eclipse shows warnings about unused variables, but compiling with javac
In eclipse when we press ctrl+tab it shows a intellisense.And in intellisence when we
In Eclipse, when you hover on an element, only the Javadoc shows, and the
Have upgraded to eclipse.indigo using a new installation. Added m2e. Maven shows up under
I try to build project in Eclipse on Linux Ubuntu. Eclipse show error message:
My Java program fails with the following error on Windows. Exception in thread main

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.