Files
carbon-lang/common/concepts.h
T
Jon Ross-Perkins dbf12eb3fc Add a SameAsOneOf helper (#5490)
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.
2025-05-16 01:39:19 +00:00

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_