OK. I know now about overloading function, that's way I've commented one out. But the problem still remain first catch (with out_of_range) and how out_of_range exception is raised in g++ STL implementation. In MS STL implementation (who in past was worse than g++ STL) it compile well. Seems g++ don't recognize such an exception. That's why I've asked which compiler others use.
Expected type-specifier before 'out_of_range' means that out_of_range need to be of some type(and seems it's not). If it is Standard Template Library shouldn't it work in the same way on each platform or compiler which come with such implementation?
If out_of_range exception is implemented in MSC STL and even Bjarne Stroustrup (which guess use a unix os ) spoken in his book(from where I've got this example) about it, shouldn't it be available on all STL impl.? (Well, guess Bjarne use his own version of compiler. )