check if member exists using enable_if

前端 未结 6 1313
鱼传尺愫
鱼传尺愫 2020-11-28 13:40

Here\'s what I\'m trying to do:

template  struct Model
{
    vector vertices ;

    #if T has a .normal member
    void transform(         


        
6条回答
  •  余生分开走
    2020-11-28 13:47

    template<
    typename HTYPE, 
    typename = std::enable_if_t::value>
    >
    static void close_release
    (HTYPE* ptr) {
        ptr->var1;
    }
    

    Using enable_if and decltype to let compiler to check variable, hope to help.

提交回复
热议问题