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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:30:06+00:00 2026-05-25T09:30:06+00:00

I encountered an error as the topic says: assignment of data-member ‘RootBoxT<CORE::DoubleWrapper>::innerBox_’ in read-only

  • 0

I encountered an error as the topic says: assignment of data-member ‘RootBoxT<CORE::DoubleWrapper>::innerBox_’ in read-only structure. I “might” know why does this happen, but I need to learn more about the rules.

I made all instances for RootBoxT as const, and the member variable *innerBox_ of class RootBoxT is also const type. In one of the methods of class RootBoxT, I need to update the *innerBox_, so I called delete to free the memory of innerBox_ and assigned it with another const pointer.

My questions is that:

  1. Is this the right method, that when I need to update the value of a const pointer, I just delete it and assign it with another const pointer?
  2. Is this error cause by the fact that the instance of RootBoxT is const but one of the methods changed the place that a member variable points to? If not, why does it happen? If so, should I just change these instances to non-const?

I really messed up with const keyword for my current project, as I’m rather new to C++. Thanks.

  • 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-25T09:30:07+00:00Added an answer on May 25, 2026 at 9:30 am

    If you have something like this:

    struct S
    {
       int * i;
    };
    

    and a const S object (s), the pointer s.i is const but not the int it points to (*s.i). This means you can write:

    *s.i = 4;
    delete s.i;
    

    but not:

    s.i = new int (5);   // illegal
    int * j = 0;
    s.i = j;             // illegal
    

    because that would modify the pointer value, not what it points to.

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

Sidebar

Related Questions

Has anyone encountered this error using SQL Server 2005 and Data access application blocks
I've recently encountered the error: System.Data.SqlClient.SqlException: The transaction log for database 'mydatabase' is full.
i am getting this error Unexpected error encountered while preparing for the operation. org.eclipse.core.runtime.AssertionFailException
I have often encountered an error such as cannot convert from 'method group' to
I encountered the above error message after applying the OutputCache attribute on ActionResult methods
I have encountered a rather odd error that I do not understand. I created
I've encountered the Iconv::IllegalSequence error on some web pages when using mechanize lib. Is
Is there anyone who have encountered Processing Dirty Regions error in MyEclipse? Actually everytime
I encountered an error today while trying to retrieve an XML by sending a
I encountered an error when my application tries to load a RSA Algorithm provider

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.