On 11/30/23 19:02, Peter Dimov via Boost wrote:
Andrey Semashev wrote:
I think a similar utility would be more useful in form of a class template, for example:
resource
windows_handle; resource sdl_window_handle; That's
template
class resource; This would also prohibit resource types with non-constexpr constructors, as well as non-default-constructible resources. I don't like this tradeoff.
It doesn't. The two operations required from R are construction from Def and comparing to Def.
https://godbolt.org/z/h7z3qGzvs
Note that the type of Def doesn't have to be R.
What I meant is something like this won't work: https://godbolt.org/z/hczoP4WMx And if you're suggesting to define some magic placeholder type that can be used as Def and automatically converts to R then that looks like a more contrived usage to me than just defining resource traits.