![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Mar 2005
Posts: 11
Rep Power: 0
![]() |
Vector bound check
How would you write a Vector template class that checks the indexes passed to the [] operator to make sure they are correct....
Inheritance?? I have this so far template <class T> class Vector
{
public:
Vector();
Vector(int size_t n);
~Vector();
std::vector<int> array;
try{
array.at(1000) = 0;
}
catch(std::out_of_range o){
std::cout<<o.what()<<std::endl;
} |
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() ![]() |
check out SGI's Standard Template Library... may have some info there about it.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|