RCString.opBinary

  1. typeof(this) opBinary(typeof(this) rhs)
  2. typeof(this) opBinary(string rhs)
  3. typeof(this) opBinary(C c)
  4. typeof(this) opBinary(R r)
    struct RCString
    typeof(this)
    opBinary
    (
    string op
    R
    )
    (
    R r
    )
    if (
    op == "~" &&
    isInputRange!R
    &&
    isSomeChar!(ElementType!R)
    &&
    !isSomeString!R
    )
  5. auto opBinary(typeof(this) rhs)

Examples

auto r1 = RCString("abc");
auto r2 = RCString("def");
assert((r1 ~ r2).equal("abcdef"));
assert((r1 ~ "foo").equal("abcfoo"));
assert(("abc" ~ r2).equal("abcdef"));
assert((r1 ~ 'd').equal("abcd"));
assert(('a' ~ r2).equal("adef"));
import std.range : take;
import std.utf : byCodeUnit;
auto r1 = RCString("abc");
auto r2 = "def".byCodeUnit.take(3);
assert((r1 ~ r2).equal("abcdef"));
assert((r2 ~ r1).equal("defabc"));

Meta