Drop the AGPL license in favor of a source-available license. See the blog post [1] for details. [1] https://www.scylladb.com/2024/12/18/why-were-moving-to-a-source-available-license/
29 lines
698 B
C++
29 lines
698 B
C++
/*
|
|
* Copyright (C) 2021-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <variant>
|
|
#include <type_traits>
|
|
|
|
namespace utils {
|
|
|
|
// Given type T and an std::variant Variant, return std::true_type if T is a variant element
|
|
template <class T, class Variant>
|
|
struct is_variant_element;
|
|
|
|
template <class T, class... Elements>
|
|
struct is_variant_element<T, std::variant<Elements...>> : std::bool_constant<(std::is_same_v<T, Elements> || ...)> {
|
|
};
|
|
|
|
// Givent type T and std::variant, true if T is one of the variant elements.
|
|
template <typename T, typename Variant>
|
|
concept VariantElement = is_variant_element<T, Variant>::value;
|
|
|
|
}
|