Is there a type-trait to remove top-level cv and reference at once?

后端 未结 2 414
情歌与酒
情歌与酒 2021-01-07 22:32

I just want to know if there is already one provided by the standard. I know it\'s easy to make one yourself

// for C++03, use  and st         


        
相关标签:
2条回答
  • 2021-01-07 23:10

    std::decay, I believe, performs this functionality.

    0 讨论(0)
  • 2021-01-07 23:11

    I prefer combining the two functionalities since it describes exactly what the intention is:

    C++11 std::remove_cv<std::remove_reference<T>::type>::type

    C++14 std::remove_cv_t<std::remove_reference_t<T>>

    C++20 std::remove_cvref_t<T>

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