makeConfig

Helper function for creating a custom config. It makes it easy to set one or more of the member variables to something other than the default without having to worry about explicitly setting them individually or setting them all at once via a constructor.

The order of the arguments does not matter. The types of each of the members of Config are unique, so that information alone is sufficient to determine which argument should be assigned to which member.

makeConfig
(
Args...
)
(
Args args
)

Examples

1 {
2     auto config = makeConfig(SkipComments.yes);
3     assert(config.skipComments == SkipComments.yes);
4     assert(config.skipPI == Config.init.skipPI);
5     assert(config.splitEmpty == Config.init.splitEmpty);
6     assert(config.throwOnEntityRef == Config.init.throwOnEntityRef);
7 }
8 {
9     auto config = makeConfig(SkipComments.yes, SkipPI.yes);
10     assert(config.skipComments == SkipComments.yes);
11     assert(config.skipPI == SkipPI.yes);
12     assert(config.splitEmpty == Config.init.splitEmpty);
13     assert(config.throwOnEntityRef == Config.init.throwOnEntityRef);
14 }
15 {
16     auto config = makeConfig(SplitEmpty.yes, SkipComments.yes, ThrowOnEntityRef.no);
17     assert(config.skipComments == SkipComments.yes);
18     assert(config.skipPI == Config.init.skipPI);
19     assert(config.splitEmpty == SplitEmpty.yes);
20     assert(config.throwOnEntityRef == ThrowOnEntityRef.no);
21 }

Meta