I have a file called jobDatabase.h which I would like to be able to fill up with as many _jobs as I feel like (maybe hundreds), but some of my function calls require me to load-in each job. Is there some way to avoid this need, b/c the argument list would become absurdly long.
I've considered using matrices, but can you mix data-types within an array? I don't think so.
I could maybe have one function to pre-load a desired set from the database of _job into job1, job2, job3, job4, but I'd prefer they all be available in whatever function I need them.
Please help!
1 2 3 4 5 6
class _job
{
public:
string name, title;
int salary, creditYearsMin;
};
(17): error C2955: 'std::deque' : use of class template requires template argument list
(28): error C2664: 'life' : cannot convert parameter 2 from 'std::deque<_Ty>' to 'std::deque'
with
[
_Ty=_job
]
(35): error C2955: 'std::deque' : use of class template requires template argument list
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\deque(970) : see declaration of 'std::deque'
You need to give deque the template argument: deque<_job>.
When you pass the deque you don't need to pass again all the objects as they are already contained in it
Looks like you may want to use an actual database as opposed to a pseudo-db, expecially if you're going to have hundreds of job entries. This looks like a classic example for a relational database.
Notice the '&' after the type, const TYPE & means 'a const reference of TYPE', which means that the argument doesn't get copied (reference) and that you can't modify it in the function (const)