How to write `is_complete` template?

前端 未结 7 1010
耶瑟儿~
耶瑟儿~ 2020-11-29 07:35

After answering this question I was trying to find is_complete template in Boost library and I realized that there is no such template in Boost.TypeTraits. Why

7条回答
  •  感动是毒
    2020-11-29 07:56

    template
    struct is_complete {
        static T & getT();
        static char (& pass(T))[2];
        static char pass(...);
    
        static const bool value = sizeof(pass(getT()))==2;
    };
    

提交回复
热议问题