C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Function overload set type information loss

From: organicoman <organicoman_at_[hidden]>
Date: Thu, 01 Aug 2024 02:08:37 +0400
Hello Tiago,You could have just asked : how it can be implemented?No problem i will explain an approach.My though process is built on top of three observations1- the set of all types used in a C++ program is a closed set with a fixed size (even if it is a million)2- the category of the objects losing their type information have three common attributes. - they are global variables - compile time available i.e constexpr - impossible to generate on runtime.3- I am not interested in the values they hold, but in the type information they hold.I will give you challenges to illustrate the above.1- write a compile time meta program that returns a type serially or ad hoc, that is, if you run it in loop, it will give you different type each time, using the current standard.The purpose of this challenge is to prove, wether the compiler could reason about the code, or it is impossible since it cannot predict what type is coming next.You don't need to post the solution, just tell me if it is possible. (Hint it is not possible)Sent from my Galaxy

Received on 2024-07-31 22:08:47