Ask Your Question
1

What is the issue with consteval function related to the use of typeid().name()?

asked 2023-06-27 16:10:42 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-06-27 16:22:02 +0000

lakamha gravatar image

The issue with consteval function related to the use of typeid().name() is that the function is evaluated at compile-time, and therefore, the typeid().name() function may not produce the expected results. This is because typeid().name() is evaluated at run-time and may change depending on the platform or compiler used. In addition, the use of this function in a consteval function may result in undefined behavior. Therefore, it is recommended to avoid using typeid().name() in consteval functions or to use a more reliable way to obtain type information, such as using type traits.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-27 16:10:42 +0000

Seen: 15 times

Last updated: Jun 27 '23