Skip to content

Commit

Permalink
Fix compile errors in examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Nov 26, 2024
1 parent 5375b25 commit 4584adb
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions CesiumAsync/test/ExamplesAsyncSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,24 +113,28 @@ void computeSomethingSlowly(
template <typename T> void doSomething(const T&) {}

//! [compute-something-slowly-wrapper]
CesiumAsync::Future<SlowValue>
myComputeSomethingSlowlyWrapper(const CesiumAsync::AsyncSystem& asyncSystem) {
CesiumAsync::Future<SlowValue> myComputeSomethingSlowlyWrapper(
const CesiumAsync::AsyncSystem& asyncSystem,
const std::string& someParameter) {
CesiumAsync::Promise<SlowValue> promise =
asyncSystem.createPromise<SlowValue>();

computeSomethingSlowly(
[promise](const SlowValue& value) { promise.resolve(value); });
computeSomethingSlowly(someParameter, [promise](const SlowValue& value) {
promise.resolve(value);
});

return promise.getFuture();
}
//! [compute-something-slowly-wrapper]

//! [compute-something-slowly-wrapper-handle-exception]
CesiumAsync::Future<SlowValue>
myComputeSomethingSlowlyWrapper2(const CesiumAsync::AsyncSystem& asyncSystem) {
CesiumAsync::Future<SlowValue> myComputeSomethingSlowlyWrapper2(
const CesiumAsync::AsyncSystem& asyncSystem,
const std::string& someParameter) {
return asyncSystem.createFuture<SlowValue>(
[](const CesiumAsync::Promise<SlowValue>& promise) {
[&](const CesiumAsync::Promise<SlowValue>& promise) {
computeSomethingSlowly(
someParameter,
[promise](const SlowValue& value) { promise.resolve(value); });
});
}
Expand Down

0 comments on commit 4584adb

Please sign in to comment.