NVIDIA / NVIDIA/cccl

type trait alias templates are needlessly forcing the instantiation of class templates

Open
#2,768 0 comments 0 reactions 0 assignees View on GitHub
libcu++
Dominant language
C++
Stars
2.5k
Forks
486
Avg merge
2d 6h
Merged PRs (30d)
295

Description

The `cuda::std::decay_t` type alias is currently defined as:

```c++
template
using decay_t = typename decay<_Tp>::type;
```

This forces the instantiation of the `cuda::std::decay` class template, which is not necessary when the `__decay` compiler intrinsic is available.

```c++
#if defined(_CCCL_BUILTIN_DECAY)
template
using decay_t = _CCCL_BUILTIN_DECAY(_Tp);
#else
template
using decay_t = typename decay<_Tp>::type;
```

There are similar efficiency wins to be had for many of the other type trait alias templates.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.