Path: blob/main/system/lib/libcxxabi/src/demangle/StringViewExtras.h
6175 views
//===--- StringViewExtras.h -------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// There are two copies of this file in the source tree. The one under9// libcxxabi is the original and the one under llvm is the copy. Use10// cp-to-llvm.sh to update the copy. See README.txt for more details.11//12//===----------------------------------------------------------------------===//1314#ifndef DEMANGLE_STRINGVIEW_H15#define DEMANGLE_STRINGVIEW_H1617#include "DemangleConfig.h"1819#include <string_view>2021DEMANGLE_NAMESPACE_BEGIN2223inline bool starts_with(std::string_view self, char C) noexcept {24return !self.empty() && *self.begin() == C;25}2627inline bool starts_with(std::string_view haystack,28std::string_view needle) noexcept {29if (needle.size() > haystack.size())30return false;31haystack.remove_suffix(haystack.size() - needle.size());32return haystack == needle;33}3435DEMANGLE_NAMESPACE_END3637#endif383940