All Versions Quiz

60 questions available • Test your knowledge of modern C++ features

settings.hpp
Question 1/60|0/0 correct
true_false.cpp
#Template argument deduction for class templatesintermediate

// Is this statement true or false?

If a class template provides a default template argument, like `template <typename T = float> struct MyContainer;`, creating an object with an empty constructor call `MyContainer c;` will fail to compile because there are no arguments from which to deduce `T`.

template <typename T = float>
struct MyContainer {
  T val;
  MyContainer() : val{} {}
};

MyContainer c; // OK, c is of type MyContainer<float>