Тест на знание последних стандартов С++
Русский
Advanced
Проверь, насколько хорошо ты помнишь, какие возможности языка были добавлены в С++11, а какие в С++14 или С++17. Или, может быть, такого вообще нет в стандарте? Заодно, может, узнаешь что-то новое.
Description
30
Questions
30 sec
Per question
3:19
Average time
3.0
Contest Score
14
Participants
4 comments
Tall Panda judge
Thank you for taking the effort to submit your test for the contest.
Unfortunately, this test will not be able to receive a prize:

Missing explanations. Most explanations simply repeat the correct answer. E.g.:
#q2, #q3, #q4, #q5, #q6, #q7, #q11, #q13, #q15, etc.
Nice Giraffe judge
This Quiz was fully re-assessed by an independent Judge.

The original verdict was incorrect. Your Quiz is no longer disqualified. However, we cannot guarantee that it will receive a prize.
Small Lizard
В какой версии стандарта появилась агрегатная инициализация, позволяющая, в частности, писать циклы вида:
std::map<int, double> dictionary = {...};
for (auto& [key, value] : dictionary) ...

В первой строке кода приведён пример агрегатной инициализации, но она доступна уже с C++11.
Aggregate initialization: https://en.cppreference.com/w/cpp/language/aggregate_initialization.
Код: http://cpp.sh/7xbifm (в options можно выбрать standard C++11, и это скомпилируется).
Таким образом, ответ - C++11, а не C++14.

Во второй строке приведён пример range-based for loop с structured binding declaration, но это доступно только с C++17.
Range-based for loop: https://en.cppreference.com/w/cpp/language/range-for.
Structured binding declaration: https://en.cppreference.com/w/cpp/language/aggregate_initialization.
Код: http://cpp.sh/5avdo (в options можно выбрать standard C++14, и это НЕ скомпилируется).
Таким образом, непонятно, зачем эта строка была добавлена в вопрос. И даже, если бы спрашивалось о ней, то ответ всё равно был бы не C++14, а C++17.
Ace Cock author
По задумке вопрос был о structured binding-е, но я всё перепутал
Take the quiz to leave a comment