Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


#ActualServant of the Lord

Posted 28 January 2013 - 03:46 PM

I am not entirely sure if our school compilers are updated for C++11 so I will have to log onto our CSE Machines to check that out.  I will look into everything to see what I should do.  
 
I also probably should make sure I'm allowed to use any of those from the standard library.  Professor has been somewhat picky on us using the standard library in some places.

You don't have to use the standard library for it. Even if you don't have move-semantics (one move cost for moving the last element over the deleted element) you could still do a simple copy (just making it one copy cost).

<array element at elementToDelete> = <array element at lastElement>

That's alot faster than...
for every element above elementToDelete
: <previous element> = <current element>


But, as mentioned, doesn't preserve the relative order of the elements - which may have been part of the class assignment's requirements.

#2Servant of the Lord

Posted 28 January 2013 - 03:45 PM

I am not entirely sure if our school compilers are updated for C++11 so I will have to log onto our CSE Machines to check that out.  I will look into everything to see what I should do.  
 
I also probably should make sure I'm allowed to use any of those from the standard library.  Professor has been somewhat picky on us using the standard library in some places.

You don't have to use the standard library for it. Even if you don't have move-semantics (one move cost for moving the last element over the deleted element) you could still do a simple copy (just making it one copy cost).

<array element at elementToDelete> = <array element at lastElement>

That's alot faster than...
for every element above elementToDelete
: <previous element> = <current element>

#1Servant of the Lord

Posted 28 January 2013 - 03:44 PM

I am not entirely sure if our school compilers are updated for C++11 so I will have to log onto our CSE Machines to check that out.  I will look into everything to see what I should do.  
 
I also probably should make sure I'm allowed to use any of those from the standard library.  Professor has been somewhat picky on us using the standard library in some places.

You don't have to use the standard library for it. Even if you don't have move-semantics (one move cost for moving the last element over the deleted element) you could still do a simple copy (just making it one copy cost).

<array element at elementToDelete> = <array element at lastElement>

PARTNERS