text: //for_each_product.h
  
  # /* **************************************************************************
  #  *                                                                          *
  #  *     (C) Copyright Paul Mensonides 2002.
  #  *     Distributed under the Boost Software License, Version 1.0. (See
  #  *     accompanying file LICENSE_1_0.txt or copy at
  #  *     http://www.boost.org/LICENSE_1_0.txt)
  #  *                                                                          *
  #  ************************************************************************** */
  
  // Copyright Querysoft Limited 2013
  //
  // Permission is hereby granted, free of charge, to any person or organization
  // obtaining a copy of the software and accompanying documentation covered by
  // this license (the "Software") to use, reproduce, display, distribute,
  // execute, and transmit the Software, and to prepare derivative works of the
  // Software, and to permit third-parties to whom the Software is furnished to
  // do so, all subject to the following:
  // 
  // The copyright notices in the Software and this entire statement, including
  // the above license grant, this restriction and the following disclaimer,
  // must be included in all copies of the Software, in whole or in part, and
  // all derivative works of the Software, unless such copies or derivative
  // works are solely in the form of machine-executable object code generated by
  // a source language processor.
  // 
  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
  // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
  // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
  // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  // DEALINGS IN THE SOFTWARE.
  
  #ifndef QOR_PREPROCESSOR_SEQ_FOR_EACH_PRODUCT_H_1
  #define QOR_PREPROCESSOR_SEQ_FOR_EACH_PRODUCT_H_1
  
  #include "../arithmetic/dec.h"
  #include "../config/config.h"
  #include "../control/if.h"
  #include "../repetition/for.h"
  #include "seq.h"
  #include "size.h"
  #include "../tuple/elem.h"
  #include "../tuple/rem.h"
  
  //QOR_PP_SEQ_FOR_EACH_PRODUCT
  
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT( macro, sets )						QOR_PP_SEQ_FOR_EACH_PRODUCT_E( QOR_PP_FOR, macro, sets )
  
  //QOR_PP_SEQ_FOR_EACH_PRODUCT_R
  
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_R( r, macro, sets )					QOR_PP_SEQ_FOR_EACH_PRODUCT_E( QOR_PP_FOR_ ## r, macro, sets )
  
  #if ~QOR_PP_CONFIG_FLAGS() & QOR_PP_CONFIG_EDG()
  #   define QOR_PP_SEQ_FOR_EACH_PRODUCT_E( impl, macro, sets )			impl( ( QOR_PP_SEQ_HEAD( sets )( nil ), QOR_PP_SEQ_TAIL( sets )( nil ), ( nil ), macro ), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_0 )
  #else
  #   define QOR_PP_SEQ_FOR_EACH_PRODUCT_E( impl, macro, sets )			QOR_PP_SEQ_FOR_EACH_PRODUCT_E_I( impl, macro, sets )
  #   define QOR_PP_SEQ_FOR_EACH_PRODUCT_E_I( impl, macro, sets )			impl( ( QOR_PP_SEQ_HEAD( sets )( nil ), QOR_PP_SEQ_TAIL( sets )( nil ), ( nil ), macro ), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_0 )
  #endif
  
  #if QOR_PP_CONFIG_FLAGS() & QOR_PP_CONFIG_STRICT()
  #   define QOR_PP_SEQ_FOR_EACH_PRODUCT_P( r, data )						QOR_PP_SEQ_FOR_EACH_PRODUCT_P_I data
  #   define QOR_PP_SEQ_FOR_EACH_PRODUCT_P_I( cset, rset, res, macro )	QOR_PP_DEC( QOR_PP_SEQ_SIZE( cset ) )
  #else
  #   define QOR_PP_SEQ_FOR_EACH_PRODUCT_P( r, data )						QOR_PP_DEC( QOR_PP_SEQ_SIZE( QOR_PP_TUPLE_ELEM( 4, 0, data ) ) )
  #endif
  
  #if ~QOR_PP_CONFIG_FLAGS() & QOR_PP_CONFIG_MWCC()
  #   define QOR_PP_SEQ_FOR_EACH_PRODUCT_O( r, data )						QOR_PP_SEQ_FOR_EACH_PRODUCT_O_I data
  #   define QOR_PP_SEQ_FOR_EACH_PRODUCT_O_I( cset, rset, res, macro )	( QOR_PP_SEQ_TAIL( cset ), rset, res, macro )
  #else
  #   define QOR_PP_SEQ_FOR_EACH_PRODUCT_O( r, data )						( QOR_PP_SEQ_TAIL( QOR_PP_TUPLE_ELEM( 4, 0, data ) ), QOR_PP_TUPLE_ELEM( 4, 1, data ), QOR_PP_TUPLE_ELEM( 4, 2, data ), QOR_PP_TUPLE_ELEM( 4, 3, data ) )
  #endif
  
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_C( data, i )						QOR_PP_IF( QOR_PP_DEC( QOR_PP_SEQ_SIZE( QOR_PP_TUPLE_ELEM( 4, 1, data ) ) ), QOR_PP_SEQ_FOR_EACH_PRODUCT_N_ ## i, QOR_PP_SEQ_FOR_EACH_PRODUCT_I )
  
  #if ~QOR_PP_CONFIG_FLAGS() & QOR_PP_CONFIG_EDG()
  #   define QOR_PP_SEQ_FOR_EACH_PRODUCT_I( r, data )						QOR_PP_SEQ_FOR_EACH_PRODUCT_I_I( r, QOR_PP_TUPLE_ELEM( 4, 0, data ), QOR_PP_TUPLE_ELEM( 4, 1, data ), QOR_PP_TUPLE_ELEM( 4, 2, data ), QOR_PP_TUPLE_ELEM( 4, 3, data ) )
  #else
  #   define QOR_PP_SEQ_FOR_EACH_PRODUCT_I( r, data )						QOR_PP_SEQ_FOR_EACH_PRODUCT_I_IM( r, QOR_PP_TUPLE_REM_4 data )
  #   define QOR_PP_SEQ_FOR_EACH_PRODUCT_I_IM( r, im )					QOR_PP_SEQ_FOR_EACH_PRODUCT_I_I( r, im )
  #endif
  
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_I_I( r, cset, rset, res, macro )	macro( r, QOR_PP_SEQ_TAIL( res ( QOR_PP_SEQ_HEAD( cset ) ) ) )
  
  #if ~QOR_PP_CONFIG_FLAGS() & QOR_PP_CONFIG_MWCC()
  #   define QOR_PP_SEQ_FOR_EACH_PRODUCT_H( data )						QOR_PP_SEQ_FOR_EACH_PRODUCT_H_I data
  #else
  #   define QOR_PP_SEQ_FOR_EACH_PRODUCT_H( data )						QOR_PP_SEQ_FOR_EACH_PRODUCT_H_I( QOR_PP_TUPLE_ELEM( 4, 0, data ), QOR_PP_TUPLE_ELEM( 4, 1, data ), QOR_PP_TUPLE_ELEM( 4, 2, data ), QOR_PP_TUPLE_ELEM( 4, 3, data ) )
  #endif
  
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_H_I( cset, rset, res, macro )		( QOR_PP_SEQ_HEAD( rset )( nil ), QOR_PP_SEQ_TAIL( rset ), res ( QOR_PP_SEQ_HEAD( cset ) ), macro )
  
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_0(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 0)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_1(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 1)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_2(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 2)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_3(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 3)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_4(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 4)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_5(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 5)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_6(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 6)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_7(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 7)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_8(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 8)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_9(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 9)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_10(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 10)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_11(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 11)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_12(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 12)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_13(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 13)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_14(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 14)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_15(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 15)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_16(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 16)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_17(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 17)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_18(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 18)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_19(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 19)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_20(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 20)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_21(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 21)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_22(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 22)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_23(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 23)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_24(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 24)(r, data)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_M_25(r, data) QOR_PP_SEQ_FOR_EACH_PRODUCT_C(data, 25)(r, data)
  
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_0(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_1)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_1(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_2)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_2(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_3)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_3(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_4)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_4(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_5)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_5(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_6)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_6(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_7)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_7(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_8)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_8(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_9)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_9(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_10)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_10(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_11)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_11(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_12)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_12(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_13)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_13(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_14)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_14(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_15)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_15(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_16)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_16(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_17)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_17(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_18)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_18(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_19)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_19(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_20)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_20(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_21)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_21(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_22)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_22(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_23)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_23(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_24)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_24(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_25)
  #define QOR_PP_SEQ_FOR_EACH_PRODUCT_N_25(r, data) QOR_PP_FOR_ ## r(QOR_PP_SEQ_FOR_EACH_PRODUCT_H(data), QOR_PP_SEQ_FOR_EACH_PRODUCT_P, QOR_PP_SEQ_FOR_EACH_PRODUCT_O, QOR_PP_SEQ_FOR_EACH_PRODUCT_M_26)
  
  #endif//QOR_PREPROCESSOR_SEQ_FOR_EACH_PRODUCT_H_1
  