C++ Smart Pointers, Overloading, and Templates Proficiency

  • 30m
  • 30 questions
The C++ Smart Pointers, Overloading, and Templates Proficiency benchmark will measure your ability to understand operator overloading and implement overloading for arithmetic and relational operators, stream operators, assignment operators, as well as use the copy-and-swap idiom. You will be assessed on your skills in recognizing how to use function and class templates and implement a move constructor and move assignment operator. A learner who scores high on this benchmark demonstrates that they have the skills to overload operators and use templates in C++.

Topics covered

  • assign default values to template parameters and fix type mismatches
  • create and instantiate classes with class template parameters
  • create copy assignment operators using the copy-swap idiom
  • create function templates which accept the return type of functions
  • create specializations of class templates
  • define templated functions in header files and use templates for reference types
  • except template parameters that are not of types
  • fix one out of multiple template parameters using partial specializations
  • implement move constructors and move assignment operators
  • inline operator overloads and to use as member functions
  • invoke functions with specialized templates
  • invoke functions with templates on user-defined types
  • name templates to explicitly specify their type
  • outline how functions with function templates can mismanage pointers
  • outline key concepts of operator overloading
  • overload operators with primitive types as the left operand
  • overload templated functions with pointer types
  • overload the copy assignment operator
  • overload the pre and post increment operators
  • recall the need for function templates
  • recognize common issues with the default copy assignment constructor including the inability to copy objects storing pointers
  • recognize requirements for + operator overloads
  • recognize side effects of braced initialization list constructors
  • recognize stylistic elements of operator overloading
  • recognize the efficiency improvements triggered by move constructors
  • use decl_type and contrast it with auto
  • use insertion and extraction operators as functions
  • use the braced initialization list constructor and let the compiler deduce template parameters
  • use the += operator and attempt to return a value type
  • use the std::rel_ops namespace to have C++ generate operator overloads