How to stop member function returning T& being defined for T = void (and is supposed to be)
22:37 29 Mar 2026
I'm trying to create a pointer like type wrapper for CUDA device pointers, but ran into a problem trying to define T& operator[]. By default, the compiler complains that I'm attempting to "form reference from void" So I attempted to use C++20 concepts in order to avoid this. I get the same error (examples all normal C++ code, not cuda, and have the same issues):
Is there away to get this to work more or less like I intended it to in the first example?
c++c++20sfinaec++-conceptsrequires-clause
Your Answer
lock_outline
You need to log in to submit an answer.
Privacy & Cookie Consent
We use cookies to ensure the best experience on our website. This includes analytics, personalization, and marketing purposes. Some cookies are essential for the website to function properly.
By clicking "Accept", you consent to our use of cookies. You can read more about how we use cookies and how you can change your preferences in our Privacy Policy.