BOOST_PP_MOD_D

The BOOST_PP_MOD_D macro expands to the modulus of its second and third arguments. It reenters BOOST_PP_WHILE with maximum efficiency.

#### Usage

BOOST_PP_MOD_D(d, x, y)

#### Arguments

d
  The next available BOOST_PP_WHILE iteration.
x
  The dividend (numerator) of the operation. Valid values range from 0 to BOOST_PP_LIMIT_MAG.
y
  The divisor (denominator) of the operation. Valid values range from 1 to BOOST_PP_LIMIT_MAG.

#### Remarks

If y is 0, the result is undefined.

#### See Also

- BOOST_PP_LIMIT_MAG
- BOOST_PP_MOD

#### Requirements

Header: <boost/preprocessor/arithmetic/div.hpp>

#### Sample Code

    #include <boost/preprocessor/arithmetic/mod.hpp>
    #include <boost/preprocessor/list/filter.hpp>
    #include <boost/preprocessor/logical/not.hpp>

    #define LIST (1, (2, (3, (4, (5, BOOST_PP_NIL)))))

    #define EVEN_P(d, _, num) BOOST_PP_NOT(BOOST_PP_MOD_D(d, num, 2))
    #define EVEN(list) BOOST_PP_LIST_FILTER(EVEN_P, nil, list)

    EVEN(LIST) // expands to (2, (4, BOOST_PP_NIL))

    #define ODD_P(d, _, num) BOOST_PP_MOD_D(d, num, 2)
    #define ODD(list) BOOST_PP_LIST_FILTER(ODD_P, nil, list)

    ODD(LIST) // expands to (1, (3, (5, BOOST_PP_NIL)))