-
-
Notifications
You must be signed in to change notification settings - Fork 439
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
6050: Investigating partitioned_vector problems r=hkaiser a=hkaiser - flyby: reduce the need for make_ready_future for various AGAS operations Co-authored-by: Hartmut Kaiser <[email protected]>
- Loading branch information
Showing
30 changed files
with
483 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...d_vector/include/hpx/components/containers/partitioned_vector/partitioned_vector_decl.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...de/hpx/components/containers/partitioned_vector/partitioned_vector_segmented_iterator.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Copyright (c) 2022 Hartmut Kaiser | ||
// | ||
// SPDX-License-Identifier: BSL-1.0 | ||
// Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
#pragma once | ||
|
||
#include <hpx/config.hpp> | ||
#include <hpx/datastructures/variant.hpp> | ||
#include <hpx/futures/future.hpp> | ||
|
||
namespace hpx { | ||
|
||
template <typename T> | ||
struct future_or_value | ||
{ | ||
future_or_value(T const& value) | ||
: data(value) | ||
{ | ||
} | ||
|
||
future_or_value(T&& value) noexcept | ||
: data(HPX_MOVE(value)) | ||
{ | ||
} | ||
|
||
future_or_value(hpx::future<T>&& value) noexcept | ||
: data(HPX_MOVE(value)) | ||
{ | ||
} | ||
|
||
constexpr bool has_value() const noexcept | ||
{ | ||
return hpx::holds_alternative<T>(data); | ||
} | ||
constexpr bool has_future() const noexcept | ||
{ | ||
return hpx::holds_alternative<hpx::future<T>>(data); | ||
} | ||
|
||
T& get_value() & | ||
{ | ||
return hpx::get<T>(data); | ||
} | ||
T const& get_value() const& | ||
{ | ||
return hpx::get<T>(data); | ||
} | ||
T&& get_value() && | ||
{ | ||
return hpx::get<T>(HPX_MOVE(data)); | ||
} | ||
|
||
hpx::future<T>& get_future() & | ||
{ | ||
return hpx::get<hpx::future<T>>(data); | ||
} | ||
hpx::future<T> const& get_future() const& | ||
{ | ||
return hpx::get<hpx::future<T>>(data); | ||
} | ||
hpx::future<T>&& get_future() && | ||
{ | ||
return hpx::get<hpx::future<T>>(HPX_MOVE(data)); | ||
} | ||
|
||
private: | ||
hpx::variant<T, hpx::future<T>> data; | ||
}; | ||
} // namespace hpx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.