MODMatchToBuffer

Checks for mismatching modifiers between lhsMod and rhsMod and prints the mismatching modifiers to buf.

The modifiers of the lhsMod mismatching the ones with the rhsMod are printed, i.e. lhs(shared) vs. rhs() prints "shared", wheras lhs() vs rhs(shared) prints "non-shared".

MODMatchToBuffer
(,
ubyte lhsMod
,
ubyte rhsMod
)

Parameters

buf
Type: OutBuffer*

output buffer to write to

lhsMod
Type: ubyte

modifier on the left-hand side

lhsMod
Type: ubyte

modifier on the right-hand side

Return Value

Type: auto

A tuple with isMutable and isNotShared set if the lhsMod is missing those modifiers (compared to rhs).

Examples

1 OutBuffer buf;
2 auto mismatches = MODMatchToBuffer(&buf, MODFlags.shared_, 0);
3 assert(buf[] == "`shared` ");
4 assert(!mismatches.isNotShared);
5 
6 buf.setsize(0);
7 mismatches = MODMatchToBuffer(&buf, 0, MODFlags.shared_);
8 assert(buf[] == "non-shared ");
9 assert(mismatches.isNotShared);
10 
11 buf.setsize(0);
12 mismatches = MODMatchToBuffer(&buf, MODFlags.const_, 0);
13 assert(buf[] == "`const` ");
14 assert(!mismatches.isMutable);
15 
16 buf.setsize(0);
17 mismatches = MODMatchToBuffer(&buf, 0, MODFlags.const_);
18 assert(buf[] == "mutable ");
19 assert(mismatches.isMutable);

Meta