In article <fdb8c646-950b-4774-961f-3a04da433b57
@b9g2000prh.googlegroups.com>,
os******@gmail.com says...
Which style is better for initializing iterators:
std::vector<int>::iterator iter (aVec.begin() );
or
std::vector<int>::iterator iter = aVec.begin() ;
For most practical purposes, the two are identical. From a purely
theoretical viewpoint, the second is marginally more complex. The first
initializes iter directly from aVec.begin(), where the second
(theoretically) creates a temporary, then copies that temporary into
iter.
In reality, it's probably fairly rare that the compiler will really
create and copy the temporary. Even if it did iterators are easy and
cheap to copy anyway, so it's extremely unlikely to make a difference
anyway.
--
Later,
Jerry.
The universe is a figment of its own imagination.