Namespaces
Variants
Views
Actions

Talk:cpp/language/array

From cppreference.com
< Talk:cpp‎ | language
Revision as of 14:15, 25 November 2019 by Cubbi (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

[edit] identity

template<typename T> using identity = T;

f(identity<int[][3]>{{1, 2, 3}, {4, 5, 6}}); // okay: binds to prvalue

What does 'identity' do here? It doesn't seem to make any difference and it compiles to the same thing as

f({{1, 2, 3}, {4, 5, 6}});

when compared using CompilerExplorer. QuentinUK (talk) 04:46, 23 November 2019 (PST)

it makes it a prvalue expression. A braced-init-list is not an expression. --Cubbi (talk) 14:15, 25 November 2019 (PST)