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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:31:15+00:00 2026-05-31T16:31:15+00:00

I am using std::unique_ptr in this piece of code which compiles and runs as

  • 0

I am using std::unique_ptr in this piece of code which compiles and runs as I expected.

std::stringstream out;
out << std::setw(3) << std::setfill('0') << i;
std::unique_ptr<std::string> s(new std::string(out.str()));
s->insert(s->end()-2, 1, '.');
return std::move(s);

However, I am getting error messages from Eclipse CDT. At the fourth line: Method ‘insert’ could not be resolved, Method ‘end’ could not be resolved.

Previously, I was also getting errors on appearances of the name std::unique_ptr. This was solved by setting the pre-processor symbol __GXX_EXPERIMENTAL_CXX0X__ and rebuilding the index, as described in the answer to this question.

Is there a way to make CDT understand that s is of type std::string * and that it should look in std::string for s->insert() and s->end() ?

PS: I am using Eclipse 3.7.1 and CDT 8.0.0.201106081058

PS2: I would have liked to post this as a comment in the above question, but I can’t, presumably because I am a new user

  • 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-05-31T16:31:17+00:00Added an answer on May 31, 2026 at 4:31 pm

    It seems as if the Eclipse CDT indexer is not able to deduce the unique_ptr::pointer type that is also used as the return type of operator->(). You can see this when you type something like

    std::unique_ptr<Type *> ptr;
    ptr.reset(new Type);
    

    an error will be “detected” that there would be no matching overload, and that the only candidate would be reset(?). So this is obviously a bug.

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

Sidebar

Related Questions

I'm having a hard time using std::string::iterators in C++. This code compiles fine (still
Consider this code: using namespace std; int* get() { unique_ptr<int> p (new int[4]); return
I have this code: //// // Default Namespaces /// using namespace std; typedef map
Up until now I have been using std::string in my C++ applications for embedded
I am trying to initialise an std::vector<std::unique_ptr<std::string>> in a way that is equivalent to
My code is using std::count() on a list of an abstract data type that
When using this code to remove duplicates I get invalid operands to binary expression
I've been using std::unique_ptr to store some COM resources, and provided a custom deleter
std::sort swaps elements by using std::swap , which in turn uses the copy constructor
I have problems using std::rotate on a const_iterator over a unique_ptr middle. I have

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.