]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
common: add iterator-based string splitter 33696/head
authorCasey Bodley <cbodley@redhat.com>
Fri, 22 Nov 2019 18:16:10 +0000 (13:16 -0500)
committerCasey Bodley <cbodley@redhat.com>
Tue, 3 Mar 2020 19:14:55 +0000 (14:14 -0500)
commitfab7c649fd4498460bbf564fd50bd68da59ce503
tree5273a4c4333d8870f1714e2c16cd99c1086144b8
parent5e15e111d30a155b861cafd5f8cdc14386c2d970
common: add iterator-based string splitter

ranged-for loop example:

  for (std::string_view s : split(input)) {
    ...

container initialization example:

  auto parts = split(input);

  std::vector<std::string> strings;
  strings.assign(parts.begin(), parts.end());

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/common/split.h [new file with mode: 0644]
src/test/common/CMakeLists.txt
src/test/common/test_split.cc [new file with mode: 0644]