Commit db254ee8 authored by Jakub Klinkovský's avatar Jakub Klinkovský

Fixed forwarding of arguments passed to StaticFor

StaticArrayAssignment expects the arguments passed as reference.
parent 7a9a3087
......@@ -28,10 +28,10 @@ struct StaticFor< Begin, End, true >
template< typename Function, typename... Args >
__cuda_callable__
static void exec( const Function& f, Args... args )
static void exec( const Function& f, Args&&... args )
{
f( Begin, args... );
StaticFor< Begin + 1, End >::exec( f, args... );
StaticFor< Begin + 1, End >::exec( f, std::forward< Args >( args )... );
}
};
......@@ -40,7 +40,7 @@ struct StaticFor< End, End, true >
{
template< typename Function, typename... Args >
__cuda_callable__
static void exec( const Function& f, Args... args ) {}
static void exec( const Function& f, Args&&... args ) {}
};
template< int Begin, int End >
......@@ -50,10 +50,10 @@ struct StaticFor< Begin, End, false >
template< typename Function, typename... Args >
__cuda_callable__
static void exec( const Function& f, Args... args )
static void exec( const Function& f, Args&&... args )
{
for( int i = Begin; i < End; i++ )
f( i, args... );
f( i, std::forward< Args >( args )... );
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment