diff --git a/libcxx/include/__locale b/libcxx/include/__locale --- a/libcxx/include/__locale +++ b/libcxx/include/__locale @@ -926,6 +926,14 @@ return std::use_facet >(__loc).is(ctype_base::graph, __c); } +template +_LIBCPP_HIDE_FROM_ABI +bool +isblank(_CharT __c, const locale& __loc) +{ + return std::use_facet >(__loc).is(ctype_base::blank, __c); +} + template inline _LIBCPP_INLINE_VISIBILITY _CharT diff --git a/libcxx/test/std/localization/locales/locale.convenience/classification/isblank.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/classification/isblank.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/localization/locales/locale.convenience/classification/isblank.pass.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +// template bool isblank (charT c, const locale& loc); + +#include +#include + +#include "test_macros.h" + +int main(int, char**) { + std::locale l; + assert(std::isblank(' ', l)); + assert(!std::isblank('<', l)); + assert(!std::isblank('\x8', l)); + assert(!std::isblank('A', l)); + assert(!std::isblank('a', l)); + assert(!std::isblank('z', l)); + assert(!std::isblank('3', l)); + assert(!std::isblank('.', l)); + assert(!std::isblank('f', l)); + assert(!std::isblank('9', l)); + assert(!std::isblank('+', l)); + + return 0; +}