mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 20:00:12 +01:00
Trying to make repeated `std::same_as` easier to write. Calling it "concepts.h" because I figure we'll maybe have a couple more things like this. Was looking at this because I may add a couple more similar constructs.
19 lines
510 B
C++
19 lines
510 B
C++
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
#ifndef CARBON_COMMON_CONCEPTS_H_
|
|
#define CARBON_COMMON_CONCEPTS_H_
|
|
|
|
#include <concepts>
|
|
|
|
namespace Carbon {
|
|
|
|
// True if `T` is the same as one of `OtherT`.
|
|
template <typename T, typename... OtherT>
|
|
concept SameAsOneOf = (std::same_as<T, OtherT> || ...);
|
|
|
|
} // namespace Carbon
|
|
|
|
#endif // CARBON_COMMON_CONCEPTS_H_
|