Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- This single-argument constructor instantiates an LPHash object.
- The amount of allocated space for the object's data is set to
- 140% of maxExpected.
- maxExpected: Maximum allowable pieces of data.
- */
- template <class TYPE>
- LPHash<TYPE>::LPHash(int maxExpected) {
- this->m_nUsableSpace = maxExpected;
- this->m_nAllocatedSpace = this->m_nUsableSpace * 1.4;
- this->m_nUsedSpace = 0;
- /*
- ***NOTE***
- Future reference:
- Allocating memory for an array of pointers with ()
- at the end will initialise them all to 0.
- Alternatively, you can call them like a constructor;
- however, they need to have been allocated memory already:
- LPHash(int maxExpected) : m_pData() { ... }
- */
- this->m_pData = new TYPE*[m_nAllocatedSpace]();
- }
Advertisement
Add Comment
Please, Sign In to add comment