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,还是不是?还有,为什么它不可用?