Why four definitions of std.meta.Replace?
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon May 25 01:43:01 UTC 2020
/**
* Returns an `AliasSeq` created from TList with the first occurrence
* of type T, if found, replaced with type U.
*/
template Replace(T, U, TList...)
{
alias Replace = GenericReplace!(T, U, TList).result;
}
/// Ditto
template Replace(alias T, U, TList...)
{
alias Replace = GenericReplace!(T, U, TList).result;
}
/// Ditto
template Replace(T, alias U, TList...)
{
alias Replace = GenericReplace!(T, U, TList).result;
}
/// Ditto
template Replace(alias T, alias U, TList...)
{
alias Replace = GenericReplace!(T, U, TList).result;
}
Why all this? Delete it, rename GenericReplace to Replace, and call it a
day.
I reckon documentation won't be as nice because GenericReplace just
takes an ellipsis? Was this the rationale? I don't think it's much of a
problem, and if we decide it is, version(StdDdoc) takes care of that
with less aggravation.
This pattern is all over std.meta, and it's bad.
More information about the Digitalmars-d
mailing list