brintos

brintos / llvm-project-archived public Read only

0
0
Text · 874 B · 00fc8ae Raw
36 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// <locale>10 11// template <class Facet> bool has_facet(const locale& loc) throw();12 13#include <locale>14#include <cassert>15 16#include "test_macros.h"17 18struct my_facet19    : public std::locale::facet20{21    static std::locale::id id;22};23 24std::locale::id my_facet::id;25 26int main(int, char**)27{28    std::locale loc;29    assert(std::has_facet<std::ctype<char> >(loc));30    assert(!std::has_facet<my_facet>(loc));31    std::locale loc2(loc, new my_facet);32    assert(std::has_facet<my_facet>(loc2));33 34  return 0;35}36