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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:49:46+00:00 2026-05-31T23:49:46+00:00

After about 10 years of using managed memory and functional languages, I’m finally coming

  • 0

After about 10 years of using managed memory and functional languages, I’m finally coming home to C++, and smart pointers are confusing the heck out of me. Half of the documentation out there is still regarding the deprecated auto_ptr.

I’m trying to implement this fairly straightforward Bullet “hello world” program:

int _tmain(int argc, _TCHAR* argv[])
{
    auto bp = unique_ptr<btBroadphaseInterface>(new btDbvtBroadphase);
    auto cc = unique_ptr<btDefaultCollisionConfiguration>(new btDefaultCollisionConfiguration);
    auto disp = unique_ptr<btDispatcher>(new btCollisionDispatcher(cc));
}

The btCollisionDispatcher constructor wants a btCollisionConfiguration*, but I’m giving it a unique_ptr to one instead.

What do I normally want to do in this case? If there’s a way to “de-smart” the pointer, something tells me that unique_ptr isn’t the right smart pointer to use.

enter image description here

C++ was my language of choice before I moved to other things. It’s a little shocking coming back and seeing that all the patterns and practices have completely changed.

  • 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-31T23:49:46+00:00Added an answer on May 31, 2026 at 11:49 pm

    There is a get() member function that gives you the raw pointer that is held by the unique_ptr. This does not cause the unique_ptr to relinquish the ownership, though, so proper cleanup will still happen (careful with storing that raw pointer!).

    There is also a release() member function, which relinquishes ownership. This means that you’re back on dumb pointer land and cleanup is all your responsibility.

    I can’t fathom why the code is using new in the first place and not just using automatic storage objects, but I’m going to pretend there is a reason…

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

Sidebar

Related Questions

I am about to reenter the MFC world after years away for a new
I am using an open source .Net library which uses MSMQ underneath. After about
I started cloning an SVN repository using the git-svn's clone operation. After about 6
Yesterday, after about two years we re-deployed our application. Code hasn't changed, but the
Using Getting back up to speed on Java after 8-10 years as a starting
After many years of working on a general-purpose C++ library using the Microsoft MSVC
I'm a recent semi-convert to Eclipse after 20 years of using vi and gvim.
After using AS2 for several years, I'm getting started with writing applications in AS3
After two years of Android development I'm still not 100% sure about what resources
I started learning c++ about 3 weeks ago after 2 years of java. It

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.