Skip to content

Instantly share code, notes, and snippets.

Created Aug 17, 2020
What would you like to do?
#include <type_traits>
int main() {
int x = 42;
static_assert(std::is_same_v<decltype( x ), int>);
static_assert(std::is_same_v<decltype((x)), int&>);
int (y) = 42; // redundant parentheses
static_assert(std::is_same_v<decltype( y ), int>);
static_assert(std::is_same_v<decltype((y)), int&>);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment