Il 08/12/2015 10:46, Ziller Eike ha scritto:
I really wonder though, why it is possible to assign the wrong type to 
a_reference_  here, even if it is const ?
I cannot do that with e.g. a std::vector (std::vector<const std::string> v; const 
std::vector<std::string> &v2 = v;), so is that some funny thing with std::pair?

Just that std::pair has a constructor performing implicit conversions from another pair's types, see the constructors 4/5

http://en.cppreference.com/w/cpp/utility/pair/pair

Those conversions silently succeed and kaboom, you're deep copying std::strings...

Cheers,
--
Giuseppe D'Angelo | [email protected] | Software Engineer
KDAB (UK) Ltd., a KDAB Group company | Tel: UK +44-1625-809908
KDAB - The Qt Experts

Attachment: smime.p7s
Description: Firma crittografica S/MIME

_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to