Open matus-chochlik opened 8 years ago
A few questions that can be responded when the TODO is taken care of:
typedef
. Now, MetaAliased may be misleading - is it the original type? the most basic type? something context-dependent and error-prone I should not rely on unless I need to? ... perhaps a different name for MetaAliased
would help such as MetaDeclaredType
?size_t
, is its type an alias (size_t
) or the most basic type (unsigned
or whatever)? If it's size_t
, there's more ways to obtain it then. Otherwise, that's no a very useful information since I can't obtain size_t
anywhere else. Let's say, serializing variables of such alias may be problematic - to transfer the info about the platform independent type. I'm aware of some discussion around this.size_t
) from the reflected parameter. Knowing reflection will be used through templates all the time, wouldn't the behavior explained here make get_name_v
for types too limited?get_name_v<MetaNamed>
be actually the alias "type
"?typedef
vs. using
aliases for the same type, is that right?type -> T -> G -> F -> E
where type
knows it is an alias of T
but it knowns nothing about the others in the chain of aliases, T
knows it is actually G
and so on... of course at any point it would be possile to tell that any them are actually E
and that E
is not an alias.
Let's have the following:
Alternatives for alias reflection:
A) (my new favorite)
Concepts:
For reflected typedef both a /meta-Alias/ and a /meta-Aliased/ are also a /meta-Type/ so all type-related operations apply to them, just like a /typedef/ is still a /type/.
Operations:
get_name<meta::Named>
-- returns the 'basic' (without any qualifiers), 'standard', platform-independent name usable for parsing, etc.get_display_name<meta::Named>
-- returns a 'nice', compiler-specific, human-readable nameget_aliased<meta::Alias>
-> meta-Aliased -- goes from an alias (typedef) to the most basic aliased declaration.get_alias<meta::Aliased>
-> meta-Alias -- goes from aliased (the most basic thing) to its known alias.Rules:
also:
get_name<meta::Alias>
returns the alias/typedef name:get_name<meta::Aliased>
returns the most basic underlying declaration name:Pros: The /meta-Alias/ ties together information about:
and it allows to use the same functions as with /meta-Named/ -- no duplication:
TODO: to be finished