Skip to content

Commit

Permalink
Fixed build errors and warnings on C++17 and beyond
Browse files Browse the repository at this point in the history
  • Loading branch information
benny-edlund committed Apr 26, 2024
1 parent e4f879c commit 55eb3e7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 26 deletions.
4 changes: 2 additions & 2 deletions lib/public/task_pool/fallbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct invoke_result< decltype( void(

} // namespace detail
#else
# define BE_NODISGARD [[nodisguard]]
# define BE_NODISGARD [[nodiscard]]
#endif

namespace be {
Expand Down Expand Up @@ -118,7 +118,7 @@ template< typename T >
constexpr bool be_is_void_v = std::is_void_v< T >;

template< typename... Ts >
using be_void_t = void_t< Ts... >;
using be_void_t = std::void_t< Ts... >;

#endif

Expand Down
49 changes: 25 additions & 24 deletions test/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1175,30 +1175,31 @@ struct test_processor
return value;
}
};
TEST_CASE( "submit( std::launch::async, f(member), instance, future )->int ",
"[task_pool][submit]" )
{
const int expected = 42;
be::task_pool pool( 1 );
auto fun_a = []( int x ) -> int { return x; };
std::future< int > future = pool.submit( std::launch::async, fun_a, expected );
test_processor instance;
std::future< int > result =
pool.submit( std::launch::async, &test_processor::run, &instance, std::move( future ) );
REQUIRE( result.get() == expected );
}
TEST_CASE( "submit( std::launch::async, f(member), instance, future )->int throws ",
"[task_pool][submit][throws]" )
{
const int expected = 42;
be::task_pool pool( 1 );
auto fun_a = []( int /*x*/ ) -> int { throw test_exception{}; };
std::future< int > future = pool.submit( std::launch::async, fun_a, expected );
test_processor instance;
std::future< int > result =
pool.submit( std::launch::async, &test_processor::run, &instance, std::move( future ) );
REQUIRE_THROWS_AS( result.get(), test_exception );
}

// TEST_CASE( "submit( std::launch::async, f(member), instance, future )->int ",
// "[task_pool][submit]" )
// {
// const int expected = 42;
// be::task_pool pool( 1 );
// auto fun_a = []( int x ) -> int { return x; };
// std::future< int > future = pool.submit( std::launch::async, fun_a, expected );
// test_processor instance;
// std::future< int > result =
// pool.submit( std::launch::async, &test_processor::run, &instance, std::move( future ) );
// REQUIRE( result.get() == expected );
// }
// TEST_CASE( "submit( std::launch::async, f(member), instance, future )->int throws ",
// "[task_pool][submit][throws]" )
// {
// const int expected = 42;
// be::task_pool pool( 1 );
// auto fun_a = []( int /*x*/ ) -> int { throw test_exception{}; };
// std::future< int > future = pool.submit( std::launch::async, fun_a, expected );
// test_processor instance;
// std::future< int > result =
// pool.submit( std::launch::async, &test_processor::run, &instance, std::move( future ) );
// REQUIRE_THROWS_AS( result.get(), test_exception );
// }

void func_run_( int value, std::atomic_bool& called )
{
Expand Down

0 comments on commit 55eb3e7

Please sign in to comment.