|
I'm writing a linked list and I want a struct's destructor (a Node struct) to simply delete itself, and not have any side effects. I want my list's destructor to iteratively call the Node destructor on itself (storing the next node temporarily), like ...
Started by Hooked on
, 9 posts
by 9 people.
Answer Snippets (Read the full thread at stackoverflow):
delete this; would call the destructor of the current object if you delete the outer object first you would have no way to access the inner pointers to delete a delete doesn't make....
Element in the linked list.
|
|
In my code I use an object and variables inside a function. When in that function I no longer use the object and variables I delete it:
delete myObject; delete myVar;
Is it good practice?
Does it give speed?
My JavaScript is server-side on smart.joyent...
Started by webjay on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
And also instead of using....
In fact it is disallowed in the new ECMAScript Fifth Edition ‘strict mode’:
When a delete instead =null the variable to free up any object it referenced for garbage collection, but it's almost isn't sensible.
|
|
I want to have a "Delete"-link on a page viewing an object in my Ruby on Rails project. I am running into problems as
<%= link_to "Delete", @member, :confirm => 'Are you sure?', :method => :delete %>
loads the page it is on, when the method...
Started by nibbo on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
To create a before_filter in my controller which finds the object, and if it doesn't exist, it will automatically redirect back to a default index URL with an error message, like so:
def find_object @object = Object.find(params[:....
|
Ask your Facebook Friends
|
I have a parent object which has a one to many relationship with an IList of child objects. What is the best way to delete the child objects? I am not deleting the parent. My parent object contains an IList of child objects. Here is the mapping for the...
Started by Mark Struzinski on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Try using merge() instead of....
Change cascade attribute value from "all" to "all-delete-orphan".
Will not necessarily delete the child object, but one way to do so is to set cascade=all-delete-orphan syntax though (sorry).
|
|
I've spent the last 4 years in C# so I'm interested in current best practices and common design patterns in C++. Consider the following partial example:
class World { public: void Add(Object *object); void Remove(Object *object); void Update(); } class...
Started by Generic Error on
, 12 posts
by 12 people.
Answer Snippets (Read the full thread at stackoverflow):
Class Fire : Object { public: virtual void Update() { if(age > burnTime) { world.Remove(this); delete somevariable;....
In your case it looks like the World can just delete the object when() .
In a very straightforward way.
|
|
I am quite sure I've seen the answer to this question somewhere, but as I couldn't find it with a couple of searches on SO or google, I ask it again anyway...
In Entity Framework, the only way to delete a data object seems to be
MyEntityModel ent = new...
Started by Tomas Lycken on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
In "plain old SQLI found this post , which....
If you delete an object you confirmed that you wanted to delete the object and the actual delete.
To let me know =)
Apologies in advance, but I have to question your goal .
|
|
I need to remove the value associated with a property in a Flex 3 associative array; is this possible?
For example, suppose I created this array like so:
var myArray:Object = new Object(); myArray[someXML.@attribute] = "foo";
Later, I need to do something...
Started by Chris R on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
MyArray[someXML.@attribute] = null;
That way it'll end up the same as ... .
Object(); myArray[someXML.@attribute.toString()] = "foo"; delete myArray[someXML.@attribute.toString()];
Rather than delete it, try setting the value to null.
|
|
I am working on both parts of a data layer. I get to create the procs, and the business object layer that will consume the procs.
Is there a best practice for determining where a delete should occur?
Here's the scenario. I have a table Book with foreign...
Started by Jay Mooney on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Depending on what your DAL looks like you'll have to make maintenance will be ... .
I would put the deletes in the data layer object where you a cascade delete on the PK-FK relationship.
Ones with simple Inserts/Update/Delete.
|
|
Hi
i have following model:
<class name="Person" table="Person" optimistic-lock="version" > <id name="Id" type="Int32" unsaved-value="0" > <generator class="native" /> </id> <!-- plus some properties here --> </class>...
Started by Greg on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
As far as I know, cascade="all-delete-orphan" belongs on the collection mapping element --> <set name="Events" inverse="true" cascade="all-delete-orphan"> <key column="Person name="Person" class="Person" column="PersonId" foreign....
|
|
So I have a container(any kind, probably std::map or std::vector) which contains objects of a class with some network thing running in a thread that checks if it is still connected (the thread is defined inside that class and launches when constructed...
Started by csiz on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
I think I prefer your second solution....
You will also have.
You will need to maintain a pointer to the container in the object.
In order for the object to delete itself from the container, it will have to know which container it is in.
|