Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • n.b. std::allocate_shared takes an allocator (and stores it) so one can control allocation however one wants, one doesn't have to use the heap. Commented Jun 21, 2018 at 1:36
  • @esoterik: But since you have no idea how much memory it will allocate, you dramatically limit your options for non-heap (or heap-like) allocations. Commented Jun 21, 2018 at 1:54
  • 1
    Personally I think the most idiomatic way to do this would be to create a Shader class which contains the GLuint and frees it in it's destructor, then you can just use a shared_ptr<Shader> if you want reference counting. Commented Jun 25, 2018 at 12:46