Why does std::declval add a reference?

后端 未结 3 711
谎友^
谎友^ 2020-12-13 06:12

std::declval is a compile-time utility used to construct an expression for the purpose of determining its type. It is defined like this:

template< class T         


        
3条回答
  •  清歌不尽
    2020-12-13 06:41

    Arrays cannot be returned by value thus even just the declaration of a function returning an array by value is invalid code.

    You can however return an array by reference.

提交回复
热议问题