private typedef as return type of private function
For information, really (I tried Comeau, and it doesn't complain), here's another VC++ non-standardism:
Code:
// A.h
#include <vector>
class A
{
typedef std::vector<int>::iterator iterator;
public:
A() : v(10, 1) {}
private:
iterator f();
std::vector<int> v;
};
// A.cpp
#include "A.h"
A::iterator A::f()
{
return v.begin();
}
VC++6.0 rejects this, saying that you can't access the private typedef A::iterator. Basically it seems to be failing to get the context of the (private) function before deciding whether private access is allowed. As I said, Comeau has no problem with it.
Correct is better than fast. Simple is better than complex. Clear is better than cute. Safe is better than insecure.
-- Sutter and Alexandrescu, C++ Coding Standards
Programs must be written for people to read, and only incidentally for machines to execute.
-- Harold Abelson and Gerald Jay Sussman
The cheapest, fastest and most reliable components of a computer system are those that aren't there.
-- Gordon Bell