On Friday 20 February 2015 00:17:00 Mathias Hasselmann wrote:
> Use std::cref() if not sure about your container's constness.
> 
>      for (auto const& item : std::cref(c)) { ... }

Do NOT do this. This will crash:

        for (auto const &item : std::cref(somefunction()) { ... }

See my other email for an explanation.

And another reason is that std::cref is a C++11 Standard Library addition and 
we cannot depend on that yet.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

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

Reply via email to