Fix the asio example

* Attempt to fix the GCC warning in a different way
This commit is contained in:
Denis Blank 2019-09-02 01:03:28 +02:00
parent 7aff2c0d9b
commit ffb3db7089
3 changed files with 23 additions and 35 deletions

View File

@ -67,7 +67,11 @@ struct functional_io_service {
auto trough_post() noexcept {
return [&](auto&& work) mutable {
asio::post(service_, std::forward<decltype(work)>(work));
asio::post(service_,
[work = std::forward<decltype(work)>(work)]() mutable {
std::move(work)();
// .. or: work.set_value();
});
};
}

View File

@ -62,15 +62,7 @@ using unique_type = result<std::unique_ptr<int>>;
using result_test_types = testing::Types<unique_type, copyable_type>;
// https://github.com/google/googletest/issues/2271
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#endif
TYPED_TEST_SUITE(result_all_tests, result_test_types);
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
TYPED_TEST_SUITE(result_all_tests, result_test_types, name_generator);
TYPED_TEST(result_all_tests, is_default_constructible) {
TypeParam e;

View File

@ -33,6 +33,7 @@
#include <continuable/continuable-base.hpp>
#include <continuable/continuable-testing.hpp>
#include <continuable/continuable.hpp>
#include <string>
using cti::detail::identity;
using cti::detail::util::unused;
@ -115,9 +116,9 @@ struct provide_copyable {
struct provide_unique {
template <typename... Args, typename... Hint, typename T>
auto make(identity<Args...>, identity<Hint...>, T&& callback) {
return cti::make_continuable<Hint...>([
callback = std::forward<T>(callback), guard = std::make_unique<int>(0)
](auto&&... args) mutable {
return cti::make_continuable<Hint...>(
[callback = std::forward<T>(callback),
guard = std::make_unique<int>(0)](auto&&... args) mutable {
(void)(*guard);
return std::move(callback)(std::forward<decltype(args)>(args)...);
});
@ -205,18 +206,17 @@ struct tag1 {};
struct tag2 {};
struct tag3 {};
struct name_generator {
template <typename T>
static std::string GetName(int i) {
return std::to_string(i);
}
};
template <typename Provider>
struct single_dimension_tests : continuation_provider<Provider> {};
// https://github.com/google/googletest/issues/2271
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#endif
TYPED_TEST_SUITE(single_dimension_tests, single_types);
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
TYPED_TEST_SUITE(single_dimension_tests, single_types, name_generator);
template <typename T, typename First, typename Second>
struct combine_to_type;
@ -258,15 +258,7 @@ struct single_aggregate_tests<identity<Provider, Connector>>
: continuation_provider<Provider>, Connector {};
// https://github.com/google/googletest/issues/2271
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#endif
TYPED_TEST_SUITE(single_aggregate_tests, aggregate_types);
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
TYPED_TEST_SUITE(single_aggregate_tests, aggregate_types, name_generator);
template <typename T>
auto make_step(T* me, unsigned& current, unsigned step) {