Skip to content

C++

Void Cast

Any expression can be explicitly converted to type void, in which case it becomes a discarded-value expression. Casting to void is used to suppress compiler warnings.

std::is_same_v

Determines if two types are the same at compile-time.

An example:

#include <type_traits>

int main() {
    bool same = std::is_same_v<int, int>; // same == true
    bool different = std::is_same_v<int, double>; // different == false
}