Skip to content

Commit a44619c

Browse files
authored
Fix compilation error when targeting C++23 (#926)
Compilation fails if cxx_std_17 is changed to cxx_std_23 because expected_lite namespace is not defined. Commit fixes this. /home/vincent/BehaviorTree.CPP/include/behaviortree_cpp/json_export.h:117: error: ‘nonstd::expected_lite’ has not been declared; did you mean ‘nonstd::unexpected_type’? [-Wtemplate-body] In file included from /home/vincent/BehaviorTree.CPP/src/blackboard.cpp:3: /home/vincent/BehaviorTree.CPP/include/behaviortree_cpp/json_export.h: In member function ‘BT::Expected<T> BT::JsonExporter::fromJson(const nlohmann::json_abi_v3_11_3::json&) const’: /home/vincent/BehaviorTree.CPP/include/behaviortree_cpp/json_export.h:117:20: error: ‘nonstd::expected_lite’ has not been declared; did you mean ‘nonstd::unexpected_type’? [-Wtemplate-body] 117 | return nonstd::expected_lite::make_unexpected(res.error()); | ^~~~~~~~~~~~~
1 parent c23f8ed commit a44619c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/behaviortree_cpp/json_export.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,12 @@ inline Expected<T> JsonExporter::fromJson(const nlohmann::json& source) const
114114
auto res = fromJson(source);
115115
if(!res)
116116
{
117-
return nonstd::expected_lite::make_unexpected(res.error());
117+
return nonstd::make_unexpected(res.error());
118118
}
119119
auto casted = res->first.tryCast<T>();
120120
if(!casted)
121121
{
122-
return nonstd::expected_lite::make_unexpected(casted.error());
122+
return nonstd::make_unexpected(casted.error());
123123
}
124124
return *casted;
125125
}

0 commit comments

Comments
 (0)