Pelle said:
Hi,
Honestly, what is this 'size_t'?
An unsigned integer type used by the standard library to represent
sizes or indices. Many functions in the standard library take or return
size_t's and you should always use the same type. For example,
void f(std::vector<string> &v)
{
std::size_t size = v.size();
std::size_t index = 10;
std::cout << v[index];
}
Personnaly, I use std::size_t very often in my programs, not only in
conjuction with the standard library.
And while I'm at it - what is a 'mutable' var.?
I've understood it somehow makes a const a non-const,
but what's the point of that?
Allows an object to be logically const. An object is logically const
when its visible state does not change. For example, you may cache some
data for faster access. Accessing this data may modify the cache, and
this is ok even for const objects, since the cache does not modify the
object's visible state. Making the cache mutable allows a const member
function to modify it.
See
http://www.parashift.com/c++-faq-lite/const-correctness.html#faq-18.13
for some more infos. IIRC, Scott Meyer's [More] Effective C++ has an
item on that, but I cannot give specific references.
Jonathan