Skip to content

Commit

Permalink
Allow move-only types in Promise<>. (based on contribution from jb-gcx)
Browse files Browse the repository at this point in the history
  • Loading branch information
li-feng-sc committed Jul 15, 2024
1 parent cc8190a commit f603002
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions support-lib/cpp/Future.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ struct ValueHolder {
using type = T;
std::optional<T> value;
T getValueUnsafe() const {return *value;}
T getValueUnsafe() {return std::move(*value);}
};
template <>
struct ValueHolder<void> {
Expand Down
5 changes: 5 additions & 0 deletions test-suite/handwritten-src/cpp/test_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@

namespace testsuite {

// verify we we can put move only types in futures
std::unique_ptr<int> testFutureMove() {
return djinni::Promise<std::unique_ptr<int>>::resolve(nullptr).get();
}

SetRecord TestHelpers::get_set_record() {
return SetRecord { {
"StringA",
Expand Down

0 comments on commit f603002

Please sign in to comment.