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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:32:21+00:00 2026-05-28T04:32:21+00:00

I have a problem understanding why a certain implicit conversion is not working as

  • 0

I have a problem understanding why a certain implicit conversion is not working as I expect it. I have the following class

ref class ManagedWStringArrayWrapper
{
    wchar_t** m_pointer;

public:

    operator wchar_t**()
    {
        return m_pointer;
    }
};

and I thought this would implicitly convert to const wchar_t ** as well – but it doesn’t. Can someone tell me why?

  • 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-28T04:32:22+00:00Added an answer on May 28, 2026 at 4:32 am

    Conversion from T** to T const** is not as intuitive as you might expect — in fact, it’s given as an example in the standard itself as const-incorrect code.

    The example given is:

    #include <cassert>  
    
    int main() {  
      char* p = 0;  
    
      //char const** a = &p; // not allowed, but let's pretend it is  
      char const** a = (char const**)&p; // instead force the cast to compile  
    
      char const* orig = "original";  
      *a = orig; // type of *a is char const*, which is the type of orig, this is allowed  
    
      assert(p == orig); // oops! char* points to a char const*  
    }
    

    Study the above scenario for a while and it will become clear that this is not the same as a conversion T* → T const*. Not at all!

    I asked the same question in a blog post, and the FAQ has an entry on it too.

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

Sidebar

Related Questions

I have an understanding problem of how the following code works: XMLInputFactory xif =
I have problem understanding the meaning of join in the following case: Thread t1=new
i have small problem understanding why my smart pointer class is leaking on self
I'm not sure how to describe this best. But I have a problem understanding
I seem to have a problem understanding how to conditionally test a boolean value
I think I have a problem in understanding the proper way of using MVC.
There are many skills a programmer could have (understanding the problem, asking good questions,
i'm starting to work with php basics and i have some problem understanding how
Please I have a problem understanding references in perl . Can anyone provide a
I'm having a problem understanding what I'm doing wrong here. I have the code

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.