Version: SMASH-3.1
cxx17compat.h
Go to the documentation of this file.
1 
2 /*
3  *
4  * Copyright (c) 2023
5  * SMASH Team
6  *
7  * GNU General Public License (GPLv3 or later)
8  *
9  */
10 
11 #ifndef SRC_INCLUDE_SMASH_CXX17COMPAT_H_
12 #define SRC_INCLUDE_SMASH_CXX17COMPAT_H_
13 
14 #include <optional>
15 #include <utility>
16 
17 namespace smash {
18 
19 // GCC_COMPILER macro is defined in CMake code when appropriate
20 #if defined(GCC_COMPILER) && (__GNUC__ == 8 && __GNUC_MINOR__ < 4)
33 template <typename T>
34 std::optional<T> make_optional(T&& value) {
35  return std::optional<std::decay_t<T>>(std::forward<T>(value));
36 }
37 #else
38 using std::make_optional;
39 #endif
40 } // namespace smash
41 
42 #endif // SRC_INCLUDE_SMASH_CXX17COMPAT_H_
Definition: action.h:24