Monday, 9 November 2015

Low Level Programming Session Summary 7, 9th November

Low Level Programming Session Summary

9th November

This session we talked a little more about vectors and their role in programming. I found out that it is possible to have an array or vector which consists of pointers, something that was unknown to me before. I can't quite see the use of such a thing yet, but still. One can have a vector of unique pointers so it will auto delete itself and one doesn't have to worry about deallocation. We would first have to reserve space for these pointers as normal and then assign the new pointers as we normally would using an iterator.

We can perform a number of default operations on standard arrays and vectors to organise and manipulate the data stored within. We can use the 'push back' operation to put a new bit of data on top of the stack and we can use the 'push forward' operation to put a new bit of data at the bottom of the stack. Can also use an iterator loop.

If one uses a vector of normal pointers, one must deallocate. Using clear isn't enough however, one should use an iterator to delete the data the pointer points to and then nullify the pointer.

One can use an alias to create a quick way of creating pointers using a simple namespace, and I might end up doing this just so I don't have to type standard every time. Granted, it is probably clearer to use standard, but I would prefer having it quick to type than massively precise.

We talked a little more about predicates and their uses. I am still very confused about these, but I'm going with the flow for now. Find if seems to be a way of easily navigating the vector and locating certain pieces of data, however it still seems to be able to be replaced by a simple iterator which returns a bool variable. Not too sure on these, but they might be useful when combined with weak pointers to check to see if things are still running before deallocation.

We also talked about maps and strings, however my knowledge of strings is still very minimal. I don't really feel I know how to use one of those. As far as I know it is simply a collection of pointers, but I could be wrong.

Overall, again, I'm not too confident with the way things are going. I would certainly appreciate some more time with working with these things rather than being told about them. I know what most of the things being talked about are now, but using them is another thing altogether.

No comments:

Post a Comment