Is it possible to restrict a type parameter to be a reference type? I see you can use T(!new) but I’m looking for the opposite.
Question
Is it possible to restrict a type parameter to be a reference type? I see you can use T(!new)
but I’m looking for the opposite.
Answer
No. The only restrictions available (as of version 3.7.3) are
T(==)
- type supports equalityT(0)
- type is auto-initializableT(00)
- type is non-emptyT(!new)
- type may not be a reference type or contain a reference type
See the appropriate section of the reference manual for more information.