Quiz: Write Our Own C++ Concepts

Test your understanding of writing C++ Concepts.

Choose the best answer.

1

(Select all that apply) Which requires clause compiles in the following context?

#include <concepts>
#include <type_traits>

template <typename T>
/*requires clause comes here*/
T add(T a, T b) {
return a+b;
}
A)

requires std::floating_point<T> || std::unsigned_integral <T>

B)

requires (std::floating_point<T> || !std::unsigned_integral <T>)

C)

requires std::floating_point<T> || !std::unsigned_integral <T>

D)

requires !std::integral<T>

Question 1 of 40 attempted

Get hands-on with 1400+ tech skills courses.