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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:56:36+00:00 2026-06-15T02:56:36+00:00

In order to use an incomplete type with a smart pointer such as boost::scoped_ptr

  • 0

In order to use an incomplete type with a smart pointer such as boost::scoped_ptr, one must explicitly define an empty destructor for the parent class in the corresponding CPP file. Example:

// H file
class Foo
{
public:
  ~Foo();

private:
  class Pimpl;
  boost::scoped_ptr<Pimpl> pimpl_;
};

// CPP file
class Foo::Pimpl {};

Foo::~Foo() {}

Where exactly does the compiler place the instantiation of boost::scoped_ptr‘s destructor? I’m trying to visually imagine where it would be in either of these source files, as if I had explicitly defined scoped_ptr’s destructor myself. Is it reasonable to imagine it this way?

I know that template methods and classes aren’t instantiated for a type until it is used with that type, but I’m trying to think about it structurally now, and where the compiler would place it if it actually hand-wrote it. This will help me get a better understanding of how such techniques (like the one above) are able to be used.

Also I’m not sure if the entire definition of a template class is instantiated or only the relevant parts of it, as they are used. In other words, is it possible for only part of boost::scoped_ptr‘s entire definition to exist?

  • 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-15T02:56:37+00:00Added an answer on June 15, 2026 at 2:56 am

    I feel like I’m missing something from your question.

    There’s only one body (“.cpp”) file being used in this example, so it goes there. More precisely, it goes into the same object file (“.o”, “.obj”, etc) as that destructor. The language standard doesn’t specify this, but that’s how all the implementations I’m familiar with do it.

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

Sidebar

Related Questions

OCaml process can use just one core and in order to use multiple cores
In order to use cout as such : std::cout << myObject, why do I
I want to use one pointer ( _ref ) to point to different class
In order to use Moxy as JAXB Implementation, one has to add a file
In order to use JSTL (JSP taglibs) in a maven project, one needs to
In order to use some AJAX calls, we use often some input type=hidden. But
In order to use normal mapping in GLSL shaders, you need to know the
In order to use xpath-functions (specifically the fn part), I included the respective namespace
I understood that in order to use cookies inside of phonegap native app there
I would like to use ORDER BY FIELD() (MySQL) in Django. Does Django support

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.