longestMemberNames

Introspects one or more aggregate types and determines the name of the longest member found between them, as well as the name of the longest type. Ignores Unserialisable members.

This is used for formatting terminal output of configuration files, so that columns line up.

enum longestMemberNames (
Things...
)

Parameters

Things

Types to introspect.

Examples

import lu.uda : Hidden, Unserialisable;

struct Foo
{
    string veryLongName;
    char[][string] css;
    @Unserialisable string[][string] veryVeryVeryLongNameThatIsInvalid;
    @Hidden float likewiseWayLongerButInvalid;
    deprecated bool alsoVeryLongButDeprecated;
    void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa();
    void bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb(T)();
    string foo(string,string,string,string,string,string,string,string);
}

struct Bar
{
    string evenLongerName;
    float f;

    @Unserialisable short shoooooooooooooooort;

    @Unserialisable
    @Hidden
    long looooooooooooooooooooooong;
}

alias fooNames = longestMemberNames!Foo;
static assert((fooNames.member == "veryLongName"), fooNames.member);
static assert((fooNames.type == "char[][string]"), fooNames.type);

alias barNames = longestMemberNames!Bar;
static assert((barNames.member == "evenLongerName"), barNames.member);
static assert((barNames.type == "string"), barNames.type);

alias bothNames = longestMemberNames!(Foo, Bar);
static assert((bothNames.member == "evenLongerName"), bothNames.member);
static assert((bothNames.type == "char[][string]"), bothNames.type);