Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix compilation error when targeting C++23
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());
      |                    ^~~~~~~~~~~~~
  • Loading branch information
vincent-hui authored Feb 4, 2025
commit 85edee7ee1594ad438772a158783c6a49cbbbe56
4 changes: 2 additions & 2 deletions include/behaviortree_cpp/json_export.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ inline Expected<T> JsonExporter::fromJson(const nlohmann::json& source) const
auto res = fromJson(source);
if(!res)
{
return nonstd::expected_lite::make_unexpected(res.error());
return nonstd::make_unexpected(res.error());
}
auto casted = res->first.tryCast<T>();
if(!casted)
{
return nonstd::expected_lite::make_unexpected(casted.error());
return nonstd::make_unexpected(casted.error());
}
return *casted;
}
Expand Down
Loading