1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-13 22:12:43 +01:00

WIP initial design

This commit is contained in:
Carlo Nucera 2020-06-30 14:10:30 -04:00
parent a1f66d1d9e
commit b798efb829
3 changed files with 19 additions and 10 deletions

View file

@ -1,6 +1,7 @@
#pragma once
#include <optional>
#include <string_view>
namespace nix {
@ -8,9 +9,7 @@ namespace nix {
// separator, and modify the string argument to contain only the part after the
// separator. Otherwise, wer return `std::nullopt`, and we leave the argument
// string alone.
std::optional<std::string_view> splitPrefix(std::string_view & string, char separator);
std::optional<std::string_view> splitPrefix(std::string_view & string, char separator) {
static inline std::optional<std::string_view> splitPrefix(std::string_view & string, char separator) {
auto sepInstance = string.find(separator);
if (sepInstance != std::string_view::npos) {