Move init variable in if.
This commit is contained in:
parent
22f09c47fd
commit
1ebcaf6f97
1 changed files with 1 additions and 2 deletions
|
|
@ -3,8 +3,7 @@
|
|||
namespace safe_cuda {
|
||||
std::variant<std::unique_ptr<CUstream_st, streamDestroyType>, cudaError_t> create_stream() noexcept {
|
||||
cudaStream_t stream = nullptr;
|
||||
const cudaError_t error = cudaStreamCreate(&stream);
|
||||
if (error != cudaSuccess) {
|
||||
if (const cudaError_t error = cudaStreamCreate(&stream); error != cudaSuccess) {
|
||||
return error;
|
||||
}
|
||||
return std::unique_ptr<CUstream_st, streamDestroyType>{ stream, cudaStreamDestroy };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue