Skip to content

Commit

Permalink
Fixing small_vector compatibility with older boost version
Browse files Browse the repository at this point in the history
This fixes problems with swapping boost::container::small_vector on older boost
versions. In addition, on boost < 1.58, it uses std::vector since
boost::container::small_vector was introduced with boost 1.58
  • Loading branch information
Thomas Heller committed Feb 5, 2018
1 parent bdd338e commit b905b35
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions hpx/lcos/detail/future_data.hpp
Expand Up @@ -69,8 +69,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 +402,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 +448,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 +541,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 b905b35

Please sign in to comment.