How to Manually call a Destructor on a Smart Pointer

Questions : How to Manually call a Destructor on a Smart Pointer


I have a shared_ptr for an SDL_Texture programming in a game I'm making. I want to use a Learning shared pointer to be able to use the Earhost same texture on multiple objects without most effective leaking any memory. I have the shared wrong idea pointer return from a method which is

std::shared_ptr<SDL_Texture> _OFFSET);  RenderWindow::loadTexture(const char (-SMALL  *filePath) {

    return _left).offset  std::shared_ptr<SDL_Texture>(IMG_LoadTexture(renderer, arrowImgView.mas  filePath),
            (self.  SDL_DestroyTexture);

However, when I'm done using the texture use of case in the game, I want to be able to United manually call it's destructor, which is Modern SDL_DestroyTexture however that doesn't ecudated get called when I need it to and it some how takes up a lot of memory. Is there any anything else way of telling it to call its destructor not at all when I want it to?

Total Answers 1

Answers 1 : of How to Manually call a Destructor on a Smart Pointer

You can release the ownership of the very usefull object by calling reset() on the localhost shared_ptr. If that is the last one love of them holding the pointer, the shared_ptr's localtext deleter member will be used to destroy basic the object.

Top rated topics

How to fetch data from website and print in excel Page object model, Data driven and page factory this is hybrid framework

Skia-for-Aseprite libs: how to compile for a DEBUG-build project in Visual Studio?

How to get all metric names from Prometheus server filtered by a particular label

How to use addEventListener on multiple input fields to invoke keyup event on them in JavaScript?

Unable to create superuser in django getting error "django.db.utils.OperationalError: no such table: auth_user"

Fill out pre-existing PDF document with Javascript, NodeJS

Python Matplotlib Pie chart merge two slices with identical titles together

Sending message from wearos app to phone: onMessageRecieved not called after update targetSdk

Python: Dynamically read and download an excel file?

Android Instrumentation Test cases for last known location

Jolt Spec - Flatten out Nested Array and copy root values

If else statement is not working in selenium webdriver

AS create a new project,code reports some error, but it can run normally

Apply async on Azure ocr API

Using Avro Schemas that refer other Avro Schema to generate specific record class in Java

Simple way in Vega to colapse and exspand a Tree node

Import CSV file to mariadb

Issue ionic bluetooth seriel plugin

How to retrieve Azure Service Principal's secret in Powershell 7

Best method to retrieve huge amount of data

Bash CURL GET Request output to a single JSON file including server response and CURL Information

How to get a shifting windows output on CNN-LSTM time-series forecasting? ([t-120:t] sequence to predict [t+1:t+40])

How to pass { or " in query parameters to HttpClient in C# for Autotask?

Why don't methods need to return a value after throwing an exception?

How to implement a sending queue in PHP

How do I compute a discounted price or the regular price after the inputs?

Storing value in a dictionary

What's the behind magic of python os.path.realpath?

Making generated column optional in NestJS/TypeORM

Extended variants not working in Tailwind 2.0.2 and Laravel 8

Revert merge postman from fork to master

Python Kmeans Print absolute frequency of words in each cluster

How to CVRP mathematical formulation in to GUROBI using Python with feasible solutions

Short cut for moving tabs in IntelliJ IDEA

How do I convert apriori algorithm from python to java?

Styles applied to Horizontal Line via css file is not working

White screen appears instead of splash screen

POST request doesn't work on iOS devices in IONIC app

I am using PdfiumViewer to display pdf, when there are too many PDF pages, cannot add pictures to some subsequent pages

IPVLAN CNI based pods across hosts using VLAN headers

Can't use a custom cohort in retention cohort analysis

Why is Kafka_2.13_2.6.2 throughput higher than Kafka_2.13_3.0.0?

I want to check the user input in sign up form at runtime not just on clicking the submit button

Save image to path from temporary storage

UseWrappedStore missing in next-redux-wrapper

Multiple table update in single page handler method razor pages

What will be the type of class object where the class implements an interface and also has it own new members

How to split a large CSV file with no code?

How can I query specific child in multiple-level relationship table in SQLAlchemy

ValueError: No JSON object could be decoded building Chromium