summaryrefslogtreecommitdiffstats
path: root/Source/cm_utility.hxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2019-08-02 20:52:19 (GMT)
committerBrad King <brad.king@kitware.com>2019-08-23 12:43:35 (GMT)
commit197c5e12adea2b7d72cf8bfa17e961b9428f5d57 (patch)
tree327b5c4d8a376a2712c9a5e11d7b5fc1c06ef63a /Source/cm_utility.hxx
parent170fcd715f586cfd6b9f741c0572d472e0abe8ed (diff)
downloadCMake-197c5e12adea2b7d72cf8bfa17e961b9428f5d57.zip
CMake-197c5e12adea2b7d72cf8bfa17e961b9428f5d57.tar.gz
CMake-197c5e12adea2b7d72cf8bfa17e961b9428f5d57.tar.bz2
Source: Add cm::optional
Diffstat (limited to 'Source/cm_utility.hxx')
-rw-r--r--Source/cm_utility.hxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/Source/cm_utility.hxx b/Source/cm_utility.hxx
new file mode 100644
index 0000000..99d7f8b
--- /dev/null
+++ b/Source/cm_utility.hxx
@@ -0,0 +1,35 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#ifndef cm_utility_hxx
+#define cm_utility_hxx
+
+#include "cmConfigure.h" // IWYU pragma: keep
+
+#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
+# define CMake_HAVE_CXX_IN_PLACE
+#endif
+
+#if defined(CMake_HAVE_CXX_IN_PLACE)
+# include <utility>
+#endif
+
+namespace cm {
+
+#if defined(CMake_HAVE_CXX_IN_PLACE)
+
+using std::in_place_t;
+using std::in_place;
+
+#else
+
+struct in_place_t
+{
+ explicit in_place_t() = default;
+};
+
+constexpr in_place_t in_place{};
+
+#endif
+}
+
+#endif