C++Now 2018: Jason Turner “Initializer Lists Are Broken, Let's Fix Them”

preview_player
Показать описание


C++11's initializer_list objects are flawed in ways that prevent them from being used in some contexts and used efficiently in other contexts. They allow you to create dangling references that most compilers and static analysis tools are unable to track. Specific examples, benchmarks, and quotes from the standard will illustrate these problems and how they are mandated. Will it be possible to address these issues with library changes or do we need to make a change to the standard? We will attempt to come to a consensus as a group.

Jason Turner
Developer, Trainer, Speaker

I'm available for contracting and onsite training.

---

*--*

---
Рекомендации по теме
Комментарии
Автор

33m : you can do better then emplace_back by using memcpy for trivially copiable types.

Also In my measurements checks for capacity in push back don't go away.

denisyaroshevskiy
Автор

So basically lack of partial template deduction for classes makes make_array function better than std::array constructor.

Predelnik
Автор

Would have preferred examples where initializer lists are broken when used in non-contrived real life code

Silmarieni
Автор

Sorry guys, i'm going back to C with classes, meaning i'm using C++ with a very very limited amount of ++ extensions.

llothar