Imported Upstream version 3.25.0
[platform/upstream/cmake.git] / Source / cmArgumentParserTypes.h
1 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2    file Copyright.txt or https://cmake.org/licensing for details.  */
3 #pragma once
4
5 #include "cmConfigure.h" // IWYU pragma: keep
6
7 #if defined(__SUNPRO_CC)
8
9 #  include <string>
10 #  include <vector>
11
12 namespace ArgumentParser {
13
14 template <typename T>
15 struct Maybe;
16 template <>
17 struct Maybe<std::string> : public std::string
18 {
19   using std::string::basic_string;
20 };
21
22 template <typename T>
23 struct MaybeEmpty;
24 template <typename T>
25 struct MaybeEmpty<std::vector<T>> : public std::vector<T>
26 {
27   using std::vector<T>::vector;
28 };
29
30 template <typename T>
31 struct NonEmpty;
32 template <typename T>
33 struct NonEmpty<std::vector<T>> : public std::vector<T>
34 {
35   using std::vector<T>::vector;
36 };
37 template <>
38 struct NonEmpty<std::string> : public std::string
39 {
40   using std::string::basic_string;
41 };
42
43 } // namespace ArgumentParser
44
45 #else
46
47 namespace ArgumentParser {
48
49 template <typename T>
50 struct Maybe : public T
51 {
52   using T::T;
53 };
54
55 template <typename T>
56 struct MaybeEmpty : public T
57 {
58   using T::T;
59 };
60
61 template <typename T>
62 struct NonEmpty : public T
63 {
64   using T::T;
65 };
66
67 } // namespace ArgumentParser
68
69 #endif