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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:32:17+00:00 2026-06-07T13:32:17+00:00

While there exists an equivalent of boost::shared_ptr ( QSharedPointer ) I wasn’t able to

  • 0

While there exists an equivalent of boost::shared_ptr (QSharedPointer) I wasn’t able to find something that resembles boost::shared_array.

Of course I could use something similar to

QSharedPointer<const std::vector<T> > shared_vector_ptr(new std::vector<T>(
       reinterpret_cast<T*>(pBuffer),
       reinterpret_cast<T*>(pBuffer+length)
));    

but I would like to know if there exists a native Qt solution which provides T& operator[](size_t) and uses delete[] instead of delete. I’m reluctant to use boost in this project since the target machine couldn’t have boost installed and the project gets distributed by source.

Note: I know I can specify a deleter by using QSharedPointer::QSharedPointer ( T * ptr, Deleter deleter ), however I dislike approach since the compiler doesn’t force you to specify a deleter, which would result in a new [] allocated block deleted by delete.

  • 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-07T13:32:20+00:00Added an answer on June 7, 2026 at 1:32 pm

    I think the nearest is QScopedArrayPointer, but of course it’s scoped.

    It would be little work to subclass QSharedPointer to silently add your own hidden Deleter that calls delete[] (and add anoperator[]), that way the user wouldn’t have to do any thinking, and it’s still using Qt native code – you have just wrapped it up neatly.

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

Sidebar

Related Questions

The Problem It's something I came across a while back and was able to
I would like to know if there exists in Java an event that is
I was wondering if something exists (in Java world) able to take an snapshot
How to check for a string that for every character in it, there exists
I'm wondering if there exists a python module that would allow me to do
While coding, I wondered if a plugin exists that I could highlight a series
While there are many good online and offline tools for testing regular expressions, I
While there are a handful of great programs for ISV Startups (BizSpark, Emplower ISV,
While there are many guides for Browser Helper Objects, i have a hard time
While there are multiple ways to reverse bit order in a byte, I'm curious

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.