Working with the STL iterators

Almost every programmer some how gets involved with STL iterators while programming. I’m quite fond of these concepts. So what exactly is an iterator? STL stands for the Standard Template Library which has different flavors or implementations floating around with different compilers but the concept and structure behind all of them is the same. It’s […]
Continue reading…

 

What’s the size limit of a vector?

Use std::vector::max_size() function. Don’t confuse this function with std::vector::capacity() and std::vector::size() functions. vector::capacity() tells us when a vector will be reallocated and vector::size() tells us the count of elements inserted into a vector. Source code of vector::max_size looks like this… [sourcecode language=’cpp’]_SIZT max_size() const _THROW0() {    // estimate maximum array size    _SIZT _Count […]
Continue reading…