summaryrefslogtreecommitdiff
path: root/src/shared_string.cc
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2022-07-19 12:58:14 +0200
committerJohannes Altmanninger <aclopte@gmail.com>2022-07-21 16:48:44 +0200
commitb2f45a29e4ef7680b864e910912c301439445415 (patch)
tree5fcb9386a85c3d4cd91bbbc78679b4ffe4d04010 /src/shared_string.cc
parent559af669c77a3b3b6de0376f177ebbba5ebd0328 (diff)
Elide temporary vector when completing keymap modes (user modes)
complete() merely iterates over its input, so we can pass it a range instead of a vector. For some reason, this requires specifying the type of the static array, or else its elements become String which triggers this assertion: static_assert(not std::is_same<decltype(*begin(container)), String>::value, "complete require long lived strings, not temporaries"); Specify the type with an explicit Array<StringView, 8>. This is pretty ugly but the alternative of appending "_sv" to every single array element seems worse? If we modify the vector of user modes while complete() is iterating over, we could crash -- but that scenario is impossible since both only happen inside the single-threaded server process.
Diffstat (limited to 'src/shared_string.cc')
0 files changed, 0 insertions, 0 deletions