相关疑难解决方法(0)

constixpr算法真的很有用,当迭代器(输入参数)一般不是constexpr时?

在c ++ 20中提出,一些算法是constexpr.

例如:

template< class InputIt, class UnaryPredicate >
bool all_of( InputIt first, InputIt last, UnaryPredicate p );
(since C++11)
(until C++20)


template< class InputIt, class UnaryPredicate >
constexpr bool all_of( InputIt first, InputIt last, UnaryPredicate p );
(since C++20)
Run Code Online (Sandbox Code Playgroud)

虽然我们知道迭代器通常不是constexpr.我认为这只适用于constexpr容器.有人可以澄清我是否遗漏了某些内容以及我的理解是否正确?

c++ c++20

7
推荐指数
1
解决办法
187
查看次数

标签 统计

c++ ×1

c++20 ×1