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 7830529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:16:27+00:00 2026-06-02T11:16:27+00:00

I am getting a string not dereferencable error for my code, which is pretty

  • 0

I am getting a “string not dereferencable” error for my code, which is pretty much copied verbatim from somewhere on the internet. The application compiles perfectly in release mode (VS 2010), however keeps throwing me an error in Debug mode. It should be splitting the string at the * and saving each of the words to a vector. Does anyone have any ideas? It really doesn’t seem to like the (string::npos != found) part of the comparison.

string newString = "Something*NotCool";

size_t found = newString.find_first_of("+*-/%()");
size_t lastPos = 0;
//while (found != newString.length)
while (string::npos != found || string::npos != lastPos)
{
    if (found >= newString.length()) break;
    if (found == lastPos)
    {
        lastPos = found+1;
        found = newString.find_first_of("+*-/()", found+1);
    }
    string temp (newString,lastPos,found);
    temp.assign(newString, lastPos, found-lastPos);
    strings.push_back(temp);
    lastPos = found+1;
    found = newString.find_first_of("+*-/()", found + 1);
}

Your help is gratefully appreciated!!!

  • 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-02T11:16:29+00:00Added an answer on June 2, 2026 at 11:16 am

    Your code didn’t produce any errors for me in VS2010.

    Since you’ve got access to regular expressions (<regex> library), another alternative could be:

    std::string str = "Something*NotCool";
    std::regex re("[^(\\*\\+%/\\-\\(\\))]+");
    std::sregex_token_iterator begin(str.begin(), str.end(), re), end;
    std::vector<std::string> tokens;
    std::copy(begin, end, std::back_inserter(tokens));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting an error msg DataReader.h:13: error: 'String' was not declared in this scope
I am getting a Method not found: 'Boolean MyCompany.LibraryAssembly.SomeFunction(System.String)' exception/error when running a VB.NET
i keep getting this error, The current value 'String.Empty' type is not compatible with
I am getting JSON string from website. I have data which looks like this
The XML String I am getting from other application is converting & to &amp;
In my header file I'm getting the error: ‘string’ has not been declared error
Please consider my codes below: I'm getting an error Constructor on type 'System.String' not
In my application, I am getting some string values from a server, but I'm
In the code below, the program is getting string data from the user and
I am getting this error: Error: Format Exception: Input string was not in a

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.