Which header file provides std::rank and std::extent in C++?

Options

  • A. <iostream>
  • B. <type_traits>
  • C. <array>
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. <type_traits>

Detailed Explanation

Answer: (B) <type_traits>

The C++ standard library provides std::rank and std::extent through the <type_traits> header.

For example, a program using these type traits generally includes:

#include <type_traits>

<iostream> is mainly used for input and output operations, while <array> provides the std::array container.