Skip to content

Commit 2c90d02

Browse files
committed
c++20: Use std::invoke_result instead of std::result_of depending on c++ standard
std::result_of was deprecated in c++17 and removed in c++20. This was identified under MSVC in c++20
1 parent 37ddc14 commit 2c90d02

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

jitify2.hpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9738,9 +9738,19 @@ class LRUFileCache {
97389738
file_suffix_(sanitize_filename(file_suffix)),
97399739
lock_file_name_(path_join(path_, file_prefix_ + "lock")) {}
97409740

9741+
9742+
// std::result_of was deprecated in c++17 and removed in c++20.
9743+
#if JITIFY_CPLUSPLUS >= 201703L
9744+
template <typename T>
9745+
using invoke_result_type = typename std::invoke_result<T>::type;
9746+
#else // JITIFY_CPLUSPLUS >= 201703L
9747+
template <typename T>
9748+
using invoke_result_type = typename std::result_of<T()>::type;
9749+
#endif // JITIFY_CPLUSPLUS >= 201703L
9750+
97419751
template <class Construct, class Serialize, class Deserialize>
97429752
std::string get(const std::string& name,
9743-
typename std::result_of<Construct()>::type* result,
9753+
invoke_result_type<Construct>* result,
97449754
Construct construct, Serialize serialize,
97459755
Deserialize deserialize, bool* hit = nullptr) const {
97469756
if (path_.empty() || max_size_ == 0) {

0 commit comments

Comments
 (0)