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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:15:27+00:00 2026-05-25T01:15:27+00:00

I could have a queue<char*> file_queue; but than I would need to clean up

  • 0

I could have a queue<char*> file_queue; but than I would need to clean up after each char*. I have a dinamic variable int buff_length; that would be length of each char in file_queue. It would be set once from a config file before queue creation. So I wonder – is it possible to keep char[buff_length] inside one boost::shared_ptr and how to do such thing?

  • 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-25T01:15:27+00:00Added an answer on May 25, 2026 at 1:15 am

    You can use a shared_array:

    boost::shared_array<char> ptr(new char[buff_length]);
    

    Any reason why std::string or std::vector<char> is not appropriate for your situation?


    Note, with C++11 you can use the following:

    std::unique_ptr<char[]> ptr(new char[buff_length]);
    

    std::unique_ptr has a specialization to deal with arrays. I was under the mistaken belief that boost::shared_ptr did too, but evidently that was incorrect.

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

Sidebar

Related Questions

I know I could have an attribute but that's more work than I want
I could have sworn i have done this somewhere - im using 2.0 right
I could have sworn that I saw a quick demo of new features in
I have a Double which could have a value from around 0.000001 to 1,000,000,000.000
I just wanted to see if I could have your thoughts on the design
There are many skills a programmer could have (understanding the problem, asking good questions,
In prior versions of Windows before Vista you could have a Windows Service interact
I'm writing a Java Tree in which tree nodes could have children that take
Below is my table, a User could have multiple profiles in certain languages, non-English
Why isn't Collection.remove(Object o) generic? Seems like Collection<E> could have boolean remove(E o); Then,

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.