It's easy to create a method/function parametrized on the type of an unnamed struct:
struct Foo {
template <typename T> Foo(T*) { /* we have access to T here */ }
}
template<typename T> struct Bar {};
void test() {
struct {
Foo foo { this };
} unnamed;
}
It is also easy to get the type after the struct's definition:
Bar<decltype(unnamed)> bar;
But is there any template magic that could allow the use of unnamed
's type within Foo
, not merely within its constructor or outside of it? Akin to this pseudo code:?
struct {
Bar<decltype(this)> foo;
} unnamed;
Aucun commentaire:
Enregistrer un commentaire