Skip to content
Snippets Groups Projects
Commit f6d08f4b authored by Jakub Klinkovský's avatar Jakub Klinkovský Committed by Jakub Klinkovský
Browse files

NDArray: generalized call_with_permuted_arguments

parent e444116e
No related branches found
No related tags found
1 merge request!18NDArray
...@@ -169,11 +169,11 @@ struct CallPermutationHelper< Permutation, std::index_sequence< N... > > ...@@ -169,11 +169,11 @@ struct CallPermutationHelper< Permutation, std::index_sequence< N... > >
template< typename Func, template< typename Func,
typename... Args > typename... Args >
__cuda_callable__ __cuda_callable__
static auto apply( Func f, Args&&... args ) static auto apply( Func&& f, Args&&... args ) -> decltype(auto)
{ {
return f( get_from_pack< return std::forward< Func >( f )( get_from_pack<
get< N >( Permutation{} ) get< N >( Permutation{} )
>( args... )... ); >( std::forward< Args >( args )... )... );
} }
}; };
...@@ -183,7 +183,13 @@ template< typename Permutation, ...@@ -183,7 +183,13 @@ template< typename Permutation,
typename Func, typename Func,
typename... Args > typename... Args >
__cuda_callable__ __cuda_callable__
auto call_with_permuted_arguments( Func f, Args&&... args ) // FIXME: does not compile with nvcc 10.0
//auto call_with_permuted_arguments( Func&& f, Args&&... args ) -> decltype(auto)
//{
// return CallPermutationHelper< Permutation, std::make_index_sequence< sizeof...( Args ) > >
// ::apply( std::forward< Func >( f ), std::forward< Args >( args )... );
//}
auto call_with_permuted_arguments( Func f, Args&&... args ) -> decltype(auto)
{ {
return CallPermutationHelper< Permutation, std::make_index_sequence< sizeof...( Args ) > > return CallPermutationHelper< Permutation, std::make_index_sequence< sizeof...( Args ) > >
::apply( f, std::forward< Args >( args )... ); ::apply( f, std::forward< Args >( args )... );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment