What does std::is_const<const int>::value return?
Options
- A. true
- B. false
- C. The size of int
- D. More than one of the above
- E. None of the above
Quiz Practice:
A. true
Answer: (A) true
std::is_const checks whether the specified type is const-qualified.
In const int, the type is explicitly declared as constant. Therefore, std::is_const<const int>::value returns true.
For a normal type such as int, it returns false.
This trait is useful when template code needs to determine whether a type has the const qualifier.