<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    so true

    心懷未來,開創未來!
    隨筆 - 160, 文章 - 0, 評論 - 40, 引用 - 0
    數據加載中……

    使用boost的preprocessor

    在線文檔:http://www.boost.org/doc/libs/1_48_0/libs/preprocessor/doc/index.html
                  http://www.boost.org/doc/libs/1_48_0/libs/preprocessor/doc/topics/techniques.html
                  http://www.boost.org/doc/libs/1_48_0/libs/preprocessor/doc/ref.html
    幾篇不錯的博文:http://blog.csdn.net/zx77/article/details/2270991
    一個關于2D的repeat的實現 :
    /* Copyright (C) 2002
     * Housemarque Oy
     * http://www.housemarque.com
     *
     * Permission to copy, use, modify, sell and distribute this software is
     * granted provided this copyright notice appears in all copies. This
     * software is provided "as is" without express or implied warranty, and
     * with no claim as to its suitability for any purpose.
     *
     * See http://www.boost.org for most recent version.
     */

    /* This example implements a generalized macro for 2D repetition using
     * the simple repetition primitives of the preprocessor library.
     */

    #include "preprocessor/repeat.hpp"
    #include "preprocessor/logical/or.hpp"
    #include "preprocessor/comma_if.hpp"
    #include "preprocessor/list/cat.hpp"
    #include "preprocessor/tuple/elem.hpp"
    #include "preprocessor/tuple/to_list.hpp"

    /** <p>Repeats the macro <code>M(X,Y,DATA)</code> for <code>X = [0,W)</code> and <code>Y = [0,H)</code>.</p>

    <p>In other words, expands to the sequence:</p>

    <pre>
    M(  0,  0,  DATA) M(  1,  0,  DATA) ... M(W-1,  0,  DATA)
    M(  0,  1,  DATA) M(  1,  1,  DATA) ... M(W-1,  1,  DATA)
          ...            ...      ...       ...
    M(  0,H-1,  DATA) M(  1,H-1,  DATA) ... M(W-1,H-1,  DATA)
    </pre>
    */
    #define REPEAT_2D(W,H,M,DATA)\
      /* Here we can simply use BOOST_PP_REPEAT(), because\
       * it implements automatic recursion.\
       */\
      BOOST_PP_REPEAT\
      ( H\
      , REPEAT_2D_ROW\
      , (W,M,DATA)\
      )
    #define REPEAT_2D_ROW(z,Y,WMD)\
      BOOST_PP_REPEAT\
      ( BOOST_PP_TUPLE_ELEM(3,0,WMD)\
      , REPEAT_2D_ELEM\
      , (Y, BOOST_PP_TUPLE_ELEM(3,1,WMD), BOOST_PP_TUPLE_ELEM(3,2,WMD))\
      )
    #define REPEAT_2D_ELEM(z,X,YMD)\
      BOOST_PP_TUPLE_ELEM(3,1,YMD)\
      ( X\
      , BOOST_PP_TUPLE_ELEM(3,0,YMD)\
      , BOOST_PP_TUPLE_ELEM(3,2,YMD)\
      )

    /* Here we use the above macro to generate something. */
    #define ELEM(X,Y,E) BOOST_PP_COMMA_IF(BOOST_PP_OR(X,Y)) BOOST_PP_LIST_CAT(BOOST_PP_TUPLE_TO_LIST(5,(E,_,X,_,Y)))
    enum { REPEAT_2D(3,4,ELEM,elem) };

    /* The above expands to:
     *
     * enum { elem_0_0, elem_1_0, elem_2_0,
     *        elem_0_1, elem_1_1, elem_2_1,
     *        elem_0_2, elem_1_2, elem_2_2,
     *        elem_0_3, elem_1_3, elem_2_3 };
     */

    posted on 2011-11-26 14:10 so true 閱讀(936) 評論(0)  編輯  收藏 所屬分類: C&C++

    主站蜘蛛池模板: 亚洲日韩国产二区无码 | 91视频免费观看高清观看完整| 男人的好免费观看在线视频| 亚洲精品成人久久| 91精品免费久久久久久久久| 亚洲电影唐人社一区二区| 67pao强力打造国产免费| 亚洲精品中文字幕乱码影院| 久久久久av无码免费网| 久久亚洲最大成人网4438| 欧亚精品一区三区免费| 亚洲精华国产精华精华液好用| 免费高清资源黄网站在线观看| 国产亚洲午夜精品| 中文字幕亚洲无线码| 四虎国产成人永久精品免费| 亚洲美女激情视频| 免费无码AV片在线观看软件| 亚洲av无码专区青青草原| 亚洲国产成人久久综合一区77| 国产精品99爱免费视频| 亚洲午夜精品久久久久久人妖| 色播精品免费小视频| 亚洲女子高潮不断爆白浆| 亚洲成aⅴ人片久青草影院| 国内永久免费crm系统z在线| 亚洲成av人片在线看片| 又爽又高潮的BB视频免费看| 免费毛片在线看不用播放器 | 亚洲最大成人网色香蕉| 精品久久免费视频| 中文字幕永久免费视频| 亚洲毛片无码专区亚洲乱| 精品免费国产一区二区| 国产免费网站看v片在线| 亚洲综合小说另类图片动图| 亚洲麻豆精品国偷自产在线91| 日本高清高色视频免费| 亚洲精品无码av中文字幕| 中文字幕不卡亚洲| 成全视频免费高清 |