How can be realized the auto keyword functionality without using c++0x standard?
for(std::deque<std::pair<int, int> >::iterator it = points.begin();
it != points.end(); ++it)
{
...
}
Maybe such class:
class AUTO
{
public:
template <typename T1>
AUTO(T1);
template <typename T2>
operator T2();
};
With such usage:
for(AUTO it = points.begin(); it != points.end(); ++it)
{
...
}
But, T1 and T2 are different.
How to move info about T1 to operator T2()?
Is it really possible?
If a library extension was easily implementable there would have been no need for a language extension. See N1607 for details on the auto proposal.
However, the article on the Boost.Foreach (which sort of does what you want) macro may help understand the issues related to such an implementation.