"BigMan" <Bi****@abv.bg> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
This line compiles jsut fine:
std::vector< int const > v;
Just as many illegal C++ constructs may happen to compile on
one or more existing platforms.
The ISO C++ standard says in 23.1/3 about the type of
the elements of a container:
<<The type of objects stored in these components must meet the requirements
of CopyConstructible types (20.1.3), and the additional requirements of
Assignable types.>>
'int const' obviously isn't a type that fulfills the requirement of being
assignable.
Besides, even if 'vector<int const>' were legal, it would have
a number of drawbacks compared to 'vector<int> const'.
A key difference is that vector<int> can implicitly be converted
to a 'vector<int> const&', but not to a 'vector<int const>&'.
Cheers,
Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Brainbench MVP for C++ <>
http://www.brainbench.com