Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace uses of boost/experimental::optional with util::optional #3117

Merged
merged 1 commit into from Jan 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 0 additions & 6 deletions cmake/HPX_PerformCxxFeatureTests.cmake
Expand Up @@ -180,12 +180,6 @@ macro(hpx_perform_cxx_feature_tests)
DEFINITIONS HPX_HAVE_CXX14_DEPRECATED_ATTRIBUTE)

hpx_check_for_cxx14_return_type_deduction()

# check for experimental facilities

# check for Library Fundamentals TS v2's experimental/optional
hpx_check_for_libfun_std_experimental_optional(
DEFINITIONS HPX_HAVE_LIBFUN_STD_EXPERIMENTAL_OPTIONAL)
endif()

if(HPX_WITH_CXX1Z OR HPX_WITH_CXX17)
Expand Down
11 changes: 0 additions & 11 deletions cmake/tests/libfun_std_experimental_optional.cpp

This file was deleted.

24 changes: 2 additions & 22 deletions hpx/parallel/executors/execution.hpp
Expand Up @@ -26,6 +26,7 @@
#include <hpx/util/deferred_call.hpp>
#include <hpx/util/detail/pack.hpp>
#include <hpx/util/invoke.hpp>
#include <hpx/util/optional.hpp>
#include <hpx/util/range.hpp>
#include <hpx/util/tuple.hpp>
#include <hpx/util/unwrap.hpp>
Expand All @@ -38,12 +39,6 @@
#include <utility>
#include <vector>

#if defined(HPX_HAVE_CXX1Y_EXPERIMENTAL_OPTIONAL)
#include <experimental/optional>
#else
#include <boost/optional.hpp>
#endif

///////////////////////////////////////////////////////////////////////////////
namespace hpx { namespace parallel { namespace execution
{
Expand Down Expand Up @@ -319,28 +314,13 @@ namespace hpx { namespace parallel { namespace execution
auto && args =
hpx::util::forward_as_tuple(std::forward<Ts>(ts)...);

#if defined(HPX_HAVE_CXX1Y_EXPERIMENTAL_OPTIONAL)
std::experimental::optional<result_type> out;
hpx::util::optional<result_type> out;
auto && wrapper =
[&]() mutable
{
out.emplace(hpx::util::invoke_fused(
std::forward<F>(f), std::move(args)));
};
#else
boost::optional<result_type> out;
auto && wrapper =
[&]() mutable
{
#if BOOST_VERSION < 105600
out = boost::in_place(hpx::util::invoke_fused(
std::forward<F>(f), std::move(args)));
#else
out.emplace(hpx::util::invoke_fused(
std::forward<F>(f), std::move(args)));
#endif
};
#endif

// use async execution, wait for result, propagate exceptions
async_execute_dispatch(0, std::forward<TwoWayExecutor>(exec),
Expand Down
24 changes: 2 additions & 22 deletions hpx/parallel/executors/v1/executor_traits.hpp
Expand Up @@ -21,6 +21,7 @@
#include <hpx/util/decay.hpp>
#include <hpx/util/deferred_call.hpp>
#include <hpx/util/invoke.hpp>
#include <hpx/util/optional.hpp>
#include <hpx/util/range.hpp>
#include <hpx/util/unwrap.hpp>

Expand All @@ -33,12 +34,6 @@
#include <utility>
#include <vector>

#if defined(HPX_HAVE_LIBFUN_STD_EXPERIMENTAL_OPTIONAL)
#include <experimental/optional>
#else
#include <boost/optional.hpp>
#endif

namespace hpx { namespace parallel { inline namespace v3
{
///////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -128,28 +123,13 @@ namespace hpx { namespace parallel { inline namespace v3
auto && args =
hpx::util::forward_as_tuple(std::forward<Ts>(ts)...);

#if defined(HPX_HAVE_LIBFUN_STD_EXPERIMENTAL_OPTIONAL)
std::experimental::optional<result_type> out;
hpx::util::optional<result_type> out;
auto && wrapper =
[&]() mutable
{
out.emplace(hpx::util::invoke_fused(
std::forward<F>(f), std::move(args)));
};
#else
boost::optional<result_type> out;
auto && wrapper =
[&]() mutable
{
#if BOOST_VERSION < 105600
out = boost::in_place(hpx::util::invoke_fused(
std::forward<F>(f), std::move(args)));
#else
out.emplace(hpx::util::invoke_fused(
std::forward<F>(f), std::move(args)));
#endif
};
#endif

// use async execution, wait for result, propagate exceptions
exec.async_execute(std::ref(wrapper)).get();
Expand Down
21 changes: 2 additions & 19 deletions hpx/runtime/threads/run_as_hpx_thread.hpp
Expand Up @@ -11,6 +11,7 @@
#include <hpx/runtime/threads/thread_helpers.hpp>
#include <hpx/util/assert.hpp>
#include <hpx/util/invoke_fused.hpp>
#include <hpx/util/optional.hpp>
#include <hpx/util/result_of.hpp>
#include <hpx/util/tuple.hpp>

Expand All @@ -23,12 +24,6 @@
#include <type_traits>
#include <utility>

#if defined(HPX_HAVE_LIBFUN_STD_EXPERIMENTAL_OPTIONAL)
#include <experimental/optional>
#else
#include <boost/optional.hpp>
#endif

namespace hpx { namespace threads
{
///////////////////////////////////////////////////////////////////////////
Expand All @@ -48,11 +43,7 @@ namespace hpx { namespace threads
// Using the optional for storing the returned result value
// allows to support non-default-constructible and move-only
// types.
#if defined(HPX_HAVE_LIBFUN_STD_EXPERIMENTAL_OPTIONAL)
std::experimental::optional<result_type> result;
#else
boost::optional<result_type> result;
#endif
hpx::util::optional<result_type> result;

// This lambda function will be scheduled to run as an HPX
// thread
Expand All @@ -62,15 +53,7 @@ namespace hpx { namespace threads
{
// Execute the given function, forward all parameters,
// store result.

#if defined(HPX_HAVE_LIBFUN_STD_EXPERIMENTAL_OPTIONAL)
result.emplace(util::invoke_fused(f, std::move(args)));
#elif BOOST_VERSION < 105600
result = boost::in_place(
util::invoke_fused(f, std::move(args)));
#else
result.emplace(util::invoke_fused(f, std::move(args)));
#endif

// Now signal to the waiting thread that we're done.
{
Expand Down