Interdependent class template and std::is_base_of specialization

后端 未结 1 2139
青春惊慌失措
青春惊慌失措 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 
    struct derived : base
    {
            child child_; // derived not yet complete here.
            typedef T type; 
    };
    

    For T::base_tag, IIRC (I think POI of child 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)
提交回复
热议问题