From b16a8e44797eaa7154a1a678fde03ba535bb0465 Mon Sep 17 00:00:00 2001 From: aurianer Date: Mon, 9 Dec 2019 14:11:40 +0100 Subject: [PATCH] Clang-format the execution module --- .../executors/thread_timed_execution.hpp | 4 +- .../execution/datapar/execution_policy.hpp | 2 +- .../execution/detail/future_await_traits.hpp | 84 +- .../hpx/execution/detail/future_data.hpp | 14 +- .../hpx/execution/detail/future_traits.hpp | 17 +- .../execution/detail/future_transforms.hpp | 152 ++-- .../include/hpx/execution/exception_list.hpp | 2 +- .../hpx/execution/execution_policy.hpp | 2 +- .../distribution_policy_executor.hpp | 2 +- .../hpx/execution/executors/execution.hpp | 17 +- .../executors/execution_parameters.hpp | 4 +- .../execution/executors/parallel_executor.hpp | 6 +- .../parallel_executor_aggregated.hpp | 6 +- .../executors/post_policy_dispatch.hpp | 2 +- .../executors/sequenced_executor.hpp | 2 +- .../execution/executors/service_executors.hpp | 2 +- .../execution/executors/thread_execution.hpp | 8 +- .../thread_execution_information.hpp | 2 +- .../executors/thread_pool_executor.hpp | 6 +- .../execution/executors/timed_execution.hpp | 2 +- .../execution/executors/timed_executors.hpp | 4 +- .../include/hpx/execution/future.hpp | 849 +++++++++--------- .../include/hpx/execution/futures_factory.hpp | 30 +- .../include/hpx/execution/launch_policy.hpp | 166 ++-- .../include/hpx/execution/split_future.hpp | 220 +++-- .../hpx/execution/traits/acquire_future.hpp | 70 +- .../execution/traits/acquire_shared_state.hpp | 75 +- .../hpx/execution/traits/future_access.hpp | 129 ++- .../execution/traits/future_then_result.hpp | 107 +-- .../hpx/execution/traits/future_traits.hpp | 71 +- .../hpx/execution/traits/is_future.hpp | 79 +- .../hpx/execution/traits/is_future_range.hpp | 50 +- .../hpx/execution/traits/is_launch_policy.hpp | 40 +- .../hpx/lcos/detail/future_await_traits.hpp | 5 +- .../hpx/lcos/detail/future_data.hpp | 6 +- .../hpx/lcos/detail/future_traits.hpp | 6 +- .../hpx/lcos/detail/future_transforms.hpp | 5 +- .../include_compatibility/hpx/lcos/future.hpp | 6 +- .../hpx/lcos/local/futures_factory.hpp | 5 +- .../hpx/lcos/split_future.hpp | 6 +- .../hpx/runtime/launch_policy.hpp | 6 +- .../hpx/traits/acquire_future.hpp | 6 +- .../hpx/traits/acquire_shared_state.hpp | 5 +- .../hpx/traits/future_access.hpp | 6 +- .../hpx/traits/future_then_result.hpp | 6 +- .../hpx/traits/future_traits.hpp | 6 +- .../hpx/traits/is_future.hpp | 6 +- .../hpx/traits/is_future_range.hpp | 6 +- .../hpx/traits/is_launch_policy.hpp | 6 +- libs/execution/src/detail/future_data.cpp | 95 +- libs/execution/src/future.cpp | 1 - libs/execution/src/launch_policy.cpp | 19 +- 52 files changed, 1155 insertions(+), 1278 deletions(-) diff --git a/hpx/parallel/executors/thread_timed_execution.hpp b/hpx/parallel/executors/thread_timed_execution.hpp index 4af875d13650..f309431acd24 100644 --- a/hpx/parallel/executors/thread_timed_execution.hpp +++ b/hpx/parallel/executors/thread_timed_execution.hpp @@ -8,11 +8,11 @@ #define HPX_PARALLEL_EXECUTORS_THREAD_TIMED_EXECUTION_JAN_09_2017_1117AM #include -#include #include +#include +#include #include #include -#include #include diff --git a/libs/execution/include/hpx/execution/datapar/execution_policy.hpp b/libs/execution/include/hpx/execution/datapar/execution_policy.hpp index 1482fad0208e..32cad487d2fa 100644 --- a/libs/execution/include/hpx/execution/datapar/execution_policy.hpp +++ b/libs/execution/include/hpx/execution/datapar/execution_policy.hpp @@ -18,8 +18,8 @@ #include #include #include -#include #include +#include #include #include diff --git a/libs/execution/include/hpx/execution/detail/future_await_traits.hpp b/libs/execution/include/hpx/execution/detail/future_await_traits.hpp index 18718fb05bfd..56305633e836 100644 --- a/libs/execution/include/hpx/execution/detail/future_await_traits.hpp +++ b/libs/execution/include/hpx/execution/detail/future_await_traits.hpp @@ -11,8 +11,8 @@ #include #include -#include #include +#include #if defined(HPX_HAVE_EMULATE_COROUTINE_SUPPORT_LIBRARY) #include @@ -25,17 +25,22 @@ #include /////////////////////////////////////////////////////////////////////////////// -namespace hpx { namespace lcos { namespace detail -{ +namespace hpx { namespace lcos { namespace detail { /////////////////////////////////////////////////////////////////////////// // this was removed from the TS, so we define our own struct suspend_if { bool is_ready_; - explicit suspend_if(bool cond) noexcept : is_ready_(!cond) {} + explicit suspend_if(bool cond) noexcept + : is_ready_(!cond) + { + } - bool await_ready() noexcept { return is_ready_; } + bool await_ready() noexcept + { + return is_ready_; + } void await_suspend(std::experimental::coroutine_handle<>) noexcept {} void await_resume() noexcept {} }; @@ -50,18 +55,16 @@ namespace hpx { namespace lcos { namespace detail } template - HPX_FORCEINLINE void await_suspend(future& f, - std::experimental::coroutine_handle rh) + HPX_FORCEINLINE void await_suspend( + future& f, std::experimental::coroutine_handle rh) { // f.then([=](future result) {}); auto st = traits::detail::get_shared_state(f); - st->set_on_completed( - [=]() mutable - { - if (st->has_exception()) - rh.promise().set_exception(st->get_exception_ptr()); - rh(); - }); + st->set_on_completed([=]() mutable { + if (st->has_exception()) + rh.promise().set_exception(st->get_exception_ptr()); + rh(); + }); } template @@ -72,13 +75,13 @@ namespace hpx { namespace lcos { namespace detail // Allow wrapped futures to be unwrapped, if possible. template - HPX_FORCEINLINE T await_resume(future >& f) + HPX_FORCEINLINE T await_resume(future>& f) { return f.get().get(); } template - HPX_FORCEINLINE T await_resume(future >& f) + HPX_FORCEINLINE T await_resume(future>& f) { return f.get().get(); } @@ -92,18 +95,16 @@ namespace hpx { namespace lcos { namespace detail } template - HPX_FORCEINLINE void await_suspend(shared_future& f, - std::experimental::coroutine_handle rh) + HPX_FORCEINLINE void await_suspend( + shared_future& f, std::experimental::coroutine_handle rh) { // f.then([=](shared_future result) {}) auto st = traits::detail::get_shared_state(f); - st->set_on_completed( - [=]() mutable - { - if (st->has_exception()) - rh.promise().set_exception(st->get_exception_ptr()); - rh(); - }); + st->set_on_completed([=]() mutable { + if (st->has_exception()) + rh.promise().set_exception(st->get_exception_ptr()); + rh(); + }); } template @@ -129,8 +130,8 @@ namespace hpx { namespace lcos { namespace detail hpx::lcos::future get_return_object() { hpx::intrusive_ptr shared_state(this); - return hpx::traits::future_access >:: - create(std::move(shared_state)); + return hpx::traits::future_access>::create( + std::move(shared_state)); } std::experimental::suspend_never initial_suspend() @@ -148,27 +149,29 @@ namespace hpx { namespace lcos { namespace detail void set_exception(std::exception_ptr e) { - try { + try + { std::rethrow_exception(std::move(e)); } - catch (...) { + catch (...) + { this->base_type::set_exception(std::current_exception()); } } void destroy() { - std::experimental::coroutine_handle:: - from_promise(*static_cast(this)).destroy(); + std::experimental::coroutine_handle::from_promise( + *static_cast(this)) + .destroy(); } }; -}}} +}}} // namespace hpx::lcos::detail /////////////////////////////////////////////////////////////////////////////// -namespace std { namespace experimental -{ +namespace std { namespace experimental { // Allow for functions which use co_await to return an hpx::future - template + template struct coroutine_traits, Ts...> { struct promise_type @@ -178,14 +181,14 @@ namespace std { namespace experimental hpx::lcos::detail::coroutine_promise_base; template - void return_value(U && value) + void return_value(U&& value) { this->base_type::set_value(std::forward(value)); } }; }; - template + template struct coroutine_traits, Ts...> { struct promise_type @@ -200,8 +203,7 @@ namespace std { namespace experimental } }; }; -}} - -#endif // HPX_HAVE_AWAIT -#endif // HPX_LCOS_ACBA3E3F_7B29_41D1_AE85_C73CB69D089C +}} // namespace std::experimental +#endif // HPX_HAVE_AWAIT +#endif // HPX_LCOS_ACBA3E3F_7B29_41D1_AE85_C73CB69D089C diff --git a/libs/execution/include/hpx/execution/detail/future_data.hpp b/libs/execution/include/hpx/execution/detail/future_data.hpp index f2a199cb88f1..84fd84ba869d 100644 --- a/libs/execution/include/hpx/execution/detail/future_data.hpp +++ b/libs/execution/include/hpx/execution/detail/future_data.hpp @@ -11,18 +11,18 @@ #include #include #include +#include +#include #include #include -#include -#include #include -#include #include #include +#include +#include #include #include #include -#include #include #include #include @@ -864,10 +864,8 @@ namespace hpx { namespace lcos { namespace detail { // run in a separate thread virtual threads::thread_id_type apply( - threads::thread_pool_base* /*pool*/, - const char* /*annotation*/, - launch /*policy*/, - threads::thread_priority /*priority*/, + threads::thread_pool_base* /*pool*/, const char* /*annotation*/, + launch /*policy*/, threads::thread_priority /*priority*/, threads::thread_stacksize /*stacksize*/, threads::thread_schedule_hint /*schedulehint*/, error_code& /*ec*/) { diff --git a/libs/execution/include/hpx/execution/detail/future_traits.hpp b/libs/execution/include/hpx/execution/detail/future_traits.hpp index 7d0552db7439..499e76ff9229 100644 --- a/libs/execution/include/hpx/execution/detail/future_traits.hpp +++ b/libs/execution/include/hpx/execution/detail/future_traits.hpp @@ -9,30 +9,27 @@ #define HPX_LCOS_DETAIL_FUTURE_TRAITS_DEC_05_2017_0214PM #include -#include #include +#include #include -namespace hpx { namespace lcos { namespace detail -{ +namespace hpx { namespace lcos { namespace detail { /////////////////////////////////////////////////////////////////////////// template struct future_iterator_traits - {}; + { + }; template struct future_iterator_traits::value_type - >::type> + typename std::iterator_traits::value_type>::type> { - typedef - typename std::iterator_traits::value_type - type; + typedef typename std::iterator_traits::value_type type; typedef hpx::traits::future_traits traits_type; }; -}}} +}}} // namespace hpx::lcos::detail #endif diff --git a/libs/execution/include/hpx/execution/detail/future_transforms.hpp b/libs/execution/include/hpx/execution/detail/future_transforms.hpp index 79c79c45bacb..cd401edfd3a3 100644 --- a/libs/execution/include/hpx/execution/detail/future_transforms.hpp +++ b/libs/execution/include/hpx/execution/detail/future_transforms.hpp @@ -10,9 +10,9 @@ #include #include #include -#include #include #include +#include #include #include @@ -21,89 +21,85 @@ #include #include -namespace hpx { -namespace lcos { - namespace detail { - /// Returns true when the given future is ready, - /// the future is deferred executed if possible first. - template ::type>::value>::type* = nullptr> - bool async_visit_future(T&& current) +namespace hpx { namespace lcos { namespace detail { + /// Returns true when the given future is ready, + /// the future is deferred executed if possible first. + template ::type>::value>::type* = nullptr> + bool async_visit_future(T&& current) + { + // Check for state right away as the element might not be able to + // produce a shared state (even if it's ready). + if (current.is_ready()) { - // Check for state right away as the element might not be able to - // produce a shared state (even if it's ready). - if (current.is_ready()) - { - return true; - } - - auto const& state = - traits::detail::get_shared_state(std::forward(current)); - - if (state.get() == nullptr) - { - return true; - } - - // Execute_deferred might have made the future ready - state->execute_deferred(); - - // Detach the context if the future isn't ready - return state->is_ready(); + return true; } - /// Attach the continuation next to the given future - template ::type>::value>::type* = nullptr> - void async_detach_future(T&& current, N&& next) - { - auto const& state = - traits::detail::get_shared_state(std::forward(current)); - - // Attach a continuation to this future which will - // re-evaluate it and continue to the next argument (if any). - state->set_on_completed(util::deferred_call(std::forward(next))); - } + auto const& state = + traits::detail::get_shared_state(std::forward(current)); - /// Acquire a future range from the given begin and end iterator - template ::type>> - Container acquire_future_iterators(Iterator begin, Iterator end) + if (state.get() == nullptr) { - Container lazy_values; - - auto difference = std::distance(begin, end); - if (difference > 0) - traits::detail::reserve_if_reservable( - lazy_values, static_cast(difference)); - - std::transform(begin, end, std::back_inserter(lazy_values), - traits::acquire_future_disp()); - - return lazy_values; // Should be optimized by RVO + return true; } - /// Acquire a future range from the given - /// begin iterator and count - template ::type>> - Container acquire_future_n(Iterator begin, std::size_t count) - { - Container values; - traits::detail::reserve_if_reservable(values, count); - - traits::acquire_future_disp func; - for (std::size_t i = 0; i != count; ++i) - values.push_back(func(*begin++)); - - return values; // Should be optimized by RVO - } - } // end namespace detail -} // end namespace lcos -} // end namespace hpx + // Execute_deferred might have made the future ready + state->execute_deferred(); + + // Detach the context if the future isn't ready + return state->is_ready(); + } + + /// Attach the continuation next to the given future + template ::type>::value>::type* = nullptr> + void async_detach_future(T&& current, N&& next) + { + auto const& state = + traits::detail::get_shared_state(std::forward(current)); + + // Attach a continuation to this future which will + // re-evaluate it and continue to the next argument (if any). + state->set_on_completed(util::deferred_call(std::forward(next))); + } + + /// Acquire a future range from the given begin and end iterator + template ::type>> + Container acquire_future_iterators(Iterator begin, Iterator end) + { + Container lazy_values; + + auto difference = std::distance(begin, end); + if (difference > 0) + traits::detail::reserve_if_reservable( + lazy_values, static_cast(difference)); + + std::transform(begin, end, std::back_inserter(lazy_values), + traits::acquire_future_disp()); + + return lazy_values; // Should be optimized by RVO + } + + /// Acquire a future range from the given + /// begin iterator and count + template ::type>> + Container acquire_future_n(Iterator begin, std::size_t count) + { + Container values; + traits::detail::reserve_if_reservable(values, count); + + traits::acquire_future_disp func; + for (std::size_t i = 0; i != count; ++i) + values.push_back(func(*begin++)); + + return values; // Should be optimized by RVO + } +}}} // namespace hpx::lcos::detail #endif // HPX_LCOS_DETAIL_FUTURE_TRANSFORMS_HPP diff --git a/libs/execution/include/hpx/execution/exception_list.hpp b/libs/execution/include/hpx/execution/exception_list.hpp index e32536e0d90e..5d795ff7dcf8 100644 --- a/libs/execution/include/hpx/execution/exception_list.hpp +++ b/libs/execution/include/hpx/execution/exception_list.hpp @@ -11,8 +11,8 @@ #include #include #include -#include #include +#include #include #include diff --git a/libs/execution/include/hpx/execution/execution_policy.hpp b/libs/execution/include/hpx/execution/execution_policy.hpp index e7d685602548..091fa5ee9381 100644 --- a/libs/execution/include/hpx/execution/execution_policy.hpp +++ b/libs/execution/include/hpx/execution/execution_policy.hpp @@ -22,8 +22,8 @@ #include #include #include -#include #include +#include #include #include diff --git a/libs/execution/include/hpx/execution/executors/distribution_policy_executor.hpp b/libs/execution/include/hpx/execution/executors/distribution_policy_executor.hpp index d03ce4705447..c9e463e51025 100644 --- a/libs/execution/include/hpx/execution/executors/distribution_policy_executor.hpp +++ b/libs/execution/include/hpx/execution/executors/distribution_policy_executor.hpp @@ -12,9 +12,9 @@ #include #include +#include #include #include -#include #include #include #include diff --git a/libs/execution/include/hpx/execution/executors/execution.hpp b/libs/execution/include/hpx/execution/executors/execution.hpp index 1d6b3f2c6c3a..0342137d5f71 100644 --- a/libs/execution/include/hpx/execution/executors/execution.hpp +++ b/libs/execution/include/hpx/execution/executors/execution.hpp @@ -18,18 +18,18 @@ #include #include #include -#include -#include -#include #include -#include -#include -#include #include -#include +#include #include #include #include +#include +#include +#include +#include +#include +#include #include #include @@ -1142,7 +1142,8 @@ namespace hpx { namespace parallel { namespace execution { -> result_future_type { // use unwrap directly (instead of lazily) to avoid // having to pull in dataflow - return hpx::util::unwrap(func(std::move(predecessor))); + return hpx::util::unwrap( + func(std::move(predecessor))); }); return hpx::traits::future_access::create( diff --git a/libs/execution/include/hpx/execution/executors/execution_parameters.hpp b/libs/execution/include/hpx/execution/executors/execution_parameters.hpp index 0277c9145890..c27c477844f1 100644 --- a/libs/execution/include/hpx/execution/executors/execution_parameters.hpp +++ b/libs/execution/include/hpx/execution/executors/execution_parameters.hpp @@ -14,13 +14,13 @@ #include #include #include +#include #include #include -#include +#include #include #include #include -#include #include #include diff --git a/libs/execution/include/hpx/execution/executors/parallel_executor.hpp b/libs/execution/include/hpx/execution/executors/parallel_executor.hpp index d4ab5ffb8a94..c6fff25014b3 100644 --- a/libs/execution/include/hpx/execution/executors/parallel_executor.hpp +++ b/libs/execution/include/hpx/execution/executors/parallel_executor.hpp @@ -18,14 +18,15 @@ #include #include #include +#include +#include +#include #include #include #include #include #include #include -#include -#include #include #include #include @@ -33,7 +34,6 @@ #include #include #include -#include #include #include diff --git a/libs/execution/include/hpx/execution/executors/parallel_executor_aggregated.hpp b/libs/execution/include/hpx/execution/executors/parallel_executor_aggregated.hpp index 2934b7cac959..ccece382ae34 100644 --- a/libs/execution/include/hpx/execution/executors/parallel_executor_aggregated.hpp +++ b/libs/execution/include/hpx/execution/executors/parallel_executor_aggregated.hpp @@ -16,16 +16,16 @@ #include #include #include +#include +#include +#include #include #include #include -#include #include -#include #include #include #include -#include #include #include diff --git a/libs/execution/include/hpx/execution/executors/post_policy_dispatch.hpp b/libs/execution/include/hpx/execution/executors/post_policy_dispatch.hpp index 561cb9c52e4d..df2da8a932ab 100644 --- a/libs/execution/include/hpx/execution/executors/post_policy_dispatch.hpp +++ b/libs/execution/include/hpx/execution/executors/post_policy_dispatch.hpp @@ -10,9 +10,9 @@ #include #include +#include #include #include -#include #include #include #include diff --git a/libs/execution/include/hpx/execution/executors/sequenced_executor.hpp b/libs/execution/include/hpx/execution/executors/sequenced_executor.hpp index 760af893327d..75bbd6c142c2 100644 --- a/libs/execution/include/hpx/execution/executors/sequenced_executor.hpp +++ b/libs/execution/include/hpx/execution/executors/sequenced_executor.hpp @@ -11,10 +11,10 @@ #include #include +#include #include #include #include -#include #include #include #include diff --git a/libs/execution/include/hpx/execution/executors/service_executors.hpp b/libs/execution/include/hpx/execution/executors/service_executors.hpp index 5d20d3d1c605..3bdfc827ce35 100644 --- a/libs/execution/include/hpx/execution/executors/service_executors.hpp +++ b/libs/execution/include/hpx/execution/executors/service_executors.hpp @@ -12,8 +12,8 @@ #include #include #include -#include #include +#include #include namespace hpx { namespace parallel { namespace execution { diff --git a/libs/execution/include/hpx/execution/executors/thread_execution.hpp b/libs/execution/include/hpx/execution/executors/thread_execution.hpp index f0daa55886f7..001c60cf2621 100644 --- a/libs/execution/include/hpx/execution/executors/thread_execution.hpp +++ b/libs/execution/include/hpx/execution/executors/thread_execution.hpp @@ -18,17 +18,17 @@ #include #include #include +#include +#include +#include +#include #include #include #include #include -#include -#include #include #include #include -#include -#include #include #include diff --git a/libs/execution/include/hpx/execution/executors/thread_execution_information.hpp b/libs/execution/include/hpx/execution/executors/thread_execution_information.hpp index d3090f5f29ad..8ba0a9c7e356 100644 --- a/libs/execution/include/hpx/execution/executors/thread_execution_information.hpp +++ b/libs/execution/include/hpx/execution/executors/thread_execution_information.hpp @@ -9,11 +9,11 @@ #define HPX_PARALLEL_EXECUTORS_THREAD_EXECUTION_INFORMATION_JAN_17_2017_0130PM #include +#include #include #include #include #include -#include #include diff --git a/libs/execution/include/hpx/execution/executors/thread_pool_executor.hpp b/libs/execution/include/hpx/execution/executors/thread_pool_executor.hpp index 5790b8a7a879..f586ab5b8405 100644 --- a/libs/execution/include/hpx/execution/executors/thread_pool_executor.hpp +++ b/libs/execution/include/hpx/execution/executors/thread_pool_executor.hpp @@ -18,14 +18,15 @@ #include #include #include +#include +#include +#include #include #include #include #include #include #include -#include -#include #include #include #include @@ -33,7 +34,6 @@ #include #include #include -#include #include #include diff --git a/libs/execution/include/hpx/execution/executors/timed_execution.hpp b/libs/execution/include/hpx/execution/executors/timed_execution.hpp index 8f63322e9d45..b4c71ebff379 100644 --- a/libs/execution/include/hpx/execution/executors/timed_execution.hpp +++ b/libs/execution/include/hpx/execution/executors/timed_execution.hpp @@ -11,9 +11,9 @@ #include #include +#include #include #include -#include #include #include diff --git a/libs/execution/include/hpx/execution/executors/timed_executors.hpp b/libs/execution/include/hpx/execution/executors/timed_executors.hpp index 894616c0ce91..7de5dceb1f69 100644 --- a/libs/execution/include/hpx/execution/executors/timed_executors.hpp +++ b/libs/execution/include/hpx/execution/executors/timed_executors.hpp @@ -10,12 +10,12 @@ #define HPX_PARALLEL_TIMED_EXECUTORS_JAN_06_2017_0802AM #include +#include #include +#include #include -#include #include #include -#include #include #include diff --git a/libs/execution/include/hpx/execution/future.hpp b/libs/execution/include/hpx/execution/future.hpp index facad85c5c9d..9d4d26523050 100644 --- a/libs/execution/include/hpx/execution/future.hpp +++ b/libs/execution/include/hpx/execution/future.hpp @@ -14,17 +14,9 @@ #include #include #include -#include -#include -#include -#include -#include #include #include -#include #include -#include -#include #include #include #include @@ -32,6 +24,14 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -39,9 +39,11 @@ #include #include +// clang-format off #if defined(HPX_HAVE_AWAIT) - #include + #include #endif +// clang-format on #include #include @@ -49,15 +51,13 @@ #include #include - namespace hpx { // Due to the removal of the lcos_fwd include using lcos::future; using lcos::shared_future; -} +} // namespace hpx -namespace hpx { namespace lcos { namespace detail -{ +namespace hpx { namespace lcos { namespace detail { /////////////////////////////////////////////////////////////////////////// enum future_state { @@ -91,7 +91,8 @@ namespace hpx { namespace lcos { namespace detail typedef typename shared_state::init_no_addref init_no_addref; std::unique_ptr value( - serialization::detail::constructor_selector::create(ar)); + serialization::detail::constructor_selector::create( + ar)); hpx::intrusive_ptr p( new shared_state(init_no_addref{}, in_place{}, std::move(*value)), @@ -101,9 +102,9 @@ namespace hpx { namespace lcos { namespace detail } template - typename std::enable_if< - !std::is_void::type>::value - >::type serialize_future_load(Archive& ar, Future& f) + typename std::enable_if::type>::value>::type + serialize_future_load(Archive& ar, Future& f) { typedef typename hpx::traits::future_traits::type value_type; typedef lcos::detail::future_data shared_state; @@ -115,8 +116,9 @@ namespace hpx { namespace lcos { namespace detail { serialize_future_load( ar, f, std::is_default_constructible()); - - } else if (state == future_state::has_exception) { + } + else if (state == future_state::has_exception) + { std::exception_ptr exception; ar >> exception; @@ -125,19 +127,22 @@ namespace hpx { namespace lcos { namespace detail false); f = hpx::traits::future_access::create(std::move(p)); - } else if (state == future_state::invalid) { + } + else if (state == future_state::invalid) + { f = Future(); - } else { - HPX_THROW_EXCEPTION(invalid_status, - "serialize_future_load", + } + else + { + HPX_THROW_EXCEPTION(invalid_status, "serialize_future_load", "attempting to deserialize a future with an unknown state"); } } template - typename std::enable_if< - std::is_void::type>::value - >::type serialize_future_load(Archive& ar, Future& f) //-V659 + typename std::enable_if::type>::value>::type + serialize_future_load(Archive& ar, Future& f) //-V659 { typedef lcos::detail::future_data shared_state; typedef typename shared_state::init_no_addref init_no_addref; @@ -147,11 +152,14 @@ namespace hpx { namespace lcos { namespace detail if (state == future_state::has_value) { hpx::intrusive_ptr p( - new shared_state(init_no_addref{}, in_place{}, hpx::util::unused), + new shared_state( + init_no_addref{}, in_place{}, hpx::util::unused), false); f = hpx::traits::future_access::create(std::move(p)); - } else if (state == future_state::has_exception) { + } + else if (state == future_state::has_exception) + { std::exception_ptr exception; ar >> exception; @@ -160,11 +168,14 @@ namespace hpx { namespace lcos { namespace detail false); f = hpx::traits::future_access::create(std::move(p)); - } else if (state == future_state::invalid) { + } + else if (state == future_state::invalid) + { f = Future(); - } else { - HPX_THROW_EXCEPTION(invalid_status, - "serialize_future_load", + } + else + { + HPX_THROW_EXCEPTION(invalid_status, "serialize_future_load", "attempting to deserialize a future with an unknown state"); } } @@ -188,11 +199,12 @@ namespace hpx { namespace lcos { namespace detail } template - typename std::enable_if< - !std::is_void::type>::value - >::type serialize_future_save(Archive& ar, Future const& f) + typename std::enable_if::type>::value>::type + serialize_future_save(Archive& ar, Future const& f) { - typedef typename hpx::traits::future_traits::result_type value_type; + typedef + typename hpx::traits::future_traits::result_type value_type; int state = future_state::invalid; if (f.valid() && !f.is_ready()) @@ -209,8 +221,7 @@ namespace hpx { namespace lcos { namespace detail } else { - HPX_THROW_EXCEPTION(invalid_status, - "serialize_future_save", + HPX_THROW_EXCEPTION(invalid_status, "serialize_future_save", "future must be ready in order for it to be serialized"); } return; @@ -219,28 +230,31 @@ namespace hpx { namespace lcos { namespace detail if (f.has_value()) { state = future_state::has_value; - value_type const & value = - *hpx::traits::future_access:: - get_shared_state(f)->get_result(); + value_type const& value = + *hpx::traits::future_access::get_shared_state(f) + ->get_result(); ar << state; serialize_future_save( ar, value, std::is_default_constructible()); - - } else if (f.has_exception()) { + } + else if (f.has_exception()) + { state = future_state::has_exception; std::exception_ptr exception = f.get_exception_ptr(); ar << state << exception; - } else { + } + else + { state = future_state::invalid; ar << state; } } template - typename std::enable_if< - std::is_void::type>::value - >::type serialize_future_save(Archive& ar, Future const& f) //-V659 + typename std::enable_if::type>::value>::type + serialize_future_save(Archive& ar, Future const& f) //-V659 { int state = future_state::invalid; if (f.valid() && !f.is_ready()) @@ -257,8 +271,7 @@ namespace hpx { namespace lcos { namespace detail } else { - HPX_THROW_EXCEPTION(invalid_status, - "serialize_future_save", + HPX_THROW_EXCEPTION(invalid_status, "serialize_future_save", "future must be ready in order for it to be serialized"); } return; @@ -289,7 +302,8 @@ namespace hpx { namespace lcos { namespace detail } template - void serialize_future(serialization::output_archive& ar, Future& f, unsigned) + void serialize_future( + serialization::output_archive& ar, Future& f, unsigned) { serialize_future_save(ar, f); } @@ -297,10 +311,11 @@ namespace hpx { namespace lcos { namespace detail /////////////////////////////////////////////////////////////////////////// template struct future_unwrap_result - {}; + { + }; template