|
|
|||
File indexing completed on 2026-05-10 08:43:48
0001 //===--- StringViewExtras.h ----------*- mode:c++;eval:(read-only-mode) -*-===// 0002 // Do not edit! See README.txt. 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 // 0009 // There are two copies of this file in the source tree. The one under 0010 // libcxxabi is the original and the one under llvm is the copy. Use 0011 // cp-to-llvm.sh to update the copy. See README.txt for more details. 0012 // 0013 //===----------------------------------------------------------------------===// 0014 0015 #ifndef DEMANGLE_STRINGVIEW_H 0016 #define DEMANGLE_STRINGVIEW_H 0017 0018 #include "DemangleConfig.h" 0019 0020 #include <string_view> 0021 0022 DEMANGLE_NAMESPACE_BEGIN 0023 0024 inline bool starts_with(std::string_view self, char C) noexcept { 0025 return !self.empty() && *self.begin() == C; 0026 } 0027 0028 inline bool starts_with(std::string_view haystack, 0029 std::string_view needle) noexcept { 0030 if (needle.size() > haystack.size()) 0031 return false; 0032 haystack.remove_suffix(haystack.size() - needle.size()); 0033 return haystack == needle; 0034 } 0035 0036 DEMANGLE_NAMESPACE_END 0037 0038 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|