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

Fixing small_vector compatibility with older boost version #3141

Merged
merged 2 commits into from Feb 6, 2018
Merged
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
21 changes: 15 additions & 6 deletions hpx/lcos/detail/future_data.hpp
Expand Up @@ -28,7 +28,12 @@
#include <hpx/util/unused.hpp>

#include <boost/intrusive_ptr.hpp>

#if BOOST_VERSION < 105800
#include <vector>
#else
#include <boost/container/small_vector.hpp>
#endif

#include <chrono>
#include <cstddef>
Expand Down Expand Up @@ -69,8 +74,13 @@ namespace detail
{
public:
typedef util::unique_function_nonser<void()> completed_callback_type;
#if BOOST_VERSION < 105800
typedef std::vector<completed_callback_type>
completed_callback_vector_type;
#else
typedef boost::container::small_vector<completed_callback_type, 3>
completed_callback_vector_type;
#endif

typedef void has_future_data_refcnt_base;

Expand Down Expand Up @@ -397,8 +407,8 @@ namespace detail
return;
}

completed_callback_vector_type on_completed;
on_completed.swap(on_completed_);
auto on_completed = std::move(on_completed_);
on_completed_ = completed_callback_vector_type();

// set the data
result_type* value_ptr =
Expand Down Expand Up @@ -443,8 +453,8 @@ namespace detail
return;
}

completed_callback_vector_type on_completed;
on_completed.swap(on_completed_);
auto on_completed = std::move(on_completed_);
on_completed_ = completed_callback_vector_type();

// set the data
std::exception_ptr* exception_ptr =
Expand Down Expand Up @@ -536,8 +546,7 @@ namespace detail
}

state_ = empty;
on_completed_.clear();
on_completed_.shrink_to_fit();
on_completed_ = completed_callback_vector_type();
}

std::exception_ptr get_exception_ptr() const override
Expand Down