I'm taking the object oriented aspect of c++ this semister and whenever I try to use the size_t data type it tells me it isn't a part of 'std.' I am following all of the instructions in the book, but I am stumped on this one. Does size_t even exist? I am using it in a bag class. I have included <cstdlib> at the beginning of the header file. I'm using VC++ 6.0 sp5 btw.
class bag
{
public:
//TYPEDEFS AND MEMBER CONSTANTS
typedef int value;
typedef std::size_t sizeType;
enum {CAPACITY = 200};
//Constructor
bag() {used = 0;}
//Modification Member functions
void Insert(const value& entry);
void InsertMany(const value& entry, value& amount);
bool EraseOne(const value& target);
void operator +=(const bag& addend);
//Constant Member fucnctions
sizeType size() const {return used;}
sizeType Count(const value& target) const;
private:
value aList[CAPACITY]; //Data for products
sizeType used; //how much is used
}
The only errors I get during compile deal with the size_t type.
class bag
{
public:
//TYPEDEFS AND MEMBER CONSTANTS
typedef int value;
typedef std::size_t sizeType;
enum {CAPACITY = 200};
//Constructor
bag() {used = 0;}
//Modification Member functions
void Insert(const value& entry);
void InsertMany(const value& entry, value& amount);
bool EraseOne(const value& target);
void operator +=(const bag& addend);
//Constant Member fucnctions
sizeType size() const {return used;}
sizeType Count(const value& target) const;
private:
value aList[CAPACITY]; //Data for products
sizeType used; //how much is used
}
The only errors I get during compile deal with the size_t type.