/* * Copyright (c) 2022, Tim Flynn * * SPDX-License-Identifier: BSD-2-Clause */ #include #include #include #include #include #pragma once // These concepts are used to help the compiler distinguish between specializations that would be // ambiguous otherwise. For example, if the specializations for int and Vector were declared as // follows: // // template<> ErrorOr decode(Decoder& decoder); // template ErrorOr> decode(Decoder& decoder); // // Then decode() would be ambiguous because either declaration could work (the compiler would // not be able to distinguish if you wanted to decode an int or a Vector of int). namespace IPC::Concepts { namespace Detail { template constexpr inline bool IsHashMap = false; template constexpr inline bool IsHashMap> = true; template constexpr inline bool IsOptional = false; template constexpr inline bool IsOptional> = true; template constexpr inline bool IsSharedSingleProducerCircularQueue = false; template constexpr inline bool IsSharedSingleProducerCircularQueue> = true; template constexpr inline bool IsVariant = false; template constexpr inline bool IsVariant> = true; template constexpr inline bool IsVector = false; template constexpr inline bool IsVector> = true; } template concept HashMap = Detail::IsHashMap; template concept Optional = Detail::IsOptional; template concept SharedSingleProducerCircularQueue = Detail::IsSharedSingleProducerCircularQueue; template concept Variant = Detail::IsVariant; template concept Vector = Detail::IsVector; }