zoukankan      html  css  js  c++  java
  • 【Qt开发】foreach用法

    If you just want to iterate over all the items in a container in order, you can use Qt's foreach keyword. The keyword is a Qt-specific addition to the C++ language, and is implemented using the preprocessor.Its syntax is: foreach (variable, container) statement. For example, here's how to use foreach to iterate over aQLinkedList<QString>:QLinkedList<QString> list; ... QString str; foreach (str, list) qDebug() << str;如果你想有序迭代容器中的所有项可以使用关键字foreach,这是qt对C++的特定补充,并通过预处理器实现。他的语法是:foreach (variable, container) +语句;这儿varible就相当于varible=container.item,只不过这个item会从container的头遍历到尾罢了。QLinkedList<QString> list;QLinkedListIterator<QString> i(list); while (i.hasNext()) qDebug() << i.next();这两个语句达到的目的是一样的
  • 相关阅读:
    麦茶商务的网站
    jQuery Ajax 实例 ($.ajax、$.post、$.get)
    关于meta知多少
    WebApp之Meta标签
    html5开发之viewport使用
    bootstrap
    8.8&8.9 dp训练小结
    2019.8.10小结
    2019.8.17 小结
    [NOI2001]炮兵阵地 题解
  • 原文地址:https://www.cnblogs.com/huty/p/8518314.html
Copyright © 2011-2022 走看看