xref: /llvm-project/flang/include/flang/Common/variant.h (revision 7860f970666f46184ad740db48a69882d62e64fc)
1 //===-- include/flang/Common/variant.h --------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // A single way to expose C++ variant class in files that can be used
10 // in F18 runtime build. With inclusion of this file std::variant
11 // and the related names become available, though, they may correspond
12 // to alternative definitions (e.g. from cuda::std namespace).
13 
14 #ifndef FORTRAN_COMMON_VARIANT_H
15 #define FORTRAN_COMMON_VARIANT_H
16 
17 #if RT_USE_LIBCUDACXX
18 #include <cuda/std/variant>
19 namespace std {
20 using cuda::std::get;
21 using cuda::std::monostate;
22 using cuda::std::variant;
23 using cuda::std::variant_size_v;
24 using cuda::std::visit;
25 } // namespace std
26 #else // !RT_USE_LIBCUDACXX
27 #include <variant>
28 #endif // !RT_USE_LIBCUDACXX
29 
30 #endif // FORTRAN_COMMON_VARIANT_H
31