BOOST_PP_LIST_SIZE_D マクロは リスト のサイズに展開される。  これは BOOST_PP_WHILE 内で呼ばれる際には最も効率よく機能する。

Usage

BOOST_PP_LIST_SIZE_D(d, list)

Arguments

d
次の有効な BOOST_PP_WHILE 反復。
list
サイズが計算される リスト

See Also

Requirements

Header:  <boost/preprocessor/list/size.hpp>

Sample Code

#include <boost/preprocessor/arithmetic/add.hpp>
#include <boost/preprocessor/list/fold_left.hpp>
#include <boost/preprocessor/list/size.hpp>

#define L1 (a, (b, (c, BOOST_PP_NIL)))
#define L2 (x, (y, BOOST_PP_NIL))
#define L3 (p, (q, BOOST_PP_NIL))

#define LIST (L1, (L2, (L3, BOOST_PP_NIL)))

#define OP(d, state, x) \
   BOOST_PP_ADD_D( \
      d, state, \
      BOOST_PP_LIST_SIZE_D(d, x) \
   ) \
   /**/

BOOST_PP_LIST_FOLD_LEFT(OP, 0, LIST) // 7 に展開される