hachyderm.io is one of the many independent Mastodon servers you can use to participate in the fediverse.
Hachyderm is a safe space, LGBTQIA+ and BLM, primarily comprised of tech industry professionals world wide. Note that many non-user account types have restrictions - please see our About page.

Administered by:

Server stats:

9K
active users

Šimon Tóth

When implementing generic code that relies on decltype, you can run into a problem.

If a type cannot be default constructed, we won't be able to spell an instantiation of that type within an expression.

Using std::declval, we can obtain an lvalue reference without creating a value.

Note that std::declval can only be used in unevaluated contexts (e.g. decltype).

Compiler Explorer link: compiler-explorer.com/z/KK8frn