If anyone would be willing to walk me through this I would greatly appreciate it. How would I change the private variables in the header files and the code in the cpp files for the primary indexes so they use a dynamic array or vector instead. For the primary index, the initial vector size will be 8.
#ifndef MY_PRIMARY_INDEX_H
#define MY_PRIMARY_INDEX_H
#include
#include
#include
#include
class PrimaryIndex
{
private:
struct Entry
{
//The key is the entry title
std::string key;
//the value is the position in the binary file that the indexed entry is located
int value;
Entry() : value(-1) {}
Entry(const std::string& k, int v) : key(k), value(v) {}
} index[25];
int count;
public:
PrimaryIndex()
: count(0)
{
}
void add_index(const std::string&, int);
void remove_index(const std::string&);
int get_value(const std::string&) const;
int get_count() const;
void load(const std::string&);
void save(const std::string&) const;
};
#endif