• Kenton Varda's avatar
    Add kj::arr() for specifying arrays easily. Requries C++17. · 6643b805
    Kenton Varda authored
    std::initializer_list is problematic because it insists that its elements be const, meaning among other things that you can't move from them. So, an std::initializer_list<kj::String> is often useless. With kj::arr you can do like:
    
        kj::Array<String> = kj::arr(kj::mv(string1), kj::mv(string2));
    
    This requires C++17 due to the fold expression. This could maybe be worked around using some ugly recursion but I'm writing C++17 these days so meh.
    6643b805
array-test.c++ 10.5 KB