c_NEXT
定义在class AskBase
:
struct Status {
static auto constexpr c_ROOT {-999};
static auto constexpr c_PREVIOUS {-1};
static auto constexpr c_NEXT {1};
static auto constexpr c_EOF {999};
};
后来c_NEXT
用于template<typename Container> class AskUI
auto run(){
auto status = AskBase::Status::c_NEXT;
for (typename Container::iterator ii=m_asks.begin();
ii!=m_asks.end();
ii=(AskBase::Status::c_ROOT==status)? m_asks.begin():
(AskBase::Status::c_PREVIOUS==status)?(m_asks.begin()==ii?m_asks.begin():ii-1):
(AskBase::Status::c_NEXT==status)?ii+1:
m_asks.end())
status = (*ii)->ask_user();
return (AskBase::Status::c_NEXT==status);
}
参考这三个()?
表达式和return
语句 clang++ 报告:
error: invalid operands to binary expression ('const std::initializer_list<int>'
and 'std::initializer_list<int>')
解决错误的建议。
使用命令:
clang++ -std=c++1z