C++ boost::call_traits-为什么gcc对此给出false?

C++ boost::call_traits-为什么gcc对此给出false?,c++,gcc,boost,c++11,C++,Gcc,Boost,C++11,示例: #include <iostream> #include <boost/call_traits.hpp> #include <type_traits> boost::call_traits<int>::param_type f() { return 1; } int main() { std::cout << std::boolalpha; std::cout <<

示例:

#include <iostream>
#include <boost/call_traits.hpp>
#include <type_traits>

boost::call_traits<int>::param_type f()
{
        return 1;
}

int main()
{
        std::cout << std::boolalpha;
        std::cout <<
        std::is_const<boost::call_traits<int>::param_type>::value
        << std::endl; // true
        std::cout << std::is_const<decltype(f())>::value << std::endl; // false

}
#包括
#包括
#包括
boost::call_traits::param_type f()
{
返回1;
}
int main()
{

std::cout非类类型的右值永远不会是常量限定值。只有类类型的右值可以是常量限定值

因此,即使函数
f
被声明为返回一个
const int
,并且即使函数
f
的类型是
const int()
,调用表达式
f()
也是一个类型(非常量)
int
的右值

(在中,调用表达式
f()