You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know if this is the right place to ask this question, but I don't know where I can find a discussion environment that is more knowledgeable about the C++ language standard.
I want to implement something like rust's dyn trait
but I found that the c++standard may not be able to derive “new (ptr) T() == static_cast<T*>(ptr)“?
So conversely, “static_cast<T*>(ptr) == new (ptr) T()” cannot prove Trait<void>* operator->(){ return static_cast<Trait<void>*>(reinterpret_cast<void*>(_buffer)); }
Other attempts
a abstruct class can't be a union member(why?),and I can't use placement new to calculate offset at compile time, because Trait is an abstract class.
The text was updated successfully, but these errors were encountered:
I don't know if this is the right place to ask this question, but I don't know where I can find a discussion environment that is more knowledgeable about the C++ language standard.
I want to implement something like rust's dyn trait
but I found that the c++standard may not be able to derive “new (ptr) T() == static_cast<T*>(ptr)“?
So conversely, “static_cast<T*>(ptr) == new (ptr) T()” cannot prove
Trait<void>* operator->(){ return static_cast<Trait<void>*>(reinterpret_cast<void*>(_buffer)); }
Other attempts
a abstruct class can't be a union member(why?),and I can't use placement new to calculate offset at compile time, because Trait is an abstract class.
The text was updated successfully, but these errors were encountered: