All challenges
Multiple ChoiceHard 45s

Class template argument deduction

Given `template<class T> struct S { S(T); };` what does CTAD allow in C++17?
Options
  1. 1Nothing; class templates always need explicit arguments.
  2. 2Only `S<> s(42);` with empty angle brackets.
  3. 3`S s(42);` deducing `S<int>` from the constructor argument.
  4. 4A compile error because the constructor is not `explicit`.

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle