Interdependent class template and std::is_base_of specialization

后端 未结 1 1975
青春惊慌失措
青春惊慌失措 2021-01-27 02:31

I am mildy confused by the following situation where I have a specialization enabled on is_base_of.

is_base_of requires the full definition of

相关标签:
1条回答
  • 2021-01-27 03:05

    std::is_base_of requires complete type. which is not the case in

    template <typename T>
    struct derived : base<T>
    {
            child<derived> child_; // derived<T> not yet complete here.
            typedef T type; 
    };
    

    For T::base_tag, IIRC (I think POI of child<derived> move from before struct derived to current location in the class), T doesn't need to be complete, and only visited part of it is visible.

    So derived::type would not be visible. (but derived::base::type would be).

    0 讨论(0)
提交回复
热议问题