Skip to content

Commit

Permalink
Merge pull request #3141 from STEllAR-GROUP/completion_handler
Browse files Browse the repository at this point in the history
Fixing small_vector compatibility with older boost version
  • Loading branch information
sithhell committed Feb 6, 2018
2 parents 4a99629 + 2394aac commit ffa6827
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions hpx/lcos/detail/future_data.hpp
Original file line number Diff line number Diff line change
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

0 comments on commit ffa6827

Please sign in to comment.