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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:07:26+00:00 2026-05-15T21:07:26+00:00

it occurred to me that it would be a good idea to manage a

  • 0

it occurred to me that it would be a good idea to manage a range of mapped memory (from glMapBuffer) with a std::vector.

// map data to ptr
T* dataPtr = (T*)glMapBuffer(this->target, access);

[... debug code ...]

// try to construct a std::vector from dataPtr
T* dataPtrLast = dataPtr + size;
mappedVector = new std::vector<T>(dataPtr, dataPtrLast);

the problem is that the memory range won’t be used directly but it is copied into the vector.

My question would be: is it possible to make the vector just ‘use’ the mapped memory range. (and ideally throw exceptions on resize/reserve)
Or is there any other standard container that would accomplish this?

Kind Regards,
Florian

  • 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-15T21:07:27+00:00Added an answer on May 15, 2026 at 9:07 pm

    No, and for good reason. This code would never work. For example, you could alter the MapBuffer and break the size/capacity values inside the vector. You could push into the vector and cause an access violation/segmentation fault. You could cause a resize, destroying the buffer. And, fundamentally, if it’s already within a contiguous array, what’s the benefit? You could roll a custom container for fixed length arrays, I guess.

    Especially! if you already have a pair of pointers to act like iterators.

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

Sidebar

Related Questions

I originally created a process that occurred by transitioning between views in a multiview
So it just occurred to me that once I upload profile pics to S3,
I am writing a string parser and the thought occurred to me that there
How could you find out that an Exception occurred in a Thread in a
I'M getting crazied for that ERROR A network-related or instance-specific error occurred while establishing
&mobile=0400000000¬es=this+is+a+test The error is above You will see that the following has occurred ¬es
Problem occured when i tried to display xml data that has been taken by
Is there a debugger which works from a virtual machine's host ? That is,
I have a number of classes that I would like to explicitly disallow heap
I have a web service that I would like to load test by sending

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.