Thanks guys, it turns out the only problem was that I was using the 'end()' method instead of 'back()'. Although since then, a further problem has arised with trying to make a 'CloseAllFiles' function. Here is the code and the corresponding error message I get when I try and compile.
Code:
void FILEIO::CloseAllFiles()
{
int idx;
for(idx = p_file.size(); idx >= 0; idx--)
{
( p_file[ p_file.begin() + idx ]->m_fileio).close();
delete p_file[ p_file.begin() + idx ];
}
p_file.clear();
}
Error Message:
Code:
132 C:\Dev-Cpp\Programs\Development Projects\BOF\fileio.cpp no match for 'operator[]' in
'((FILEIO*)this)->FILEIO::p_file[(&(((std::vector<FILE_STRUCT*, std::allocator<FILE_STRUCT*> >*)((FILEIO*)this)) + 4u)->
std::vector<_Tp, _Alloc>::begin [with _Tp = FILE_STRUCT*, _Alloc = std::allocator<FILE_STRUCT*>]())->
__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator+
[with
_Iterator = FILE_STRUCT**,
_Container = std::vector<FILE_STRUCT*, std::allocator<FILE_STRUCT*> >
](((const ptrdiff_t&)((const ptrdiff_t*)(&idx))))]'
It says from the error message that the use of '[]' is the problem. I'm not entirely sure why though.