1. In the context of C++ metaprogramming, how would a metafunction typically be implemented?
2. Why would you return std::optional from a function?
3. There are several things to make sure you understand when benchmarking, which of the following is NOT a reasonable expectation?
4. When an argument is passed by value into a function parameter, which of the following statements is true?
5. Which standard C++ library provides time-based tools that can be used for benchmarking?
chrono
duration
metrics
time
snapshot
6. What does the typename keyword do in the following snippet? template <typename T> using my_type_t = typename MyType<T>::type;
typename
template <typename T>
using my_type_t = typename MyType<T>::type;
MyType<T>::type
my_type_t
const
volatile
int
7. What is the standard way to return a value from a metafunction?
GetValue()
return value;
8. When should you avoid marking a function as constexpr?
constexpr
9. If you have a function template with two types T1 and T2 and want to change what code is run based on whether they are the same or different, what condition would you put inside your if constexpr?
T1
T2
if constexpr
std::is_same<T1 == T2>()
std::is_same<typename T1, typename T2>
std::is_same(T1, T2)
std::is_same<T1,T2>::value
std::is_same(T1)(T2)
10. If you want to use value semantics on objects of a given class, which of the following is most important to implement?
operator<<
Click Check Answers to identify any errors and try again. Click Show Answers if you also want to know which answer is the correct one.