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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:51:21+00:00 2026-05-19T11:51:21+00:00

So as part of a large hobby learning project I have implemented a mostly

  • 0

So as part of a large hobby learning project I have implemented a mostly complete smart pointer implementation. It does practically every thing I ask of it, except for one minor detail that may prove to be a deal-breaker if I can’t solve it. Contrived Example:

//Header1.h

#include <Header2.h>

class A
{
//Methods and such that involve class B in return type / arguments
};

//Header2.h

class A; //Forward declaration of A, needed because A includes Header2.h

class B
{
public:
    SmartPointer<A> Ptr;
};

The previous code, as you could guess, gives me warning C4150: deletion of pointer to incomplete type 'type'; no destructor called. I know why this is happening; in Header2.h, the smart pointer code includes a delete on a forward declared instance of A. If I could include Header1.h, no problem. I don’t really wish to have to refactor at this point.

I have heard the boost smart pointer has this problem solved, somehow. Bringing in boost is not the intent of this project, as it is pretty much a hobby / learning project. So how does boost deal with this issue? How could I get the smart pointer to behave, in this instance, like a raw pointer? I have a few ideas, but I figured floating the question to SO could cull the list of ideas into a useful subset.

Forward declaring my thanks for helping me solve this one.

  • 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-19T11:51:21+00:00Added an answer on May 19, 2026 at 11:51 am

    So how does boost deal with this issue?

    Boost deals with this issue by using checked_delete instead of delete inside the smart pointer class template, thus requiring the complete definition of A.

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

Sidebar

Related Questions

As part learning exercise, part hobby project, I am implementing my own interpretation of
Large part of squeak is implemented using squeak itself. I am curious to know
A large part of a project I'm working on now deals with sending certain
I have a large string, and a part of this string starts like this:
I have recently been developing a website which relies a large part on the
This is a part of a large csv file which I have: 66.35.223.128,66.35.223.143,1109647232,1109647247,AU,Australia 66.35.223.144,66.35.227.191,1109647248,1109648319,US,United
I have currently collected a large part of my work under a single and
I'm working on a project of which a large part is server side software.
I am implementing some spectral graph algorithms for a project. A large part of
As part of a large python program I have the following code: for arg

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.