// Copyright (c) 2023 GeometryFactory Sarl (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org) // // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : Sébastien Loriot // #ifndef CGAL_VARIANT_H #define CGAL_VARIANT_H #include namespace CGAL { template struct Is_in_variant; template struct Is_in_variant> { inline static constexpr bool value = std::is_same_v || Is_in_variant>::value; }; template struct Is_in_variant> { inline static constexpr bool value = std::is_same_v; }; /// equals true iif `T` is a possible type in `Variant` with `Variant` being a `std::variant` template inline constexpr bool Is_in_variant_v = Is_in_variant::value; // -- template struct Add_to_variant; template struct Add_to_variant> { using type = std::variant; }; /// a `std::variant` with `T` appended to the types of the `std::variant` `Variant` template< class T, class Variant > using Add_to_variant_t = typename Add_to_variant::type; namespace internal{ template struct Get_variant_impl { using type = typename Get_variant_impl< std::conditional_t, Variant, Add_to_variant_t>, Tn...>::type; }; template struct Get_variant_impl { using type = std::conditional_t, Variant, Add_to_variant_t>; }; } // end of internal namespace template struct Variant_with_no_duplicate { using type = typename internal::Get_variant_impl, Tn ...>::type; }; /// a `std::variant` with types being all different template< class ... Tn > using Variant_with_no_duplicate_t = typename Variant_with_no_duplicate::type; } //end of CGAL namespace #endif