Now I want to save "impl" somewhere, thats why I saved it in X that I will return at the end of the function. BUT as soon as this function is ended, a GC calls the deconstructor for this object. How can I set this object to be avoided by the GC, when it is called?

EDIT: After hours of searching on the internet I noticed that c++ has something called pinned pointers (pin_ptr) but all the examples I found on it, shows saving arrays of int inside. Is it possible to save a object inside a pinned pointer?

Related:

java,object,jframe,super
I've made a class that extends JFrame, and in my classes constructor, to set the title I can either use: super("title"); setTitle("title"); or just create a JFrame object i.e: JFrame f = new JFrame("title); How does the compiler differentiate from all of these to conclude the same thing? I know...

javascript,object,firebase
I'm experimenting on login with firebase. I can make an account, and it'll store additional information too. The problem is retrieving this information. I can get it using: usersRef.on("value", function(snapshot) { console.log(snapshot.val()) }, function (errorObject) {...}); When I do this I get two things (because I have two accounts): -JrrzEOqZQU0HVeYVXCm:...

java,object,overlap,spawn
I'm developing a game in Java, and part of it requires that objects spawn at the top of the screen and proceed to fall down. I have three objects that can possibly spawn, and three possible x coordinates for them to spawn at, all stored in an array called xCoordinate[]....

javascript,arrays,xml,object
I have an XML file that I read in to a Javascript object. This is called jsonXML. I can see the object in its entirety in the console when I log it. It is a pretty complex object with a lot of layers and duplication. I need to access some...

android,class,object,casting,realm
I am currently working on a project where my Database has a very large number of tables (Approx 60 total). I am working to create the Database Helper class that will function as the writer/ reader to/ from the database. And example of my write method would be this: public...

python,object,self
I made several classes which are doing the same thing, but I still don't completely understand the difference, and which is best to use. Also, the 4th object is not working. It says 'NameError: name 'self' is not defined', although I don't understand what is going wrong. This is what...

c++,object,constructor
I have two questions about the following code in c++. What does the line A obj() in main() mean? Its not giving any error. And why does the next line obj.fun(); give the following error? request for member 'fun' in 'obj', which is of non-class type 'A()' The code is:...

javascript,object
I have a weird situation. I take some values from a form and save it in an object. I print out the values and it prints fine to the console log. But when I try to access it or print again in next line. It returns empty. Here is the...

