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

  • Home
  • SEARCH
  • 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 896627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:45:29+00:00 2026-05-15T14:45:29+00:00

I have a C++ program with a reference-counting smart pointer class. This class works

  • 0

I have a C++ program with a reference-counting smart pointer class. This class works by mapping pointers to reference counts in a static map:

map<ValueIntern*,unsigned int>& ValueRetainMapGetter(){
    static map<ValueIntern*,unsigned int> m;
    return m;
}

The issue that I’ve been having is that some static variables which I have are being deallocated after the reference map has been deallocated.

My question is: how can I control the order in which the static variables are deallocated so that the map is deallocated after all of the references.

  • 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-15T14:45:30+00:00Added an answer on May 15, 2026 at 2:45 pm

    I’d recommend using boost::shared_ptr (or std::tr1::shared_ptr if it’s in your tool chain) instead of rolling your own.

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

Sidebar

Related Questions

I have an objective-C program and I am using ARC (Automatic Reference Counting), it
I have a program which doesn't once reference System.I0, coded in vb.net, yet for
I have a .NET 2.0 program that has a reference to Interop.WIA.dll (.NET), which
I have many objects reference the same class of stored data. In previous programs,
Hello I have this program which reverses letters I enter. I'm using iostream .
I have turned of Automatic Reference Counting (ARC) in my Xcode 4.3.2, and thought
I have a program that call a function with undefined arguments, like this: #include
I have strange problem with run .exe program in my WebApplication. It works fine
Lately, I have been using Automatic Reference Counting in my Objective-C/iOS programs, and have
I have program written in C. It takes 2 arguments username/password and try to

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.