Fancy padding of wide strings
The point where the parameters stop and the function-body begins isn't easy to see.
Either indent more, or better consider changing to what c2-wiki calls form 6.

You are allocating way too much when passing arguments.
Using std::wstring_view instead of std::wstring const&amp; lets you avoid that overhead and reduces indirection, which is also a win.

Also, you potentially re-allocate after copying the source when widening to the target-length.

static std::wstring fillWString(
    std::wstring_view source,
    size_t target,
    wchar_t fillChar = L' ',
    std::wstring_view startFill = {},
    std::wstring_view endFill = {}
) {
    if (target &lt;= source.size())
        return source;

    std::wstring result;
    result.reserve(target);
    result += source;
    target -= source.size();

    if (startFill.size() &gt; target)
        return result;
    result += startFill;
    target -= source.size();

    if (endFill.size() &gt; target) {
        result.append(target, fillChar);
        return result;
    }
    result.append(target - endFill.size(), fillChar);
    result += endFill;
    return result;
}