javascript,arrays,sorting,object
I have an array of objects: [{ id: 1, name: 'kitten' }, { id: 2, name: 'kitten' },{ id: 3, name: 'cat }] How do I remove the second kitten? Sorting into an array of names doesn't work, because I can't know if I am deleting id 1 or or...

c#,linq,list,object,properties
Ok so I have an object type called monsters and a list of all monsters I need to get all the strings from the property called MName and add each one to a Drop down text box. here is the class so far.(sorry Im really new to coding.) using System;...

java,object,dynamically-generated
I am developing a program to mark algorithms submitted by a group of students; each student will submit their own .java files. I would like to place these .java files into a folder and run my program. My program would then instantiate each class in the folder and add it...

java,null
I want to check if a String is empty or not and I would like to know the differences between the following and which one is better and on which occasions. Specially because I'm getting this error if I use "isNotBlank": "cannot be cast to java.lang.String". this.text.getData() != null <---...

matlab,object
Hello lovely community, i am quite new here, but still hope someone can help me out. I just worked a bit with Matlab in the past and want to do a new project. Earlier I just stored all in one Matlab file and didn't had the need to use classes....

php,json,object
This question already has an answer here: How can I access an array/object? 3 answers Just a real quick question please, I have this string that came from my query I am able to display the string using xx = dd($sumx) which gave me the string below: string(124) "[{"total":-4107717.58,"alerx":4,"currentYear":-4107717.58,"lastYear":0,"date":2015,"value":{"debit":0,"credit":4107717.58}}]"...

excel,vba,excel-vba,object
When I use wb.Sheets(1).Range("A:A").Find(What:=ID, LookIn:=xlValues) I get error 91 - Object Variable or With Block not set. When I use Sheet1.Range("A:A").Find(What:=ID, LookIn:=xlValues) it returns correct value. Why the difference? Is there a flowchart I can reference or any simple information available to understand which sub-commands (I don't know the proper...

java,object,null
Summary: New to Java, tried looking through other posts but didn't find an answer. I'm learning inheritance and have an AddressBook class extended by a Runner class. When I write a program to test the inheritance I create a Runner object. If I get the first String parameter it returns...

asp.net-mvc,entity-framework,null,edit,httppostedfilebase
In my SachController, there is an Edit method like below. In the view, there are several textbox and one file-input for upload image object. Sometime, user doesn't want to change the image and they just don't select a new image. And the image (HttpPostedFileBase) is null. How can I avoid...

java,android,null,hashmap
I am using a HashMap to link some strings to integers, which are then used to index a list. The strings I am using in .get() are passed to a method, from an android spinner, and are definitely correct as I outputted them to the log, and they match those...

javascript,arrays,object
I need to complete the keysAndValues function so that it takes an object and returns the keys and values as separate arrays. For example: keysAndValues({k: 11, l: 12, m: 13}) // should return [['k', 'l', 'm'], [11, 12, 13]] I have already tried: http://jsfiddle.net/marcusdei/ppfh5fpa/4/...

java,object
My sample code - private final DataObj dataObj = getDataObjs(); private final DataObj dataObj1 = new DataObjImpl(); dataObj1 = dataObj; //I need the value of dataObj1 to be the same even if the value of dataObj is modified anywhere further down in a class. My problem is that if the...

javascript,arrays,object
I have an array as below. What I'd like to implement is a function that takes the node's ID, x and y as its inputs and make changes accordingly in the array. var nodes = [{ID:"101", x:100, y:200} ,{ID:"102", x:200, y:200} ,{ID:"103", x:300, y:300} ,{ID:"104", x:200, y:300}]; For example, function...

javascript,json,object
This question already has an answer here: Access / process (nested) objects, arrays or JSON 6 answers I'm trying to get a bit of javascript working to pull back a currency conversion. Using the API from fixer.io, I'm requesting http://api.fixer.io/latest?symbols=USD&base=GBP I get an object back, but I don't know...

javascript,jquery,arrays,object,filter
This question is similar to this one Jquery filter array of object with loop but this time I need to do the filter with an array of objects. Exemple: I have an array of objects like this: myArray = [ { userid: "100", projectid: "10", rowid: "0" }, { userid:...

java,multithreading,object,methods
Let's suppose I have this class: public class Myclass { method1(); method2(); method3(); } I want to know if there's a way to run all 3 methods in different threads simultaneously. Is there a way to create a class MyThread : public class MyThread{ //implementation } in way that it...

java,list,concurrency,null,add
I have 2 lists and want to copy some element from one to another, i.e. there are old and new employees list I need to union 2 lists and delete the elements that include to the old list but not include in the new one. I could solve the part...

python,list,sorting,null
I have a list with dictionaries in which I sort them on different values. I'm doing it with these lines of code: def orderBy(self, col, dir, objlist): if dir == 'asc': sorted_objects = sorted(objlist, key=lambda k: k[col]) else: sorted_objects = sorted(objlist, key=lambda k: k[col], reverse=True) return sorted_objects Now the problem...

python,object,super
I do not understand the meaning of the super keyword when it is not used in a child class. The question comes from this class here that I found on a git hub project where I am working (the link is https://github.com/statsmodels/statsmodels/pull/2374/files) Look for example at the fit method where...

arrays,flash,object,actionscript
In Java it is possible to set the datatype of an array, and by setting the datatype to the object I am using, I can call the methods and variables of that object. For instance: ArrayList<Object> name = new ArrayList<Object>(); name.add(new Object(variables)); name.get(0).method; Is there any way I can do...

ios,swift,if-statement,null
Currently trying to check if three values, that I just converted from Strings to doubles, are nil from the UITextFields aValue, bValue, and cValue. I don't get a compile error from these variables until the if statement at the bottom of the code block (shown below) where it causes a...

javascript,arrays,sorting,object
This question already has an answer here: Sorting an array of JavaScript objects 14 answers (Please excuse any errors - this is my first post and I am also relatively new to Javascript) I'm trying to sort an array of objects by a specific property value in Javascript. I...

java,performance,object
I have this loop which runs about 1,000,000 times. while ((line = br.readLine()) != null) { if(!(line.isEmpty())){ data = new JSONObject(line); name = (String)data.get("name"); surname = (String)data.get("surname"); ar.put(name, surname); //an array } } What are the advantages (if any) in terms of efficiency of having it like that were data,name...

java,json,object,jackson,jackson-modules
I don't know a ton about Jackson, I'm just using it because I needed to share data from Python to Java. Anyway my code is pretty simple ObjectMapper mapper = new ObjectMapper(); Map<String,Object> data = mapper.readValue(new File(FileName), Map.class); System.out.println(data.get("SomeInput")); This is what I'm getting: {Y=0.830168776371308, Z=0.16877637130801687, X=0.0010548523206751054} I really just...