Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/142.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ begin()在C++;17但是C+中的cbegin()是+;14?_C++_Iterator_Containers_C++14_C++17 - Fatal编程技术网

C++ begin()在C++;17但是C+中的cbegin()是+;14?

C++ begin()在C++;17但是C+中的cbegin()是+;14?,c++,iterator,containers,c++14,c++17,C++,Iterator,Containers,C++14,C++17,据介绍,容器的std::cbegin()在C++14中作为constepr引入,但在C++11中引入的std::begin()在C++17之前一直保持非constepr 真的吗?这似乎很不平衡。这是什么原因?过载 template< class T, std::size_t N > constexpr T* begin( T (&array)[N] ) noexcept; 模板 constexpr T*begin(T(&array)[N])noexcept; 在C++14

据介绍,容器的
std::cbegin()
在C++14中作为
constepr
引入,但在C++11中引入的
std::begin()
在C++17之前一直保持非constepr

真的吗?这似乎很不平衡。这是什么原因?

过载

template< class T, std::size_t N >
constexpr T* begin( T (&array)[N] ) noexcept;
模板
constexpr T*begin(T(&array)[N])noexcept;
在C++14中是constexpr,因此调用
std::begin
std::cbegin
在C++14中也是constexpr


对于非数组,
std::cbegin
在C++14的常量表达式中不可用,即使函数模板仍然标记为
constepr

,那么,函数模板是constepr,还是不是?还有,为什么它不可用?